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 1EA97431FB6
\r
6 for <notmuch@notmuchmail.org>; Sat, 5 Apr 2014 22:32:56 -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 Tj9qif13kcsG for <notmuch@notmuchmail.org>;
\r
17 Sat, 5 Apr 2014 22:32:48 -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 C3FB8431FAF
\r
22 for <notmuch@notmuchmail.org>; Sat, 5 Apr 2014 22:32:47 -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 1WWfh6-0003kf-DU; Sun, 06 Apr 2014 06:32:45 +0100
\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] 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 1WWfh6-0003Ry-36; Sun, 06 Apr 2014 06:32:36 +0100
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Austin Clements <amdragon@MIT.EDU>
\r
33 Subject: Re: [PATCH 5/5] emacs: Add a sort-order option to saved-searches
\r
34 In-Reply-To: <20140406013029.GG15472@mit.edu>
\r
35 References: <1396733065-32602-1-git-send-email-markwalters1009@gmail.com>
\r
36 <1396733065-32602-6-git-send-email-markwalters1009@gmail.com>
\r
37 <20140406013029.GG15472@mit.edu>
\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: Sun, 06 Apr 2014 06:32:35 +0100
\r
41 Message-ID: <87sipruioc.fsf@qmul.ac.uk>
\r
43 Content-Type: text/plain; charset=us-ascii
\r
44 X-Sender-Host-Address: 93.97.24.31
\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: 95a750182b32e53587c6ff5a3d2ab059 (of first 20000 bytes)
\r
49 X-SpamAssassin-Score: 0.0
\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.0 points. Summary of the scoring:
\r
55 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
56 provider * (markwalters1009[at]gmail.com)
\r
57 * 0.0 AWL AWL: From: address is in the auto white-list
\r
58 X-QM-Scan-Virus: ClamAV says the message is clean
\r
59 Cc: notmuch@notmuchmail.org
\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: Sun, 06 Apr 2014 05:32:56 -0000
\r
77 On Sun, 06 Apr 2014, Austin Clements <amdragon@MIT.EDU> wrote:
\r
78 > Quoth Mark Walters on Apr 05 at 10:24 pm:
\r
79 >> This adds a sort-order option to saved-searches, stores it in the
\r
80 >> saved-search buttons (widgets), and uses the stored value when the
\r
81 >> button is pressed.
\r
83 >> Storing the sort-order in the widget was suggested by Jani in
\r
84 >> id:4c3876274126985683e888641b29cf18142a5eb8.1391771337.git.jani@nikula.org.
\r
86 >> emacs/notmuch-hello.el | 11 ++++++++++-
\r
87 >> emacs/notmuch-lib.el | 7 ++++++-
\r
88 >> 2 files changed, 16 insertions(+), 2 deletions(-)
\r
90 >> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
91 >> index aa40e6f..6a28372 100644
\r
92 >> --- a/emacs/notmuch-hello.el
\r
93 >> +++ b/emacs/notmuch-hello.el
\r
94 >> @@ -364,7 +364,8 @@ (defun notmuch-hello-reflect (list ncols)
\r
95 >> (defun notmuch-hello-widget-search (widget &rest ignore)
\r
96 >> (notmuch-search (widget-get widget
\r
97 >> :notmuch-search-terms)
\r
98 >> - notmuch-search-oldest-first))
\r
99 >> + (widget-get widget
\r
100 >> + :notmuch-search-oldest-first)))
\r
102 >> (defun notmuch-saved-search-count (search)
\r
103 >> (car (process-lines notmuch-command "count" search)))
\r
104 >> @@ -496,12 +497,20 @@ (defun notmuch-hello-insert-buttons (searches)
\r
105 >> (widget-insert (make-string column-indent ? )))
\r
106 >> (let* ((name (plist-get elem :name))
\r
107 >> (query (plist-get elem :query))
\r
108 >> + (oldest-first (cond
\r
109 >> + ((eq (plist-get elem :sort-order) 'newest-first)
\r
111 >> + ((eq (plist-get elem :sort-order) 'oldest-first)
\r
114 >> + notmuch-search-oldest-first)))
\r
116 > (case (plist-get elem :sort-order)
\r
117 > (newest-first nil)
\r
119 > (otherwise notmuch-search-oldest-first))
\r
121 This is much better.
\r
124 >> (msg-count (plist-get elem :count)))
\r
125 >> (widget-insert (format "%8s "
\r
126 >> (notmuch-hello-nice-number msg-count)))
\r
127 >> (widget-create 'push-button
\r
128 >> :notify #'notmuch-hello-widget-search
\r
129 >> :notmuch-search-terms query
\r
130 >> + :notmuch-search-oldest-first oldest-first
\r
132 >> (setq column-indent
\r
133 >> (1+ (max 0 (- column-width (length name)))))))
\r
134 >> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
135 >> index 8a12f91..8aa8cfc 100644
\r
136 >> --- a/emacs/notmuch-lib.el
\r
137 >> +++ b/emacs/notmuch-lib.el
\r
138 >> @@ -125,7 +125,12 @@ (define-widget 'notmuch-saved-search-plist 'list
\r
139 >> (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v")))
\r
140 >> (checklist :inline t
\r
142 >> - (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v")))))
\r
143 >> + (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v"))
\r
144 >> + (group :format "%v" :inline t (const :format "" :sort-order)
\r
145 >> + (choice :tag " Sort Order"
\r
147 > Should there be a colon? (I haven't applied the patches and I'm
\r
148 > afraid this is beyond my mental implementation of define-widget!)
\r
150 I think it is OK without: since this is using :tag rather than :format
\r
151 the colon is supplied automatically.
\r
158 >> + (const :tag "Default" nil)
\r
159 >> + (const :tag "Oldest-first" oldest-first)
\r
160 >> + (const :tag "Newest-first" newest-first))))))
\r
162 >> (defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox")
\r
163 >> (:name "unread" :query "tag:unread"))
\r