How to simulate entering keys into mutt?

Cameron Simpson cs at cskk.id.au
Wed Jan 15 03:55:16 UTC 2020


On 07Jan2020 16:44, Chris Green <cl at isbd.net> wrote:
>I want to emulate typing a dozen or so keys into mutt 'automatically'
>so my typing doesn't slow things down.  One can't just redirect
>standard input because that makes mutt think you want to run in
>scripting mode with everything on the command line.
>
>Is there a quick and easy way to do what I want?

Would mutt's "push" command do you? It pushes keystrokes onto mutt's 
logical keyboard input queue. For example, my muttrc has this:

    folder-hook .         'push ":set collapse_unread=no<enter>"'
    folder-hook .         'push ":set auto_tag=no<enter><untag-pattern>~T<enter><tag-pattern>~P~N<enter><tag-prefix-cond><clear-flag>N<untag-pattern>~T<enter><end-cond>:set auto_tag=yes<enter>"'
    folder-hook .         'push "<collapse-all>"'

to run a set of keyboard based stuff when I enter a folder.

You can bind things like this to a keyboard macro, and my "mboxify" 
sheel script includes this incantation:

    mutt -n -F /dev/null -f "$mailbox" -e "set sort=mailbox-order; set confirmappend=no; set delete=yes; push '<tag-pattern>.<enter><tag-prefix><save-message>$mailboxtmp<enter><sync-mailbox><exit>'"

to copy one mail folder's messages into a plain "mbox" mail folder.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Mutt-users mailing list