all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* "Rmail": Key "o" sometimes marks wrong mail as deleted
@ 2024-06-11 15:28 Dr Rainer Woitok
  2024-06-11 15:43 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dr Rainer Woitok @ 2024-06-11 15:28 UTC (permalink / raw)
  To: Help-Gnu-Emacs

Greetings,

In my "Rmail" configuration file  I have set "rmail-delete-after-output"
to t.

When the summary buffer is active  and I run "o target"  on a mail which
is not the last in the summary buffer, the current mail is correctly co-
pied to the target mail folder, but in the summary buffer the mail AFTER
the current mail is marked as deleted.

When I do the same  while the message buffer is active,  the COPIED mail
is correctly marked as deleted in the summary buffer.

Is this a bug or a feature?  I'm on Emacs 28.2, in case that matters.

Sincerely,
  Rainer



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "Rmail": Key "o" sometimes marks wrong mail as deleted
  2024-06-11 15:28 "Rmail": Key "o" sometimes marks wrong mail as deleted Dr Rainer Woitok
@ 2024-06-11 15:43 ` Eli Zaretskii
  2024-06-12 11:27   ` Dr Rainer Woitok
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-06-11 15:43 UTC (permalink / raw)
  To: Help-Gnu-Emacs

> From: Dr Rainer Woitok <rainer.woitok@gmail.com>
> Date: Tue, 11 Jun 2024 17:28:27 +0200
> 
> In my "Rmail" configuration file  I have set "rmail-delete-after-output"
> to t.
> 
> When the summary buffer is active  and I run "o target"  on a mail which
> is not the last in the summary buffer, the current mail is correctly co-
> pied to the target mail folder, but in the summary buffer the mail AFTER
> the current mail is marked as deleted.
> 
> When I do the same  while the message buffer is active,  the COPIED mail
> is correctly marked as deleted in the summary buffer.
> 
> Is this a bug or a feature?  I'm on Emacs 28.2, in case that matters.

I cannot reproduce this buggy behavior, neither in Emacs 28.2 nor in
Emacs 29.

Do you see this in "emacs -Q"?  If not, then some of your
customizations cause this somehow.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "Rmail": Key "o" sometimes marks wrong mail as deleted
  2024-06-11 15:43 ` Eli Zaretskii
@ 2024-06-12 11:27   ` Dr Rainer Woitok
  2024-06-12 11:56     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dr Rainer Woitok @ 2024-06-12 11:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Help-Gnu-Emacs

Eli,

On Tue, 11 Jun 2024 18:43:12 +0300 you wrote:

> ...
> I cannot reproduce this buggy behavior, neither in Emacs 28.2 nor in
> Emacs 29.
> 
> Do you see this in "emacs -Q"?

Yes.   At least when I load my personal "Rmail" configuration.   So I've
bisected my  variable definitions  and found the culprit  to be variable
"rmail-output-reset-deleted-flag".   If it also has a non-nil value (to-
gether with variable "rmail-delete-after-output") and the summary buffer
is selected,  rather than the current  the following mail  (if existing)
will reliably be marked deleted.

My reading of the "rmail-output-reset-deleted-flag" docstring was a mail
marked as deleted will be stored in a target mail folder without "delet-
ed" flag and of the docstring of "rmail-delete-after-output" that a mail
is either moved or copied  to the target folder.   But somehow these two
concepts seem to subtly interfere.

Sincerely,
  Rainer



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "Rmail": Key "o" sometimes marks wrong mail as deleted
  2024-06-12 11:27   ` Dr Rainer Woitok
@ 2024-06-12 11:56     ` Eli Zaretskii
  2024-06-13  8:24       ` Dr Rainer Woitok
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-06-12 11:56 UTC (permalink / raw)
  To: Help-Gnu-Emacs

> From: Dr Rainer Woitok <rainer.woitok@gmail.com>
> Date: Wed, 12 Jun 2024 13:27:30 +0200
> Cc: Help-Gnu-Emacs@Gnu.Org
> 
> > I cannot reproduce this buggy behavior, neither in Emacs 28.2 nor in
> > Emacs 29.
> > 
> > Do you see this in "emacs -Q"?
> 
> Yes.   At least when I load my personal "Rmail" configuration.   So I've
> bisected my  variable definitions  and found the culprit  to be variable
> "rmail-output-reset-deleted-flag".   If it also has a non-nil value (to-
> gether with variable "rmail-delete-after-output") and the summary buffer
> is selected,  rather than the current  the following mail  (if existing)
> will reliably be marked deleted.

Ah, okay.  This bug is already fixed in Emacs 29, so when you upgrade
your Emacs, you will be free from it.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "Rmail": Key "o" sometimes marks wrong mail as deleted
  2024-06-12 11:56     ` Eli Zaretskii
