[PATCH v2 0/8] Improve tag change completion

Subject: [PATCH v2 0/8] Improve tag change completion

Date: Tue, 22 Oct 2013 20:21:53 -0400

To: notmuch@notmuchmail.org

Cc:

From: Austin Clements


This is v2 of id:1382471457-26056-1-git-send-email-amdragon@mit.edu.
It improves some documentation strings, fixes one bug, and elimintes
some redundant code.  The diff from v1 is below.

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ef77839..f66d669 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1800,7 +1800,6 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."
    (list (let (tags)
 	   (notmuch-show-mapc
 	    (lambda () (setq tags (append (notmuch-show-get-tags) tags))))
-	   (delete-dups tags)
 	   (notmuch-read-tag-changes tags "Tag thread"))))
   (notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
   (notmuch-show-mapc
diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index feee17c..7b21006 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -189,6 +189,9 @@ the messages that were tagged"
 `notmuch-read-tag-changes' function.")
 
 (defun notmuch-tag-completions (&rest search-terms)
+  "Return a list of tags for messages matching SEARCH-TERMS.
+
+Returns all tags if no search terms are given."
   (if (null search-terms)
       (setq search-terms (list "*")))
   (split-string
@@ -199,7 +202,7 @@ the messages that were tagged"
    "\n+" t))
 
 (defun notmuch-select-tag-with-completion (prompt &rest search-terms)
-  (let ((tag-list (notmuch-tag-completions search-terms)))
+  (let ((tag-list (apply #'notmuch-tag-completions search-terms)))
     (completing-read prompt tag-list nil nil nil 'notmuch-select-tag-history)))
 
 (defun notmuch-read-tag-changes (current-tags &optional prompt initial-input)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5492e1b..53e9826 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -584,7 +584,10 @@ Returns (TAG-CHANGES REGION-BEGIN REGION-END)."
   "Change tags for the currently selected thread or region.
 
 See `notmuch-tag' for information on the format of TAG-CHANGES.
-If BEG or END are nil, applies to the thread at point."
+When called interactively, this uses the region if the region is
+active.  When called directly, BEG and END provide the region.
+If these are nil or not provided, this applies to the thread at
+point."
   (interactive (notmuch-search-interactive-tag-changes))
   (unless (and beg end) (setq beg (point) end (point)))
   (let ((search-string (notmuch-search-find-thread-id-region-search beg end)))



Thread: