From: Robert Pluim <rpluim@gmail.com>
To: Husain Alshehhi <husain@alshehhi.io>
Cc: info-gnus-english@gnu.org
Subject: Re: Reading the article/message in elisp
Date: Wed, 12 Jul 2023 12:12:16 +0200 [thread overview]
Message-ID: <87edld781r.fsf@gmail.com> (raw)
In-Reply-To: <87o7kh9146.fsf@alshehhi.io> (Husain Alshehhi's message of "Wed, 12 Jul 2023 04:59:08 +0000")
>>>>> On Wed, 12 Jul 2023 04:59:08 +0000, Husain Alshehhi <husain@alshehhi.io> said:
Husain> 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
Husain> Thank you. message-fetch-field works if the point is in a message
Husain> buffer. I was not aware of this option. But when the point is in a
Husain> gnus-summary buffer, then
Husain> (message-fetch-field "Subject")
Husain> returns nil. Even with something like:
Husain> (defun husain--test-message-subject-yank ()
Husain> (interactive)
Husain> (save-excursion
Husain> (let ((subj (message-fetch-field "Subject")))
Husain> (if subj
Husain> (message subj)
Husain> (gnus-summary-show-article)
Husain> (gnus-summary-select-article-buffer)
Husain> (message (message-fetch-field "Subject"))))))
Husain> this still doesn't work as intended because it does not restore the
Husain> window if the point is in a gnus-summary buffer pointing to an article
Husain> not open.
Husain> Is there a gnus function that can build the message in a temp buffer?
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.
Robert
--
next prev parent reply other threads:[~2023-07-12 10:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 4:59 Husain Alshehhi
2023-07-12 10:12 ` Robert Pluim [this message]
2023-07-13 0:04 ` Emanuel Berg
2023-07-13 0:26 ` Michael Heerdegen
-- strict thread matches above, loose matches on Subject: below --
2023-07-14 0:52 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
2023-07-11 3:33 husain
2023-07-11 11:29 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87edld781r.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=husain@alshehhi.io \
--cc=info-gnus-english@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).