[PATCH] emacs: put current query as default value in notmuch-read-query

David Edmondson dme at dme.org
Tue May 6 00:44:53 PDT 2014


On Tue, May 06 2014, Mark Walters wrote:
> Hi
>
> On Tue, 06 May 2014, David Edmondson <dme at dme.org> wrote:
>> On Sat, May 03 2014, Mark Walters wrote:
>>> An alternative to putting the logic in notmuch-read-query would be to
>>> store the query in a consistently named buffer local variable in all
>>> the modes. If we want to show the actually run query in notmuch-show
>>> above then this is probably the neatest solution.
>>
>> Could per-mode query functions not simply pass the default as an
>> optional second argument to `notmuch-read-query'?
>
> They could but at the moment notmuch-search and notmuch-tree are both
> bound in the global key map and they in turn call notmuch-read-query. 
>
> I guess we could add an argument to notmuch-search and notmuch-tree
> for the default argument (which they would pass to
> notmuch-read-query). Then calling modes which know a search value
> (show,search and tree) could override the global keymap (probably using
> remap or something to mean that they keep any customised binding) to
> link into something which passes the default value through.

I would probably replace the global keymap bindings, but others should
chime in.

> One variant which might be nicer than the current version would be to
> have something like
> (let ((current-query (case major-mode
>                            (notmuch-show-mode (notmuch-show-get-current-query))
>                            (notmuch-tree-mode (notmuch-tree-get-current-query))
>                            (notmuch-search-mode (notmuch-search-get-current-query))))))
>
> so at least all the logic for calculating the current query can live in
> the relevant file.
>
> What do you think?

This is nicer than the current patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 310 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140506/57bcc05a/attachment-0001.pgp>


More information about the notmuch mailing list