Re: Extracting Header and Content from an Article

Tim Landscheidt <[email protected]> Tue, 19 Nov 2024 19:22:15 +0000
Newsgroups gmane.emacs.gnus.general
Organization https://www.tim-landscheidt.de/
Message-ID <[email protected]>
"Husain Alshehhi" <[email protected]> wrote:

>> I do not know if it is the right way, but I use patterns of
>> the type:

>> | (gnus-with-article-buffer
>> |   (gnus-fetch-original-field "User-Agent"))

>> Similarly, I use gnus-with-article-buffer and
>> save-mark-and-excursion to "enter" the article buffer, then
>> article-goto-body to go to the article body's top, and then
>> search-forward-regexp to capture text.

> Thank you. Extracting the field worked well.

> For the body, however, I noticed that I need a little more: what I want
> to search in is the the whole email, not just the article buffer. In
> particular, I want to be able to search the text/plain as well as the
> text/html parts. gnus-with-article-buffer and article-goto-body, on the
> other hand, only allow me to search within the buffer, which has only
> the visible part of the email (text/html in my case).

I have one use case where I need to search (or rather copy
parts of) the raw article text, and I use
gnus-summary-show-raw-article for that as Gijs suggested.

For another use case, more similar to yours, I want to pro-
perly iterate over attachments, etc.  I haven't done any ac-
tual work in that direction, but noted that it would proba-
bly involve iterating over (gnus-article-mime-handles).  If
someone has a working example, any pointer would be much
appreciated.

Tim