unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* (emacs) customise key bindings taking text input
@ 2015-07-14 11:32 Matthew Lear
       [not found] ` <87bnff0wb9.fsf@qmul.ac.uk>
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Lear @ 2015-07-14 11:32 UTC (permalink / raw)
  To: notmuch

Hi all,

I was wondering if there was a way to add a new search similar to what
pressing s does, but make it use a predefined list of search terms in
addition to the text being entered? For example, I have reams of bug
notification emails which currently have various tags applied. If I wanted
to search a subset of these tags with a number (bug id) in the subject,
right now I have to press s and type tag:foo and tag:bar and subject:1234.
If I could add a new search option (eg 'B') and after pressing that I
simply enter the bug id and hit return, it would save me a lot of typing.
I have custom searches set up which do the 'tag:foo and tag:bar' and I can
filter on the subject, but that still means pressing f and typing
subject:1234.

I fear I'm rambling here but hopefully I've conveyed what I'm trying to do.
Is this possible?
Just trying to cut down on my typing ;-)

Thanks,
--  Matt

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: (emacs) customise key bindings taking text input
       [not found] ` <87bnff0wb9.fsf@qmul.ac.uk>
@ 2015-07-15  8:28   ` Matthew Lear
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Lear @ 2015-07-15  8:28 UTC (permalink / raw)
  To: Mark Walters; +Cc: notmuch

>
> On Tue, 14 Jul 2015, Matthew Lear <matt@bubblegen.co.uk> wrote:
>> Hi all,
>>
>> I was wondering if there was a way to add a new search similar to what
>> pressing s does, but make it use a predefined list of search terms in
>> addition to the text being entered? For example, I have reams of bug
>> notification emails which currently have various tags applied. If I
>> wanted
>> to search a subset of these tags with a number (bug id) in the subject,
>> right now I have to press s and type tag:foo and tag:bar and
>> subject:1234.
>> If I could add a new search option (eg 'B') and after pressing that I
>> simply enter the bug id and hit return, it would save me a lot of
>> typing.
>> I have custom searches set up which do the 'tag:foo and tag:bar' and I
>> can
>> filter on the subject, but that still means pressing f and typing
>> subject:1234.
>>
>> I fear I'm rambling here but hopefully I've conveyed what I'm trying to
>> do.
>> Is this possible?
>> Just trying to cut down on my typing ;-)
>
> I don't think there is anything built in but adding something like this
> snippet
>
> (defun my-search (&optional bug)
>   (interactive)
>   (let* ((bug (or bug (notmuch-read-query "Bug number: ")))
> 	 (query (concat "tag:foo and tag:bar and subject:" bug)))
>     (notmuch-search query)))
>
> to your .emacs file and binding it to B in the notmuch-common-keymap would
> probably
> do what you want.
>
> If people think this would be more generally useful it may be possible
> to add something like this to saved searches (ie a partial saved search)
> and then they would be accessible from notmuch-hello or via notmuch
> jump.

That's a good idea. Hooking into saved searches and then being able to
refine/enhance them via a customisable text input field would be really
nice.
The above lisp-fu works a treat. Thank you very much, and thanks for
fixing the mark read logic in notmuch-tree :-)
Cheers,
--  Matt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-15  8:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 11:32 (emacs) customise key bindings taking text input Matthew Lear
     [not found] ` <87bnff0wb9.fsf@qmul.ac.uk>
2015-07-15  8:28   ` Matthew Lear

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).