unofficial mirror of bug-gnu-emacs@gnu.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

* bug#49070: [PATCH] Accept list as AFTER argument for message-replace-header
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-19 13:07 UTC (permalink / raw)
  To: Łukasz Stelmach; +Cc: 49070

Łukasz Stelmach <stlman@poczta.fm> writes:

> * 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.

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).