mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-15 17:00:26 +00:00
Allow `message-replace-header' to take a list of AFTERs
* lisp/gnus/message.el (message-replace-header): Facilitate capability of message-position-on-field to accept multiple headers as AFTERS argument and make possible to mimic behavioir of message-goto-* functions with message-replace-header in case the header does not exist (bug#49070).
This commit is contained in:
parent
6ea7e33846
commit
989de3b824
@ -8722,16 +8722,19 @@ Header and body are separated by `mail-header-separator'."
|
||||
|
||||
(defun message-replace-header (header new-value &optional after force)
|
||||
"Remove HEADER and insert the NEW-VALUE.
|
||||
If AFTER, insert after this header. If FORCE, insert new field
|
||||
even if NEW-VALUE is empty."
|
||||
If AFTER, insert after this header. AFTER may be a list of
|
||||
headers. If FORCE, insert new field even if NEW-VALUE is empty."
|
||||
;; Similar to `nnheader-replace-header' but for message buffers.
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(message-narrow-to-headers)
|
||||
(message-remove-header header))
|
||||
(when (or force (> (length new-value) 0))
|
||||
(if after
|
||||
(message-position-on-field header after)
|
||||
(when after
|
||||
(if (listp after)
|
||||
(apply #'message-position-on-field
|
||||
(append (list header) after))
|
||||
(message-position-on-field header after))
|
||||
(message-position-on-field header))
|
||||
(insert new-value))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user