all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#49070: [PATCH] Accept list as AFTER argument for message-replace-header
@ 2021-06-17  9:41 Łukasz Stelmach
  2021-06-19 13:07 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Łukasz Stelmach @ 2021-06-17  9:41 UTC (permalink / raw)
  To: 49070; +Cc: Łukasz Stelmach

* 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.
---
 lisp/gnus/message.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 02db38725a..b788670dc3 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -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))))
 
-- 
2.29.2






^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-19 13:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-17  9:41 bug#49070: [PATCH] Accept list as AFTER argument for message-replace-header Łukasz Stelmach
2021-06-19 13:07 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.