mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
rmail-cease-edit fixes related to "^From " escaping
* mail/rmail.el (rmail-mime-decoded): New permanent local. (rmail-show-message-1): Set rmail-mime-decoded when appropriate. * mail/rmailedit.el (rmail-cease-edit): Respect rmail-mbox-format and rmail-mime-decoded. Fixes: debbugs:9841
This commit is contained in:
parent
822995f8b9
commit
54c8b5baf1
3 changed files with 30 additions and 4 deletions
|
|
@ -167,10 +167,25 @@ This function runs the hooks `text-mode-hook' and `rmail-edit-mode-hook'.
|
|||
(if (or rmail-old-mime-state
|
||||
(not rmail-old-pruned))
|
||||
(forward-line 1))
|
||||
(while (re-search-forward "^>*From " nil t)
|
||||
(beginning-of-line)
|
||||
(insert ">")
|
||||
(forward-line))
|
||||
;; When editing a non-MIME message, rmail-show-message-1 has unescaped
|
||||
;; ^>*From lines according to rmail-mbox-format. We are editing
|
||||
;; the message as it was displayed, and need to put the escapes when done.
|
||||
;; When editing a MIME message, we are editing the "raw" message.
|
||||
;; ^>*From lines have not been escaped, but we still need to ensure
|
||||
;; a "^From " line is escaped so as not to break later parsing (?).
|
||||
;; With ^>+From lines, we have no way of knowing whether the person
|
||||
;; doing the editing escaped them or not, so it seems best to leave
|
||||
;; them alone. (This all assumes you are using rmailmm rather than
|
||||
;; something else that behaves differently.)
|
||||
(let ((fromline (if (or (eq 'mboxo rmail-mbox-format)
|
||||
rmail-mime-decoded)
|
||||
"^From "
|
||||
"^>*From "))
|
||||
case-fold-search)
|
||||
(while (re-search-forward fromline nil t)
|
||||
(beginning-of-line)
|
||||
(insert ">")
|
||||
(forward-line)))
|
||||
;; Make sure buffer ends with a blank line so as not to run this
|
||||
;; message together with the following one.
|
||||
(goto-char (point-max))
|
||||
|
|
@ -201,6 +216,7 @@ This function runs the hooks `text-mode-hook' and `rmail-edit-mode-hook'.
|
|||
(setq buffer-undo-list t)
|
||||
(rmail-variables))
|
||||
;; If text has really changed, mark message as edited.
|
||||
;; FIXME we should do the comparison before escaping From lines.
|
||||
(unless (and (= (length old) (- (point-max) (point-min)))
|
||||
(string= old (buffer-substring (point-min) (point-max))))
|
||||
(setq old nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue