1 Return-Path: <notmuch@dima.secretsauce.net>
\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 571D9431FD0
\r
6 for <notmuch@notmuchmail.org>; Sun, 29 May 2011 01:57:18 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 5EucNL-1tpMP for <notmuch@notmuchmail.org>;
\r
16 Sun, 29 May 2011 01:57:17 -0700 (PDT)
\r
17 Received: from hrndva-omtalb.mail.rr.com (hrndva-omtalb.mail.rr.com
\r
19 by olra.theworths.org (Postfix) with ESMTP id B55FB431FB6
\r
20 for <notmuch@notmuchmail.org>; Sun, 29 May 2011 01:57:17 -0700 (PDT)
\r
21 X-Authority-Analysis: v=1.1 cv=ou1QuR4lBR9YeJgEH9ccYmbAdaWqVVq3lOvCKJtMpGM=
\r
22 c=1 sm=0 a=kdBHfC_lHAEA:10 a=8YMtuzaJ5FE3wtSInqJrPg==:17
\r
23 a=ncDVm-j7AAAA:8 a=170x8asiWLmGcE8pcEUA:9 a=1TAlIYiSTWAA:10
\r
24 a=AeRk0RUmecrZEO0f:21 a=cBNwx19qwRruWKQi:21
\r
25 a=8YMtuzaJ5FE3wtSInqJrPg==:117
\r
26 X-Cloudmark-Score: 0
\r
27 X-Originating-IP: 76.175.234.46
\r
28 Received: from [76.175.234.46] ([76.175.234.46:57219]
\r
29 helo=localhost.localdomain)
\r
30 by hrndva-oedge02.mail.rr.com (envelope-from
\r
31 <notmuch@dima.secretsauce.net>) (ecelerity 2.2.3.46 r()) with ESMTP
\r
32 id 9D/B5-04598-03A02ED4; Sun, 29 May 2011 08:56:16 +0000
\r
33 From: notmuch@dima.secretsauce.net
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH] Added C-up and C-down to cycle through previous searches
\r
36 Date: Sun, 29 May 2011 01:56:28 -0700
\r
37 Message-Id: <1306659388-21809-1-git-send-email-notmuch@dima.secretsauce.net>
\r
38 X-Mailer: git-send-email 1.7.5.3
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Sun, 29 May 2011 08:57:18 -0000
\r
53 From: Dima Kogan <dima@secretsauce.net>
\r
59 I made a few improvements to the emacs UI. This patch allows the user to scroll
\r
60 through the most recent searches with C-up and C-down while in the search box.
\r
64 emacs/notmuch-hello.el | 49 +++++++++++++++++++++++++++++++++++++++++------
\r
65 1 files changed, 42 insertions(+), 7 deletions(-)
\r
67 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
68 index 916cda1..56f853f 100644
\r
69 --- a/emacs/notmuch-hello.el
\r
70 +++ b/emacs/notmuch-hello.el
\r
71 @@ -123,6 +123,12 @@ Typically \",\" in the US and UK and \".\" in Europe."
\r
73 (defvar notmuch-hello-recent-searches nil)
\r
75 +(defvar notmuch-hello-cyclerecent-index 0
\r
76 + "The current index of the most-recent searches" )
\r
78 +(defvar notmuch-hello-search-widget nil
\r
79 + "The search widget")
\r
81 (defun notmuch-hello-remember-search (search)
\r
82 (if (not (member search notmuch-hello-recent-searches))
\r
83 (push search notmuch-hello-recent-searches))
\r
84 @@ -148,6 +154,28 @@ Typically \",\" in the US and UK and \".\" in Europe."
\r
85 (match-string 1 search)
\r
88 +(defun notmuch-hello-cyclerecent-next ()
\r
89 + "Cycle through the most recently-searched queries, going forwards"
\r
91 + (notmuch-hello-cyclerecent 1))
\r
93 +(defun notmuch-hello-cyclerecent-prev ()
\r
94 + "Cycle through the most recently-searched queries, going backwards"
\r
96 + (notmuch-hello-cyclerecent -1))
\r
98 +(defun notmuch-hello-cyclerecent (d) ()
\r
100 + (when notmuch-hello-recent-searches ; if no recent searches, do nothing
\r
101 + (let ((N (length notmuch-hello-recent-searches)))
\r
102 + (setq notmuch-hello-cyclerecent-index
\r
103 + (% (+ notmuch-hello-cyclerecent-index d N) N))) ; update the index
\r
105 + (widget-value-set notmuch-hello-search-widget
\r
106 + (nth notmuch-hello-cyclerecent-index notmuch-hello-recent-searches))
\r
110 (defun notmuch-hello-search (search)
\r
111 (let ((search (notmuch-hello-trim search)))
\r
112 (notmuch-hello-remember-search search)
\r
113 @@ -455,13 +483,19 @@ Complete list of currently available key bindings:
\r
115 (widget-insert "\nSearch: ")
\r
116 (setq notmuch-hello-search-bar-marker (point-marker))
\r
117 - (widget-create 'editable-field
\r
118 - ;; Leave some space at the start and end of the
\r
120 - :size (max 8 (- (window-width) notmuch-hello-indent
\r
121 - (length "Search: ")))
\r
122 - :action (lambda (widget &rest ignore)
\r
123 - (notmuch-hello-search (widget-value widget))))
\r
124 + (setq notmuch-hello-search-widget
\r
125 + (widget-create 'editable-field
\r
126 + ;; Leave some space at the start and end of the
\r
128 + :size (max 8 (- (window-width) notmuch-hello-indent
\r
129 + (length "Search: ")))
\r
130 + :action (lambda (widget &rest ignore)
\r
131 + (notmuch-hello-search (widget-value widget)))
\r
132 + :keymap (let ((map (make-sparse-keymap)))
\r
133 + (set-keymap-parent map widget-field-keymap)
\r
134 + (define-key map (kbd "<C-up>") 'notmuch-hello-cyclerecent-prev)
\r
135 + (define-key map (kbd "<C-down>") 'notmuch-hello-cyclerecent-next)
\r
137 (widget-insert "\n")
\r
139 (when notmuch-hello-recent-searches
\r
140 @@ -535,6 +569,7 @@ Complete list of currently available key bindings:
\r
141 (widget-insert "Type a search query and hit RET to view matching threads.\n")
\r
142 (when notmuch-hello-recent-searches
\r
143 (widget-insert "Hit RET to re-submit a previous search. Edit it first if you like.\n")
\r
144 + (widget-insert "In the search box, C-up/C-down cycles through the recent searches.\n")
\r
145 (widget-insert "Save recent searches with the `save' button.\n"))
\r
146 (when notmuch-saved-searches
\r
147 (widget-insert "Edit saved searches with the `edit' button.\n"))
\r