[PATCH v2] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}
[notmuch-archives.git] / 1a / 3644eeb479c2a6b7f1ae69d8886db1d7692a30
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 EF6C1431FDA\r
6         for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:19:18 -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 WQX5bciRr10W for <notmuch@notmuchmail.org>;\r
17         Sun, 18 Nov 2012 11:19:17 -0800 (PST)\r
18 Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com\r
19  [74.125.82.45])        (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  45365431FC0    for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:19:17 -0800\r
22  (PST)\r
23 Received: by mail-wg0-f45.google.com with SMTP id dq11so838560wgb.2\r
24         for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:19:16 -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=onHk67cScTJNp2gozO0WJgxX9RxqiJzg1GvFczObDjs=;\r
29         b=aXw22UFlCKOxEF7DLqt7Hip8Z+p/swJV0NmnZeBhMSquy2qvaaPX4oub7sW9PoSxJ5\r
30         VFazoxIJGbHx9ebrzKXnMXPxU5EPzDg6bdJ8JmPxOGyA/D9Csm1vOEvDlzON5//i63/j\r
31         WomJNONE8lgkfWFEoahHhVbF4q9PXVnMCV+G6SfGG+tqojN8xEjFfGbsvvfa8hFdGtEI\r
32         WXq7OBFSLlyWdMtHst3xKtTpBXEXTQpCAFWPEE0/JpEm0uQUB4ZFu8VDh1BnUJuRTC6f\r
33         prb2o7W64llhDiOCDgWo1JYVE7rI9G0VTzWQQL0CDWcuBI85TLcd4KoWBlpUKnJxTShb\r
34         EdOw==\r
35 Received: by 10.216.217.214 with SMTP id i64mr3666202wep.124.1353266354696;\r
36         Sun, 18 Nov 2012 11:19:14 -0800 (PST)\r
37 Received: from localhost.localdomain (ble59-4-82-228-190-150.fbx.proxad.net.\r
38         [82.228.190.150])\r
39         by mx.google.com with ESMTPS id i2sm10290063wiw.3.2012.11.18.11.19.13\r
40         (version=TLSv1/SSLv3 cipher=OTHER);\r
41         Sun, 18 Nov 2012 11:19:13 -0800 (PST)\r
42 From: Damien Cassou <damien.cassou@gmail.com>\r
43 To: notmuch mailing list <notmuch@notmuchmail.org>\r
44 Subject: [PATCH 1/4] Add a thread's tags to emacs header-line\r
45 Date: Sun, 18 Nov 2012 20:18:39 +0100\r
46 Message-Id: <1353266322-20318-2-git-send-email-damien.cassou@gmail.com>\r
47 X-Mailer: git-send-email 1.7.10.4\r
48 In-Reply-To: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com>\r
49 References: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com>\r
50 MIME-Version: 1.0\r
51 Content-Type: text/plain; charset=UTF-8\r
52 Content-Transfer-Encoding: 8bit\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Sun, 18 Nov 2012 19:19:19 -0000\r
66 \r
67 Signed-off-by: Damien Cassou <damien.cassou@gmail.com>\r
68 ---\r
69  emacs/notmuch-show.el   |   24 +++++++++++++++++++++---\r
70  emacs/notmuch-tagger.el |   44 ++++++++++++++++++++++++++++++++++++++++++++\r
71  2 files changed, 65 insertions(+), 3 deletions(-)\r
72  create mode 100644 emacs/notmuch-tagger.el\r
73 \r
74 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
75 index 5b3e70e..988e27c 100644\r
76 --- a/emacs/notmuch-show.el\r
77 +++ b/emacs/notmuch-show.el\r
78 @@ -36,6 +36,7 @@\r
79  (require 'notmuch-mua)\r
80  (require 'notmuch-crypto)\r
81  (require 'notmuch-print)\r
82 +(require 'notmuch-tagger)\r
83  \r
84  (declare-function notmuch-call-notmuch-process "notmuch" (&rest args))\r
85  (declare-function notmuch-fontify-headers "notmuch" nil)\r
86 @@ -1121,11 +1122,28 @@ function is used."\r
87  \r
88        (jit-lock-register #'notmuch-show-buttonise-links)\r
89  \r
90 -      ;; Set the header line to the subject of the first message.\r
91 -      (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject)))\r
92 -\r
93 +      (notmuch-show-update-header-line)\r
94        (run-hooks 'notmuch-show-hook))))\r
95  \r
96 +(defun notmuch-show-thread-tags ()\r
97 +  "Return the list of tags for the current thread."\r
98 +  (let ((tags (list)))\r
99 +    (notmuch-show-mapc (lambda ()\r
100 +                        (mapcar (lambda (elt)\r
101 +                                  ;; Avoid adding duplicate tags\r
102 +                                  (add-to-list 'tags elt))\r
103 +                                (notmuch-show-get-tags))))\r
104 +    tags))\r
105 +\r
106 +(defun notmuch-show-update-header-line ()\r
107 +  "Make the header-line show the thread's subject and tags."\r
108 +  (let ((thread-subject (notmuch-show-strip-re (notmuch-show-get-subject))))\r
109 +    (setq header-line-format\r
110 +         (list\r
111 +          thread-subject\r
112 +          " "\r
113 +          (notmuch-tagger-present-tags-header-line (notmuch-show-thread-tags))))))\r
114 +\r
115  (defun notmuch-show-capture-state ()\r
116    "Capture the state of the current buffer.\r
117  \r
118 diff --git a/emacs/notmuch-tagger.el b/emacs/notmuch-tagger.el\r
119 new file mode 100644\r
120 index 0000000..5ca190e\r
121 --- /dev/null\r
122 +++ b/emacs/notmuch-tagger.el\r
123 @@ -0,0 +1,44 @@\r
124 +;; notmuch-tagger.el --- Library to improve the way tags are displayed\r
125 +;;\r
126 +;; Copyright © Damien Cassou\r
127 +;;\r
128 +;; This file is part of Notmuch.\r
129 +;;\r
130 +;; Notmuch is free software: you can redistribute it and/or modify it\r
131 +;; under the terms of the GNU General Public License as published by\r
132 +;; the Free Software Foundation, either version 3 of the License, or\r
133 +;; (at your option) any later version.\r
134 +;;\r
135 +;; Notmuch is distributed in the hope that it will be useful, but\r
136 +;; WITHOUT ANY WARRANTY; without even the implied warranty of\r
137 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
138 +;; General Public License for more details.\r
139 +;;\r
140 +;; You should have received a copy of the GNU General Public License\r
141 +;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.\r
142 +;;\r
143 +;; Authors: Damien Cassou <damien.cassou@gmail.com>\r
144 +;;; Commentary:\r
145 +;;\r
146 +;;; Code:\r
147 +;;\r
148 +(defun notmuch-tagger-separate-elems (list sep)\r
149 +  "Return a list with all elements of LIST separated by SEP."\r
150 +  (let ((first t)\r
151 +        (res nil))\r
152 +    (dolist (elt (reverse list) res)\r
153 +      (unless first\r
154 +        (push sep res))\r
155 +      (setq first nil)\r
156 +      (push elt res))))\r
157 +\r
158 +(defun notmuch-tagger-present-tags-header-line (tags)\r
159 +  "Return a property list to present TAGS in emacs header-line."\r
160 +  (list\r
161 +   "("\r
162 +   (notmuch-tagger-separate-elems tags " ")\r
163 +   ")"))\r
164 +\r
165 +\r
166 +(provide 'notmuch-tagger)\r
167 +;;; notmuch-tagger.el ends here\r
168 -- \r
169 1.7.10.4\r
170 \r