X-Loop: help-debbugs@HIDDEN
Subject: bug#79815: [PATCH] Add current subject to future history in `message-change-subject'
Resent-From: Rudolf =?UTF-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: larsi@HIDDEN, bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 11 Nov 2025 12:23:02 +0000
Resent-Message-ID: <handler.79815.B.176286373915298 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 79815
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 79815 <at> debbugs.gnu.org
Cc: Lars Magne Ingebrigtsen <larsi@HIDDEN>
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
X-Debbugs-Original-Xcc: Lars Magne Ingebrigtsen <larsi@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.176286373915298
(code B ref -1); Tue, 11 Nov 2025 12:23:02 +0000
Received: (at submit) by debbugs.gnu.org; 11 Nov 2025 12:22:19 +0000
Received: from localhost ([127.0.0.1]:43670 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vInO6-0003ye-BL
for submit <at> debbugs.gnu.org; Tue, 11 Nov 2025 07:22:19 -0500
Received: from lists.gnu.org ([2001:470:142::17]:58372)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <rudolf@HIDDEN>)
id 1vInO1-0003yA-VF
for submit <at> debbugs.gnu.org; Tue, 11 Nov 2025 07:22:16 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <rudolf@HIDDEN>)
id 1vInNs-0007s7-FM
for bug-gnu-emacs@HIDDEN; Tue, 11 Nov 2025 07:22:04 -0500
Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <rudolf@HIDDEN>)
id 1vInNq-0001mP-8W
for bug-gnu-emacs@HIDDEN; Tue, 11 Nov 2025 07:22:04 -0500
Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51])
by mailfout.stl.internal (Postfix) with ESMTP id 9485A1D00125
for <bug-gnu-emacs@HIDDEN>; Tue, 11 Nov 2025 07:22:00 -0500 (EST)
Received: from phl-mailfrontend-02 ([10.202.2.163])
by phl-compute-11.internal (MEProxy); Tue, 11 Nov 2025 07:22:00 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org;
h=cc:content-type:content-type:date:date:from:from:in-reply-to
:message-id:mime-version:reply-to:subject:subject:to:to; s=fm1;
t=1762863720; x=1762950120; bh=dJUVMpx36IxURsk4Az9Q7lK1ItYCpFbm
YJpKVM0nMhs=; b=Bla1QAjBdwz9c5LLdZ4KlfFJXS4CrqTGnKtRLmtK/Jvifjxs
DCeaJJfoERpBjeeoEx7ixT0BtL5F83lhXkFi0m7fYBczDdNZEAyY7560Er1DuRz4
72NbAsQd/DiLMwd2YsYbSsl7xhrTAXPJ+kpDg1SGZoTlAvrr/th7HEREqxTuC4iy
GesBGDz6sl2zZNU6CacZu/usqBjlQehnhgUS6bm7Q1RjCkC/7yXJ4EECb0WuJPEa
kGIZ0Rj16Av+3HoUOGXIb12WPWLdir5OvgPT7xCZ4zQPnsojcqa0hIcGC/kOHh+U
++52PbfFkJttM7myDnWSrN64rTRr+uuPy9YS3Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:content-type:content-type:date:date
:feedback-id:feedback-id:from:from:in-reply-to:message-id
:mime-version:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1762863720; x=
1762950120; bh=dJUVMpx36IxURsk4Az9Q7lK1ItYCpFbmYJpKVM0nMhs=; b=p
VUc29apKQuV0InnZU9758U+XB+jhTOetW5cgkh5ct+qNWWKkNUVH1kYocF/u2KWN
sQfP76foRCLb5t1U5S3p8vM4+IP3xNEN71sl7+4NThHP+1BsCdUNdY9SfRPW+duE
C7r8tAI8C+ncu/X8c/I0kSCzQi8HjYF/F1GZ6JxYy9nNtBB1WCrfSKPxd5h99uvF
AcAfVeMKzD50p1P8rBri7WYuz4MdfBnS8vrGZzxU1dGlAhJYEfpZVEIZHG6BJxuV
+713oGdTiVKNBFPVtJ8zFriM8WZC/PSmMEF+dvTJQVOEdOiKDqHz6dri0B1MRES/
JwrZX3CfFmru9Ql9JdMLA==
X-ME-Sender: <xms:aCoTaZ7kcFCdFA3afLsZOVDxfxh4_SrZ3KYwpiHpgbZazvv_iPuahw>
<xme:aCoTaczcvOUjtBPZKwNlp54AMfS2sg7b611AA3It3JjJXu4XMaENqCWSPM1_lVAiQ
gHinN60zOPvEGLytgriLTXD93ZFLqrhYKiW0LW4HIJSfz7PWYN6IA>
X-ME-Received: <xmr:aCoTabgXivwUnxYtvFhBS98fgxdVGPadD-jCIrSYbMrH7MVvDmZvUXS1yxqG6vTV1CR45j_B_sPDxZvErD_HUEypoXj69Vk>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvtdduudekucetufdoteggodetrf
dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
rghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkgggtsehmtderredttdejne
cuhfhrohhmpeftuhguohhlfhcutegurghmkhhovhhitgcuoehruhguohhlfhesrggurghm
khhovhhitgdrohhrgheqnecuggftrfgrthhtvghrnhepffekfeeuudeftdekveejjeevte
ffudetjeetgedtffduuedvjeekvdejueeiveffnecuvehluhhsthgvrhfuihiivgeptden
ucfrrghrrghmpehmrghilhhfrhhomheprhhuugholhhfsegruggrmhhkohhvihgtrdhorh
hgpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegs
uhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg
X-ME-Proxy: <xmx:aCoTae99W6yuQFnsQ82HIIZL2nIZdRzaJ46-r7K2kNkm-oBUkrIORQ>
<xmx:aCoTaQvEj2x6g0NBQGkhjOHmOJFA6wMrbNcZhtSL5UuVoib7maiSAQ>
<xmx:aCoTadbb8Q_o4Kmx6tSpBi5kCqX4Zw5cXv681pFM06CYMfULibwAwQ>
<xmx:aCoTaYrT6fOjZQjWLEk7ZvHGGdOBLryrJmOlrj7IFlgKTCWNQPym6Q>
<xmx:aCoTaSqoyQHl2fKgZLCwB4DCCpzjLQEJPqxtn75ldUinL2PU3Qh_lhlY>
Feedback-ID: i88214938:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA for
<bug-gnu-emacs@HIDDEN>; Tue, 11 Nov 2025 07:21:59 -0500 (EST)
From: Rudolf =?UTF-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
Date: Tue, 11 Nov 2025 13:21:57 +0100
Message-ID: <m28qgcrc7u.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=202.12.124.144; envelope-from=rudolf@HIDDEN;
helo=fout-b1-smtp.messagingengine.com
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,
RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)
--=-=-=
Content-Type: text/plain
Tags: patch
Fellow Emacs hackers,
When amending the subject header with `message-change-subject', the
current value of the header is not available in the "future history",
which is impractical if all one needs is to fix a word, or add a missing
prefix or suffix. The attached patch improves the situation by putting
the current subject into the future history.
Rudy
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=0001-Add-current-subject-to-future-history-in-message-cha.patch
From 2ce917c57eec7453b52be540f0c847ff2922af96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <rudolf@HIDDEN>
Date: Tue, 11 Nov 2025 13:07:18 +0100
Subject: [PATCH] Add current subject to future history in
`message-change-subject'
* etc/NEWS (minutes): Announce the feature.
* lisp/gnus/message.el (message-change-subject): Read the new subject
with the old subject in the "future history".
---
etc/NEWS | 3 ++
lisp/gnus/message.el | 67 ++++++++++++++++++++++++--------------------
2 files changed, 40 insertions(+), 30 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 7168cc5bb92..c773f3a6d01 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1740,6 +1740,9 @@ honored if it was already set.
+++
*** 'message-strip-subject-re' now matches case-insensitively.
+---
+*** 'message-change-subject' inserts current subject to "future history".
+
** Sendmail
---
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 18a3e0a9fde..0f90a098a3f 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -2400,36 +2400,43 @@ message-strip-subject-trailing-was
;;; Suggested by Jonas Steverud @ www.dtek.chalmers.se/~d4jonas/
-(defun message-change-subject (new-subject)
- "Ask for NEW-SUBJECT header, append (was: <Old Subject>)."
- (interactive
- (list
- (read-from-minibuffer "New subject: "))
- message-mode)
- (cond ((and (not (or (null new-subject) ; new subject not empty
- (zerop (string-width new-subject))
- (string-match "^[ \t]*$" new-subject))))
- (save-excursion
- (let ((old-subject
- (save-restriction
- (message-narrow-to-headers)
- (message-fetch-field "Subject"))))
- (cond ((not old-subject)
- (error "No current subject"))
- ((not (string-match
- (concat "^[ \t]*"
- (regexp-quote new-subject)
- "[ \t]*$")
- old-subject)) ; yes, it really is a new subject
- ;; delete eventual Re: prefix
- (setq old-subject
- (message-strip-subject-re old-subject))
- (message-goto-subject)
- (delete-line)
- (insert (concat "Subject: "
- new-subject
- " (was: "
- old-subject ")\n")))))))))
+(defun message-change-subject (&optional new-subject)
+ "Change subject to NEW-SUBJECT with \"(was: <Old Subject>)\" suffix.
+If NEW-SUBJECT is nil, the user is prompted for the new subject, with
+the old subject in \"future history\"."
+ (interactive nil message-mode)
+ (let ((old-subject (save-restriction
+ (message-narrow-to-headers)
+ (message-fetch-field "Subject"))))
+ (if (not old-subject)
+ (error "No current subject")
+ (let ((new-subject (or new-subject
+ (read-from-minibuffer "New subject: "
+ nil nil nil nil
+ old-subject))))
+ (cond
+ ;; Abort on empty subject.
+ ((or (null new-subject)
+ (zerop (string-width new-subject))
+ (string-match "^[ \t]*$" new-subject))
+ (message "Subject empty"))
+ ;; Abort on unchanged subject.
+ ((string-match
+ (concat "^[ \t]*"
+ (regexp-quote new-subject)
+ "[ \t]*$")
+ old-subject)
+ (message "Subject unchanged"))
+ ;; Otherwise, proceed.
+ (t
+ (save-excursion
+ (message-goto-subject)
+ (delete-line)
+ (insert (concat "Subject: "
+ new-subject
+ " (was: "
+ (message-strip-subject-re old-subject)
+ ")\n")))))))))
(defun message-mark-inserted-region (beg end &optional verbatim)
"Mark some region in the current article with enclosing tags.
--
2.39.5 (Apple Git-154)
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
--=20
"It is better to have 100 functions operate on one data structure than
10 functions on 10 data structures."
--- Alan Perlis
Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> [he/him]
http://adamkovic.org
--=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Rudolf =?UTF-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN> Subject: bug#79815: Acknowledgement ([PATCH] Add current subject to future history in `message-change-subject') Message-ID: <handler.79815.B.176286373915298.ack <at> debbugs.gnu.org> References: <m28qgcrc7u.fsf@HIDDEN> X-Gnu-PR-Message: ack 79815 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 79815 <at> debbugs.gnu.org Date: Tue, 11 Nov 2025 12:23:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. As you requested using X-Debbugs-CC, your message was also forwarded to Lars Magne Ingebrigtsen <larsi@HIDDEN> (after having been given a bug report number, if it did not have one). Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 79815 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 79815: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79815 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.