1 Return-Path: <m.walters@qmul.ac.uk>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id BD8D0431FBF
\r
6 for <notmuch@notmuchmail.org>; Thu, 8 May 2014 02:15:20 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id lFYIBb2kDbLL for <notmuch@notmuchmail.org>;
\r
17 Thu, 8 May 2014 02:15:14 -0700 (PDT)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id A6D3A431FAE
\r
22 for <notmuch@notmuchmail.org>; Thu, 8 May 2014 02:15:13 -0700 (PDT)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1WiKQ1-0000zx-O7; Thu, 08 May 2014 10:15:12 +0100
\r
27 Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)
\r
28 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1WiKPh-0005Fj-AG; Thu, 08 May 2014 10:14:49 +0100
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org
\r
33 Subject: Re: [PATCH v2] emacs: Add support for saved search accelerators
\r
34 In-Reply-To: <1399461694-25350-2-git-send-email-dme@dme.org>
\r
35 References: <1399385776-19918-1-git-send-email-dme@dme.org>
\r
36 <1399461694-25350-1-git-send-email-dme@dme.org>
\r
37 <1399461694-25350-2-git-send-email-dme@dme.org>
\r
38 User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1
\r
39 (x86_64-pc-linux-gnu)
\r
40 Date: Thu, 08 May 2014 10:14:47 +0100
\r
41 Message-ID: <87zjislji0.fsf@qmul.ac.uk>
\r
43 Content-Type: text/plain; charset=us-ascii
\r
44 X-Sender-Host-Address: 87.81.223.162
\r
45 X-QM-Geographic: According to ripencc,
\r
46 this message was delivered by a machine in Britain (UK) (GB).
\r
47 X-QM-SPAM-Info: Sender has good ham record. :)
\r
48 X-QM-Body-MD5: 07f41aa1f7ae45e6727c096e1e45db39 (of first 20000 bytes)
\r
49 X-SpamAssassin-Score: -0.1
\r
50 X-SpamAssassin-SpamBar: /
\r
51 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
53 spam. We require at least 5.0 points to mark a message as spam.
\r
54 This message scored -0.1 points.
\r
55 Summary of the scoring:
\r
56 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
57 provider * (markwalters1009[at]gmail.com)
\r
58 * -0.1 AWL AWL: From: address is in the auto white-list
\r
59 X-QM-Scan-Virus: ClamAV says the message is clean
\r
60 X-BeenThere: notmuch@notmuchmail.org
\r
61 X-Mailman-Version: 2.1.13
\r
63 List-Id: "Use and development of the notmuch mail system."
\r
64 <notmuch.notmuchmail.org>
\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
68 List-Post: <mailto:notmuch@notmuchmail.org>
\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
72 X-List-Received-Date: Thu, 08 May 2014 09:15:20 -0000
\r
77 This version looks good to me.
\r
79 The only slight query I have is which key to bind it to: Austin used g
\r
80 in notmuch-go and this uses j. Austin said on irc that he chose g
\r
81 because it wasn't bound and matched gmail's shortcut.
\r
83 Personally I like j (as it starts fewer words than g) and given that we
\r
84 don't match any of gmail's other bindings I don't think there is much
\r
85 advantage to doing so in this case.
\r
87 In any case that's all bikeshedding: I like this patch with either
\r
96 On Wed, 07 May 2014, David Edmondson <dme@dme.org> wrote:
\r
97 > Extended the saved search definition to allow the inclusion of an
\r
98 > accelerator key for the search. Bind 'j' in the common mode map as a
\r
99 > leader for such accelerator keys.
\r
101 > emacs/notmuch-hello.el | 5 ++++-
\r
102 > emacs/notmuch-lib.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++
\r
103 > 2 files changed, 50 insertions(+), 1 deletion(-)
\r
105 > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
106 > index 3de5238..64d5aa1 100644
\r
107 > --- a/emacs/notmuch-hello.el
\r
108 > +++ b/emacs/notmuch-hello.el
\r
109 > @@ -85,6 +85,7 @@ searches so they still work in customize."
\r
110 > (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v")))
\r
111 > (checklist :inline t
\r
113 > + (group :format "%v" :inline t (const :format " Key: " :key) (key-sequence :format "%v"))
\r
114 > (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v"))
\r
115 > (group :format "%v" :inline t (const :format "" :sort-order)
\r
116 > (choice :tag " Sort Order"
\r
117 > @@ -101,6 +102,7 @@ a plist. Supported properties are
\r
119 > :name Name of the search (required).
\r
120 > :query Search to run (required).
\r
121 > + :key Optional accelerator key.
\r
122 > :count-query Optional extra query to generate the count
\r
123 > shown. If not present then the :query property
\r
125 > @@ -551,7 +553,8 @@ with `notmuch-hello-query-counts'."
\r
127 > (if (> column-indent 0)
\r
128 > (widget-insert (make-string column-indent ? )))
\r
129 > - (let* ((name (plist-get elem :name))
\r
130 > + (let* ((key (plist-get elem :key))
\r
131 > + (name (plist-get elem :name))
\r
132 > (query (plist-get elem :query))
\r
133 > (oldest-first (case (plist-get elem :sort-order)
\r
134 > (newest-first nil)
\r
135 > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
136 > index 2941da3..f8c5f96 100644
\r
137 > --- a/emacs/notmuch-lib.el
\r
138 > +++ b/emacs/notmuch-lib.el
\r
139 > @@ -25,6 +25,10 @@
\r
140 > (require 'mm-decode)
\r
143 > +(declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation))
\r
144 > +(declare-function notmuch-saved-search-get "notmuch-hello" (saved-search field))
\r
145 > +(defvar notmuch-saved-searches) ;; In `notmuch-hello.el'.
\r
147 > (defvar notmuch-command "notmuch"
\r
148 > "Command to run the notmuch binary.")
\r
150 > @@ -130,6 +134,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
\r
151 > (define-key map "m" 'notmuch-mua-new-mail)
\r
152 > (define-key map "=" 'notmuch-refresh-this-buffer)
\r
153 > (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)
\r
154 > + (define-key map "j" 'notmuch-jump)
\r
156 > "Keymap shared by all notmuch modes.")
\r
158 > @@ -845,6 +850,47 @@ status."
\r
159 > (defvar notmuch-show-process-crypto nil)
\r
160 > (make-variable-buffer-local 'notmuch-show-process-crypto)
\r
162 > +;; Jump key support:
\r
164 > +(defvar notmuch-jump-search nil)
\r
165 > +(defun notmuch-jump-map ()
\r
166 > + (let ((map (make-sparse-keymap))
\r
168 > + (set-keymap-parent map minibuffer-local-map)
\r
169 > + (suppress-keymap map)
\r
170 > + (dolist (saved-search notmuch-saved-searches)
\r
171 > + (let ((key (notmuch-saved-search-get saved-search :key)))
\r
173 > + (define-key map key `(lambda ()
\r
175 > + (setq notmuch-jump-search ',saved-search)
\r
176 > + (exit-minibuffer)))
\r
177 > + (push (format "%s: %s"
\r
178 > + (propertize key 'face 'minibuffer-prompt)
\r
179 > + (notmuch-saved-search-get saved-search :name))
\r
181 > + ;; Hitting ? displays a quick hint of the accelerators.
\r
182 > + (define-key map "?" `(lambda ()
\r
185 > + (mapconcat #'identity
\r
186 > + ;; Reverse the list so
\r
187 > + ;; that elements appear
\r
188 > + ;; in the same order as
\r
189 > + ;; `notmuch-saved-searches'.
\r
190 > + (reverse ',help)
\r
194 > +(defun notmuch-jump ()
\r
195 > + "Read a saved search accelerator key and perform the search."
\r
197 > + (setq notmuch-jump-search nil)
\r
198 > + (read-from-minibuffer "Jump to saved search: " nil (notmuch-jump-map))
\r
199 > + (when notmuch-jump-search
\r
200 > + (notmuch-search (notmuch-saved-search-get notmuch-jump-search :query)
\r
201 > + (notmuch-saved-search-get notmuch-jump-search :oldest-first))))
\r
203 > (provide 'notmuch-lib)
\r
205 > ;; Local Variables:
\r
209 > _______________________________________________
\r
210 > notmuch mailing list
\r
211 > notmuch@notmuchmail.org
\r
212 > http://notmuchmail.org/mailman/listinfo/notmuch
\r