[PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 7b / 6b27be5be88a385c61739122055ff4aacc48aa
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 1CAFD431FC0\r
6         for <notmuch@notmuchmail.org>; Tue, 15 Jul 2014 13:19:21 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.502\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.502 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_LOW=-0.7] 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 6qDgrLtq3b4l for <notmuch@notmuchmail.org>;\r
17         Tue, 15 Jul 2014 13:19:14 -0700 (PDT)\r
18 Received: from mail1.qmul.ac.uk (mail1.qmul.ac.uk [138.37.6.7])\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 DC45A431FBD\r
22         for <notmuch@notmuchmail.org>; Tue, 15 Jul 2014 13:19:13 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail1.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1X79Br-0005cn-SE; Tue, 15 Jul 2014 21:19:08 +0100\r
27 Received: from [194.42.225.51] (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 1X79Br-000373-KL; Tue, 15 Jul 2014 21:19:07 +0100\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH v2 0/2] emacs: Shortcut keys to saved searches\r
34 In-Reply-To: <1405433166-2198-1-git-send-email-amdragon@mit.edu>\r
35 References: <1405353735-26244-1-git-send-email-amdragon@mit.edu>\r
36         <1405433166-2198-1-git-send-email-amdragon@mit.edu>\r
37 User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1\r
38         (x86_64-pc-linux-gnu)\r
39 Date: Tue, 15 Jul 2014 21:18:48 +0100\r
40 Message-ID: <87lhru5qaf.fsf@qmul.ac.uk>\r
41 MIME-Version: 1.0\r
42 Content-Type: text/plain; charset=us-ascii\r
43 X-QM-SPAM-Info: 194.42.225.51 is in Janet mirror of Spamhaus XBL;\r
44         see http://www.spamhaus.org/xbl/\r
45 X-Sender-Host-Address: 194.42.225.51\r
46 X-QM-Geographic: According to ripencc,\r
47         this message was delivered by a machine in Britain (UK) (GB).\r
48 X-QM-SPAM-Info: Sender has good ham record.  :)\r
49 X-QM-Body-MD5: 2eed5866bb23d21371769a77ef21c5bd (of first 20000 bytes)\r
50 X-SpamAssassin-Score: -0.0\r
51 X-SpamAssassin-SpamBar: /\r
52 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
53         determine if it is\r
54         spam. We require at least 5.0 points to mark a message as spam.\r
55         This message scored -0.0 points.\r
56         Summary of the scoring: \r
57         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
58         provider *      (markwalters1009[at]gmail.com)\r
59         * -0.0 AWL AWL: From: address is in the auto white-list\r
60 X-QM-Scan-Virus: ClamAV says the message is clean\r
61 X-BeenThere: notmuch@notmuchmail.org\r
62 X-Mailman-Version: 2.1.13\r
63 Precedence: list\r
64 List-Id: "Use and development of the notmuch mail system."\r
65         <notmuch.notmuchmail.org>\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
69 List-Post: <mailto:notmuch@notmuchmail.org>\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
73 X-List-Received-Date: Tue, 15 Jul 2014 20:19:21 -0000\r
74 \r
75 \r
76 On Tue, 15 Jul 2014, Austin Clements <amdragon@MIT.EDU> wrote:\r
77 > This is version 2 of\r
78 > id:1405353735-26244-1-git-send-email-amdragon@mit.edu and addresses\r
79 > Mark's comments in id:87egxnd4aq.fsf@qmul.ac.uk.\r
80 >\r
81 > The diff from v1 is below.\r
82 \r
83 This version gets a +1 from me. I would have a slight preference for\r
84 making the prompt "Jump to search: " rather than "Search: " to emphasise\r
85 that you can't type an actual search, but am definitely happy with this\r
86 version.\r
87 \r
88 Best wishes\r
89 \r
90 Mark\r
91 \r
92 \r
93 \r
94 \r
95 >\r
96 > diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el\r
97 > index cb1ae10..9cb1e6a 100644\r
98 > --- a/emacs/notmuch-jump.el\r
99 > +++ b/emacs/notmuch-jump.el\r
100 > @@ -53,20 +53,19 @@ (defun notmuch-jump-search ()\r
101 >      (setq action-map (nreverse action-map))\r
102 >  \r
103 >      (if action-map\r
104 > -     (notmuch-jump action-map "Search ")\r
105 > -      (error "No shortcut keys for saved searches.  Please customize notmuch-saved-searches."))))\r
106 > +     (notmuch-jump action-map "Search: ")\r
107 > +      (error "To use notmuch-jump, please customize shortcut keys in notmuch-saved-searches."))))\r
108 >  \r
109 >  (defvar notmuch-jump--action nil)\r
110 >  \r
111 >  (defun notmuch-jump (action-map prompt)\r
112 >    "Interactively prompt for one of the keys in ACTION-MAP.\r
113 >  \r
114 > -Displays a pop-up temporary buffer with a summary of all bindings\r
115 > -in ACTION-MAP, reads a key from the minibuffer, and performs the\r
116 > -corresponding action.  The prompt can be canceled with C-g.\r
117 > -PROMPT must be a string to use for the prompt if this command was\r
118 > -not invoked directly by a key binding (e.g., it was invoked\r
119 > -through M-x).  PROMPT should include a space at the end.\r
120 > +Displays a summary of all bindings in ACTION-MAP in the\r
121 > +minibuffer, reads a key from the minibuffer, and performs the\r
122 > +corresponding action.  The prompt can be canceled with C-g or\r
123 > +RET.  PROMPT must be a string to use for the prompt.  PROMPT\r
124 > +should include a space at the end.\r
125 >  \r
126 >  ACTION-MAP must be a list of triples of the form\r
127 >    (KEY LABEL ACTION)\r
128 > @@ -82,16 +81,9 @@ (defun notmuch-jump (action-map prompt)\r
129 >         (with-temp-buffer\r
130 >           (notmuch-jump--insert-items (window-body-width) items)\r
131 >           (buffer-string)))\r
132 > -      (prompt-text\r
133 > -       (if (eq this-original-command this-command)\r
134 > -           ;; Make it look like we're just part of any regular\r
135 > -           ;; submap prompt (like C-x, C-c, etc.)\r
136 > -           (concat (format-kbd-macro (this-command-keys)) "-")\r
137 > -         ;; We were invoked through something like M-x\r
138 > -         prompt))\r
139 >        (full-prompt\r
140 >         (concat table "\n\n"\r
141 > -               (propertize prompt-text 'face 'minibuffer-prompt)))\r
142 > +               (propertize prompt 'face 'minibuffer-prompt)))\r
143 >        ;; By default, the minibuffer applies the minibuffer face to\r
144 >        ;; the entire prompt.  However, we want to clearly\r
145 >        ;; distinguish bindings (which we put in the prompt face\r
146 > @@ -121,14 +113,14 @@ (defun notmuch-jump--format-actions (action-map)\r
147 >  \r
148 >    ;; Compute the maximum key description width\r
149 >    (let ((key-width 1))\r
150 > -    (dolist (action action-map)\r
151 > +    (dolist (entry action-map)\r
152 >        (setq key-width\r
153 >           (max key-width\r
154 > -              (string-width (format-kbd-macro (first action))))))\r
155 > +              (string-width (format-kbd-macro (first entry))))))\r
156 >      ;; Format each action\r
157 > -    (mapcar (lambda (action)\r
158 > -           (let ((key (format-kbd-macro (first action)))\r
159 > -                 (desc (second action)))\r
160 > +    (mapcar (lambda (entry)\r
161 > +           (let ((key (format-kbd-macro (first entry)))\r
162 > +                 (desc (second entry)))\r
163 >               (concat\r
164 >                (propertize key 'face 'minibuffer-prompt)\r
165 >                (make-string (- key-width (length key)) ? )\r
166 > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
167 > index 135422d..b338aaa 100644\r
168 > --- a/emacs/notmuch-lib.el\r
169 > +++ b/emacs/notmuch-lib.el\r
170 > @@ -25,6 +25,9 @@\r
171 >  (require 'mm-decode)\r
172 >  (require 'cl)\r
173 >  \r
174 > +(autoload 'notmuch-jump-search "notmuch-jump"\r
175 > +  "Jump to a saved search by shortcut key." t)\r
176 > +\r
177 >  (defvar notmuch-command "notmuch"\r
178 >    "Command to run the notmuch binary.")\r
179 >  \r
180 > @@ -134,8 +137,6 @@ (defvar notmuch-common-keymap\r
181 >      map)\r
182 >    "Keymap shared by all notmuch modes.")\r
183 >  \r
184 > -(autoload 'notmuch-jump-search "notmuch-jump" "Jump to a saved search by shortcut key." t)\r
185 > -\r
186 >  ;; By default clicking on a button does not select the window\r
187 >  ;; containing the button (as opposed to clicking on a widget which\r
188 >  ;; does). This means that the button action is then executed in the\r