[PATCH 1/5] emacs: move tag.el utility functions from lists to strings

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


From: markwalters1009 <markwalters1009 at gmail.com>

The query for most of the notmuch-tag.el utility functions was a list
(or multiple arguments) (but not for the main calling point:
notmuch-tag). This patch moves them all to take the query as a string
instead. This makes it easier to add extra parameters in the next
patch.
---
 emacs/notmuch-tag.el |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 4fce3a9..1f3d8cf 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -55,26 +55,26 @@ the messages that were tagged"
 `notmuch-read-tag-changes' function.")
 
 (defun notmuch-tag-completions (&optional search-terms)
-  (if (null search-terms)
-      (setq search-terms (list "*")))
+  (unless search-terms
+    (setq search-terms "*"))
   (split-string
    (with-output-to-string
      (with-current-buffer standard-output
-       (apply 'call-process notmuch-command nil t
+       (funcall 'call-process notmuch-command nil t
 	      nil "search" "--output=tags" "--exclude=false" search-terms)))
    "\n+" t))
 
-(defun notmuch-select-tag-with-completion (prompt &rest search-terms)
+(defun notmuch-select-tag-with-completion (prompt &optional search-terms)
   (let ((tag-list (notmuch-tag-completions search-terms)))
     (completing-read prompt tag-list nil nil nil 'notmuch-select-tag-history)))
 
-(defun notmuch-read-tag-changes (&optional initial-input &rest search-terms)
+(defun notmuch-read-tag-changes (&optional initial-input search-terms)
   (let* ((all-tag-list (notmuch-tag-completions))
 	 (add-tag-list (mapcar (apply-partially 'concat "+") all-tag-list))
 	 (remove-tag-list (mapcar (apply-partially 'concat "-")
-				  (if (null search-terms)
-				      all-tag-list
-				    (notmuch-tag-completions search-terms))))
+				  (if search-terms
+				      (notmuch-tag-completions search-terms)
+				    all-tag-list)))
 	 (tag-list (append add-tag-list remove-tag-list))
 	 (crm-separator " ")
 	 ;; By default, space is bound to "complete word" function.
-- 
1.7.9.1



More information about the notmuch mailing list