* Accessing the body a message programatically
@ 2019-12-16 19:34 Alan Schmitt
2019-12-17 0:34 ` David Bremner
0 siblings, 1 reply; 3+ messages in thread
From: Alan Schmitt @ 2019-12-16 19:34 UTC (permalink / raw)
To: notmuch
[-- Attachment #1: Type: text/plain, Size: 499 bytes --]
Hello,
I need to extract some information from a message that is shown in
notmuch-mode, and I was able to easily get the from and subject of the
message. I now need to use the body, but I cannot find how to get it. I
assume I should use notmuch-get-bodypart-text, but I don't know how to
obtain the msg or part argument.
In addition, can I get access to the List-Archive header? I could do it
by spawning an external process to get the raw message, but it seems a
bit heavy handed.
Thanks,
Alan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Accessing the body a message programatically
2019-12-16 19:34 Accessing the body a message programatically Alan Schmitt
@ 2019-12-17 0:34 ` David Bremner
2019-12-17 8:33 ` Alan Schmitt
0 siblings, 1 reply; 3+ messages in thread
From: David Bremner @ 2019-12-17 0:34 UTC (permalink / raw)
To: Alan Schmitt, notmuch
Alan Schmitt <alan.schmitt@polytechnique.org> writes:
> Hello,
>
> I need to extract some information from a message that is shown in
> notmuch-mode, and I was able to easily get the from and subject of the
> message. I now need to use the body, but I cannot find how to get it. I
> assume I should use notmuch-get-bodypart-text, but I don't know how to
> obtain the msg or part argument.
>
If you mean interactively for a currently displayed message, have a look
at the function notmuch-show-current-part-handle, and the way it uses
notmuch-show-get-{message,part}-properties.
> In addition, can I get access to the List-Archive header? I could do it
> by spawning an external process to get the raw message, but it seems a
> bit heavy handed.
there is a couple of patches by Johan Parin currently under review
to provide a configurable set of headers. You can find them via
https://nmbug.notmuchmail.org/status/#Review
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Accessing the body a message programatically
2019-12-17 0:34 ` David Bremner
@ 2019-12-17 8:33 ` Alan Schmitt
0 siblings, 0 replies; 3+ messages in thread
From: Alan Schmitt @ 2019-12-17 8:33 UTC (permalink / raw)
To: David Bremner, notmuch
[-- Attachment #1: Type: text/plain, Size: 882 bytes --]
On 2019-12-17 09:34, David Bremner <david@tethera.net> writes:
>
> If you mean interactively for a currently displayed message, have a look
> at the function notmuch-show-current-part-handle, and the way it uses
> notmuch-show-get-{message,part}-properties.
This is great, thanks. Here is what I did:
(defun as/notmuch-get-body ()
(let* ((msg (notmuch-show-get-message-properties))
(part (notmuch-show-get-part-properties)))
(notmuch-get-bodypart-text msg part nil)))
>> In addition, can I get access to the List-Archive header? I could do it
>> by spawning an external process to get the raw message, but it seems a
>> bit heavy handed.
>
> there is a couple of patches by Johan Parin currently under review
> to provide a configurable set of headers. You can find them via
>
> https://nmbug.notmuchmail.org/status/#Review
I'll have a look.
Thanks again,
Alan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-17 8:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-16 19:34 Accessing the body a message programatically Alan Schmitt
2019-12-17 0:34 ` David Bremner
2019-12-17 8:33 ` Alan Schmitt
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).