diff options
| author | Glenn Morris | 2012-12-07 00:59:14 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-12-07 00:59:14 -0800 |
| commit | 54c8b5baf18adfb42599a59b73d63e03673916ef (patch) | |
| tree | 24f20c3f291d67c11bf9aa0a8b195cf19d6f212a | |
| parent | 822995f8b9776a3bcd3794eb7c362bed0f21c4a1 (diff) | |
| download | emacs-54c8b5baf18adfb42599a59b73d63e03673916ef.tar.gz emacs-54c8b5baf18adfb42599a59b73d63e03673916ef.zip | |
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
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/mail/rmail.el | 5 | ||||
| -rw-r--r-- | lisp/mail/rmailedit.el | 24 |
3 files changed, 30 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 940dc62fedf..36fc8eea448 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2012-12-07 Glenn Morris <rgm@gnu.org> | 1 | 2012-12-07 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * mail/rmail.el (rmail-mime-decoded): New permanent local. | ||
| 4 | (rmail-show-message-1): Set rmail-mime-decoded when appropriate. | ||
| 5 | * mail/rmailedit.el (rmail-cease-edit): Respect rmail-mbox-format | ||
| 6 | and rmail-mime-decoded. (Bug#9841) | ||
| 7 | |||
| 3 | * mail/unrmail.el (unrmail-mbox-format): New option. (Bug#6574) | 8 | * mail/unrmail.el (unrmail-mbox-format): New option. (Bug#6574) |
| 4 | (batch-unrmail, unrmail): Doc fixes. | 9 | (batch-unrmail, unrmail): Doc fixes. |
| 5 | (unrmail): Respect unrmail-mbox-format. | 10 | (unrmail): Respect unrmail-mbox-format. |
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 446ea4de0f3..c0fb7d1c5bd 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -100,6 +100,10 @@ its character representation and its display representation.") | |||
| 100 | "The current header display style choice, one of | 100 | "The current header display style choice, one of |
| 101 | 'normal (selected headers) or 'full (all headers).") | 101 | 'normal (selected headers) or 'full (all headers).") |
| 102 | 102 | ||
| 103 | (defvar rmail-mime-decoded nil | ||
| 104 | "Non-nil if message has been processed by `rmail-show-mime-function'.") | ||
| 105 | (put 'rmail-mime-decoded 'permanent-local t) ; for rmail-edit | ||
| 106 | |||
| 103 | (defgroup rmail nil | 107 | (defgroup rmail nil |
| 104 | "Mail reader for Emacs." | 108 | "Mail reader for Emacs." |
| 105 | :group 'mail) | 109 | :group 'mail) |
| @@ -2768,6 +2772,7 @@ The current mail message becomes the message displayed." | |||
| 2768 | (re-search-forward "mime-version: 1.0" nil t)) | 2772 | (re-search-forward "mime-version: 1.0" nil t)) |
| 2769 | (let ((rmail-buffer mbox-buf) | 2773 | (let ((rmail-buffer mbox-buf) |
| 2770 | (rmail-view-buffer view-buf)) | 2774 | (rmail-view-buffer view-buf)) |
| 2775 | (set (make-local-variable 'rmail-mime-decoded) t) | ||
| 2771 | (funcall rmail-show-mime-function)) | 2776 | (funcall rmail-show-mime-function)) |
| 2772 | (setq body-start (search-forward "\n\n" nil t)) | 2777 | (setq body-start (search-forward "\n\n" nil t)) |
| 2773 | (narrow-to-region beg (point)) | 2778 | (narrow-to-region beg (point)) |
diff --git a/lisp/mail/rmailedit.el b/lisp/mail/rmailedit.el index e4e066bd642..004eb2e3247 100644 --- a/lisp/mail/rmailedit.el +++ b/lisp/mail/rmailedit.el | |||
| @@ -167,10 +167,25 @@ This function runs the hooks `text-mode-hook' and `rmail-edit-mode-hook'. | |||
| 167 | (if (or rmail-old-mime-state | 167 | (if (or rmail-old-mime-state |
| 168 | (not rmail-old-pruned)) | 168 | (not rmail-old-pruned)) |
| 169 | (forward-line 1)) | 169 | (forward-line 1)) |
| 170 | (while (re-search-forward "^>*From " nil t) | 170 | ;; When editing a non-MIME message, rmail-show-message-1 has unescaped |
| 171 | (beginning-of-line) | 171 | ;; ^>*From lines according to rmail-mbox-format. We are editing |
| 172 | (insert ">") | 172 | ;; the message as it was displayed, and need to put the escapes when done. |
| 173 | (forward-line)) | 173 | ;; When editing a MIME message, we are editing the "raw" message. |
| 174 | ;; ^>*From lines have not been escaped, but we still need to ensure | ||
| 175 | ;; a "^From " line is escaped so as not to break later parsing (?). | ||
| 176 | ;; With ^>+From lines, we have no way of knowing whether the person | ||
| 177 | ;; doing the editing escaped them or not, so it seems best to leave | ||
| 178 | ;; them alone. (This all assumes you are using rmailmm rather than | ||
| 179 | ;; something else that behaves differently.) | ||
| 180 | (let ((fromline (if (or (eq 'mboxo rmail-mbox-format) | ||
| 181 | rmail-mime-decoded) | ||
| 182 | "^From " | ||
| 183 | "^>*From ")) | ||
| 184 | case-fold-search) | ||
| 185 | (while (re-search-forward fromline nil t) | ||
| 186 | (beginning-of-line) | ||
| 187 | (insert ">") | ||
| 188 | (forward-line))) | ||
| 174 | ;; Make sure buffer ends with a blank line so as not to run this | 189 | ;; Make sure buffer ends with a blank line so as not to run this |
| 175 | ;; message together with the following one. | 190 | ;; message together with the following one. |
| 176 | (goto-char (point-max)) | 191 | (goto-char (point-max)) |
| @@ -201,6 +216,7 @@ This function runs the hooks `text-mode-hook' and `rmail-edit-mode-hook'. | |||
| 201 | (setq buffer-undo-list t) | 216 | (setq buffer-undo-list t) |
| 202 | (rmail-variables)) | 217 | (rmail-variables)) |
| 203 | ;; If text has really changed, mark message as edited. | 218 | ;; If text has really changed, mark message as edited. |
| 219 | ;; FIXME we should do the comparison before escaping From lines. | ||
| 204 | (unless (and (= (length old) (- (point-max) (point-min))) | 220 | (unless (and (= (length old) (- (point-max) (point-min))) |
| 205 | (string= old (buffer-substring (point-min) (point-max)))) | 221 | (string= old (buffer-substring (point-min) (point-max)))) |
| 206 | (setq old nil) | 222 | (setq old nil) |