* When suggesting a file recovery, emacs should maybe check for actual changes
@ 2022-10-02 13:33 Andrea Monaco
2022-10-02 13:47 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Andrea Monaco @ 2022-10-02 13:33 UTC (permalink / raw)
To: emacs-devel
After an unclean shutdown, I opened a file, say main.c. Emacs said that
the file had auto-save data and suggested a recover-this-file. But upon
checking, #main.c# was byte-by-byte identical to main.c.
Maybe emacs should check that the auto-save file is not identical before
suggesting a recover-this-file. Do you agree?
Andrea Monaco
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When suggesting a file recovery, emacs should maybe check for actual changes
2022-10-02 13:33 When suggesting a file recovery, emacs should maybe check for actual changes Andrea Monaco
@ 2022-10-02 13:47 ` Eli Zaretskii
2022-10-02 14:08 ` Stefan Kangas
2022-10-02 14:09 ` Andrea Monaco
0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2022-10-02 13:47 UTC (permalink / raw)
To: Andrea Monaco; +Cc: emacs-devel
> From: Andrea Monaco <andrea.monaco@autistici.org>
> Date: Sun, 02 Oct 2022 15:33:23 +0200
>
>
> After an unclean shutdown, I opened a file, say main.c. Emacs said that
> the file had auto-save data and suggested a recover-this-file. But upon
> checking, #main.c# was byte-by-byte identical to main.c.
This generally happens only with plain-ASCII files. Non-ASCII files
are saved in auto-save files in the internal representation, which is
generally different from the bytestream in the original file.
> Maybe emacs should check that the auto-save file is not identical before
> suggesting a recover-this-file. Do you agree?
Why is it a problem that they are identical?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When suggesting a file recovery, emacs should maybe check for actual changes
2022-10-02 13:47 ` Eli Zaretskii
@ 2022-10-02 14:08 ` Stefan Kangas
2022-10-02 14:29 ` Eli Zaretskii
2022-10-02 14:09 ` Andrea Monaco
1 sibling, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2022-10-02 14:08 UTC (permalink / raw)
To: Eli Zaretskii, Andrea Monaco; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> Maybe emacs should check that the auto-save file is not identical before
>> suggesting a recover-this-file. Do you agree?
>
> Why is it a problem that they are identical?
Either the user or Emacs could verify that the files are identical.
Currently, the user has to do that work. If it was the other way
around, the user would not have to.
Maybe I'm missing something, but I believe that in that case Emacs
wouldn't even have to show a prompt. The recovery file could just be
deleted, as it doesn't contain anything new.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When suggesting a file recovery, emacs should maybe check for actual changes
2022-10-02 14:08 ` Stefan Kangas
@ 2022-10-02 14:29 ` Eli Zaretskii
2022-10-02 15:07 ` Stefan Kangas
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-10-02 14:29 UTC (permalink / raw)
To: Stefan Kangas; +Cc: andrea.monaco, emacs-devel
> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Sun, 2 Oct 2022 07:08:52 -0700
> Cc: emacs-devel@gnu.org
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> Maybe emacs should check that the auto-save file is not identical before
> >> suggesting a recover-this-file. Do you agree?
> >
> > Why is it a problem that they are identical?
>
> Either the user or Emacs could verify that the files are identical.
> Currently, the user has to do that work. If it was the other way
> around, the user would not have to.
>
> Maybe I'm missing something, but I believe that in that case Emacs
> wouldn't even have to show a prompt. The recovery file could just be
> deleted, as it doesn't contain anything new.
I'm asking if this is an important enough situation to add code that
could be buggy to a feature that basically must be 110% safe?
If the file is identical, restoring from it does no harm, does it?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When suggesting a file recovery, emacs should maybe check for actual changes
2022-10-02 14:29 ` Eli Zaretskii
@ 2022-10-02 15:07 ` Stefan Kangas
2022-10-02 15:31 ` Lars Ingebrigtsen
2022-10-02 15:49 ` Eli Zaretskii
0 siblings, 2 replies; 10+ messages in thread
From: Stefan Kangas @ 2022-10-02 15:07 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: andrea.monaco, emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
> I'm asking if this is an important enough situation to add code that
> could be buggy to a feature that basically must be 110% safe?
You're right that it sounds a bit scary on the face of it.
Maybe it's okay if we do it in Emacs 30, and add tests? Adding tests
would of course be good even if we don't make any changes.
> If the file is identical, restoring from it does no harm, does it?
No, but it's somewhat jarring. Especially with files that are not under
version control.
My usual response, if I care enough about the file, is to manually make
a copy, restore the file from Emacs, and then check the diff. Now that
I think about it, this suggests another nice feature to have would be to
show the diff directly from the Emacs prompt.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When suggesting a file recovery, emacs should maybe check for actual changes
2022-10-02 15:07 ` Stefan Kangas
@ 2022-10-02 15:31 ` Lars Ingebrigtsen
2022-10-02 15:53 ` Stefan Kangas
2022-10-02 15:49 ` Eli Zaretskii
1 sibling, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-02 15:31 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Eli Zaretskii, andrea.monaco, emacs-devel
Stefan Kangas <stefankangas@gmail.com> writes:
> My usual response, if I care enough about the file, is to manually make
> a copy, restore the file from Emacs, and then check the diff. Now that
> I think about it, this suggests another nice feature to have would be to
> show the diff directly from the Emacs prompt.
Yes, that would be very nice.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When suggesting a file recovery, emacs should maybe check for actual changes
2022-10-02 15:31 ` Lars Ingebrigtsen
@ 2022-10-02 15:53 ` Stefan Kangas
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Kangas @ 2022-10-02 15:53 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, andrea.monaco, emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Stefan Kangas <stefankangas@gmail.com> writes:
>
>> My usual response, if I care enough about the file, is to manually make
>> a copy, restore the file from Emacs, and then check the diff. Now that
>> I think about it, this suggests another nice feature to have would be to
>> show the diff directly from the Emacs prompt.
>
> Yes, that would be very nice.
I've opened Bug#58253 to track this feature request.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When suggesting a file recovery, emacs should maybe check for actual changes
2022-10-02 15:07 ` Stefan Kangas
2022-10-02 15:31 ` Lars Ingebrigtsen
@ 2022-10-02 15:49 ` Eli Zaretskii
1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2022-10-02 15:49 UTC (permalink / raw)
To: Stefan Kangas; +Cc: andrea.monaco, emacs-devel
> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Sun, 2 Oct 2022 08:07:33 -0700
> Cc: andrea.monaco@autistici.org, emacs-devel@gnu.org
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > I'm asking if this is an important enough situation to add code that
> > could be buggy to a feature that basically must be 110% safe?
>
> You're right that it sounds a bit scary on the face of it.
>
> Maybe it's okay if we do it in Emacs 30, and add tests? Adding tests
> would of course be good even if we don't make any changes.
Adding tests is always welcome. But the thing with safety belts is
that they are always important in edge cases that are hard to test.
I think it could be okay to compare plain-ASCII files to their
auto-save files (but even there we'd need to be aware of EOL
differences, which will almost always happen on Windows, for
example). I'd hesitate to do this with non-ASCII files.
> My usual response, if I care enough about the file, is to manually make
> a copy, restore the file from Emacs, and then check the diff. Now that
> I think about it, this suggests another nice feature to have would be to
> show the diff directly from the Emacs prompt.
Again, if you intend to run the Diff utility, it will show differences
due to encoding and EOL format.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When suggesting a file recovery, emacs should maybe check for actual changes
2022-10-02 13:47 ` Eli Zaretskii
2022-10-02 14:08 ` Stefan Kangas
@ 2022-10-02 14:09 ` Andrea Monaco
2022-10-02 14:30 ` Eli Zaretskii
1 sibling, 1 reply; 10+ messages in thread
From: Andrea Monaco @ 2022-10-02 14:09 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
> Why is it a problem that they are identical?
Because in that case there's nothing to recover, so emacs is suggesting
a meaningless operation; also, the user will needlessly worry about lost
data.
Andrea Monaco
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When suggesting a file recovery, emacs should maybe check for actual changes
2022-10-02 14:09 ` Andrea Monaco
@ 2022-10-02 14:30 ` Eli Zaretskii
0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2022-10-02 14:30 UTC (permalink / raw)
To: Andrea Monaco; +Cc: emacs-devel
> From: Andrea Monaco <andrea.monaco@autistici.org>
> Cc: emacs-devel@gnu.org
> Date: Sun, 02 Oct 2022 16:09:12 +0200
>
>
> > Why is it a problem that they are identical?
>
> Because in that case there's nothing to recover, so emacs is suggesting
> a meaningless operation; also, the user will needlessly worry about lost
> data.
Just restore the file, and all those problems is gone.
Why risk false negatives in a feature that must be 110% reliable?
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-10-02 15:53 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-02 13:33 When suggesting a file recovery, emacs should maybe check for actual changes Andrea Monaco
2022-10-02 13:47 ` Eli Zaretskii
2022-10-02 14:08 ` Stefan Kangas
2022-10-02 14:29 ` Eli Zaretskii
2022-10-02 15:07 ` Stefan Kangas
2022-10-02 15:31 ` Lars Ingebrigtsen
2022-10-02 15:53 ` Stefan Kangas
2022-10-02 15:49 ` Eli Zaretskii
2022-10-02 14:09 ` Andrea Monaco
2022-10-02 14:30 ` Eli Zaretskii
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.