Re: [PATCH v2 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches
[notmuch-archives.git] / 82 / 8a50e89c1c43949f974c389549730c7a1c0c52
diff --git a/82/8a50e89c1c43949f974c389549730c7a1c0c52 b/82/8a50e89c1c43949f974c389549730c7a1c0c52
new file mode 100644 (file)
index 0000000..4460f1b
--- /dev/null
@@ -0,0 +1,182 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 15CB2431FBC\r
+       for <notmuch@notmuchmail.org>; Mon,  4 Aug 2014 18:44:14 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id qW1M2KinJxE6 for <notmuch@notmuchmail.org>;\r
+       Mon,  4 Aug 2014 18:44:07 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu\r
+       [18.9.25.12])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id B686C431FAE\r
+       for <notmuch@notmuchmail.org>; Mon,  4 Aug 2014 18:44:07 -0700 (PDT)\r
+X-AuditID: 1209190c-f79ef6d000005dd6-11-53e036e65542\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       (using TLS with cipher AES256-SHA (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id FB.64.24022.6E630E35; Mon,  4 Aug 2014 21:44:07 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s751i5vL005609; \r
+       Mon, 4 Aug 2014 21:44:05 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s751i3jl004814\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+       Mon, 4 Aug 2014 21:44:04 -0400\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1XETnH-0008EX-8K; Mon, 04 Aug 2014 21:44:03 -0400\r
+Date: Mon, 4 Aug 2014 21:44:03 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: David Bremner <david@tethera.net>\r
+Subject: Re: [PATCH v2 1/2] emacs: Introduce notmuch-jump: shortcut keys to\r
+       saved searches\r
+Message-ID: <20140805014403.GX13893@mit.edu>\r
+References: <1405353735-26244-1-git-send-email-amdragon@mit.edu>\r
+       <1405433166-2198-1-git-send-email-amdragon@mit.edu>\r
+       <1405433166-2198-2-git-send-email-amdragon@mit.edu>\r
+       <87ha1r6esm.fsf@maritornes.cs.unb.ca>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87ha1r6esm.fsf@maritornes.cs.unb.ca>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFprGKsWRmVeSWpSXmKPExsUixG6novvc7EGwwSJtixut3YwW++5sYbJY\r
+       PZfH4vrNmcwOLB67nv9l8tg56y67x7NVt5g9thx6zxzAEsVlk5Kak1mWWqRvl8CV0bRrI3NB\r
+       i0TFit0fmBsY/wh1MXJySAiYSLQf+8YKYYtJXLi3nq2LkYtDSGA2k8T7lt2MIAkhgQ2MEl83\r
+       W0MkTjFJXD5/khXCWcIo8XlHAxtIFYuAisS8TbfYQWw2AQ2JbfuXg3WLCKhKXN02GayGWcBZ\r
+       YsaDPWDrhAViJNo3z2UCsXkFdCQu93xngRh6hVHi6vfpjBAJQYmTM5+wQDRrSdz49xKogQPI\r
+       lpZY/o8DJMwpYCRx7tlfsDmiQDdMObmNbQKj0Cwk3bOQdM9C6F7AyLyKUTYlt0o3NzEzpzg1\r
+       Wbc4OTEvL7VI11AvN7NELzWldBMjKPg5JXl2ML45qHSIUYCDUYmHV0DtfrAQa2JZcWXuIUZJ\r
+       DiYlUd5QvQfBQnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR48wWBcrwpiZVVqUX5MClpDhYlcd63\r
+       1lbBQgLpiSWp2ampBalFMFkZDg4lCd6fpkCNgkWp6akVaZk5JQhpJg5OkOE8QMN7QWp4iwsS\r
+       c4sz0yHypxgVpcR5M0ESAiCJjNI8uF5YcnrFKA70ijCvBzBVCfEAExtc9yugwUxAg8107oMM\r
+       LklESEk1MC5cJv5A5Z/uqph9uXu/Sgft2y0s3/zn0q8kP5lCCa9ZzfU+pxz8pZembzwWw+ps\r
+       u8L2GbPAd5M5tpf8NKc9ExOYOzFeIunEb6mbP6rLPMuaFi848crQs9M+UcxHSyGxf+E99pCN\r
+       ccLSBzf+7VQ3qzuZ2Ms5bVfB8ai1ko0XtpgIfg+e2vx/mxJLcUaioRZzUXEiAFsDy3UpAwAA\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 05 Aug 2014 01:44:14 -0000\r
+\r
+Quoth David Bremner on Aug 04 at  8:00 pm:\r
+> Austin Clements <amdragon@MIT.EDU> writes:\r
+> \r
+> > This introduces notmuch-jump, which is like a user-friendly,\r
+> > user-configurable global prefix map for saved searches.  This provi\r
+> \r
+> Unfortunately this patch doesn't apply anymore.\r
+\r
+Drat.  Thwarted by my own other patch!\r
+\r
+Rebased series coming shortly (the resolution wasn't anything\r
+interesting).\r
+\r
+> > @@ -18,7 +18,8 @@ emacs_sources := \\r
+> >    $(dir)/notmuch-tag.el \\r
+> >    $(dir)/coolj.el \\r
+> >    $(dir)/notmuch-print.el \\r
+> > -  $(dir)/notmuch-version.el\r
+> > +  $(dir)/notmuch-version.el \\r
+> > +  $(dir)/notmuch-jump.el \\r
+> \r
+> Why the extra \ ?\r
+\r
+It means we can add more lines to this list without having the modify\r
+an existing line, which cleans up future diffs and simplifies future\r
+rebasing and handling of merge conflicts.\r
+\r
+> > +(defun notmuch-jump--plist-delete (plist property)\r
+> > +  (let* ((xplist (cons nil plist))\r
+> > +   (pred xplist))\r
+> > +    (while (cdr pred)\r
+> > +      (when (eq (cadr pred) property)\r
+> > +  (setcdr pred (cdddr pred)))\r
+> > +      (setq pred (cddr pred)))\r
+> > +    (cdr xplist)))\r
+> \r
+> Should this function maybe be somewhere more generic?\r
+\r
+Good idea.  I've moved it to notmuch-lib.  The diff from v2 is below:\r
+\r
+diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el\r
+index 9cb1e6a..05bbce5 100644\r
+--- a/emacs/notmuch-jump.el\r
++++ b/emacs/notmuch-jump.el\r
+@@ -22,6 +22,7 @@\r
\r
+ (eval-when-compile (require 'cl))\r
\r
++(require 'notmuch-lib)\r
+ (require 'notmuch-hello)\r
\r
+ ;;;###autoload\r
+@@ -90,7 +91,7 @@ (defun notmuch-jump (action-map prompt)\r
+        ;; ourselves) from their labels, so disable the minibuffer's\r
+        ;; own re-face-ing.\r
+        (minibuffer-prompt-properties\r
+-        (notmuch-jump--plist-delete\r
++        (notmuch-plist-delete\r
+          (copy-sequence minibuffer-prompt-properties)\r
+          'face))\r
+        ;; Build the keymap with our bindings\r
+@@ -165,15 +166,6 @@ (defun notmuch-jump--make-keymap (action-map)\r
+          (exit-minibuffer))))\r
+     map))\r
\r
+-(defun notmuch-jump--plist-delete (plist property)\r
+-  (let* ((xplist (cons nil plist))\r
+-       (pred xplist))\r
+-    (while (cdr pred)\r
+-      (when (eq (cadr pred) property)\r
+-      (setcdr pred (cdddr pred)))\r
+-      (setq pred (cddr pred)))\r
+-    (cdr xplist)))\r
+-\r
+ (unless (fboundp 'window-body-width)\r
+   ;; Compatibility for Emacs pre-24\r
+   (defun window-body-width (&optional window)\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index a23c85d..19269e3 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -476,6 +476,15 @@ (defun notmuch-remove-if-not (predicate list)\r
+       (setq list (cdr list)))\r
+     (nreverse out)))\r
\r
++(defun notmuch-plist-delete (plist property)\r
++  (let* ((xplist (cons nil plist))\r
++       (pred xplist))\r
++    (while (cdr pred)\r
++      (when (eq (cadr pred) property)\r
++      (setcdr pred (cdddr pred)))\r
++      (setq pred (cddr pred)))\r
++    (cdr xplist)))\r
++\r
+ (defun notmuch-split-content-type (content-type)\r
+   "Split content/type into 'content' and 'type'"\r
+   (split-string content-type "/"))\r
+\r