--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\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 28D71431FC7\r
+ for <notmuch@notmuchmail.org>; Tue, 6 May 2014 09:43:38 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.502\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.502 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_LOW=-0.7] 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 ux9qhNfSM5us for <notmuch@notmuchmail.org>;\r
+ Tue, 6 May 2014 09:43:30 -0700 (PDT)\r
+Received: from mail1.qmul.ac.uk (mail1.qmul.ac.uk [138.37.6.7])\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 83D5F431FAF\r
+ for <notmuch@notmuchmail.org>; Tue, 6 May 2014 09:43:30 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail1.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WhiQl-00057k-He; Tue, 06 May 2014 17:43:28 +0100\r
+Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WhiQl-0006nJ-6E; Tue, 06 May 2014 17:41:23 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [RFC] [PATCH] emacs: Add support for saved search accelerators.\r
+In-Reply-To: <1399385776-19918-1-git-send-email-dme@dme.org>\r
+References: <1399385776-19918-1-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 06 May 2014 17:41:21 +0100\r
+Message-ID: <87oazaq2q6.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 87.81.223.162\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: a8a84af88f5258eb440537911183618f (of first 20000 bytes)\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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, 06 May 2014 16:43:38 -0000\r
+\r
+\r
+Hi\r
+\r
+Yes this looks nice modulo polishing. I think the nifty window-splitting\r
+Austin's notmuch-go does is moderately orthogonal to the keyboard\r
+shortcuts (since shortcuts can be used without it, and it could be used\r
+for other things too)\r
+\r
+On Tue, 06 May 2014, David Edmondson <dme@dme.org> wrote:\r
+> Extended the saved search definition to allow the inclusion of an\r
+> accelerator key for the search. Bind 'j' in the common mode map as a\r
+> leader for such accelerator keys.\r
+> ---\r
+>\r
+> This arose out a conversation in #notmuch and Mark's patch to extend\r
+> the saved search custom specification based on requirements for an\r
+> external package (Austin's notmuch-go.el).\r
+>\r
+> Re-organising the layout of the saved searches is missing (as it's\r
+> lots of fiddling about with absolute numbers and I didn't want to\r
+> waste time on it if this is going nowhere), so the saved searches may\r
+> not all line up correctly in notmuch-hello.\r
+>\r
+> emacs/notmuch-hello.el | 8 ++++++--\r
+> emacs/notmuch-lib.el | 27 +++++++++++++++++++++++++++\r
+> 2 files changed, 33 insertions(+), 2 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+> index 3de5238..56379ef 100644\r
+> --- a/emacs/notmuch-hello.el\r
+> +++ b/emacs/notmuch-hello.el\r
+> @@ -85,6 +85,7 @@ searches so they still work in customize."\r
+> (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v")))\r
+> (checklist :inline t\r
+> :format "%v"\r
+> + (group :format "%v" :inline t (const :format " Key: " :key) (string :format "%v"))\r
+\r
+if you use key-sequence rather than string then this is a bit nicer. It\r
+allows a multiple key press binding: eg "n i" or "C-n".\r
+\r
+> (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v"))\r
+> (group :format "%v" :inline t (const :format "" :sort-order)\r
+> (choice :tag " Sort Order"\r
+> @@ -551,7 +552,8 @@ with `notmuch-hello-query-counts'."\r
+> (when elem\r
+> (if (> column-indent 0)\r
+> (widget-insert (make-string column-indent ? )))\r
+> - (let* ((name (plist-get elem :name))\r
+> + (let* ((key (plist-get elem :key))\r
+> + (name (plist-get elem :name))\r
+> (query (plist-get elem :query))\r
+> (oldest-first (case (plist-get elem :sort-order)\r
+> (newest-first nil)\r
+> @@ -564,7 +566,9 @@ with `notmuch-hello-query-counts'."\r
+> :notify #'notmuch-hello-widget-search\r
+> :notmuch-search-terms query\r
+> :notmuch-search-oldest-first oldest-first\r
+> - name)\r
+> + (if key\r
+> + (concat name " (" key ")")\r
+> + name))\r
+\r
+I think it might be worth having an option to suppress the display of\r
+the binding: I think inbox (i) would annoy me, but it is good for discoverability.\r
+I, personally, would be completely happy without the displayed binding.\r
+\r
+Actually just a thought: could ? in jump-mode-map be bound to something\r
+that displayed the bindings?\r
+\r
+> (setq column-indent\r
+> (1+ (max 0 (- column-width (length name)))))))\r
+> (setq count (1+ count))\r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index 2941da3..9aa7ba7 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -130,6 +130,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an\r
+> (define-key map "m" 'notmuch-mua-new-mail)\r
+> (define-key map "=" 'notmuch-refresh-this-buffer)\r
+> (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)\r
+> + (define-key map "j" 'notmuch-jump)\r
+> map)\r
+> "Keymap shared by all notmuch modes.")\r
+> \r
+> @@ -845,6 +846,32 @@ status."\r
+> (defvar notmuch-show-process-crypto nil)\r
+> (make-variable-buffer-local 'notmuch-show-process-crypto)\r
+> \r
+> +;; Jump key support:\r
+> +\r
+> +(defvar notmuch-jump-search nil)\r
+> +(defun notmuch-jump-map ()\r
+> + (let ((map (make-sparse-keymap)))\r
+> + (set-keymap-parent map nil)\r
+\r
+if you make the parent keymap the minibuffer-local-map then the various\r
+exits from the minibuffer work (ctrl-g and return for example)\r
+\r
+> + (suppress-keymap map)\r
+> + (dolist (saved-search notmuch-saved-searches)\r
+> + (let ((key (plist-get saved-search :key)))\r
+> + (when key\r
+> + (define-key map key `(lambda ()\r
+> + (interactive)\r
+> + (setq notmuch-jump-search ',saved-search)\r
+> + (exit-minibuffer)\r
+> + )))))\r
+> + map))\r
+> +\r
+> +(defun notmuch-jump ()\r
+> + "Read a saved search accelerator key and perform the associated\r
+> +search."\r
+> + (interactive)\r
+> + (read-from-minibuffer "Jump to saved search: " nil (notmuch-jump-map))\r
+> + (when notmuch-jump-search\r
+> + (notmuch-search (plist-get notmuch-jump-search :query)\r
+> + (plist-get notmuch-jump-search :oldest-first))))\r
+\r
+These two plist-gets should be notmuch-saved-search-get. That is a\r
+helper so that people with old style saved searches (a cons cell of name\r
+and query) don't get errors.\r
+\r
+(There were also a couple of "not yet declared" things.)\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+> +\r
+> (provide 'notmuch-lib)\r
+> \r
+> ;; Local Variables:\r
+> -- \r
+> 2.0.0.rc0\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r