[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reading the article/message in elisp
From: |
Husain Alshehhi |
Subject: |
Re: Reading the article/message in elisp |
Date: |
Wed, 12 Jul 2023 04:59:08 +0000 |
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?