Re: Hi all
[notmuch-archives.git] / c3 / 5a7234f6a3e40107180683075bc569cfe0ece9
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 arlo.cworth.org (Postfix) with ESMTP id E3D526DE177D\r
6  for <notmuch@notmuchmail.org>; Wed, 14 Oct 2015 01:38:49 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.578\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.578 tagged_above=-999 required=5\r
12  tests=[AWL=-0.008, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,\r
13  DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25,\r
14  FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
15  RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled\r
16 Received: from arlo.cworth.org ([127.0.0.1])\r
17  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
18  with ESMTP id xomYsON1JWjc for <notmuch@notmuchmail.org>;\r
19  Wed, 14 Oct 2015 01:38:48 -0700 (PDT)\r
20 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
21  [209.85.212.181])\r
22  by arlo.cworth.org (Postfix) with ESMTPS id 608926DE1789\r
23  for <notmuch@notmuchmail.org>; Wed, 14 Oct 2015 01:38:41 -0700 (PDT)\r
24 Received: by wicgb1 with SMTP id gb1so120071259wic.1\r
25  for <notmuch@notmuchmail.org>; Wed, 14 Oct 2015 01:38:39 -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=kE0PTwl/Xl0PL124w5W7pYsOgMKusWUWr6oXbKOLX9I=;\r
29  b=RoSa3cMj2h8NByr9BO2hex/6hq4NMS232buwcA1SV6Tu4C12g0/gl/HWlqIYtTWXkI\r
30  OfY9qxzqyJ/0e0/Zs1VuGXcWM8yUfJIsuDb5xQUkEyZFHQXt3Ze9+1DqM1/kPVhCZGjt\r
31  9LrHsgX1UyD9C2shqEYk8m21q64l051Q2HSmNz7Wr9mr5jDQChctJPK4FBimfczey5JN\r
32  5rPsFcpXDLcZfR0Vgdw3RKnlLgPZvPfaa9ZIUyWcHOIobdau7F6sIixbknIAwUBziny/\r
33  1taFr2MkJgfGznuY3WlY7vi/CXncWRfytMzrYy8zKV3gOHZp7gmouPV5GYH72PlFEWrA\r
34  lSWg==\r
35 X-Received: by 10.194.84.42 with SMTP id v10mr2753699wjy.1.1444811918774;\r
36  Wed, 14 Oct 2015 01:38:38 -0700 (PDT)\r
37 Received: from localhost ([161.23.118.65])\r
38  by smtp.gmail.com with ESMTPSA id z2sm6171989wij.1.2015.10.14.01.38.37\r
39  (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
40  Wed, 14 Oct 2015 01:38:37 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH 1/2] emacs: allow saved searches to select tree-view\r
44 Date: Wed, 14 Oct 2015 09:38:22 +0100\r
45 Message-Id: <1444811903-16741-2-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 2.1.4\r
47 In-Reply-To: <1444811903-16741-1-git-send-email-markwalters1009@gmail.com>\r
48 References: <1444811903-16741-1-git-send-email-markwalters1009@gmail.com>\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.18\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53  <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Wed, 14 Oct 2015 08:38:50 -0000\r
62 \r
63 This patch allows the user to customize a saved search to choose tree\r
64 view rather than the default search view. It also updates notmuch-jump\r
65 so that it respects this choice.\r
66 ---\r
67  emacs/notmuch-hello.el | 21 ++++++++++++++++-----\r
68  emacs/notmuch-jump.el  |  4 +++-\r
69  2 files changed, 19 insertions(+), 6 deletions(-)\r
70 \r
71 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
72 index 7bfa752..d9fe3ff 100644\r
73 --- a/emacs/notmuch-hello.el\r
74 +++ b/emacs/notmuch-hello.el\r
75 @@ -28,6 +28,8 @@\r
76  \r
77  (declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation))\r
78  (declare-function notmuch-poll "notmuch" ())\r
79 +(declare-function notmuch-tree "notmuch-tree"\r
80 +                  (&optional query query-context target buffer-name open-target))\r
81  \r
82  (defun notmuch-saved-search-get (saved-search field)\r
83    "Get FIELD from SAVED-SEARCH.\r
84 @@ -91,7 +93,11 @@ searches so they still work in customize."\r
85                             (choice :tag " Sort Order"\r
86                                     (const :tag "Default" nil)\r
87                                     (const :tag "Oldest-first" oldest-first)\r
88 -                                   (const :tag "Newest-first" newest-first))))))\r
89 +                                   (const :tag "Newest-first" newest-first)))\r
90 +                    (group :format "%v" :inline t (const :format "" :search-type)\r
91 +                           (choice :tag " Search Type"\r
92 +                                   (const :tag "Search mode" nil)\r
93 +                                   (const :tag "Tree mode" tree))))))\r
94  \r
95  (defcustom notmuch-saved-searches\r
96    `((:name "inbox" :query "tag:inbox" :key ,(kbd "i"))\r
97 @@ -425,10 +431,13 @@ diagonal."\r
98           append (notmuch-hello-reflect-generate-row ncols nrows row list))))\r
99  \r
100  (defun notmuch-hello-widget-search (widget &rest ignore)\r
101 -  (notmuch-search (widget-get widget\r
102 -                             :notmuch-search-terms)\r
103 -                 (widget-get widget\r
104 -                             :notmuch-search-oldest-first)))\r
105 +  (if (widget-get widget :notmuch-search-type)\r
106 +      (notmuch-tree (widget-get widget\r
107 +                               :notmuch-search-terms))\r
108 +    (notmuch-search (widget-get widget\r
109 +                               :notmuch-search-terms)\r
110 +                   (widget-get widget\r
111 +                               :notmuch-search-oldest-first))))\r
112  \r
113  (defun notmuch-saved-search-count (search)\r
114    (car (process-lines notmuch-command "count" search)))\r
115 @@ -564,6 +573,7 @@ with `notmuch-hello-query-counts'."\r
116                                      (newest-first nil)\r
117                                      (oldest-first t)\r
118                                      (otherwise notmuch-search-oldest-first)))\r
119 +                    (search-type (eq (plist-get elem :search-type) 'tree))\r
120                      (msg-count (plist-get elem :count)))\r
121                 (widget-insert (format "%8s "\r
122                                        (notmuch-hello-nice-number msg-count)))\r
123 @@ -571,6 +581,7 @@ with `notmuch-hello-query-counts'."\r
124                                :notify #'notmuch-hello-widget-search\r
125                                :notmuch-search-terms query\r
126                                :notmuch-search-oldest-first oldest-first\r
127 +                              :notmuch-search-type search-type\r
128                                name)\r
129                 (setq column-indent\r
130                       (1+ (max 0 (- column-width (length name)))))))\r
131 diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el\r
132 index 20e24b2..506ae2c 100644\r
133 --- a/emacs/notmuch-jump.el\r
134 +++ b/emacs/notmuch-jump.el\r
135 @@ -54,7 +54,9 @@ fast way to jump to a saved search from anywhere in Notmuch."\r
136                    (oldest-first t)\r
137                    (otherwise (default-value 'notmuch-search-oldest-first)))))\r
138             (push (list key name\r
139 -                       `(lambda () (notmuch-search ',query ',oldest-first)))\r
140 +                       (if (eq (plist-get saved-search :search-type) 'tree)\r
141 +                           `(lambda () (notmuch-tree ',query))\r
142 +                         `(lambda () (notmuch-search ',query ',oldest-first))))\r
143                   action-map)))))\r
144      (setq action-map (nreverse action-map))\r
145  \r
146 -- \r
147 2.1.4\r
148 \r