[neomutt-users] piping shell command output to vfolder-from-query

Yubin Ruan ablacktshirt at gmail.com
Thu May 31 03:33:17 CEST 2018


On 2018-05-30 19:35, Evgenii Sovetkin wrote:
> Dear community,
> 
> I am reaching out for some help, since some time of trial and
> error/and google didn't help.
> 
> I am trying to create a macro for creating a virtual folder from a
> query that is generated by executing a shell command.
> 
> That is something of that sort:
> 
>   macro index,pager \cx "<shell-escape>'generate-query.sh'<enter><vfolder-from-query>"
> 
> Unfortunately, the 'generate-query.sh' command result is not piped to
> the <vfolder-from-query> command and I cannot find in manual how this
> can be done.

I think you can take a look at the mutt-notmuch script here:
https://notmuchmail.org/notmuch-mutt/

I am using it and I have these two macros in my muttrc:

macro index <F8> \
      "<enter-command>unset wait_key<enter><shell-escape>~/.mutt/mutt-notmuch --prompt search<enter><change-folder-readonly>~/.mutt/mutt_results<enter>" \
      "search mail (using notmuch)"
macro index <F9> \
      "<enter-command>unset wait_key<enter><pipe-message>~/.mutt/mutt-notmuch thread<enter><change-folder-readonly>~/.mutt/mutt_results<enter><enter-command>set wait_key<enter>" \
      "search and reconstruct owning thread (using notmuch)"

`mutt-notmuch' is a script. The first macro will run `mutt-notmuch' and enter
a prompt which let you search for emails, put those emails into a separate
folder (~/.mutt/mutt_results), and then enter that folder. The second one pipe
the current message to `mutt-notmuch', which will search for its corresponding
thread, put messages in that thread into ~/.mutt/mutt_results, and then enter
that folder.

HTH,
Yubin


More information about the neomutt-users mailing list