[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reading the article/message in elisp
From: |
Robert Pluim |
Subject: |
Re: Reading the article/message in elisp |
Date: |
Wed, 12 Jul 2023 12:12:16 +0200 |
>>>>> 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
--
- Reading the article/message in elisp, husain, 2023/07/10
- Re: Reading the article/message in elisp, Husain Alshehhi, 2023/07/12
- Re: Reading the article/message in elisp,
Robert Pluim <=
- Re: Reading the article/message in elisp, Husain Alshehhi, 2023/07/13
- Re: Reading the article/message in elisp, Emanuel Berg, 2023/07/13
- Re: Reading the article/message in elisp, Michael Heerdegen, 2023/07/13
- Re: Reading the article/message in elisp, Emanuel Berg, 2023/07/14
- Re: Reading the article/message in elisp, Michael Heerdegen, 2023/07/14
- Re: Reading the article/message in elisp, Emanuel Berg, 2023/07/14
- Re: Reading the article/message in elisp, Michael Heerdegen, 2023/07/14
- Re: Reading the article/message in elisp, Emanuel Berg, 2023/07/15