After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 575242 - New composer window not autosaved until modification
New composer window not autosaved until modification
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Mailer
2.30.x (obsolete)
Other All
: Normal minor
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
evolution[composer]
Depends on:
Blocks:
 
 
Reported: 2009-03-13 12:34 UTC by Michel Dänzer
Modified: 2015-06-04 19:43 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
Possible fix (476 bytes, patch)
2009-03-13 12:35 UTC, Michel Dänzer
reviewed Details | Review
Only autosave populated composers (3.89 KB, patch)
2009-05-01 08:13 UTC, Michel Dänzer
committed Details | Review

Description Michel Dänzer 2009-03-13 12:34:19 UTC
Please describe the problem:
When opening a new composer window, e.g. with ctrl(-shift)-R, it is not autosaved until something in it is modified. As a result, the composer window will not be restored after a restart of Evolution, e.g. after a crash.

I will attach a patch which fixes this. The patch still leaves a window of up to one minute until the next autosave run; I think ideally the new composer should be autosaved once immediately, but I'll leave that to the Evolution developers.

Steps to reproduce:
1. Open a new composer window
2. Don't make any modifications in it


Actual results:
No ~/.evolution/.evolution-composer.autosave-* file appears for it after any amount of time.

Expected results:


Does this happen every time?
Yes

Other information:
Comment 1 Michel Dänzer 2009-03-13 12:35:37 UTC
Created attachment 130582 [details] [review]
Possible fix

This just removes the composer dirty check from e_composer_autosave_snapshot().
Comment 2 Matthew Barnes 2009-03-13 13:30:38 UTC
It might be nice to distinguish whether new composer windows are seeded with initial text (via reply, forward, or "Edit as New Message") before auto-saving immediately, so we're not restoring blank composer windows.
Comment 3 Michel Dänzer 2009-03-13 13:54:10 UTC
Indeed it might, though OTOH even a blank composer window could serve as a reminder that one meant to write some mail to someone. :)
Comment 4 Michel Dänzer 2009-03-25 10:54:58 UTC
So, is there any chance for something like this to go into 2.26.x? Anything I need to do for that?
Comment 5 Matthew Barnes 2009-03-30 12:14:25 UTC
I still don't want blank windows to be auto-saved.

Looks like new composer windows that are seeded with initial text are initially marked dirty by EMsgComposer, but then we revert that in em-composer-utils.c through composer_set_no_change().  Might try adding a boolean parameter that controls whether we call e_composer_autosave_set_saved(), and pass FALSE from the appropriate places (or just kill the function and inline the logic).

I think that should get you the right behavior.
Comment 6 Michel Dänzer 2009-05-01 08:13:59 UTC
Created attachment 133722 [details] [review]
Only autosave populated composers

This should do what you suggested. I verified it doesn't autosave an unmodified empty composer window but does autosave an unmodified reply.
Comment 7 Matthew Barnes 2009-05-01 13:11:27 UTC
I'd suggest renaming the function argument from "call_editor" to something like "set_changed", but otherwise it looks good.  Please commit to master only, or I can if you don't have a GNOME account.
Comment 8 Michel Dänzer 2009-05-01 13:19:25 UTC
(In reply to comment #7)
> I'd suggest renaming the function argument from "call_editor" to something like
> "set_changed", but otherwise it looks good.  Please commit to master only, or I
> can if you don't have a GNOME account.

I don't, so I'd appreciate if you could push it with the change above, thanks.

Do you think this could be appropriate for the 2.26 branch as well?
Comment 9 Matthew Barnes 2009-05-01 13:53:33 UTC
No problem, I'll take care of it.  Looks safe enough for the 2.26 branch.
Comment 11 Michel Dänzer 2010-03-31 12:24:09 UTC
This bug is back in 2.29.92.1, at least when replying: there's no autosave file until I change something in the composer.
Comment 12 Michel Dänzer 2010-04-26 14:55:21 UTC
AFAICT this was reintroduced by commit abc690c6ff4215f77e41f3cc779435746be7ca88, the fix for bug 599794. Maybe the dirty state just needs to be tracked completely separately for drafts and autosaves, as was done in my original patches for bug 220672 (the latest patches proposed there don't fix this problem).
Comment 13 Milan Crha 2015-06-04 19:43:15 UTC
The composer autosave module code says this:
       /* User may have reverted or explicitly saved
        * the changes since the timeout was scheduled. */
and below it checks whether to save or not based on the stored 'changed' flag from the last try on the composer. I do not think it's correct, because if the user explicitly saves the message then the autosaved will contain an old version. I removed this private flag from the autosave code, and it also causes autosave of empty mail and replies and such.

Created commit bd0ace7 in evo master (3.17.3+)
Created commit 5a6f460 in evo gnome-3-16 (3.16.3+)