emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog mail/rmail.el


From: Richard M. Stallman
Subject: [Emacs-diffs] emacs/lisp ChangeLog mail/rmail.el
Date: Mon, 18 May 2009 16:27:01 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       09/05/18 16:27:00

Modified files:
        lisp           : ChangeLog 
        lisp/mail      : rmail.el 

Log message:
        * 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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15642&r2=1.15643
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/rmail.el?cvsroot=emacs&r1=1.534&r2=1.535

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15642
retrieving revision 1.15643
diff -u -b -r1.15642 -r1.15643
--- ChangeLog   17 May 2009 16:11:23 -0000      1.15642
+++ ChangeLog   18 May 2009 16:26:57 -0000      1.15643
@@ -1,3 +1,14 @@
+2009-05-18  Richard M Stallman  <address@hidden>
+
+       * 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.
+
 2009-05-17  Richard M Stallman  <address@hidden>
 
        * mail/rmailedit.el (rmail-edit-current-message):

Index: mail/rmail.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/rmail.el,v
retrieving revision 1.534
retrieving revision 1.535
diff -u -b -r1.534 -r1.535
--- mail/rmail.el       10 Apr 2009 10:41:19 -0000      1.534
+++ mail/rmail.el       18 May 2009 16:27:00 -0000      1.535
@@ -440,12 +440,15 @@
   :group 'rmail-files)
 
 (defcustom rmail-confirm-expunge 'y-or-n-p
-  "Whether and how to ask for confirmation before expunging deleted messages."
+  "Whether and how to ask for confirmation before expunging deleted messages.
+The value, if non-nil is a function to call with a question (string)
+as argument, to ask the user that question."
   :type '(choice (const :tag "No confirmation" nil)
                 (const :tag "Confirm with y-or-n-p" y-or-n-p)
                 (const :tag "Confirm with yes-or-no-p" yes-or-no-p))
   :version "21.1"
   :group 'rmail-files)
+(put 'rmail-confirm-expunge 'risky-local-variable t)
 
 ;;;###autoload
 (defvar rmail-mode-hook nil
@@ -967,6 +970,7 @@
            (rmail-perm-variables)
            (rmail-variables)
            (setq rmail-was-converted t)
+           (rmail-dont-modify-format)
            (goto-char (point-max))
            (rmail-set-message-counters))
          (message "Replacing BABYL format with mbox format...done"))
@@ -2257,6 +2261,10 @@
       (setq n (1+ n))))
   (if (stringp attr)
       (error "Unknown attribute `%s'" attr))
+  ;; Ask for confirmation before setting any attribute except `unseen'
+  ;; if it would force a format change.
+  (unless (= attr rmail-unseen-attr-index)
+    (rmail-modify-format))
   (with-current-buffer rmail-buffer
     (or msgnum (setq msgnum rmail-current-message))
     (when (> msgnum 0)
@@ -2269,8 +2277,12 @@
             (if (= msgnum rmail-current-message)
                 (rmail-display-labels)))
          ;; Don't save in mbox format over a Babyl file
-         ;; merely because of this.
-         (rmail-dont-modify-format)))))
+         ;; merely because of a change in `unseen' attribute.
+         (if (= attr rmail-unseen-attr-index)
+             (rmail-dont-modify-format)
+           ;; Otherwise, if we modified the file text via the view buffer,
+           ;; mark the main buffer modified too.
+           (set-buffer-modified-p t))))))
 
 (defun rmail-message-attr-p (msg attrs)
   "Return non-nil if message number MSG has attributes matching regexp ATTRS."
@@ -3252,17 +3264,15 @@
       newnum)))
 
 (defun rmail-expunge-confirmed ()
-  "Return t if deleted message should be expunged. If necessary, ask the user.
-See also user-option `rmail-confirm-expunge'."
+  "Return t if expunge is needed and desirable.
+If `rmail-confirm-expunge' is non-nil, ask user to confirm."
   (set-buffer rmail-buffer)
-  ;; FIXME shouldn't this return nil if there is nothing to expunge?
-  ;; Eg to save rmail-expunge wasting its time?
-  (or (not (stringp rmail-deleted-vector))
-      (not (string-match "D" rmail-deleted-vector))
+  (and (stringp rmail-deleted-vector)
+       (string-match "D" rmail-deleted-vector)
       (if rmail-confirm-expunge
          (funcall rmail-confirm-expunge
                   "Erase deleted messages from Rmail file? ")
-       (progn (rmail-modify-format) t))))
+        t)))
 
 (defun rmail-only-expunge (&optional dont-show)
   "Actually erase all deleted messages in the file."
@@ -3357,6 +3367,7 @@
 does not pop any summary buffer."
   (interactive)
   (when (rmail-expunge-confirmed)
+    (rmail-modify-format)
     (let ((was-deleted (rmail-message-deleted-p rmail-current-message))
          (was-swapped (rmail-buffers-swapped-p)))
       (rmail-only-expunge t)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]