--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 309A4431E84\r
+ for <notmuch@notmuchmail.org>; Thu, 5 Dec 2013 12:04:56 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ 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 P5ck4EiXXhOn for <notmuch@notmuchmail.org>;\r
+ Thu, 5 Dec 2013 12:04:49 -0800 (PST)\r
+Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com\r
+ [209.85.212.178]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 6FD12431FD8\r
+ for <notmuch@notmuchmail.org>; Thu, 5 Dec 2013 12:04:49 -0800 (PST)\r
+Received: by mail-wi0-f178.google.com with SMTP id ca18so216068wib.17\r
+ for <notmuch@notmuchmail.org>; Thu, 05 Dec 2013 12:04:48 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=+1n+4a7WWXFLfMTwF3MGnzUAOPyaYy0Zw6dwT4JrMnA=;\r
+ b=l2Dwpb+T9k4z9e7Bl+fZYMrhhkYDJOJkWMsZjszOEPRp6P6g4DK8JGQkG9xA9aW8GF\r
+ rXpw3MCagUNvrzzLek5l2Ca1+H+O5wwEZi8+wZvNIh21wGXKwLiuHL3KeJRUfcaaZEyV\r
+ 0ZIPE1Z7u6ua7+8ggmN8kRRyiUVGhlyndS85/VGdSR/ZjWm0Mvp2qHdVRp3YEaqWMO+W\r
+ 1YcBl/9BHz5gNzIn6Mumn7dJFu/dZnMSsPvN/htQX5AQD0IXdpsT+yLGuY+V9E5NB2lj\r
+ v9e8N31DGolnjj9d7U3ek9P+xOJOz9sQ3IaJhsIdfP/SJun9He9+KX9PhYzJjOUHhEX0\r
+ m3Nw==\r
+X-Received: by 10.194.60.73 with SMTP id f9mr19097793wjr.65.1386273888231;\r
+ Thu, 05 Dec 2013 12:04:48 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id nb16sm9433226wic.0.2013.12.05.12.04.46\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Thu, 05 Dec 2013 12:04:47 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH WIP v3 1/3] emacs: show: mark tags changed since buffer loaded\r
+Date: Thu, 5 Dec 2013 20:04:29 +0000\r
+Message-Id: <1386273871-24214-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1386273871-24214-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1386273871-24214-1-git-send-email-markwalters1009@gmail.com>\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, 05 Dec 2013 20:04:56 -0000\r
+\r
+This shows any tags changed in the show buffer since it was loaded or\r
+refreshed. By default a removed tag is displayed with strike-through\r
+in red and an added tag is displayed underlined in green.\r
+\r
+One nice feature is that this makes it clear when a message was unread\r
+when you first loaded the buffer (previously the unread tag could be\r
+removed before a user realised that it had been unread).\r
+---\r
+ emacs/notmuch-show.el | 34 +++++++++++++++++++++++++++++-----\r
+ emacs/notmuch-tag.el | 30 ++++++++++++++++++++----------\r
+ 2 files changed, 49 insertions(+), 15 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 784644c..d64d407 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -211,6 +211,18 @@ For example, if you wanted to remove an \"unread\" tag and add a\r
+ :type '(repeat string)\r
+ :group 'notmuch-show)\r
+ \r
++(defface notmuch-show-deleted-tag-face\r
++ '((t :strike-through "red" :inherit 'notmuch-tag-face))\r
++ "Face for tags that have been removed"\r
++ :group 'notmuch-show\r
++ :group 'notmuch-faces)\r
++\r
++(defface notmuch-show-added-tag-face\r
++ '((t :underline "green"))\r
++ "Face for tags that have been added"\r
++ :group 'notmuch-show\r
++ :group 'notmuch-faces)\r
++\r
+ \r
+ (defmacro with-current-notmuch-show-message (&rest body)\r
+ "Evaluate body with current buffer set to the text of current message"\r
+@@ -341,11 +353,21 @@ operation on the contents of the current buffer."\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
+- (replace-match (concat "("\r
+- (notmuch-tag-format-tags tags)\r
+- ")"))))))\r
++ (let* ((orig-tags (notmuch-show-get-prop :orig-tags))\r
++ (all-tags (sort (delete-dups (append tags orig-tags)) #'string<))\r
++ (display-tags (mapcar (lambda (tag) (cond ((and (member tag tags) (member tag orig-tags))\r
++ tag)\r
++ ((not (member tag tags))\r
++ (cons tag 'deleted))\r
++ ((not (member tag orig-tags))\r
++ (cons tag 'added))))\r
++ all-tags)))\r
++\r
++ (if (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)\r
++ (let ((inhibit-read-only t))\r
++ (replace-match (concat "("\r
++ (notmuch-tag-format-tags display-tags)\r
++ ")")))))))\r
+ \r
+ (defun notmuch-clean-address (address)\r
+ "Try to clean a single email ADDRESS for display. Return a cons\r
+@@ -1167,6 +1189,8 @@ function is used."\r
+ \r
+ (jit-lock-register #'notmuch-show-buttonise-links)\r
+ \r
++ (notmuch-show-mapc (lambda () (notmuch-show-set-prop :orig-tags (notmuch-show-get-tags))))\r
++\r
+ ;; Set the header line to the subject of the first message.\r
+ (setq header-line-format (notmuch-sanitize (notmuch-show-strip-re (notmuch-show-get-subject))))\r
+ \r
+diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
+index b60f46c..fac2c3b 100644\r
+--- a/emacs/notmuch-tag.el\r
++++ b/emacs/notmuch-tag.el\r
+@@ -137,16 +137,26 @@ This can be used with `notmuch-tag-format-image-data'."\r
+ \r
+ (defun notmuch-tag-format-tag (tag)\r
+ "Format TAG by looking into `notmuch-tag-formats'."\r
+- (let ((formats (assoc tag notmuch-tag-formats)))\r
+- (cond\r
+- ((null formats) ;; - Tag not in `notmuch-tag-formats',\r
+- tag) ;; the format is the tag itself.\r
+- ((null (cdr formats)) ;; - Tag was deliberately hidden,\r
+- nil) ;; no format must be returned\r
+- (t ;; - Tag was found and has formats,\r
+- (let ((tag tag)) ;; we must apply all the formats.\r
+- (dolist (format (cdr formats) tag)\r
+- (setq tag (eval format))))))))\r
++ (let* ((status (if (consp tag) (cdr tag)))\r
++ (tag (if (consp tag) (car tag) tag))\r
++ (formats (append (assoc tag notmuch-tag-formats)))\r
++ (tag\r
++ (cond\r
++ ((null formats) ;; - Tag not in `notmuch-tag-formats',\r
++ tag) ;; the format is the tag itself.\r
++ ((null (cdr formats)) ;; - Tag was deliberately hidden,\r
++ nil) ;; no format must be returned\r
++ (t ;; - Tag was found and has formats,\r
++ (let ((tag tag)) ;; we must apply all the formats.\r
++ (dolist (format (cdr formats) tag)\r
++ (setq tag (eval format))))))))\r
++ (when tag\r
++ (cond\r
++ ((eq status 'deleted)\r
++ (notmuch-combine-face-text-property-string tag 'notmuch-show-deleted-tag-face))\r
++ ((eq status 'added)\r
++ (notmuch-combine-face-text-property-string tag 'notmuch-show-added-tag-face))\r
++ (t tag)))))\r
+ \r
+ (defun notmuch-tag-format-tags (tags)\r
+ "Return a string representing formatted TAGS."\r
+-- \r
+1.7.9.1\r
+\r