emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] show difference when recovering file


From: Ivan Kanis
Subject: Re: [PATCH] show difference when recovering file
Date: Mon, 17 Dec 2012 17:04:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <address@hidden> wrote:

>>> There's a problem here: the autosave file is saved using the internal
>>> coding-system (so it always succeeds, no matter what weird mix of
>>> characters happens to be currently in the buffer), where the
>>> non-autosave file will use the encoding which happens to be in use for
>>> this file.
>> Is it possible to open the non-autosave file in the internal format just
>> to run the diff? I guess not.
>
> There's no "open"ing involved: the two files are passed to `diff' and
> that's that.  So, to fix the problem, we have to load the non-autoload
> file, save it using the internal-encoding into a new temporary file, and
> then pass this file to diff.
>
> BTW, the "save-to-temp and then diff" is called `diff-buffer-with-file'.
>

OK I understand.

>>> So the diff may show lots of spurious changes.
>> I think it's a borderline case. It's more useful to see what the
>> difference is between the two files even though on rare occasion the
>> diff will show garbage
>
> I'd rather do it right.

Me too.

> BTW, the way the user can do it currently, is to say "yes" to recover,
> and then use M-x diff-buffer-with-file RET to decide whether or not
> recovering is a good idea.

It's too convoluted for me, I never remember how to do it when I need it.

> Rather than always popping up a *diff* buffer, we could also change the
> prompt from "yes/no" to "yes/no/diff".

We could have the same UI as implemented in
'save-some-buffers-action-alist' one key for:

y yes
n no
d for diff

Another way would be to always kill the diff buffer after recovering.

Let me know what UI you like best.

Take care,

Ivan
-- 
The road up and the road down are one and the same.
    -- Heraclitus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]