all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Kanis <ivan.kanis@googlemail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs devel <emacs-devel@gnu.org>
Subject: Re: [PATCH] show difference when recovering file
Date: Mon, 17 Dec 2012 17:04:22 +0100	[thread overview]
Message-ID: <87k3sg7ji1.fsf@kanis.fr> (raw)
In-Reply-To: <jwvpq286adc.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 17 Dec 2012 09:16:15 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> 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	other threads:[~2012-12-17 16:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-16 16:56 [PATCH] show difference when recovering file Ivan Kanis
2012-12-16 18:12 ` martin rudalics
2012-12-16 21:55 ` Stefan Monnier
2012-12-17 10:53   ` Ivan Kanis
2012-12-17 14:16     ` Stefan Monnier
2012-12-17 16:04       ` Ivan Kanis [this message]
2012-12-17 17:50         ` Stefan Monnier
2012-12-17 20:27           ` Ivan Kanis
2012-12-17 17:03       ` Wolfgang Jenkner
2012-12-17 23:15         ` Stephen J. Turnbull
2012-12-17 17:35       ` Achim Gratz
2012-12-17  9:27 ` Juri Linkov
2012-12-17 11:16   ` Ivan Kanis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k3sg7ji1.fsf@kanis.fr \
    --to=ivan.kanis@googlemail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.