--- /dev/null
+Return-Path: <jani@nikula.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 6DD66431FC0\r
+ for <notmuch@notmuchmail.org>; Mon, 9 Dec 2013 00:44:43 -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 e-HF27KKLpPJ for <notmuch@notmuchmail.org>;\r
+ Mon, 9 Dec 2013 00:44:39 -0800 (PST)\r
+Received: from mail-qc0-f172.google.com (mail-qc0-f172.google.com\r
+ [209.85.216.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 1FFF7431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 9 Dec 2013 00:44:39 -0800 (PST)\r
+Received: by mail-qc0-f172.google.com with SMTP id e16so2419444qcx.17\r
+ for <notmuch@notmuchmail.org>; Mon, 09 Dec 2013 00:44:38 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:in-reply-to:references\r
+ :user-agent:date:message-id:mime-version:content-type;\r
+ bh=aWxSVwaRoc2+FG3ar3M/YakFcWxufn5QDM+tJvNKsds=;\r
+ b=d8YHQnZ89bwUk0YyrnMMQCL8qdVZXhYZtGAzF7YI2166XQASCiegtI8CcqJjrU4V2y\r
+ QlfT2Yth+kts1613gBSe/aklidsEVE/WPnGEkIqEAxDx8TI8hYCKLmLFt7hkutlLLHXW\r
+ ABHZZ0XLAGxfzBHtBnUQavFpp//WcGfJhmzQnUmeVjzsQwo5/7ncnRlB2D04C0xH4EFR\r
+ jMS0izdBRJD6kFf8/jtiSdSyaFYQJBkDho6at5HeGrh/oicDcJpp5VRHeVnKwhWJcgcj\r
+ RZqO6CCWdiWIMQRrBU2lAdahkyjnxde2fJvZ0uc8aphLrC7VTFKqPTzUXgyENKFy+yAF\r
+ 2M/g==\r
+X-Gm-Message-State:\r
+ ALoCoQm03lkDfsBRED/CHIOtob2wLfEni4ThrVlZCAvVCcKUgGqAVmo/8LrBVkbkgHJ7h2+2/Vxf\r
+X-Received: by 10.224.55.69 with SMTP id t5mr31946484qag.82.1386578677525;\r
+ Mon, 09 Dec 2013 00:44:37 -0800 (PST)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+ by mx.google.com with ESMTPSA id x10sm30872716qas.5.2013.12.09.00.44.36\r
+ for <multiple recipients>\r
+ (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
+ Mon, 09 Dec 2013 00:44:36 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH WIP v3 1/3] emacs: show: mark tags changed since buffer\r
+ loaded\r
+In-Reply-To: <1386273871-24214-2-git-send-email-markwalters1009@gmail.com>\r
+References: <1386273871-24214-1-git-send-email-markwalters1009@gmail.com>\r
+ <1386273871-24214-2-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.17~rc2+11~gef943e9 (http://notmuchmail.org) Emacs/23.2.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Mon, 09 Dec 2013 09:44:18 +0100\r
+Message-ID: <874n6is9b1.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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: Mon, 09 Dec 2013 08:44:43 -0000\r
+\r
+On Thu, 05 Dec 2013, Mark Walters <markwalters1009@gmail.com> wrote:\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
+I really like how this works. Very nice!\r
+\r
+I did notice a small wrinkle though. On a terminal the strike-through\r
+does not work, and the appearance is that the tag was not removed (until\r
+you refresh with '='). I don't know if you can easily adapt the face or\r
+disable the whole feature when on terminal. Or make this an opt-in\r
+feature. I guess some people might not like this in general, so a way to\r
+disable might be a good idea too. Fine tuning.\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+\r
+\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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r