all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Francesco Potortì" <pot@gnu.org>
Cc: 31271@debbugs.gnu.org
Subject: bug#31271: 25.2; exported deleted RMAIL emails should have theit deleted flag reset
Date: Sat, 19 May 2018 12:40:14 +0300	[thread overview]
Message-ID: <83o9hcgf0h.fsf@gnu.org> (raw)
In-Reply-To: <E1fBfzM-0005HV-WC@tucano.isti.cnr.it> (message from Francesco Potortì on Thu, 26 Apr 2018 14:27:04 +0200)

> Date: Thu, 26 Apr 2018 14:27:04 +0200
> From: Francesco Potortì <pot@gnu.org>
> 
> 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
 		 regexp)
   :group 'rmail-output)
 
+(defcustom rmail-output-reset-deleted-flag nil
+  "Non-nil means reset the \"deleted\" flag when outputting a message to a file."
+  :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))





  parent reply	other threads:[~2018-05-19  9:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 12:27 bug#31271: 25.2; exported deleted RMAIL emails should have theit deleted flag reset Francesco Potortì
2018-04-26 21:04 ` Richard Stallman
2018-05-19  9:40 ` Eli Zaretskii [this message]
2018-06-02 10:08   ` Eli Zaretskii
2018-06-04 16:59     ` Francesco Potortì
2018-06-05 14:59       ` Eli Zaretskii
2018-06-05 16:13         ` Francesco Potortì
2018-06-09  8:05           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83o9hcgf0h.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=31271@debbugs.gnu.org \
    --cc=pot@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.