From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#31271: 25.2; exported deleted RMAIL emails should have theit deleted flag reset Date: Sat, 19 May 2018 12:40:14 +0300 Message-ID: <83o9hcgf0h.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1526722747 16715 195.159.176.226 (19 May 2018 09:39:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 19 May 2018 09:39:07 +0000 (UTC) Cc: 31271@debbugs.gnu.org To: Francesco =?UTF-8?Q?Potort=C3=AC?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 19 11:39:03 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJyKL-0004DT-W3 for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 May 2018 11:39:02 +0200 Original-Received: from localhost ([::1]:42383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJyMT-0007bb-15 for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 May 2018 05:41:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJyMM-0007bV-0N for bug-gnu-emacs@gnu.org; Sat, 19 May 2018 05:41:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJyMI-00086X-Ou for bug-gnu-emacs@gnu.org; Sat, 19 May 2018 05:41:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60829) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJyMI-00086J-Kf for bug-gnu-emacs@gnu.org; Sat, 19 May 2018 05:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fJyMI-0000BB-1J for bug-gnu-emacs@gnu.org; Sat, 19 May 2018 05:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 May 2018 09:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31271 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31271-submit@debbugs.gnu.org id=B31271.1526722830644 (code B ref 31271); Sat, 19 May 2018 09:41:01 +0000 Original-Received: (at 31271) by debbugs.gnu.org; 19 May 2018 09:40:30 +0000 Original-Received: from localhost ([127.0.0.1]:40493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJyLm-0000AJ-AV for submit@debbugs.gnu.org; Sat, 19 May 2018 05:40:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJyLl-0000A8-9x for 31271@debbugs.gnu.org; Sat, 19 May 2018 05:40:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJyLf-0007y4-A1 for 31271@debbugs.gnu.org; Sat, 19 May 2018 05:40:24 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43239) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJyLY-0007t2-R2; Sat, 19 May 2018 05:40:16 -0400 Original-Received: from [176.228.60.248] (port=2041 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fJyLY-0004vQ-5n; Sat, 19 May 2018 05:40:16 -0400 In-reply-to: (message from Francesco =?UTF-8?Q?Potort=C3=AC?= on Thu, 26 Apr 2018 14:27:04 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146289 Archived-At: > Date: Thu, 26 Apr 2018 14:27:04 +0200 > From: Francesco Potortì > > 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))