Re: [PATCH 0/2] Prompting for the GPG password within Emacs
[notmuch-archives.git] / ad / 4a16523f2e11100b6377cb6f4166b1938eb320
1 Return-Path: <dme@dme.org>\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 9EA3B431FC2\r
6         for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 10:16:36 -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.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id A8DChII1W+kA for <notmuch@notmuchmail.org>;\r
16         Thu, 26 Jan 2012 10:16:35 -0800 (PST)\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
18         [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 9006A431FBF\r
21         for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 10:16:35 -0800 (PST)\r
22 Received: by wibhi8 with SMTP id hi8so676099wib.26\r
23         for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 10:16:33 -0800 (PST)\r
24 Received: by 10.181.13.113 with SMTP id ex17mr5563053wid.15.1327601793296;\r
25         Thu, 26 Jan 2012 10:16:33 -0800 (PST)\r
26 Received: from hotblack-desiato.hh.sledj.net\r
27         (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
28         by mx.google.com with ESMTPS id fr8sm14981734wib.10.2012.01.26.10.16.31\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Thu, 26 Jan 2012 10:16:32 -0800 (PST)\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
32         id 85F68A02BA; Thu, 26 Jan 2012 18:16:30 +0000 (GMT)\r
33 From: David Edmondson <dme@dme.org>\r
34 To: notmuch@notmuchmail.org\r
35 Subject: [PATCH 1/2] emacs: Add a fake Tags: header during display.\r
36 Date: Thu, 26 Jan 2012 18:16:28 +0000\r
37 Message-Id: <1327601789-6040-2-git-send-email-dme@dme.org>\r
38 X-Mailer: git-send-email 1.7.8.3\r
39 In-Reply-To: <1327601789-6040-1-git-send-email-dme@dme.org>\r
40 References: <1327601789-6040-1-git-send-email-dme@dme.org>\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Thu, 26 Jan 2012 18:16:36 -0000\r
54 \r
55 If `truncate-lines' is `nil' in `notmuch-show-mode' the tags can be\r
56 lost from the right edge of the window. Create a fake 'Tags' header to\r
57 display them with the other headers.\r
58 \r
59 Enable it by default by adding it to `notmuch-message-headers' and\r
60 keep it up to date during tagging operations.\r
61 ---\r
62  emacs/notmuch-show.el |   24 +++++++++++++++++++-----\r
63  1 files changed, 19 insertions(+), 5 deletions(-)\r
64 \r
65 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
66 index c37479a..a975a29 100644\r
67 --- a/emacs/notmuch-show.el\r
68 +++ b/emacs/notmuch-show.el\r
69 @@ -41,7 +41,7 @@\r
70  (declare-function notmuch-select-tag-with-completion "notmuch" (prompt &rest search-terms))\r
71  (declare-function notmuch-search-show-thread "notmuch" nil)\r
72  \r
73 -(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")\r
74 +(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date" "Tags")\r
75    "Headers that should be shown in a message, in this order.\r
76  \r
77  For an open message, all of these headers will be made visible\r
78 @@ -255,6 +255,8 @@ operation on the contents of the current buffer."\r
79                 'message-header-subject)\r
80                ((looking-at "[Ff]rom:")\r
81                 'message-header-from)\r
82 +              ((looking-at "Tags:")\r
83 +               'notmuch-tag-face)\r
84                (t\r
85                 'message-header-other))))\r
86  \r
87 @@ -277,13 +279,21 @@ operation on the contents of the current buffer."\r
88  (defun notmuch-show-update-tags (tags)\r
89    "Update the displayed tags of the current message."\r
90    (save-excursion\r
91 -    (goto-char (notmuch-show-message-top))\r
92 -    (if (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)\r
93 -       (let ((inhibit-read-only t))\r
94 +    ;; Update the header line.\r
95 +    (let ((inhibit-read-only t))\r
96 +      (goto-char (notmuch-show-message-top))\r
97 +      (if (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)\r
98           (replace-match (concat "("\r
99                                  (propertize (mapconcat 'identity tags " ")\r
100                                              'face 'notmuch-tag-face)\r
101 -                                ")"))))))\r
102 +                                ")")))\r
103 +      ;; Update the header, if present.\r
104 +      (when (member "Tags" notmuch-message-headers)\r
105 +       (goto-char (notmuch-show-message-top))\r
106 +       (if (re-search-forward"^ *Tags: \\(.*\\)$" (notmuch-show-message-bottom) t)\r
107 +           (replace-match (propertize (mapconcat 'identity tags " ")\r
108 +                                      'face 'notmuch-tag-face)\r
109 +                          nil t nil 1))))))\r
110  \r
111  (defun notmuch-show-clean-address (address)\r
112    "Try to clean a single email ADDRESS for display.  Return\r
113 @@ -789,6 +799,10 @@ current buffer, if possible."\r
114          (message-invis-spec (notmuch-show-make-symbol "message"))\r
115          (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))))\r
116  \r
117 +    ;; Add a fake 'Tags' header which can be used in\r
118 +    ;; `notmuch-show-insert-headers'.\r
119 +    (plist-put headers :Tags (mapconcat #'identity (plist-get msg :tags) " "))\r
120 +\r
121      ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise\r
122      ;; removing items from `buffer-invisibility-spec' (which is what\r
123      ;; `notmuch-show-headers-visible' and\r
124 -- \r
125 1.7.8.3\r
126 \r