[PATCH 1/2] emacs: Add a fake Tags: header during display.
authorDavid Edmondson <dme@dme.org>
Thu, 26 Jan 2012 18:16:28 +0000 (18:16 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:22 +0000 (09:43 -0800)
ad/4a16523f2e11100b6377cb6f4166b1938eb320 [new file with mode: 0644]

diff --git a/ad/4a16523f2e11100b6377cb6f4166b1938eb320 b/ad/4a16523f2e11100b6377cb6f4166b1938eb320
new file mode 100644 (file)
index 0000000..779be11
--- /dev/null
@@ -0,0 +1,126 @@
+Return-Path: <dme@dme.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 9EA3B431FC2\r
+       for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 10:16:36 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id A8DChII1W+kA for <notmuch@notmuchmail.org>;\r
+       Thu, 26 Jan 2012 10:16:35 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 9006A431FBF\r
+       for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 10:16:35 -0800 (PST)\r
+Received: by wibhi8 with SMTP id hi8so676099wib.26\r
+       for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 10:16:33 -0800 (PST)\r
+Received: by 10.181.13.113 with SMTP id ex17mr5563053wid.15.1327601793296;\r
+       Thu, 26 Jan 2012 10:16:33 -0800 (PST)\r
+Received: from hotblack-desiato.hh.sledj.net\r
+       (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
+       by mx.google.com with ESMTPS id fr8sm14981734wib.10.2012.01.26.10.16.31\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 26 Jan 2012 10:16:32 -0800 (PST)\r
+Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
+       id 85F68A02BA; Thu, 26 Jan 2012 18:16:30 +0000 (GMT)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] emacs: Add a fake Tags: header during display.\r
+Date: Thu, 26 Jan 2012 18:16:28 +0000\r
+Message-Id: <1327601789-6040-2-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.8.3\r
+In-Reply-To: <1327601789-6040-1-git-send-email-dme@dme.org>\r
+References: <1327601789-6040-1-git-send-email-dme@dme.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 26 Jan 2012 18:16:36 -0000\r
+\r
+If `truncate-lines' is `nil' in `notmuch-show-mode' the tags can be\r
+lost from the right edge of the window. Create a fake 'Tags' header to\r
+display them with the other headers.\r
+\r
+Enable it by default by adding it to `notmuch-message-headers' and\r
+keep it up to date during tagging operations.\r
+---\r
+ emacs/notmuch-show.el |   24 +++++++++++++++++++-----\r
+ 1 files changed, 19 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index c37479a..a975a29 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -41,7 +41,7 @@\r
+ (declare-function notmuch-select-tag-with-completion "notmuch" (prompt &rest search-terms))\r
+ (declare-function notmuch-search-show-thread "notmuch" nil)\r
\r
+-(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")\r
++(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date" "Tags")\r
+   "Headers that should be shown in a message, in this order.\r
\r
+ For an open message, all of these headers will be made visible\r
+@@ -255,6 +255,8 @@ operation on the contents of the current buffer."\r
+               'message-header-subject)\r
+              ((looking-at "[Ff]rom:")\r
+               'message-header-from)\r
++             ((looking-at "Tags:")\r
++              'notmuch-tag-face)\r
+              (t\r
+               'message-header-other))))\r
\r
+@@ -277,13 +279,21 @@ operation on the contents of the current buffer."\r
+ (defun notmuch-show-update-tags (tags)\r
+   "Update the displayed tags of the current message."\r
+   (save-excursion\r
+-    (goto-char (notmuch-show-message-top))\r
+-    (if (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)\r
+-      (let ((inhibit-read-only t))\r
++    ;; Update the header line.\r
++    (let ((inhibit-read-only t))\r
++      (goto-char (notmuch-show-message-top))\r
++      (if (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)\r
+         (replace-match (concat "("\r
+                                (propertize (mapconcat 'identity tags " ")\r
+                                            'face 'notmuch-tag-face)\r
+-                               ")"))))))\r
++                               ")")))\r
++      ;; Update the header, if present.\r
++      (when (member "Tags" notmuch-message-headers)\r
++      (goto-char (notmuch-show-message-top))\r
++      (if (re-search-forward"^ *Tags: \\(.*\\)$" (notmuch-show-message-bottom) t)\r
++          (replace-match (propertize (mapconcat 'identity tags " ")\r
++                                     'face 'notmuch-tag-face)\r
++                         nil t nil 1))))))\r
\r
+ (defun notmuch-show-clean-address (address)\r
+   "Try to clean a single email ADDRESS for display.  Return\r
+@@ -789,6 +799,10 @@ current buffer, if possible."\r
+        (message-invis-spec (notmuch-show-make-symbol "message"))\r
+        (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))))\r
\r
++    ;; Add a fake 'Tags' header which can be used in\r
++    ;; `notmuch-show-insert-headers'.\r
++    (plist-put headers :Tags (mapconcat #'identity (plist-get msg :tags) " "))\r
++\r
+     ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise\r
+     ;; removing items from `buffer-invisibility-spec' (which is what\r
+     ;; `notmuch-show-headers-visible' and\r
+-- \r
+1.7.8.3\r
+\r