aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/mail/pmailedit.el17
1 files changed, 7 insertions, 10 deletions
diff --git a/lisp/mail/pmailedit.el b/lisp/mail/pmailedit.el
index edd5baa1b53..9ee13fb2e4a 100644
--- a/lisp/mail/pmailedit.el
+++ b/lisp/mail/pmailedit.el
@@ -29,8 +29,6 @@
29 (require 'pmail) 29 (require 'pmail)
30 (require 'pmailsum)) 30 (require 'pmailsum))
31 31
32(require 'pmailhdr)
33
34(defcustom pmail-edit-mode-hook nil 32(defcustom pmail-edit-mode-hook nil
35 "List of functions to call when editing an PMAIL message." 33 "List of functions to call when editing an PMAIL message."
36 :type 'hook 34 :type 'hook
@@ -92,7 +90,6 @@ This functions runs the normal hook `pmail-edit-mode-hook'.
92 (setq pmail-old-pruned (eq pmail-header-style 'normal)) 90 (setq pmail-old-pruned (eq pmail-header-style 'normal))
93 (make-local-variable 'pmail-edit-saved-coding-system) 91 (make-local-variable 'pmail-edit-saved-coding-system)
94 (setq pmail-edit-saved-coding-system save-buffer-coding-system) 92 (setq pmail-edit-saved-coding-system save-buffer-coding-system)
95 (pmail-header-show-headers)
96 (pmail-edit-mode) 93 (pmail-edit-mode)
97 ;; As the local value of save-buffer-coding-system is deleted by 94 ;; As the local value of save-buffer-coding-system is deleted by
98 ;; pmail-edit-mode, we restore the original value. 95 ;; pmail-edit-mode, we restore the original value.
@@ -115,11 +112,13 @@ This functions runs the normal hook `pmail-edit-mode-hook'.
115 (save-excursion 112 (save-excursion
116 (set-buffer pmail-summary-buffer) 113 (set-buffer pmail-summary-buffer)
117 (pmail-summary-enable))) 114 (pmail-summary-enable)))
118 ;; Make sure buffer ends with a newline. 115 ;; Make sure buffer ends with a blank line.
119 (save-excursion 116 (save-excursion
120 (goto-char (point-max)) 117 (goto-char (point-max))
121 (if (/= (preceding-char) ?\n) 118 (if (/= (preceding-char) ?\n)
122 (insert "\n")) 119 (insert "\n"))
120 (unless (looking-back "\n\n")
121 (insert "\n"))
123 ;; Adjust the marker that points to the end of this message. 122 ;; Adjust the marker that points to the end of this message.
124 (set-marker (aref pmail-message-vector (1+ pmail-current-message)) 123 (set-marker (aref pmail-message-vector (1+ pmail-current-message))
125 (point))) 124 (point)))
@@ -133,11 +132,10 @@ This functions runs the normal hook `pmail-edit-mode-hook'.
133 ;; As the local value of save-buffer-coding-system is changed by 132 ;; As the local value of save-buffer-coding-system is changed by
134 ;; pmail-variables, we restore the original value. 133 ;; pmail-variables, we restore the original value.
135 (setq save-buffer-coding-system pmail-edit-saved-coding-system) 134 (setq save-buffer-coding-system pmail-edit-saved-coding-system)
136 (if (and (= (length old) (- (point-max) (point-min))) 135 (unless (and (= (length old) (- (point-max) (point-min)))
137 (string= old (buffer-substring (point-min) (point-max)))) 136 (string= old (buffer-substring (point-min) (point-max))))
138 ()
139 (setq old nil) 137 (setq old nil)
140 (pmail-set-attribute "edited" t) 138 (pmail-set-attribute pmail-edited-attr-index t)
141 (if (boundp 'pmail-summary-vector) 139 (if (boundp 'pmail-summary-vector)
142 (progn 140 (progn
143 (aset pmail-summary-vector (1- pmail-current-message) nil) 141 (aset pmail-summary-vector (1- pmail-current-message) nil)
@@ -153,8 +151,7 @@ This functions runs the normal hook `pmail-edit-mode-hook'.
153 (save-excursion 151 (save-excursion
154 (pmail-show-message) 152 (pmail-show-message)
155 (pmail-toggle-header (if pmail-old-pruned 1 0)))) 153 (pmail-toggle-header (if pmail-old-pruned 1 0))))
156 (run-hooks 'pmail-mode-hook) 154 (run-hooks 'pmail-mode-hook))
157 (setq buffer-read-only t))
158 155
159(defun pmail-abort-edit () 156(defun pmail-abort-edit ()
160 "Abort edit of current message; restore original contents." 157 "Abort edit of current message; restore original contents."