unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Unseen attribute doesn't get saved in rmail
@ 2020-12-31 14:03 Andrea G. Monaco
  2020-12-31 16:31 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Andrea G. Monaco @ 2020-12-31 14:03 UTC (permalink / raw)
  To: emacs-devel

Hello everyone,


there's a behavior in rmail I can't quite understand.
I never delete my mail, I just read it. So here's the problem: when some
messages are read and marked as such, the modified flag of the RMAIL
buffer apparently stays cleared, so Emacs doesn't offer to save it when I
close the editor.
This way I lose track of read mail every time.

I think these are the relevant lines in rmail.el inside
rmail-show-message-1: 


  ;; Mark the message as seen, but preserve buffer modified flag.
  (let ((modiff (buffer-modified-p)))
    (rmail-set-attribute rmail-unseen-attr-index nil)
    (unless modiff
      (restore-buffer-modified-p modiff)))


So the modified flag is explicitly cleared after reading a new message.
Is there some reason I can't see for this behavior? Maybe we could add a
configuration option to let the user choose.


Let me know,
Andrea Monaco



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

* Re: Unseen attribute doesn't get saved in rmail
  2020-12-31 14:03 Andrea G. Monaco
@ 2020-12-31 16:31 ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2020-12-31 16:31 UTC (permalink / raw)
  To: Andrea G. Monaco; +Cc: emacs-devel

> From: "Andrea G. Monaco" <andrea.monaco@autistici.org>
> Date: Thu, 31 Dec 2020 15:03:54 +0100
> 
>   ;; Mark the message as seen, but preserve buffer modified flag.
>   (let ((modiff (buffer-modified-p)))
>     (rmail-set-attribute rmail-unseen-attr-index nil)
>     (unless modiff
>       (restore-buffer-modified-p modiff)))
> 
> So the modified flag is explicitly cleared after reading a new message.
> Is there some reason I can't see for this behavior? Maybe we could add a
> configuration option to let the user choose.

I think you can use rmail-show-message-hook to call a function that
sets the buffer's modified flag, then reading a message will leave
that set.



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

* Re: Unseen attribute doesn't get saved in rmail
@ 2021-01-02 20:05 Andrea G. Monaco
  2021-01-02 20:20 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Andrea G. Monaco @ 2021-01-02 20:05 UTC (permalink / raw)
  To: emacs-devel


  > I think you can use rmail-show-message-hook to call a function that
  > sets the buffer's modified flag, then reading a message will leave
  > that set.


Thanks, I didn't know about that hook.

But I wonder if that workaround is enough: I saw that the hook is called
at the end of the function rmail-show-message-1, but after the snippet
that I posted the information I care about is lost: we don't know if the
mail was just read for the first time or not; so we can't set the
modified flag meaningfully.

Is that correct?


Andrea Monaco



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

* Re: Unseen attribute doesn't get saved in rmail
  2021-01-02 20:05 Unseen attribute doesn't get saved in rmail Andrea G. Monaco
@ 2021-01-02 20:20 ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2021-01-02 20:20 UTC (permalink / raw)
  To: Andrea G. Monaco; +Cc: emacs-devel

> From: "Andrea G. Monaco" <andrea.monaco@autistici.org>
> Date: Sat, 02 Jan 2021 21:05:26 +0100
> 
> But I wonder if that workaround is enough: I saw that the hook is called
> at the end of the function rmail-show-message-1, but after the snippet
> that I posted the information I care about is lost: we don't know if the
> mail was just read for the first time or not; so we can't set the
> modified flag meaningfully.

Why does it matter for your purposes?



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

* Re: Unseen attribute doesn't get saved in rmail
@ 2021-01-08 21:33 Andrea G. Monaco
  2021-01-09  7:44 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Andrea G. Monaco @ 2021-01-08 21:33 UTC (permalink / raw)
  To: emacs-devel


  > Why does it matter for your purposes?


I usually don't delete my mail, I just read it, so it's important for me
to keep track of read mail. For this use case, which I think is pretty
common, clearing the unseen flag in a message should set the modified
flag for the RMAIL buffer.

Otherwise I have to manually set the flag in order to save the file, if
I understand correctly. That seems like an unnecessary workaround.


Warmly,
Andrea Monaco




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

* Re: Unseen attribute doesn't get saved in rmail
  2021-01-08 21:33 Andrea G. Monaco
@ 2021-01-09  7:44 ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2021-01-09  7:44 UTC (permalink / raw)
  To: Andrea G. Monaco; +Cc: emacs-devel

