1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Add current subject to future history in `message-change-subject'

* lisp/gnus/message.el (message-change-subject): Read the new subject
with the old subject in the "future history".
* etc/NEWS (minutes): Announce the feature.  (Bug#79815)
This commit is contained in:
Rudolf Adamkovič 2025-11-11 13:07:18 +01:00 committed by Eli Zaretskii
parent a542ed23e4
commit 6743a7d747
2 changed files with 40 additions and 30 deletions

View file

@ -1769,6 +1769,9 @@ honored if it was already set.
+++ +++
*** 'message-strip-subject-re' now matches case-insensitively. *** 'message-strip-subject-re' now matches case-insensitively.
---
*** 'message-change-subject' inserts current subject to "future history".
** Sendmail ** Sendmail
--- ---

View file

@ -2400,36 +2400,43 @@ Leading \"Re: \" is not stripped by this function. Use the function
;;; Suggested by Jonas Steverud @ www.dtek.chalmers.se/~d4jonas/ ;;; Suggested by Jonas Steverud @ www.dtek.chalmers.se/~d4jonas/
(defun message-change-subject (new-subject) (defun message-change-subject (&optional new-subject)
"Ask for NEW-SUBJECT header, append (was: <Old Subject>)." "Change subject to NEW-SUBJECT with \"(was: <Old Subject>)\" suffix.
(interactive If NEW-SUBJECT is nil, the user is prompted for the new subject, with
(list the old subject in \"future history\"."
(read-from-minibuffer "New subject: ")) (interactive nil message-mode)
message-mode) (let ((old-subject (save-restriction
(cond ((and (not (or (null new-subject) ; new subject not empty (message-narrow-to-headers)
(zerop (string-width new-subject)) (message-fetch-field "Subject"))))
(string-match "^[ \t]*$" new-subject)))) (if (not old-subject)
(save-excursion (error "No current subject")
(let ((old-subject (let ((new-subject (or new-subject
(save-restriction (read-from-minibuffer "New subject: "
(message-narrow-to-headers) nil nil nil nil
(message-fetch-field "Subject")))) old-subject))))
(cond ((not old-subject) (cond
(error "No current subject")) ;; Abort on empty subject.
((not (string-match ((or (null new-subject)
(concat "^[ \t]*" (zerop (string-width new-subject))
(regexp-quote new-subject) (string-match "^[ \t]*$" new-subject))
"[ \t]*$") (message "Subject empty"))
old-subject)) ; yes, it really is a new subject ;; Abort on unchanged subject.
;; delete eventual Re: prefix ((string-match
(setq old-subject (concat "^[ \t]*"
(message-strip-subject-re old-subject)) (regexp-quote new-subject)
(message-goto-subject) "[ \t]*$")
(delete-line) old-subject)
(insert (concat "Subject: " (message "Subject unchanged"))
new-subject ;; Otherwise, proceed.
" (was: " (t
old-subject ")\n"))))))))) (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) (defun message-mark-inserted-region (beg end &optional verbatim)
"Mark some region in the current article with enclosing tags. "Mark some region in the current article with enclosing tags.