[PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

Subject: [PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

Date: Fri, 24 Feb 2012 23:30:39 +0100

To: David Bremner, Dmitry Kurochkin

Cc: Notmuch Mail

From: Pieter Praet

* emacs/notmuch-show.el

    If provided with optional arg SEPARATOR, return a string consisting
    of all Message-Id's, separated by SEPARATOR.  Also improve original
    docstring wrt default return value.

    Removed, as its functionality is now in `notmuch-show-get-messages-ids'.

    Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
 emacs/notmuch-show.el |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6adbdc0..05606fc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1339,17 +1339,17 @@ (defun notmuch-show-get-message-id ()
   "Return the message id of the current message."
   (concat "id:\"" (notmuch-show-get-prop :id) "\""))
-(defun notmuch-show-get-messages-ids ()
-  "Return all message ids of messages in the current thread."
+(defun notmuch-show-get-messages-ids (&optional separator)
+  "Return a list of Message-Id's of all messages in the current buffer.
+If provided with optional argument SEPARATOR, return a string
+instead, consisting of all Message-Id's separated by SEPARATOR."
   (let ((message-ids))
      (lambda () (push (notmuch-show-get-message-id) message-ids)))
-    message-ids))
-(defun notmuch-show-get-messages-ids-search ()
-  "Return a search string for all message ids of messages in the
-current thread."
-  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))
+    (if separator
+	(mapconcat 'identity message-ids separator)
+      message-ids)))
 ;; dme: Would it make sense to use a macro for many of these?
@@ -1638,7 +1638,7 @@ (defun notmuch-show-tag-all (&rest tag-changes)
 TAG-CHANGES is a list of tag operations for `notmuch-tag'."
   (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
-  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
+  (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
    (lambda ()
      (let* ((current-tags (notmuch-show-get-tags))