Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Re: Reading the article/message in elisp
@ 2023-07-14  0:52 Husain Alshehhi
  2023-07-14  1:07 ` Emanuel Berg
  2023-07-14  1:48 ` Michael Heerdegen
  0 siblings, 2 replies; 22+ messages in thread
From: Husain Alshehhi @ 2023-07-14  0:52 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Husain Alshehhi, info-gnus-english

Robert Pluim <rpluim@gmail.com> writes:

>
> In a temp buffer, no, but you can access the article buffer using eg
> `gnus-with-article' or `gnus-with-article-buffer', or even
> `gnus-with-article-headers' if you only care about the headers.

I suppose that gnus-with-article-buffer works, almost. In the case that
I am in gnus summary page, with the point on an unopened article, when I
run the following:

        (defun husain--test-gnus-with-article-buffer()
          (interactive)
          (gnus-with-article-buffer
            (message "%s" (message-fetch-field "Subject"))))

It fails to read the subject. However, it works very well after I open
the article. I think this solves 95% of the cases I run into.

Thank you.



^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: Reading the article/message in elisp
@ 2023-07-12  4:59 Husain Alshehhi
  2023-07-12 10:12 ` Robert Pluim
  0 siblings, 1 reply; 22+ messages in thread
From: Husain Alshehhi @ 2023-07-12  4:59 UTC (permalink / raw)
  To: info-gnus-english

Emanuel Berg <incal@dataswamp.org> writes:

> You can use `message-fetch-field' to get headers, as in:
>
> (defun message-yank-subject ()
>   (interactive)
>   (save-excursion
>     (let ((subj (message-fetch-field "Subject")))
>       (when subj
>         (message-goto-body)
>         (insert (format "%s\n" subj)) ))))
>
> More examples:
>   https://dataswamp.org/~incal/emacs-init/gnus/message-header.el

Thank you. message-fetch-field works if the point is in a message
buffer. I was not aware of this option. But when the point is in a
gnus-summary buffer, then

        (message-fetch-field "Subject")

returns nil. Even with something like:

        (defun husain--test-message-subject-yank ()
          (interactive)
          (save-excursion
            (let ((subj (message-fetch-field "Subject")))
              (if subj
                  (message subj)
                (gnus-summary-show-article)
                (gnus-summary-select-article-buffer)
                (message (message-fetch-field "Subject"))))))

this still doesn't work as intended because it does not restore the
window if the point is in a gnus-summary buffer pointing to an article
not open.

Is there a gnus function that can build the message in a temp buffer?



^ permalink raw reply	[flat|nested] 22+ messages in thread
* Reading the article/message in elisp
@ 2023-07-11  3:33 husain
  2023-07-11 11:29 ` Emanuel Berg
  0 siblings, 1 reply; 22+ messages in thread
From: husain @ 2023-07-11  3:33 UTC (permalink / raw)
  To: info-gnus-english

Hello,

If I am in

  - the summary page, with the cursor on an unopen article line, or in
  - the summary page, with an open article, or in
  - an article

I would like to be able to read the article content in elisp and execute
processes based on that. For example, if the message has
TO:person@work.xyz, or CC:person@work.xyz, then I would like to open the
person's profile page.

Is there a gnus elisp function that allows me to access the article
programmatically?

Thanks.






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

end of thread, other threads:[~2023-07-29  3:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14  0:52 Reading the article/message in elisp Husain Alshehhi
2023-07-14  1:07 ` Emanuel Berg
2023-07-14  1:48 ` Michael Heerdegen
2023-07-14  4:18   ` Emanuel Berg
2023-07-14  5:11     ` Michael Heerdegen
2023-07-14  5:17       ` Emanuel Berg
2023-07-15  3:56         ` Michael Heerdegen
2023-07-15  4:57           ` Emanuel Berg
2023-07-15  5:12             ` Michael Heerdegen
2023-07-15  5:28               ` Emanuel Berg
2023-07-16  2:43                 ` Michael Heerdegen
2023-07-16 15:35                   ` Emanuel Berg
2023-07-29  3:24                     ` Michael Heerdegen
2023-07-15  6:45     ` Emanuel Berg
2023-07-16  2:40       ` Michael Heerdegen
2023-07-16 15:38         ` Emanuel Berg
  -- strict thread matches above, loose matches on Subject: below --
2023-07-12  4:59 Husain Alshehhi
2023-07-12 10:12 ` Robert Pluim
2023-07-13  0:04   ` Emanuel Berg
2023-07-13  0:26   ` Michael Heerdegen
2023-07-11  3:33 husain
2023-07-11 11:29 ` Emanuel Berg

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