[PATCH 2/3] emacs: use a single history for all searches
Dmitry Kurochkin
dmitry.kurochkin at gmail.com
Wed Jan 18 09:57:27 PST 2012
On Wed, 18 Jan 2012 08:25:22 +0000, David Edmondson <dme at dme.org> wrote:
> On Tue, 17 Jan 2012 23:34:09 +0400, Dmitry Kurochkin <dmitry.kurochkin at gmail.com> wrote:
> > There are two ways to do search in Emacs UI: search widget in
> > notmuch-hello buffer and `notmuch-search' function bound to "s".
> > Before the change, these search mechanisms used different history
> > lists. The patch makes notmuch-hello search use the same history list
> > as `notmuch-search' function.
>
> The test output updates included here should be with the previous patch,
> shouldn't they?
>
Indeed. Would send v2.
> > -(defun notmuch-search (query &optional oldest-first target-thread target-line continuation)
> > - "Run \"notmuch search\" with the given query string and display results.
> > +(defun notmuch-search (&optional query oldest-first target-thread target-line continuation)
> > + "Run \"notmuch search\" with the given `query' and display results.
> >
> > -The optional parameters are used as follows:
> > +If `query' is nil, it is read interactively from the minibuffer.
> > +Other optional parameters are used as follows:
> >
> > oldest-first: A Boolean controlling the sort order of returned threads
> > target-thread: A thread ID (with the thread: prefix) that will be made
> > current if it appears in the search results.
> > target-line: The line number to move to if the target thread does not
> > appear in the search results."
> > - (interactive (list (notmuch-read-query "Notmuch search: ")))
> > + (interactive)
> > + (if (null query)
> > + (setq query (notmuch-read-query "Notmuch search: "))
> > + (setq query (notmuch-trim query))
> > + (let ((history-delete-duplicates t))
> > + (add-to-history 'notmuch-search-history query)))
>
> Should user-typed queries be trimmed?
IMO that would not hurt. But we need to do it before it gets added to
the history. And that may be tricky. So this patch does trimming only
for queries from notmuch-hello search box (as it was before).
Regards,
Dmitry
More information about the notmuch
mailing list