aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman2009-05-18 16:26:57 +0000
committerRichard M. Stallman2009-05-18 16:26:57 +0000
commit4df49ff1d29649952368f633c4f1f6016429b1e6 (patch)
treebce9dd79af07bd278bdbfca600cfe79a904b6251 /lisp
parent227f12fabb3624dd28c6ce0db39f8f3926053e2b (diff)
downloademacs-4df49ff1d29649952368f633c4f1f6016429b1e6.tar.gz
emacs-4df49ff1d29649952368f633c4f1f6016429b1e6.zip
* mail/rmail.el (rmail-expunge-confirmed): Return nil if nothing to do.
Don't call rmail-modify-format here. (rmail-expunge): Call it here after expunge is confirmed. (rmail-confirm-expunge): Doc fix. Mark as risky. (rmail-convert-babyl-to-mbox): Call rmail-modify-format. (rmail-set-attribute): Call rmail-dont-modify-format only for `unseen'. For other attributes, call `rmail-modify-format', and propagate the modified flag to rmail-buffer.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/mail/rmail.el37
2 files changed, 35 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fcb89a96436..b1241123942 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12009-05-18 Richard M Stallman <rms@gnu.org>
2
3 * mail/rmail.el (rmail-expunge-confirmed): Return nil if nothing to do.
4 Don't call rmail-modify-format here.
5 (rmail-expunge): Call it here after expunge is confirmed.
6 (rmail-confirm-expunge): Doc fix. Mark as risky.
7 (rmail-convert-babyl-to-mbox): Call rmail-modify-format.
8 (rmail-set-attribute): Call rmail-dont-modify-format only for `unseen'.
9 For other attributes, call `rmail-modify-format',
10 and propagate the modified flag to rmail-buffer.
11
12009-05-17 Richard M Stallman <rms@gnu.org> 122009-05-17 Richard M Stallman <rms@gnu.org>
2 13
3 * mail/rmailedit.el (rmail-edit-current-message): 14 * mail/rmailedit.el (rmail-edit-current-message):
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 0eb500e52e0..b348495f178 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -440,12 +440,15 @@ the frame where you have the RMAIL buffer displayed."
440 :group 'rmail-files) 440 :group 'rmail-files)
441 441
442(defcustom rmail-confirm-expunge 'y-or-n-p 442(defcustom rmail-confirm-expunge 'y-or-n-p
443 "Whether and how to ask for confirmation before expunging deleted messages." 443 "Whether and how to ask for confirmation before expunging deleted messages.
444The value, if non-nil is a function to call with a question (string)
445as argument, to ask the user that question."
444 :type '(choice (const :tag "No confirmation" nil) 446 :type '(choice (const :tag "No confirmation" nil)
445 (const :tag "Confirm with y-or-n-p" y-or-n-p) 447 (const :tag "Confirm with y-or-n-p" y-or-n-p)
446 (const :tag "Confirm with yes-or-no-p" yes-or-no-p)) 448 (const :tag "Confirm with yes-or-no-p" yes-or-no-p))
447 :version "21.1" 449 :version "21.1"
448 :group 'rmail-files) 450 :group 'rmail-files)
451(put 'rmail-confirm-expunge 'risky-local-variable t)
449 452
450;;;###autoload 453;;;###autoload
451(defvar rmail-mode-hook nil 454(defvar rmail-mode-hook nil
@@ -967,6 +970,7 @@ This function also reinitializes local variables used by Rmail."
967 (rmail-perm-variables) 970 (rmail-perm-variables)
968 (rmail-variables) 971 (rmail-variables)
969 (setq rmail-was-converted t) 972 (setq rmail-was-converted t)
973 (rmail-dont-modify-format)
970 (goto-char (point-max)) 974 (goto-char (point-max))
971 (rmail-set-message-counters)) 975 (rmail-set-message-counters))
972 (message "Replacing BABYL format with mbox format...done")) 976 (message "Replacing BABYL format with mbox format...done"))
@@ -2257,6 +2261,10 @@ change; nil means current message."
2257 (setq n (1+ n)))) 2261 (setq n (1+ n))))
2258 (if (stringp attr) 2262 (if (stringp attr)
2259 (error "Unknown attribute `%s'" attr)) 2263 (error "Unknown attribute `%s'" attr))
2264 ;; Ask for confirmation before setting any attribute except `unseen'
2265 ;; if it would force a format change.
2266 (unless (= attr rmail-unseen-attr-index)
2267 (rmail-modify-format))
2260 (with-current-buffer rmail-buffer 2268 (with-current-buffer rmail-buffer
2261 (or msgnum (setq msgnum rmail-current-message)) 2269 (or msgnum (setq msgnum rmail-current-message))
2262 (when (> msgnum 0) 2270 (when (> msgnum 0)
@@ -2269,8 +2277,12 @@ change; nil means current message."
2269 (if (= msgnum rmail-current-message) 2277 (if (= msgnum rmail-current-message)
2270 (rmail-display-labels))) 2278 (rmail-display-labels)))
2271 ;; Don't save in mbox format over a Babyl file 2279 ;; Don't save in mbox format over a Babyl file
2272 ;; merely because of this. 2280 ;; merely because of a change in `unseen' attribute.
2273 (rmail-dont-modify-format))))) 2281 (if (= attr rmail-unseen-attr-index)
2282 (rmail-dont-modify-format)
2283 ;; Otherwise, if we modified the file text via the view buffer,
2284 ;; mark the main buffer modified too.
2285 (set-buffer-modified-p t))))))
2274 2286
2275(defun rmail-message-attr-p (msg attrs) 2287(defun rmail-message-attr-p (msg attrs)
2276 "Return non-nil if message number MSG has attributes matching regexp ATTRS." 2288 "Return non-nil if message number MSG has attributes matching regexp ATTRS."
@@ -3252,17 +3264,15 @@ Deleted messages stay in the file until the \\[rmail-expunge] command is given."
3252 newnum))) 3264 newnum)))
3253 3265
3254(defun rmail-expunge-confirmed () 3266(defun rmail-expunge-confirmed ()
3255 "Return t if deleted message should be expunged. If necessary, ask the user. 3267 "Return t if expunge is needed and desirable.
3256See also user-option `rmail-confirm-expunge'." 3268If `rmail-confirm-expunge' is non-nil, ask user to confirm."
3257 (set-buffer rmail-buffer) 3269 (set-buffer rmail-buffer)
3258 ;; FIXME shouldn't this return nil if there is nothing to expunge? 3270 (and (stringp rmail-deleted-vector)
3259 ;; Eg to save rmail-expunge wasting its time? 3271 (string-match "D" rmail-deleted-vector)
3260 (or (not (stringp rmail-deleted-vector)) 3272 (if rmail-confirm-expunge
3261 (not (string-match "D" rmail-deleted-vector)) 3273 (funcall rmail-confirm-expunge
3262 (if rmail-confirm-expunge 3274 "Erase deleted messages from Rmail file? ")
3263 (funcall rmail-confirm-expunge 3275 t)))
3264 "Erase deleted messages from Rmail file? ")
3265 (progn (rmail-modify-format) t))))
3266 3276
3267(defun rmail-only-expunge (&optional dont-show) 3277(defun rmail-only-expunge (&optional dont-show)
3268 "Actually erase all deleted messages in the file." 3278 "Actually erase all deleted messages in the file."
@@ -3357,6 +3367,7 @@ consistent with the Rmail buffer). If DONT-SHOW is non-nil, it
3357does not pop any summary buffer." 3367does not pop any summary buffer."
3358 (interactive) 3368 (interactive)
3359 (when (rmail-expunge-confirmed) 3369 (when (rmail-expunge-confirmed)
3370 (rmail-modify-format)
3360 (let ((was-deleted (rmail-message-deleted-p rmail-current-message)) 3371 (let ((was-deleted (rmail-message-deleted-p rmail-current-message))
3361 (was-swapped (rmail-buffers-swapped-p))) 3372 (was-swapped (rmail-buffers-swapped-p)))
3362 (rmail-only-expunge t) 3373 (rmail-only-expunge t)