bug-gnu-emacs
[Top][All Lists]
Advanced

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

Nasty rmail mbox saving bug in 21.1


From: Christopher Neufeld
Subject: Nasty rmail mbox saving bug in 21.1
Date: Sat, 23 Feb 2002 04:18:19 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

I just noticed a rather unfortunate bug in rmail in Emacs 21.1 which
has resulted in a significant quantity of lost email.  I have
rmail-delete-after-output set to 't, and I usually save messages in
mbox format.  (Note that this bug also affects users who have set
rmail-delete-after-output to nil, it just requires a bit more action
on the users' parts.)

I might receive several messages, and decide to save all of them to
the same file.  I generally type something like:
C-U 8 C-o

which saves the eight messages to a filename (prompted), and deletes
them from the rmail inbox.

Unfortunately, a bug in the mbox saving (but not in the rmail format
saving) results in the currently selected message being saved into the
file 8 times, then all eight messages being deleted.  Then, it's just
a simple rmail-summary-expunge followed by save-buffers-kill-emacs,
and the 7 unsaved messages are available only in the backup save file.
Do this once more, and they vanish forever as the backup save file is
overwritten.

The fix.  Well, the buggy operations occur within
rmail-summary-output, while the correct behaviour is observed in
rmail-summary-output-to-rmail-file.  These two functions ought to be
essentially identical, the first calling rmail-output where the second
calls rmail-output-to-rmail-file.  There is a block of code, used for
selecting the message to operate upon, which is entirely absent in the
buggy code.  This patch restores the correct behaviour on my system,
by restoring the symmetry between the two output functions.


--- 21.1/lisp/mail/rmailsum.el.orig     Fri Feb 22 22:40:30 2002
+++ 21.1/lisp/mail/rmailsum.el  Fri Feb 22 23:00:35 2002
@@ -1525,8 +1525,14 @@
    (progn (require 'rmailout)
          (list (rmail-output-read-file-name)
                (prefix-numeric-value current-prefix-arg))))
-  (let ((i 0))
-    (while (< i n)
+  (let ((i 0) prev-msg)
+    (while
+       (and (< i n)
+            (progn (rmail-summary-goto-msg)
+                   (not (eq prev-msg
+                            (setq prev-msg
+                                  (with-current-buffer rmail-buffer
+                                    rmail-current-message))))))
       (setq i (1+ i))
       (with-current-buffer rmail-buffer
        (let ((rmail-delete-after-output nil))



Of course, the .elc file should be updated after this, with
byte-compile-file.


-- 
 Christopher Neufeld                 address@hidden
 Home page:  http://caliban.physics.utoronto.ca/neufeld/Intro.html
 "Don't edit reality for the sake of simplicity"



reply via email to

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