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

Attachment: signature.asc
Description: PGP signature

Reply via email to