[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / af / bc19faea580ad61550cefd918475140b34d448
1 Return-Path: <damien.cassou@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 BF20E431FBD\r
6         for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 05:09:40 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 xyD+231TolUk for <notmuch@notmuchmail.org>;\r
17         Thu, 13 Dec 2012 05:09:39 -0800 (PST)\r
18 Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com\r
19  [74.125.82.47])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
20  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
21  ACEA5431FBC    for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 05:09:38 -0800\r
22  (PST)\r
23 Received: by mail-wg0-f47.google.com with SMTP id dq11so771129wgb.2\r
24         for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 05:09:37 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
27         :mime-version:content-type:content-transfer-encoding;\r
28         bh=qn4YEP6Hz7JoLlL2CrL0eJmvxXOsKEnld4YFdbhkm8E=;\r
29         b=ufHHkPi9mfMLB6QEnDYfqaS+T5dW1XJyZPc1ZtJzy/yduF1Wn7z9nxOuM0jhuZT5s1\r
30         oGNJaykTWRoxCaBdtEKhXw48qbUBvHDos/Uy0CTXCNJ7cxjKFZO65c6KO/yeFqbnoNP9\r
31         Bc6m+km1OoeSntwjsh5JL+8oVp/KB+7RjqdMEmEmHPPGHxW6/nf3BXbUABaiObaYG5M2\r
32         UPt24CqKdq2wYF/aZjS4zPWyqR2GHty/R7QkHKPjiUUU0jK0J1tmDbrC+MOth4/BpASQ\r
33         J1yvBPKvjiBj7C/XRwrtRz43Y7DC0ctF0JI2ROGYZnexNZfhCxHTyLMIcN1lxJ0cvQP1\r
34         Sc/A==\r
35 Received: by 10.180.93.40 with SMTP id cr8mr28902880wib.15.1355404177458;\r
36         Thu, 13 Dec 2012 05:09:37 -0800 (PST)\r
37 Received: from luz3.lille.inria.fr ([193.51.236.232])\r
38         by mx.google.com with ESMTPS id bz12sm2504214wib.5.2012.12.13.05.09.35\r
39         (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Thu, 13 Dec 2012 05:09:36 -0800 (PST)\r
41 From: Damien Cassou <damien.cassou@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH 1/4] emacs: Add a thread's tags to notmuch-show header-line\r
44 Date: Thu, 13 Dec 2012 14:09:24 +0100\r
45 Message-Id: <1355404167-31750-2-git-send-email-damien.cassou@gmail.com>\r
46 X-Mailer: git-send-email 1.7.10.4\r
47 In-Reply-To: <1355404167-31750-1-git-send-email-damien.cassou@gmail.com>\r
48 References: <1355404167-31750-1-git-send-email-damien.cassou@gmail.com>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=UTF-8\r
51 Content-Transfer-Encoding: 8bit\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\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: Thu, 13 Dec 2012 13:09:41 -0000\r
65 \r
66 Signed-off-by: Damien Cassou <damien.cassou@gmail.com>\r
67 ---\r
68  emacs/notmuch-lib.el    |   11 +++++++++--\r
69  emacs/notmuch-show.el   |   37 +++++++++++++++++++++++++++++--------\r
70  emacs/notmuch-tagger.el |   35 +++++++++++++++++++++++++++++++++++\r
71  3 files changed, 73 insertions(+), 10 deletions(-)\r
72  create mode 100644 emacs/notmuch-tagger.el\r
73 \r
74 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
75 index 9c4ee71..3541bb7 100644\r
76 --- a/emacs/notmuch-lib.el\r
77 +++ b/emacs/notmuch-lib.el\r
78 @@ -603,8 +603,15 @@ left it."\r
79      ;; Clear out what we've parsed\r
80      (delete-region (point-min) (point))))\r
81  \r
82 -\r
83 -\r
84 +(defun notmuch-intersperse (list sep)\r
85 +  "Return a list with all elements of LIST separated by SEP."\r
86 +  (let ((first t)\r
87 +        (res nil))\r
88 +    (dolist (elt list (nreverse res))\r
89 +      (unless first\r
90 +        (push sep res))\r
91 +      (setq first nil)\r
92 +      (push elt res))))\r
93  \r
94  (provide 'notmuch-lib)\r
95  \r
96 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
97 index 7d9f8a9..9c5a85e 100644\r
98 --- a/emacs/notmuch-show.el\r
99 +++ b/emacs/notmuch-show.el\r
100 @@ -36,6 +36,7 @@\r
101  (require 'notmuch-mua)\r
102  (require 'notmuch-crypto)\r
103  (require 'notmuch-print)\r
104 +(require 'notmuch-tagger)\r
105  \r
106  (declare-function notmuch-call-notmuch-process "notmuch" (&rest args))\r
107  (declare-function notmuch-fontify-headers "notmuch" nil)\r
108 @@ -355,7 +356,7 @@ operation on the contents of the current buffer."\r
109    "Return a string comprised of `n' spaces."\r
110    (make-string n ? ))\r
111  \r
112 -(defun notmuch-show-update-tags (tags)\r
113 +(defun notmuch-show-update-tags (tags &optional no-headerline-update)\r
114    "Update the displayed tags of the current message."\r
115    (save-excursion\r
116      (goto-char (notmuch-show-message-top))\r
117 @@ -364,7 +365,9 @@ operation on the contents of the current buffer."\r
118           (replace-match (concat "("\r
119                                  (propertize (mapconcat 'identity tags " ")\r
120                                              'face 'notmuch-tag-face)\r
121 -                                ")"))))))\r
122 +                                ")")))))\r
123 +  (unless no-headerline-update\r
124 +    (notmuch-show-update-header-line)))\r
125  \r
126  (defun notmuch-clean-address (address)\r
127    "Try to clean a single email ADDRESS for display. Return a cons\r
128 @@ -1136,11 +1139,28 @@ function is used."\r
129  \r
130        (jit-lock-register #'notmuch-show-buttonise-links)\r
131  \r
132 -      ;; Set the header line to the subject of the first message.\r
133 -      (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject)))\r
134 -\r
135 +      (notmuch-show-update-header-line)\r
136        (run-hooks 'notmuch-show-hook))))\r
137  \r
138 +(defun notmuch-show-thread-tags ()\r
139 +  "Return the list of tags for the current thread."\r
140 +  (let ((tags (list)))\r
141 +    (notmuch-show-mapc (lambda ()\r
142 +                        (mapcar (lambda (elt)\r
143 +                                  ;; Avoid adding duplicate tags\r
144 +                                  (add-to-list 'tags elt))\r
145 +                                (notmuch-show-get-tags))))\r
146 +    (sort tags 'string<)))\r
147 +\r
148 +(defun notmuch-show-update-header-line ()\r
149 +  "Make the header-line show the thread's subject and tags."\r
150 +  (let ((thread-subject (notmuch-show-strip-re (notmuch-show-get-subject))))\r
151 +    (setq header-line-format\r
152 +         (list\r
153 +          thread-subject\r
154 +          " "\r
155 +          (notmuch-tagger-format-tags-header-line (notmuch-show-thread-tags))))))\r
156 +\r
157  (defun notmuch-show-capture-state ()\r
158    "Capture the state of the current buffer.\r
159  \r
160 @@ -1443,10 +1463,10 @@ current thread."\r
161  (defun notmuch-show-get-depth ()\r
162    (notmuch-show-get-prop :depth))\r
163  \r
164 -(defun notmuch-show-set-tags (tags)\r
165 +(defun notmuch-show-set-tags (tags &optional no-headerline-update)\r
166    "Set the tags of the current message."\r
167    (notmuch-show-set-prop :tags tags)\r
168 -  (notmuch-show-update-tags tags))\r
169 +  (notmuch-show-update-tags tags no-headerline-update))\r
170  \r
171  (defun notmuch-show-get-tags ()\r
172    "Return the tags of the current message."\r
173 @@ -1760,7 +1780,8 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."\r
174       (let* ((current-tags (notmuch-show-get-tags))\r
175             (new-tags (notmuch-update-tags current-tags tag-changes)))\r
176         (unless (equal current-tags new-tags)\r
177 -        (notmuch-show-set-tags new-tags))))))\r
178 +        (notmuch-show-set-tags new-tags t)))))\r
179 +  (notmuch-show-update-header-line))\r
180  \r
181  (defun notmuch-show-add-tag ()\r
182    "Same as `notmuch-show-tag' but sets initial input to '+'."\r
183 diff --git a/emacs/notmuch-tagger.el b/emacs/notmuch-tagger.el\r
184 new file mode 100644\r
185 index 0000000..6fcebff\r
186 --- /dev/null\r
187 +++ b/emacs/notmuch-tagger.el\r
188 @@ -0,0 +1,35 @@\r
189 +;; notmuch-tagger.el --- Library to improve the way tags are displayed\r
190 +;;\r
191 +;; Copyright © Damien Cassou\r
192 +;;\r
193 +;; This file is part of Notmuch.\r
194 +;;\r
195 +;; Notmuch is free software: you can redistribute it and/or modify it\r
196 +;; under the terms of the GNU General Public License as published by\r
197 +;; the Free Software Foundation, either version 3 of the License, or\r
198 +;; (at your option) any later version.\r
199 +;;\r
200 +;; Notmuch is distributed in the hope that it will be useful, but\r
201 +;; WITHOUT ANY WARRANTY; without even the implied warranty of\r
202 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
203 +;; General Public License for more details.\r
204 +;;\r
205 +;; You should have received a copy of the GNU General Public License\r
206 +;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.\r
207 +;;\r
208 +;; Authors: Damien Cassou <damien.cassou@gmail.com>\r
209 +;;; Commentary:\r
210 +;;\r
211 +;;; Code:\r
212 +;;\r
213 +\r
214 +(defun notmuch-tagger-format-tags-header-line (tags)\r
215 +  "Format TAGS as a `mode-line-format' template.\r
216 +The result is suitable for inclusion in `header-line-format'."\r
217 +  (list\r
218 +   "("\r
219 +   (notmuch-intersperse tags " ")\r
220 +   ")"))\r
221 +\r
222 +(provide 'notmuch-tagger)\r
223 +;;; notmuch-tagger.el ends here\r
224 -- \r
225 1.7.10.4\r
226 \r