Subject: bug#46463: 27.1; rmailout glitch

From: Francesco Potortì <[email-masked]>
Date: Mon, 15 Feb 2021 17:19:19 +0100

>> From: Francesco Potortì <[email-masked]>
>> Date: Mon, 15 Feb 2021 12:26:09 +0100
>> Cc: [email-masked]
>> 
>> emacs -Q -nw
>> M-x load-library RET /tmp/bug.el RET
>> C-u M-x rmail RET /tmp/RMAILbug RET	<-- looking at message #3
>> C-d 	      	  			<-- looking at message #2
>> o /tmp/a RET				<-- looking at message #3
>> 
>> After the last command I should get a message saying that no more
>> undeleted messages are there, and be looking at message #2, however I
>> get no message and I am looking a message #3.
>
>So the problem is that you don't get the message about no following
>undeleted message?  Or is something else the problem?

>Regarding the lack of message, I'm not sure this is a bug: since you
>set rmail-output-reset-deleted-flag non-nil, Rmail no longer tries to
>get to the next undeleted message, it instead gets to the next
>message, whether deleted or not.

>				   The doc string of rmail-output says:
>
>  Optional prefix argument COUNT (default 1) says to output that
>  many consecutive messages, starting with the current one (ignoring
>  deleted messages, unless `rmail-output-reset-deleted-flag' is
>  non-nil).         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  ^^^^^^^

Hm.  This is not the semantics I had intended when I first suggested
adding that flag.  In my proposed implementation (which was rejected
probably because it did not cover all cases, I do not recall for sure)
the only effect of rmail-output-reset-deleted-flag was on the output
file, it did not change anything on the current file or the behaviour of
the commands.

Since current message #2 is being deleted, and the subsequent message $3
is already deleted, I expect the same that happens when pressing 'd'
on message #2:

1) get a message saying that there is no further undeleted message
2) stay on the same message

Instead, the current message #2 is deleted and I am shown message #3.
This should happen only if message #3 was not deleted.

What the flag should do is to reset the flag when writing the message to
the output file (it should not affect the flag on the original mail
file).

In this case, since rmail-delete-after-output is t, 1) and 2) should
happen.  In fact, they do happen if rmail-output-reset-deleted-flag is
nil.

>Why it is a problem for you that Rmail goes to the very next message
>in this situation?

Because I want 'o' to work the same (as far as the current mail file is
regarded) independent of the setting of rmail-output-reset-deleted-flag.
The only difference in behaviour should be whether the deleted flag is
set in the message copy that goes in the output file.