1 Return-Path: <dme@dme.org>
\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 EE2A6429E25
\r
6 for <notmuch@notmuchmail.org>; Tue, 6 May 2014 07:16:25 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 jvChatfKDnxr for <notmuch@notmuchmail.org>;
\r
16 Tue, 6 May 2014 07:16:20 -0700 (PDT)
\r
17 Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com
\r
18 [74.125.82.50]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 427AA431FD6 for <notmuch@notmuchmail.org>; Tue, 6 May 2014 07:16:20 -0700
\r
22 Received: by mail-wg0-f50.google.com with SMTP id x12so2977241wgg.9
\r
23 for <notmuch@notmuchmail.org>; Tue, 06 May 2014 07:16:19 -0700 (PDT)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=1e100.net; s=20130820;
\r
26 h=x-gm-message-state:from:to:subject:date:message-id;
\r
27 bh=XYSvl8PuSAAHcr81492E7eFt5egw7rzl6TPD5VqyZFw=;
\r
28 b=LsTweXzeG57kqdgzrl1TW5ax9jFjEo/0jC6SIKj1y3uxr/dMDjQLxk5zsOF4xE2RDm
\r
29 C2Xn71LfkTcZMlwU3h6p0osxWtZjlrY9FeVNDTBOzJt+lgu+0aI0XnUcITbd/F5Wk2aE
\r
30 pZKmsGNG2RGJzg5jYUch/xXVNfXJ6DIPSv76UWFsXBi3LKDp4fw/w8OA0fNLLdKMqxHA
\r
31 6Lt4wAGr25Tq7/wCbZyQ9qi1ycn2Ch9o8vgb80CqTBamx2SHxZD3W9dP9Sx9jx7y85C2
\r
32 4enJ9ePTzCkl5aYFRXXqdaZLNvkal0vf/Mf9f4fKbmckNKqdCCFzZiMeLuRKeSCHTGRn
\r
35 ALoCoQll1K15fxdP9HUQWGi6jlNY0WGb1/KsIW4DYRo9Cet424n5CHXV7fnGMjuyQ4G48V4aS5Gq
\r
36 X-Received: by 10.194.60.114 with SMTP id g18mr2583687wjr.61.1399385778972;
\r
37 Tue, 06 May 2014 07:16:18 -0700 (PDT)
\r
38 Received: from hotblack-desiato.hh.sledj.net (disaster-area.hh.sledj.net.
\r
40 by mx.google.com with ESMTPSA id v15sm756960wjq.17.2014.05.06.07.16.17
\r
41 for <notmuch@notmuchmail.org>
\r
42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
43 Tue, 06 May 2014 07:16:17 -0700 (PDT)
\r
44 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
45 id 1CF8A1009A6; Tue, 6 May 2014 15:16:16 +0100 (BST)
\r
46 From: David Edmondson <dme@dme.org>
\r
47 To: notmuch@notmuchmail.org
\r
48 Subject: [RFC] [PATCH] emacs: Add support for saved search accelerators.
\r
49 Date: Tue, 6 May 2014 15:16:16 +0100
\r
50 Message-Id: <1399385776-19918-1-git-send-email-dme@dme.org>
\r
51 X-Mailer: git-send-email 2.0.0.rc0
\r
52 X-BeenThere: notmuch@notmuchmail.org
\r
53 X-Mailman-Version: 2.1.13
\r
55 List-Id: "Use and development of the notmuch mail system."
\r
56 <notmuch.notmuchmail.org>
\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
60 List-Post: <mailto:notmuch@notmuchmail.org>
\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
64 X-List-Received-Date: Tue, 06 May 2014 14:16:26 -0000
\r
66 Extended the saved search definition to allow the inclusion of an
\r
67 accelerator key for the search. Bind 'j' in the common mode map as a
\r
68 leader for such accelerator keys.
\r
71 This arose out a conversation in #notmuch and Mark's patch to extend
\r
72 the saved search custom specification based on requirements for an
\r
73 external package (Austin's notmuch-go.el).
\r
75 Re-organising the layout of the saved searches is missing (as it's
\r
76 lots of fiddling about with absolute numbers and I didn't want to
\r
77 waste time on it if this is going nowhere), so the saved searches may
\r
78 not all line up correctly in notmuch-hello.
\r
80 emacs/notmuch-hello.el | 8 ++++++--
\r
81 emacs/notmuch-lib.el | 27 +++++++++++++++++++++++++++
\r
82 2 files changed, 33 insertions(+), 2 deletions(-)
\r
84 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
85 index 3de5238..56379ef 100644
\r
86 --- a/emacs/notmuch-hello.el
\r
87 +++ b/emacs/notmuch-hello.el
\r
88 @@ -85,6 +85,7 @@ searches so they still work in customize."
\r
89 (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v")))
\r
90 (checklist :inline t
\r
92 + (group :format "%v" :inline t (const :format " Key: " :key) (string :format "%v"))
\r
93 (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v"))
\r
94 (group :format "%v" :inline t (const :format "" :sort-order)
\r
95 (choice :tag " Sort Order"
\r
96 @@ -551,7 +552,8 @@ with `notmuch-hello-query-counts'."
\r
98 (if (> column-indent 0)
\r
99 (widget-insert (make-string column-indent ? )))
\r
100 - (let* ((name (plist-get elem :name))
\r
101 + (let* ((key (plist-get elem :key))
\r
102 + (name (plist-get elem :name))
\r
103 (query (plist-get elem :query))
\r
104 (oldest-first (case (plist-get elem :sort-order)
\r
106 @@ -564,7 +566,9 @@ with `notmuch-hello-query-counts'."
\r
107 :notify #'notmuch-hello-widget-search
\r
108 :notmuch-search-terms query
\r
109 :notmuch-search-oldest-first oldest-first
\r
112 + (concat name " (" key ")")
\r
114 (setq column-indent
\r
115 (1+ (max 0 (- column-width (length name)))))))
\r
116 (setq count (1+ count))
\r
117 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
118 index 2941da3..9aa7ba7 100644
\r
119 --- a/emacs/notmuch-lib.el
\r
120 +++ b/emacs/notmuch-lib.el
\r
121 @@ -130,6 +130,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
\r
122 (define-key map "m" 'notmuch-mua-new-mail)
\r
123 (define-key map "=" 'notmuch-refresh-this-buffer)
\r
124 (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)
\r
125 + (define-key map "j" 'notmuch-jump)
\r
127 "Keymap shared by all notmuch modes.")
\r
129 @@ -845,6 +846,32 @@ status."
\r
130 (defvar notmuch-show-process-crypto nil)
\r
131 (make-variable-buffer-local 'notmuch-show-process-crypto)
\r
133 +;; Jump key support:
\r
135 +(defvar notmuch-jump-search nil)
\r
136 +(defun notmuch-jump-map ()
\r
137 + (let ((map (make-sparse-keymap)))
\r
138 + (set-keymap-parent map nil)
\r
139 + (suppress-keymap map)
\r
140 + (dolist (saved-search notmuch-saved-searches)
\r
141 + (let ((key (plist-get saved-search :key)))
\r
143 + (define-key map key `(lambda ()
\r
145 + (setq notmuch-jump-search ',saved-search)
\r
146 + (exit-minibuffer)
\r
150 +(defun notmuch-jump ()
\r
151 + "Read a saved search accelerator key and perform the associated
\r
154 + (read-from-minibuffer "Jump to saved search: " nil (notmuch-jump-map))
\r
155 + (when notmuch-jump-search
\r
156 + (notmuch-search (plist-get notmuch-jump-search :query)
\r
157 + (plist-get notmuch-jump-search :oldest-first))))
\r
159 (provide 'notmuch-lib)
\r
161 ;; Local Variables:
\r