Default save mailbox from a script
Nicolas George
george at nsup.org
Sun Jul 30 13:59:57 UTC 2023
Hi.
I want to use an external command to decide in what mailbox to save
messages.
When I hit ‘s’ with its default action of save-message, mutt asks
“Save to mailbox ('?' for list): =ml/debian”, with the default being
chosen from save-hooks or from the author of the mail.
What I want is that it invokes an external command to set the default.
The idea is that the external command has access to an index of my
mailboxes and implements heuristics of my choosing to store the mail,
but I can still use Mutt's user interface to make a different decision.
What I want could look a little bit like:
save-hook * `~/local/lib/guess_mailbox`
Except it does not work in two ways:
- the backticks are evaluated once when loading the configuration, they
need to be evaluated when saving the message, each time;
- the command in the backticks need access to the content of the mail.
I am considering a solution based on a macro that pipes the message to
the command and generate a temporary configuration file, then sources it
then saves normally.
Also, I would like to avoid any solution that would slow down Mutt when
I am not trying to save a message. A message-hook invoking guess_mailbox
would probably not be acceptable, for example.
Any advice?
Thanks in advance.
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.mutt.org/pipermail/mutt-users/attachments/20230730/761e6770/attachment-0001.asc>
More information about the Mutt-users
mailing list