[PATCH 6/6] emacs: separate history for operations which accept single and multiple tags

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Sun Jan 29 17:42:15 PST 2012


On Sun, 29 Jan 2012 18:02:29 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> Quoth Dmitry Kurochkin on Jan 28 at  8:41 am:
> > Some tag-related operations accept a single tag without prefix
> > (`notmuch-select-tag-with-completion'), others accept multiple tags
> > prefixed with '+' or '-' (`notmuch-select-tags-with-completion').
> > Before the change, both functions used a single default minibuffer
> > history.  This is inconvenient because you have to skip options with
> > incompatible format when going through the history.  The patch adds
> > separate history lists for the two functions.  Note that functions
> > that accept the same input format (e.g. "+", "-", "*") share the
> > history list as before.
> > ---
> >  emacs/notmuch.el |   12 ++++++++++--
> >  1 files changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> > index 24b0ea3..9813e0a 100644
> > --- a/emacs/notmuch.el
> > +++ b/emacs/notmuch.el
> > @@ -76,6 +76,14 @@ For example:
> >  (defvar notmuch-query-history nil
> >    "Variable to store minibuffer history for notmuch queries")
> >  
> > +(defvar notmuch-select-tag-history nil
> > +  "Variable to store notmuch tag history for
> > +  `notmuch-select-tag-with-completion'.")
> > +
> > +(defvar notmuch-select-tags-history nil
> > +  "Variable to store notmuch tags history for
> > +  `notmuch-select-tags-with-completion'.")
> > +
> 
> Really these are minibuffer or input histories, not "notmuch tag
> history".  Also, the second line shouldn't be indented.  (Definitely
> nits, but if you roll a new version, you might as well fix these.)
> 

fixed

Regards,
  Dmitry

> >  (defun notmuch-tag-completions (&optional search-terms)
> >    (split-string
> >     (with-output-to-string
> > @@ -86,7 +94,7 @@ For example:
> >  
> >  (defun notmuch-select-tag-with-completion (prompt &rest search-terms)
> >    (let ((tag-list (notmuch-tag-completions search-terms)))
> > -    (completing-read prompt tag-list)))
> > +    (completing-read prompt tag-list nil nil nil 'notmuch-select-tag-history)))
> >  
> >  (defun notmuch-select-tags-with-completion (&optional initial-input &rest search-terms)
> >    (let* ((add-tag-list (mapcar (apply-partially 'concat "+")
> > @@ -105,7 +113,7 @@ For example:
> >  	    map)))
> >      (delete "" (completing-read-multiple
> >  		"Operations (+add -drop): notmuch tag " tag-list nil
> > -		nil initial-input))))
> > +		nil initial-input 'notmuch-select-tags-history))))
> >  
> >  (defun notmuch-update-tags (current-tags changed-tags)
> >    "Update `current-tags' with `changed-tags' and return the result.


More information about the notmuch mailing list