GNU bug report logs - #49070
[PATCH] Accept list as AFTER argument for message-replace-header

Previous Next

Package: emacs;

Reported by: Łukasz Stelmach <stlman <at> poczta.fm>

Date: Thu, 17 Jun 2021 09:49:02 UTC

Severity: normal

Tags: patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49070 in the body.
You can then email your comments to 49070 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#49070; Package emacs. (Thu, 17 Jun 2021 09:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Łukasz Stelmach <stlman <at> poczta.fm>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 17 Jun 2021 09:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Łukasz Stelmach <stlman <at> poczta.fm>
To: bug-gnu-emacs <at> gnu.org
Cc: Łukasz Stelmach <stlman <at> poczta.fm>
Subject: [PATCH] Accept list as AFTER argument for message-replace-header
Date: Thu, 17 Jun 2021 11:41:24 +0200
* 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49070; Package emacs. (Sat, 19 Jun 2021 13:08:02 GMT) Full text and rfc822 format available.

Message #8 received at 49070 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Łukasz Stelmach <stlman <at> poczta.fm>
Cc: 49070 <at> debbugs.gnu.org
Subject: Re: bug#49070: [PATCH] Accept list as AFTER argument for
 message-replace-header
Date: Sat, 19 Jun 2021 15:07:25 +0200
Łukasz Stelmach <stlman <at> 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




bug marked as fixed in version 28.1, send any further explanations to 49070 <at> debbugs.gnu.org and Łukasz Stelmach <stlman <at> poczta.fm> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 19 Jun 2021 13:08:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Jul 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 283 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.