From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] show difference when recovering file Date: Mon, 17 Dec 2012 09:16:15 -0500 Message-ID: References: <877goi0wcz.fsf@kanis.fr> <871uep9ch3.fsf@googlemail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1355753785 20982 80.91.229.3 (17 Dec 2012 14:16:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Dec 2012 14:16:25 +0000 (UTC) Cc: emacs devel To: Ivan Kanis Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 17 15:16:39 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TkbUj-0005Je-BP for ged-emacs-devel@m.gmane.org; Mon, 17 Dec 2012 15:16:37 +0100 Original-Received: from localhost ([::1]:55286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkbUV-0005tp-VZ for ged-emacs-devel@m.gmane.org; Mon, 17 Dec 2012 09:16:23 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkbUT-0005tI-Bu for emacs-devel@gnu.org; Mon, 17 Dec 2012 09:16:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkbUO-0007Fw-Hz for emacs-devel@gnu.org; Mon, 17 Dec 2012 09:16:21 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:3022) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkbUO-0007F3-CY for emacs-devel@gnu.org; Mon, 17 Dec 2012 09:16:16 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09FxIps/2dsb2JhbABEtBGBCIIVAQEEAVYjEAs0EhQYDSSIHAW6CZBEA4hCmnGBWIMHgTga X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="210069172" Original-Received: from 69-196-138-108.dsl.teksavvy.com (HELO pastel.home) ([69.196.138.108]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 17 Dec 2012 09:16:15 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 6C2F25912C; Mon, 17 Dec 2012 09:16:15 -0500 (EST) In-Reply-To: <871uep9ch3.fsf@googlemail.com> (Ivan Kanis's message of "Mon, 17 Dec 2012 11:53:12 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:155618 Archived-At: >> 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'. >> 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. 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. Rather than always popping up a *diff* buffer, we could also change the prompt from "yes/no" to "yes/no/diff". Stefan