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

Pieter Praet pieter at praet.org
Fri Feb 24 14:36:09 PST 2012


On Fri, 24 Feb 2012 14:42:53 +0400, Dmitry Kurochkin <dmitry.kurochkin at gmail.com> wrote:
> On Fri, 24 Feb 2012 00:09:13 +0100, Pieter Praet <pieter at praet.org> wrote:
> > * 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'.
> > ---
> 
> There is another similar case in notmuch.el:
> `notmuch-show-get-messages-ids' and
> `notmuch-show-get-messages-ids-search'.  There may be more.
> 
> Please change them as well.
>

You mean `notmuch-search-find-thread-id-region{,-search}' ?

They aren't relevant to this series, so I'll submit a separate patch
for that (later).  A quick `rgrep' doesn't reveal any others, but if
you happen to stumble across any, feel free to point them out.

> Regards,
>   Dmitry
> 
> >  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 5fc0e43..4b37c77 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -1334,17 +1334,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 t
> >       (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?
> >  
> > @@ -1633,7 +1633,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 t
> >     (lambda ()
> >       (let* ((current-tags (notmuch-show-get-tags))
> > -- 
> > 1.7.8.1
> > 


Peace

-- 
Pieter


More information about the notmuch mailing list