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
1 changed files with 7 additions and 4 deletions
|
@ -8722,16 +8722,19 @@ Header and body are separated by `mail-header-separator'."
|
||||||
|
|
||||||
(defun message-replace-header (header new-value &optional after force)
|
(defun message-replace-header (header new-value &optional after force)
|
||||||
"Remove HEADER and insert the NEW-VALUE.
|
"Remove HEADER and insert the NEW-VALUE.
|
||||||
If AFTER, insert after this header. If FORCE, insert new field
|
If AFTER, insert after this header. AFTER may be a list of
|
||||||
even if NEW-VALUE is empty."
|
headers. If FORCE, insert new field even if NEW-VALUE is empty."
|
||||||
;; Similar to `nnheader-replace-header' but for message buffers.
|
;; Similar to `nnheader-replace-header' but for message buffers.
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(message-narrow-to-headers)
|
(message-narrow-to-headers)
|
||||||
(message-remove-header header))
|
(message-remove-header header))
|
||||||
(when (or force (> (length new-value) 0))
|
(when (or force (> (length new-value) 0))
|
||||||
(if after
|
(when after
|
||||||
(message-position-on-field header after)
|
(if (listp after)
|
||||||
|
(apply #'message-position-on-field
|
||||||
|
(append (list header) after))
|
||||||
|
(message-position-on-field header after))
|
||||||
(message-position-on-field header))
|
(message-position-on-field header))
|
||||||
(insert new-value))))
|
(insert new-value))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue