[PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'
Pieter Praet
pieter at praet.org
Fri Feb 24 14:30:39 PST 2012
* emacs/notmuch-show.el
(notmuch-show-get-messages-ids):
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.
(notmuch-show-get-messages-ids-search):
Removed, as its functionality is now in `notmuch-show-get-messages-ids'.
(notmuch-show-tag-all):
Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
`notmuch-show-get-messages-ids-search'.
---
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))
(notmuch-show-mapc
(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)
(notmuch-show-mapc
(lambda ()
(let* ((current-tags (notmuch-show-get-tags))
--
1.7.8.1
More information about the notmuch
mailing list