@ 2024-06-13  8:24       ` Dr Rainer Woitok
  2024-06-13  8:39         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dr Rainer Woitok @ 2024-06-13  8:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Help-Gnu-Emacs

Eli,

On Wed, 12 Jun 2024 14:56:51 +0300 you said;

> ...
> Ah, okay.  This bug is already fixed in Emacs 29, so when you upgrade
> your Emacs, you will be free from it.

Currently I can't upgrade to Emacs 29  because in my current environment
Emacs 29 ignores or misinterprets any "--geometry" specifications on the
command line,  while Emacs 28.2  is correctly following them.   I'm cur-
rently trying to find out  which other software components  might be in-
volved.

So is there a chance that this patch is backported to Emacs 28.2?

Sincerely,
  Rainer



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "Rmail": Key "o" sometimes marks wrong mail as deleted
  2024-06-13  8:24       ` Dr Rainer Woitok
@ 2024-06-13  8:39         ` Eli Zaretskii
  2024-06-13 15:48           ` Dr Rainer Woitok
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-06-13  8:39 UTC (permalink / raw)
  To: Help-Gnu-Emacs

> From: Dr Rainer Woitok <rainer.woitok@gmail.com>
> Date: Thu, 13 Jun 2024 10:24:50 +0200
> Cc: Help-Gnu-Emacs@Gnu.Org
> 
> On Wed, 12 Jun 2024 14:56:51 +0300 you said;
> 
> > ...
> > Ah, okay.  This bug is already fixed in Emacs 29, so when you upgrade
> > your Emacs, you will be free from it.
> 
> Currently I can't upgrade to Emacs 29  because in my current environment
> Emacs 29 ignores or misinterprets any "--geometry" specifications on the
> command line,  while Emacs 28.2  is correctly following them.   I'm cur-
> rently trying to find out  which other software components  might be in-
> volved.
> 
> So is there a chance that this patch is backported to Emacs 28.2?

We no longer maintain the emacs-28 branch, but you could try
installing locally the patch below, which I think fixed this:

diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
index 49531ea..cfde335 100644
--- a/lisp/mail/rmailout.el
+++ b/lisp/mail/rmailout.el
@@ -579,7 +579,7 @@ rmail-output
                      (progn
                        (if rmail-delete-after-output
                            (rmail-delete-message))
-                       (if (> count 0)
+                       (if (>= count 0)
                            (let ((msgnum rmail-current-message))
                              (rmail-next-message 1)
                              (eq rmail-current-message (1+ msgnum)))))



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: "Rmail": Key "o" sometimes marks wrong mail as deleted
  2024-06-13  8:39         ` Eli Zaretskii
@ 2024-06-13 15:48           ` Dr Rainer Woitok
  2024-06-13 16:04             ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dr Rainer Woitok @ 2024-06-13 15:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Help-Gnu-Emacs

Eli,

On Thu, 13 Jun 2024 11:39:17 +0300 you wrote:

> ...
>                                                you could try
> installing locally the patch below, which I think fixed this:
> 
> diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
> index 49531ea..cfde335 100644
> --- a/lisp/mail/rmailout.el
> +++ b/lisp/mail/rmailout.el
> @@ -579,7 +579,7 @@ rmail-output
>                       (progn
>                         (if rmail-delete-after-output
>                             (rmail-delete-message))
> -                       (if (> count 0)
> +                       (if (>= count 0)
>                             (let ((msgnum rmail-current-message))
>                               (rmail-next-message 1)
>                               (eq rmail-current-message (1+ msgnum)))))

This will  definitely not fix  the misbehaviour I reported,  because the
new line "(if (>= count 0)" is already in my 28.2 source file.

Sincerely,
  Rainer



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "Rmail": Key "o" sometimes marks wrong mail as deleted
  2024-06-13 15:48           ` Dr Rainer Woitok
@ 2024-06-13 16:04             ` Eli Zaretskii
  2024-06-14 16:36               ` Dr Rainer Woitok
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-06-13 16:04 UTC (permalink / raw)
  To: Help-Gnu-Emacs

> From: Dr Rainer Woitok <rainer.woitok@gmail.com>
> Date: Thu, 13 Jun 2024 17:48:33 +0200
> Cc: Help-Gnu-Emacs@Gnu.Org
> 
> > diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
> > index 49531ea..cfde335 100644
> > --- a/lisp/mail/rmailout.el
> > +++ b/lisp/mail/rmailout.el
> > @@ -579,7 +579,7 @@ rmail-output
> >                       (progn
> >                         (if rmail-delete-after-output
> >                             (rmail-delete-message))
> > -                       (if (> count 0)
> > +                       (if (>= count 0)
> >                             (let ((msgnum rmail-current-message))
> >                               (rmail-next-message 1)
> >                               (eq rmail-current-message (1+ msgnum)))))
> 
> This will  definitely not fix  the misbehaviour I reported,  because the
> new line "(if (>= count 0)" is already in my 28.2 source file.

I'm just stabbing in the dark, you know.  I have no magic wands, just
comparing relevant Rmail source files.

Maybe this one, then?

diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index ba58090..21dec2b 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -1931,7 +1931,7 @@ rmail-summary-output
    (progn (require 'rmailout)
 	  (list (rmail-output-read-file-name)
 		(prefix-numeric-value current-prefix-arg))))
-  (let ((i 0) prev-msg)
+  (let ((i 0) prev-msg curmsg)
     (while
 	(and (< i n)
 	     (progn (rmail-summary-goto-msg)
@@ -1942,7 +1942,11 @@ rmail-summary-output
       (setq i (1+ i))
       (with-current-buffer rmail-buffer
 	(let ((rmail-delete-after-output nil))
+          (setq curmsg rmail-current-message)
 	  (rmail-output file-name 1)))
+      ;; rmail-output sometimes moves to the next message; undo that.
+      (or (= curmsg (rmail-summary-msg-number))
+          (rmail-summary-goto-msg curmsg))
       (if rmail-delete-after-output
 	  (rmail-summary-delete-forward nil)
 	(if (< i n)



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: "Rmail": Key "o" sometimes marks wrong mail as deleted
  2024-06-13 16:04             ` Eli Zaretskii
@ 2024-06-14 16:36               ` Dr Rainer Woitok
  0 siblings, 0 replies; 9+ messages in thread
From: Dr Rainer Woitok @ 2024-06-14 16:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Help-Gnu-Emacs

Eli,

On Thu, 13 Jun 2024 19:04:19 +0300 you wrote:

> ...
> I'm just stabbing in the dark, you know.  I have no magic wands, just
> comparing relevant Rmail source files.
> 
> Maybe this one, then?

Yes, this one seems very promising.  Since I'm currently running "Rmail"
with "rmail-output-reset-deleted-flag"  set to nil,  I don't really NEED
that patch, but when I will have some spare time, I will try it.  Thanks
a lot :-)

Sincerely,
  Rainer



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-06-14 16:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-11 15:28 "Rmail": Key "o" sometimes marks wrong mail as deleted Dr Rainer Woitok
2024-06-11 15:43 ` Eli Zaretskii
2024-06-12 11:27   ` Dr Rainer Woitok
2024-06-12 11:56     ` Eli Zaretskii
2024-06-13  8:24       ` Dr Rainer Woitok
2024-06-13  8:39         ` Eli Zaretskii
2024-06-13 15:48           ` Dr Rainer Woitok
2024-06-13 16:04             ` Eli Zaretskii
2024-06-14 16:36               ` Dr Rainer Woitok

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.