[PATCH 3/5] emacs: notmuch.el remove duplicate tags from get-tags-region

Mark Walters markwalters1009 at gmail.com
Fri Nov 30 00:21:29 PST 2012


From: markwalters1009 <markwalters1009 at gmail.com>

get-tags-region used to return a list of all tags of all messages with
tags appearing multiple times. This changes it to return a list where
each tag appears at most once. As far as I can see there were no
callers of the old function (but this series adds one!).
---
 emacs/notmuch.el |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f9454d8..4e6bbcf 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -558,10 +558,11 @@ and will also appear in a buffer named \"*Notmuch errors*\"."
   (plist-get (notmuch-search-get-result pos) :tags))
 
 (defun notmuch-search-get-tags-region (beg end)
-  (let (output)
+  (let ((output '()))
     (notmuch-search-foreach-result beg end
       (lambda (pos)
-	(setq output (append output (notmuch-search-get-tags pos)))))
+	(mapc (lambda (tag) (add-to-list 'output tag))
+	      (notmuch-search-get-tags pos))))
     output))
 
 (defun notmuch-search-tag-region (beg end &optional tag-changes)
-- 
1.7.9.1



More information about the notmuch mailing list