[Top][All Lists]

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

bug#31271: 25.2; exported deleted RMAIL emails should have theit deleted

From: Eli Zaretskii
Subject: bug#31271: 25.2; exported deleted RMAIL emails should have theit deleted flag reset
Date: Sat, 19 May 2018 12:40:14 +0300

> Date: Thu, 26 Apr 2018 14:27:04 +0200
> From: Francesco Potortì <address@hidden>
> In Rmail, suppose you want to archive your last received email to two
> different mboxes.  Then you 'o' to the first one, then 'o' to the second
> one.  After the first one, the email is marked as filed, deleted.
> I argue that the 'deleted' flag should be reset when archiving the email
> to the second mbox.

Does the patch below give good results?  I didn't feel like changing
the default behavior, on account of it being so old, so I added an
option one can customize to get the new behavior.

What about invoking 'o' with a prefix argument -- should it stop
ignoring deleted messages when it looks for the N-1 additional
messages to output to a file, when this option is set non-nil?

diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
index eee8805..6d91ac5 100644
--- a/lisp/mail/rmailout.el
+++ b/lisp/mail/rmailout.el
@@ -56,6 +56,13 @@ rmail-fields-not-to-output
   :group 'rmail-output)
+(defcustom rmail-output-reset-deleted-flag nil
+  "Non-nil means reset the \"deleted\" flag when outputting a message to a 
+  :type '(choice (const :tag "Output with the \"deleted\" flag reset" t)
+                 (const :tag "Output with the \"deleted\" flag intact" nil))
+  :version "27.1"
+  :group 'rmail-output)
 (defun rmail-output-read-file-name ()
   "Read the file name to use for `rmail-output'.
 Set `rmail-default-file' to this name as well as returning it.
@@ -533,8 +540,12 @@ rmail-output
       (if (zerop rmail-total-messages)
          (error "No messages to output"))
       (let ((orig-count count)
-           beg end)
+           beg end delete-attr-reset-p)
        (while (> count 0)
+          (when (and rmail-output-reset-deleted-flag
+                     (rmail-message-deleted-p rmail-current-message))
+            (rmail-set-attribute rmail-deleted-attr-index nil)
+            (setq delete-attr-reset-p t))
          (setq beg (rmail-msgbeg rmail-current-message)
                end (rmail-msgend rmail-current-message))
          ;; All access to the buffer's local variables is now finished...
@@ -549,6 +560,8 @@ rmail-output
                (if babyl-format
                    (rmail-output-as-babyl file-name noattribute)
                  (rmail-output-as-mbox file-name noattribute)))))
+          (if delete-attr-reset-p
+              (rmail-set-attribute rmail-deleted-attr-index t))
          (or noattribute               ; mark message as "filed"
              (rmail-set-attribute rmail-filed-attr-index t))
          (setq count (1- count))

reply via email to

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