1 Return-Path: <dmitry.kurochkin@gmail.com>
\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 401DC431FD0
\r
6 for <notmuch@notmuchmail.org>; Sun, 29 May 2011 09:03:40 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, 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 IQoZOG4Ep0bp for <notmuch@notmuchmail.org>;
\r
17 Sun, 29 May 2011 09:03:39 -0700 (PDT)
\r
18 Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com
\r
19 [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 35A23431FB6
\r
22 for <notmuch@notmuchmail.org>; Sun, 29 May 2011 09:03:38 -0700 (PDT)
\r
23 Received: by fxm8 with SMTP id 8so2338060fxm.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 29 May 2011 09:03:36 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=domainkey-signature:from:to:subject:in-reply-to:references
\r
27 :user-agent:date:message-id:mime-version:content-type;
\r
28 bh=W78RplOjH54os9OpQnCsHDT8tJ+epDoh1CaLr5Z0oaY=;
\r
29 b=Z2XWjO1LPxzmmCrD2t4UC3BRnKNQDFMZ3nHSGwVFdkgoglkPrWKIg09Tv0RMxXz9xZ
\r
30 c/BteO2JaF3rAckr0ASBot4Z+RWOzMXv7PeeJiOq3klaAoeOCtX7TWs8p9RnpM2MqZic
\r
31 oMEE+a4gfilqsgXwJBJXxiHX81oBR9EhRk6T0=
\r
32 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
\r
33 h=from:to:subject:in-reply-to:references:user-agent:date:message-id
\r
34 :mime-version:content-type;
\r
35 b=TVZlDpia08wF3hKJF8vcwVw3w13kVZTyPljn5WnQfuqG3CE1q4dDJPLLl4lguDRgHk
\r
36 R78ZMgEg5aiSrEmP9V7DJikQ04Hi96kH+1p3UJBfNVTorVt05Vfr1LaLLZ8VGC4jIhj/
\r
37 cKxXLi9/MrC1gnwl0qIBBRCQ7acZ7ezmW+3bg=
\r
38 Received: by 10.223.71.204 with SMTP id i12mr441142faj.65.1306685015293;
\r
39 Sun, 29 May 2011 09:03:35 -0700 (PDT)
\r
40 Received: from localhost ([91.144.186.21])
\r
41 by mx.google.com with ESMTPS id n15sm456322fag.42.2011.05.29.09.03.33
\r
42 (version=TLSv1/SSLv3 cipher=OTHER);
\r
43 Sun, 29 May 2011 09:03:34 -0700 (PDT)
\r
44 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
45 To: notmuch@dima.secretsauce.net, notmuch@notmuchmail.org
\r
46 Subject: Re: [PATCH] Added C-up and C-down to cycle through previous searches
\r
47 In-Reply-To: <1306659388-21809-1-git-send-email-notmuch@dima.secretsauce.net>
\r
48 References: <1306659388-21809-1-git-send-email-notmuch@dima.secretsauce.net>
\r
49 User-Agent: Notmuch/0.5-216-g0104e23 (http://notmuchmail.org) Emacs/23.3.1
\r
50 (x86_64-pc-linux-gnu)
\r
51 Date: Sun, 29 May 2011 20:04:00 +0400
\r
52 Message-ID: <87vcwto5n3.fsf@gmail.com>
\r
54 Content-Type: text/plain; charset=us-ascii
\r
55 X-BeenThere: notmuch@notmuchmail.org
\r
56 X-Mailman-Version: 2.1.13
\r
58 List-Id: "Use and development of the notmuch mail system."
\r
59 <notmuch.notmuchmail.org>
\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
63 List-Post: <mailto:notmuch@notmuchmail.org>
\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
67 X-List-Received-Date: Sun, 29 May 2011 16:03:40 -0000
\r
71 On Sun, 29 May 2011 01:56:28 -0700, notmuch@dima.secretsauce.net wrote:
\r
72 > From: Dima Kogan <dima@secretsauce.net>
\r
78 > I made a few improvements to the emacs UI. This patch allows the user to scroll
\r
79 > through the most recent searches with C-up and C-down while in the search box.
\r
82 This sounds like a very nice improvement to me! I just have one
\r
83 concern: Why C-up and C-down? I believe M-p and M-n would be more
\r
84 natural for Emacs users (at least for me :)).
\r
86 Also, I did not read the code and can not comment on it. But notmuch
\r
87 coding style is to use tabs for indentation. I guess .dir-locals.el
\r
88 should be improved to set coding style variables for all modes, not just
\r
96 > emacs/notmuch-hello.el | 49 +++++++++++++++++++++++++++++++++++++++++------
\r
97 > 1 files changed, 42 insertions(+), 7 deletions(-)
\r
99 > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
100 > index 916cda1..56f853f 100644
\r
101 > --- a/emacs/notmuch-hello.el
\r
102 > +++ b/emacs/notmuch-hello.el
\r
103 > @@ -123,6 +123,12 @@ Typically \",\" in the US and UK and \".\" in Europe."
\r
105 > (defvar notmuch-hello-recent-searches nil)
\r
107 > +(defvar notmuch-hello-cyclerecent-index 0
\r
108 > + "The current index of the most-recent searches" )
\r
110 > +(defvar notmuch-hello-search-widget nil
\r
111 > + "The search widget")
\r
113 > (defun notmuch-hello-remember-search (search)
\r
114 > (if (not (member search notmuch-hello-recent-searches))
\r
115 > (push search notmuch-hello-recent-searches))
\r
116 > @@ -148,6 +154,28 @@ Typically \",\" in the US and UK and \".\" in Europe."
\r
117 > (match-string 1 search)
\r
120 > +(defun notmuch-hello-cyclerecent-next ()
\r
121 > + "Cycle through the most recently-searched queries, going forwards"
\r
123 > + (notmuch-hello-cyclerecent 1))
\r
125 > +(defun notmuch-hello-cyclerecent-prev ()
\r
126 > + "Cycle through the most recently-searched queries, going backwards"
\r
128 > + (notmuch-hello-cyclerecent -1))
\r
130 > +(defun notmuch-hello-cyclerecent (d) ()
\r
132 > + (when notmuch-hello-recent-searches ; if no recent searches, do nothing
\r
133 > + (let ((N (length notmuch-hello-recent-searches)))
\r
134 > + (setq notmuch-hello-cyclerecent-index
\r
135 > + (% (+ notmuch-hello-cyclerecent-index d N) N))) ; update the index
\r
137 > + (widget-value-set notmuch-hello-search-widget
\r
138 > + (nth notmuch-hello-cyclerecent-index notmuch-hello-recent-searches))
\r
139 > + (widget-setup))
\r
142 > (defun notmuch-hello-search (search)
\r
143 > (let ((search (notmuch-hello-trim search)))
\r
144 > (notmuch-hello-remember-search search)
\r
145 > @@ -455,13 +483,19 @@ Complete list of currently available key bindings:
\r
147 > (widget-insert "\nSearch: ")
\r
148 > (setq notmuch-hello-search-bar-marker (point-marker))
\r
149 > - (widget-create 'editable-field
\r
150 > - ;; Leave some space at the start and end of the
\r
151 > - ;; search boxes.
\r
152 > - :size (max 8 (- (window-width) notmuch-hello-indent
\r
153 > - (length "Search: ")))
\r
154 > - :action (lambda (widget &rest ignore)
\r
155 > - (notmuch-hello-search (widget-value widget))))
\r
156 > + (setq notmuch-hello-search-widget
\r
157 > + (widget-create 'editable-field
\r
158 > + ;; Leave some space at the start and end of the
\r
159 > + ;; search boxes.
\r
160 > + :size (max 8 (- (window-width) notmuch-hello-indent
\r
161 > + (length "Search: ")))
\r
162 > + :action (lambda (widget &rest ignore)
\r
163 > + (notmuch-hello-search (widget-value widget)))
\r
164 > + :keymap (let ((map (make-sparse-keymap)))
\r
165 > + (set-keymap-parent map widget-field-keymap)
\r
166 > + (define-key map (kbd "<C-up>") 'notmuch-hello-cyclerecent-prev)
\r
167 > + (define-key map (kbd "<C-down>") 'notmuch-hello-cyclerecent-next)
\r
169 > (widget-insert "\n")
\r
171 > (when notmuch-hello-recent-searches
\r
172 > @@ -535,6 +569,7 @@ Complete list of currently available key bindings:
\r
173 > (widget-insert "Type a search query and hit RET to view matching threads.\n")
\r
174 > (when notmuch-hello-recent-searches
\r
175 > (widget-insert "Hit RET to re-submit a previous search. Edit it first if you like.\n")
\r
176 > + (widget-insert "In the search box, C-up/C-down cycles through the recent searches.\n")
\r
177 > (widget-insert "Save recent searches with the `save' button.\n"))
\r
178 > (when notmuch-saved-searches
\r
179 > (widget-insert "Edit saved searches with the `edit' button.\n"))
\r
183 > _______________________________________________
\r
184 > notmuch mailing list
\r
185 > notmuch@notmuchmail.org
\r
186 > http://notmuchmail.org/mailman/listinfo/notmuch
\r