> From: "Andrea G. Monaco" <andrea.monaco@autistici.org>
> Date: Fri, 08 Jan 2021 22:33:14 +0100
> 
> 
>   > Why does it matter for your purposes?
> 
> I usually don't delete my mail, I just read it, so it's important for me
> to keep track of read mail. For this use case, which I think is pretty
> common, clearing the unseen flag in a message should set the modified
> flag for the RMAIL buffer.
> 
> Otherwise I have to manually set the flag in order to save the file, if
> I understand correctly. That seems like an unnecessary workaround.

That's not what I asked about.  You are describing your original
motivation for raising this issue, but I was specifically asking about
this part of your response to my proposal of a solution:

> But I wonder if that workaround is enough: I saw that the hook is called
> at the end of the function rmail-show-message-1, but after the snippet
> that I posted the information I care about is lost: we don't know if the
> mail was just read for the first time or not; so we can't set the
> modified flag meaningfully.

I'm asking why is it important for your purposes to know whether the
mail was read for the first time or not.  Because if it isn't very
important, the solution I proposed should work for you.

In general, your use case is very unusual one, so much so that I was
originally certain that's not the behavior I see, because I never read
any batch of new messages without deleting or filing away at least one
of them.  That's the reason Rmail doesn't already have the feature you
want: I guess no one else uses it as you do.  (It means, btw, that
your inbox is growing without limitation, which is also not a good
idea.)



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

* Re: Unseen attribute doesn't get saved in rmail
@ 2021-01-11 12:28 Andrea G. Monaco
  2021-01-11 15:34 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Andrea G. Monaco @ 2021-01-11 12:28 UTC (permalink / raw)
  To: emacs-devel


  > I'm asking why is it important for your purposes to know whether the
  > mail was read for the first time or not.  Because if it isn't very
  > important, the solution I proposed should work for you.

My mailboxes get pretty big, some gigabytes usually, so saving the
buffer takes some seconds. I only want to save it if it got modified, for
example because I read some messages for the first time and thus changed
their unseen flag.


  > That's the reason Rmail doesn't already have the feature you
  > want: I guess no one else uses it as you do

Some features are more or less used than others. But saying that some
use case is completely nonexistent is pretty strong: can you
substantiate this claim?  Unless you are arguing that a feature being
absent means that no one wants it: I would obviously disagree with that
claim.

There's at least one person (probably more) who is unhappy with that
behavior of rmail, and that's me.


Cheers,
Andrea Monaco



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

* Re: Unseen attribute doesn't get saved in rmail
  2021-01-11 12:28 Andrea G. Monaco
@ 2021-01-11 15:34 ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2021-01-11 15:34 UTC (permalink / raw)
  To: Andrea G. Monaco; +Cc: emacs-devel

> From: "Andrea G. Monaco" <andrea.monaco@autistici.org>
> Date: Mon, 11 Jan 2021 13:28:30 +0100
> 
>   > I'm asking why is it important for your purposes to know whether the
>   > mail was read for the first time or not.  Because if it isn't very
>   > important, the solution I proposed should work for you.
> 
> My mailboxes get pretty big, some gigabytes usually, so saving the
> buffer takes some seconds. I only want to save it if it got modified, for
> example because I read some messages for the first time and thus changed
> their unseen flag.

I see.

>   > That's the reason Rmail doesn't already have the feature you
>   > want: I guess no one else uses it as you do
> 
> Some features are more or less used than others. But saying that some
> use case is completely nonexistent is pretty strong: can you
> substantiate this claim?  Unless you are arguing that a feature being
> absent means that no one wants it: I would obviously disagree with that
> claim.
> 
> There's at least one person (probably more) who is unhappy with that
> behavior of rmail, and that's me.

Please don't interpret "no one" too literally.

The reason we don't already have this is that your use of the inbox is
unusual, and doesn't really scale well: once you hit gigabyte-level
size, you risk bumping into a situation where you don't have enough
memory on your system for Emacs to visit the inbox.  And, as you say,
you already suffer from prolonged save times.

That said, I won't object having a feature that will allow you to use
Rmail that way, so please feel free to submit a feature-request bug
report using "M-x report-emacs-bug".



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

end of thread, other threads:[~2021-01-11 15:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-02 20:05 Unseen attribute doesn't get saved in rmail Andrea G. Monaco
2021-01-02 20:20 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2021-01-11 12:28 Andrea G. Monaco
2021-01-11 15:34 ` Eli Zaretskii
2021-01-08 21:33 Andrea G. Monaco
2021-01-09  7:44 ` Eli Zaretskii
2020-12-31 14:03 Andrea G. Monaco
2020-12-31 16:31 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).