Gnus development mailing list
 help / color / mirror / Atom feed
* Re: Extracting Header and Content from an Article
       [not found] <30844.7794335493$1731379178@news.gmane.org>
@ 2024-11-17 14:29 ` Tim Landscheidt
  2024-11-19  3:53   ` Husain Alshehhi
       [not found]   ` <29523.5648796492$1731988489@news.gmane.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Tim Landscheidt @ 2024-11-17 14:29 UTC (permalink / raw)
  To: Husain Alshehhi; +Cc: ding

"Husain Alshehhi" <husain@alshehhi.io> wrote:

> When the point is in the summary page while viewing an
> article, or while a point is in an open article, I want to
> be able to (1) extract a header value which is not in the
> gnus-extra-headers, and (2) get some content from the
> article via regexp search (using capture groups). What are
> the right GNUS APIs to use for my use case?

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.

Tim


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Extracting Header and Content from an Article
  2024-11-17 14:29 ` Extracting Header and Content from an Article Tim Landscheidt
@ 2024-11-19  3:53   ` Husain Alshehhi
       [not found]   ` <29523.5648796492$1731988489@news.gmane.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Husain Alshehhi @ 2024-11-19  3:53 UTC (permalink / raw)
  To: Tim Landscheidt; +Cc: ding

Tim Landscheidt <tim@tim-landscheidt.de> writes:

> 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).


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Extracting Header and Content from an Article
       [not found]   ` <29523.5648796492$1731988489@news.gmane.org>
@ 2024-11-19  9:08     ` Gijs Hillenius
  2024-11-19 19:22     ` Tim Landscheidt
  1 sibling, 0 replies; 5+ messages in thread
From: Gijs Hillenius @ 2024-11-19  9:08 UTC (permalink / raw)
  To: Husain Alshehhi; +Cc: Tim Landscheidt, ding

On 18 November 2024 21:53 Husain Alshehhi, wrote:

> Tim Landscheidt <tim@tim-landscheidt.de> writes:
>
>> 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).
>


gnus-summary-show-raw-article  ?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Extracting Header and Content from an Article
       [not found]   ` <29523.5648796492$1731988489@news.gmane.org>
  2024-11-19  9:08     ` Gijs Hillenius
@ 2024-11-19 19:22     ` Tim Landscheidt
  1 sibling, 0 replies; 5+ messages in thread
From: Tim Landscheidt @ 2024-11-19 19:22 UTC (permalink / raw)
  To: Husain Alshehhi; +Cc: ding

"Husain Alshehhi" <husain@alshehhi.io> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Extracting Header and Content from an Article
@ 2024-11-12  2:38 Husain Alshehhi
  0 siblings, 0 replies; 5+ messages in thread
From: Husain Alshehhi @ 2024-11-12  2:38 UTC (permalink / raw)
  To: ding

Hello,

When the point is in the summary page while viewing an article, or while a point is in an open article, I want to be able to (1) extract a header value which is not in the gnus-extra-headers, and (2) get some content from the article via regexp search (using capture groups). What are the right GNUS APIs to use for my use case?

Husain



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-19 19:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <30844.7794335493$1731379178@news.gmane.org>
2024-11-17 14:29 ` Extracting Header and Content from an Article Tim Landscheidt
2024-11-19  3:53   ` Husain Alshehhi
     [not found]   ` <29523.5648796492$1731988489@news.gmane.org>
2024-11-19  9:08     ` Gijs Hillenius
2024-11-19 19:22     ` Tim Landscheidt
2024-11-12  2:38 Husain Alshehhi

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 NNTP newsgroup(s).