Re:
[notmuch-archives.git] / ce / 3dfe25d90e6a4b6a965aad6a142162f270c876
1 Return-Path: <markwalters1009@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 BF996431FAF\r
6         for <notmuch@notmuchmail.org>; Sat,  5 Apr 2014 14:25:06 -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.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id QgKJ6--b3H4W for <notmuch@notmuchmail.org>;\r
18         Sat,  5 Apr 2014 14:24:58 -0700 (PDT)\r
19 Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com\r
20         [209.85.212.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id AEDA0431FC7\r
23         for <notmuch@notmuchmail.org>; Sat,  5 Apr 2014 14:24:52 -0700 (PDT)\r
24 Received: by mail-wi0-f174.google.com with SMTP id d1so3104996wiv.7\r
25         for <notmuch@notmuchmail.org>; Sat, 05 Apr 2014 14:24:51 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
28         bh=ZGtKMQzv/4fXbY06ReixlWCJwNjbLNz3AM8G7l5IpwE=;\r
29         b=Vk18QOPt+KK+z7PkOH4xX9YPhUeDsByobolUOmQ7i9NFHOwfri0zDADd9oT7kBjZXz\r
30         Jtpsia0+/f6mM0TqBHcRD7ChzXbgROtSMCSCWqp3fazxQPJFg/Nj8mqe2FOyoe1X9TTW\r
31         iOZk3feNxIrrGH4B2gnRmRnMG4dmb31Mp5gMnF/zSupaMjtrGK3x9Nb7mjs29m8f6ppy\r
32         Bf69hohyJ/ZEXaIK8QmpUl2BymPUiYY6ISDsAEzejgwUxUCzdvhr5r0m/WCgBJ5x0RI5\r
33         JqBWIfu3o40UOdcxV85XXLfbZ5/BWHiiiLKGG43vH2qRbs+wDVM3Sk9i7sGci745OUMg\r
34         AXWw==\r
35 X-Received: by 10.180.96.200 with SMTP id du8mr14433808wib.43.1396733091623;\r
36         Sat, 05 Apr 2014 14:24:51 -0700 (PDT)\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
38         by mx.google.com with ESMTPSA id gi8sm6779580wib.8.2014.04.05.14.24.50\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Sat, 05 Apr 2014 14:24:51 -0700 (PDT)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH 5/5] emacs: Add a sort-order option to saved-searches\r
45 Date: Sat,  5 Apr 2014 22:24:25 +0100\r
46 Message-Id: <1396733065-32602-6-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.10.4\r
48 In-Reply-To: <1396733065-32602-1-git-send-email-markwalters1009@gmail.com>\r
49 References: <1396733065-32602-1-git-send-email-markwalters1009@gmail.com>\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Sat, 05 Apr 2014 21:25:07 -0000\r
63 \r
64 This adds a sort-order option to saved-searches, stores it in the\r
65 saved-search buttons (widgets), and uses the stored value when the\r
66 button is pressed.\r
67 \r
68 Storing the sort-order in the widget was suggested by Jani in\r
69 id:4c3876274126985683e888641b29cf18142a5eb8.1391771337.git.jani@nikula.org.\r
70 ---\r
71  emacs/notmuch-hello.el |   11 ++++++++++-\r
72  emacs/notmuch-lib.el   |    7 ++++++-\r
73  2 files changed, 16 insertions(+), 2 deletions(-)\r
74 \r
75 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
76 index aa40e6f..6a28372 100644\r
77 --- a/emacs/notmuch-hello.el\r
78 +++ b/emacs/notmuch-hello.el\r
79 @@ -364,7 +364,8 @@ (defun notmuch-hello-reflect (list ncols)\r
80  (defun notmuch-hello-widget-search (widget &rest ignore)\r
81    (notmuch-search (widget-get widget\r
82                               :notmuch-search-terms)\r
83 -                 notmuch-search-oldest-first))\r
84 +                 (widget-get widget\r
85 +                             :notmuch-search-oldest-first)))\r
86  \r
87  (defun notmuch-saved-search-count (search)\r
88    (car (process-lines notmuch-command "count" search)))\r
89 @@ -496,12 +497,20 @@ (defun notmuch-hello-insert-buttons (searches)\r
90                   (widget-insert (make-string column-indent ? )))\r
91               (let* ((name (plist-get elem :name))\r
92                      (query (plist-get elem :query))\r
93 +                    (oldest-first (cond\r
94 +                                   ((eq (plist-get elem :sort-order) 'newest-first)\r
95 +                                    nil)\r
96 +                                   ((eq (plist-get elem :sort-order) 'oldest-first)\r
97 +                                    t)\r
98 +                                   (t\r
99 +                                    notmuch-search-oldest-first)))\r
100                      (msg-count (plist-get elem :count)))\r
101                 (widget-insert (format "%8s "\r
102                                        (notmuch-hello-nice-number msg-count)))\r
103                 (widget-create 'push-button\r
104                                :notify #'notmuch-hello-widget-search\r
105                                :notmuch-search-terms query\r
106 +                              :notmuch-search-oldest-first oldest-first\r
107                                name)\r
108                 (setq column-indent\r
109                       (1+ (max 0 (- column-width (length name)))))))\r
110 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
111 index 8a12f91..8aa8cfc 100644\r
112 --- a/emacs/notmuch-lib.el\r
113 +++ b/emacs/notmuch-lib.el\r
114 @@ -125,7 +125,12 @@ (define-widget 'notmuch-saved-search-plist 'list\r
115                 (group :format "%v" :inline t (const :format "  Query: " :query) (string :format "%v")))\r
116           (checklist :inline t\r
117                      :format "%v"\r
118 -                    (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v")))))\r
119 +                    (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v"))\r
120 +                    (group :format "%v" :inline t (const :format "" :sort-order)\r
121 +                           (choice :tag " Sort Order"\r
122 +                                   (const :tag "Default" nil)\r
123 +                                   (const :tag "Oldest-first" oldest-first)\r
124 +                                   (const :tag "Newest-first" newest-first))))))\r
125  \r
126  (defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox")\r
127                                     (:name "unread" :query "tag:unread"))\r
128 -- \r
129 1.7.10.4\r
130 \r