>>>>> On Wed, 12 Jul 2023 04:59:08 +0000, Husain Alshehhi <hus...@alshehhi.io> >>>>> said:
Husain> Emanuel Berg <in...@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 --