[PATCH 2/3] emacs: use a single history for all searches

David Edmondson dme at dme.org
Wed Jan 18 00:25:22 PST 2012


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?

> -(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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120118/d8d52410/attachment.pgp>


More information about the notmuch mailing list