[PATCH 6/7] emacs: search: use orig-tags in search

Mark Walters markwalters1009 at gmail.com
Sat Jan 18 15:30:54 PST 2014


This uses the recent functionality to show the tag changes in the
search buffer. Currently this is only used to show changes the search
buffer makes itself: i.e., it does not make display any changes
reflecting tagging done by other notmuch-buffers.
---
 emacs/notmuch.el |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 1436e5a..f0ea5d4 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -753,14 +753,20 @@ non-authors is found, assume that all of the authors match."
      format-string (notmuch-sanitize (plist-get result :authors))))
 
    ((string-equal field "tags")
-    (let ((tags (plist-get result :tags)))
-      (insert (format format-string (notmuch-tag-format-tags tags tags)))))))
+    (let ((tags (plist-get result :tags))
+	  (orig-tags (plist-get result :orig-tags)))
+      (insert (format format-string (notmuch-tag-format-tags tags orig-tags)))))))
 
 (defun notmuch-search-show-result (result &optional pos)
   "Insert RESULT at POS or the end of the buffer if POS is null."
   ;; Ignore excluded matches
   (unless (= (plist-get result :matched) 0)
-    (let ((beg (or pos (point-max))))
+    (let ((beg (or pos (point-max)))
+	  ;; If we are inserting the result for the first time POS
+	  ;; will be nil and we should set orig-tags.
+	  (result (if pos
+		      result
+		    (plist-put result :orig-tags (plist-get result :tags)))))
       (save-excursion
 	(goto-char beg)
 	(dolist (spec notmuch-search-result-format)
-- 
1.7.9.1



More information about the notmuch mailing list