Discussion:
pipe message with folder name
Ben Fitzgerald
2018-08-21 01:24:40 UTC
Permalink
Hi

I'm looking to integrate mutt with org-mode.

I can use pipe-message to "capture" an email into emacs by piping to an external
script which then dumps it into emacs with the Message-ID header tag. Works
great.

I can then use the Message-ID to have mutt pull out the given mail.

So far so good.

My problem is when I file an email into a subfolder.

Searching say my INBOX with "~i {message-id}" won't find anything
if I moved my email into another folder.

My idea for solving this would be to save both the Message-ID *and* the folder
the message resides in. Then I could, from emacs:

1. have mutt change to the correct folder
2. then search my "~i {message-id}"

To achieve this I'd need to do more than "<pipe-message>". Is there any way
to have mutt either add a temporary header named X-Folder *or* output one line
with the folder then the rest of the message?

I know this won't work if I subsequently move the email to another folder
after capturing this metadata, but I generally don't do this.

Hopefully my question is clear and there is a path forward.

Regards,

Ben Fitzgerald.
Kevin J. McCarthy
2018-08-21 01:46:07 UTC
Permalink
Post by Ben Fitzgerald
My idea for solving this would be to save both the Message-ID *and* the folder
You could set an environment variable in Mutt and then access that from
the script.

folder-hook . 'set visual=^;setenv MYCURFOLDER $visual'

However, the value of $MYCURFOLDER will contain Mutt mailbox shortcuts,
such as '='. If you don't want that you'll have to temporarily unset
$folder:

folder-hook . 'set my_folder=$folder;set folder="XXX";set visual=^'
folder-hook . 'setenv MYCURFOLDER $visual'
folder-hook . 'set folder=$my_folder'
--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
Kevin J. McCarthy
2018-08-21 14:20:03 UTC
Permalink
Post by Kevin J. McCarthy
Post by Ben Fitzgerald
My idea for solving this would be to save both the Message-ID *and* the folder
You could set an environment variable in Mutt and then access that from
the script.
[*] which btw requires 1.8.0 or greater.
--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
Ben Fitzgerald
2018-08-22 01:42:48 UTC
Permalink
Post by Kevin J. McCarthy
Post by Kevin J. McCarthy
Post by Ben Fitzgerald
My idea for solving this would be to save both the Message-ID *and* the folder
You could set an environment variable in Mutt and then access that from
the script.
[*] which btw requires 1.8.0 or greater.
thanks, this works perfectly, I can now round-trip tasks to and from
org-mode in emacs, which is hugely useful.

--

ben

Continue reading on narkive:
Loading...