From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Kanis Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] show difference when recovering file Date: Mon, 17 Dec 2012 17:04:22 +0100 Message-ID: <87k3sg7ji1.fsf@kanis.fr> 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 1355760271 18770 80.91.229.3 (17 Dec 2012 16:04:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Dec 2012 16:04:31 +0000 (UTC) Cc: emacs devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 17 17:04:46 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 1TkdBN-0002fP-Jy for ged-emacs-devel@m.gmane.org; Mon, 17 Dec 2012 17:04:45 +0100 Original-Received: from localhost ([::1]:33605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdBA-0000z0-8T for ged-emacs-devel@m.gmane.org; Mon, 17 Dec 2012 11:04:32 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdB5-0000yq-So for emacs-devel@gnu.org; Mon, 17 Dec 2012 11:04:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkdB1-0002P7-TZ for emacs-devel@gnu.org; Mon, 17 Dec 2012 11:04:27 -0500 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:50197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdB1-0002Ok-Mx for emacs-devel@gnu.org; Mon, 17 Dec 2012 11:04:23 -0500 Original-Received: by mail-we0-f169.google.com with SMTP id t49so2934091wey.0 for ; Mon, 17 Dec 2012 08:04:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:face :x-hashcash:x-hashcash:date:message-id:mime-version:content-type; bh=DddT9v8zriWYiwaJZxuh5WfWm0FlFs1NtTwurdgvsYg=; b=XZzrAvrfN9Hmz63jYP5Wu5Qx7q/FJZwaIHbBO8uFZdz8kIGan8gyw9UsliLAqHCKA0 zGt1OxU6jPuFEoQoQWNcRqsmVy0+RdUCY9VF0/ZPpwGQmXLzWZZGYV/KILqqJ/IAO8Rh fqvI6EZMGxuTkaspQdrvi/n5RGNGVYxZIzquHRZPyjc6tR7qKMsMomBPTK3ugKuP6+ya VjKvR9X7+6OiIEeS1Em1gIdRKVeWpZvJKGyXoy5A1XnHK7gUpWVyGEPAyMM+CBPO2wpH dhEK8CVj/ebbwGDU0xdapfNArv1oGrQ+sjzbEXatcOkgIUew86W3UYjKOiX2Tw9ZmjaF Hkww== Original-Received: by 10.194.93.40 with SMTP id cr8mr18161846wjb.16.1355760262798; Mon, 17 Dec 2012 08:04:22 -0800 (PST) Original-Received: from tao (lns-c10k-ft-02-t2-89-83-137-164.dsl.sta.abo.bbox.fr. [89.83.137.164]) by mx.google.com with ESMTPS id cf6sm13135791wib.3.2012.12.17.08.04.20 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Dec 2012 08:04:22 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Mon, 17 Dec 2012 09:16:15 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAAB5QTFRF IBkXUxMTOCwoTC4qcUY8iFxQmmper31txpaJ/v/8aKZ1oAAAAcVJREFUOMt100tu2zAQAFDCXnUZ oAcIqG68LZULVLQBbwuSiffm6AIRRyeotAySJoVu2+FPpJWWC3/4NKOZocSW/yxWfnJ2+Bdwzhj7 8gleWVy7DXC2rkMNr2V/zRbghXIwthf3VbIA9Ffc71vZCSFyCEsBggtNS8ludwvfmhYA0Vn9o4DP zMWxR7+cPWzAYFzwM0ModtdmcDbDS6i/hT7L+RZof5yCXGrYe5jn2YO6BYMjgY+51tCIAqHgBLwR pwLnGuRjAKyBJkuN4yd4U92uCY1vUr2D/c5b8DuxyQwfOHUeaLqDJhnkkuGXbB56h2C1IVBdgncc bBi6feroa9B6jUDojnQPQKupbyXyeeCE1oT7Oqrt+SnfY3mkiyGA/3AmD3H5g32CcBx6hY8pRkwJ 9PpcjRGobUfprFnhAa1vepwcgMOhwG+pdSgKHFU9HAvoAH6XUl7lDUCCq5Qb6GMbVm3Aj++qDYCt wdBc/YHgOFCmS3mjDMRcSE2qY4E3Q3PVIQRQmeodNH4QEbRUFZzW+VotzwX4yTcRTySOML1qjcE5 hTirVqDHkMAP0PjAywp3d18JZtqzvr9zDYD+GaSKtE6Zlr/DLPNFmOcvBAAAAABJRU5ErkJggg== X-Hashcash: 1:20:121217:emacs-devel@gnu.org::9vFgR9PWnIe3DiWo:0000000000000000000000000000000000000000000MTV X-Hashcash: 1:20:121217:monnier@iro.umontreal.ca::n8k3biJAcV1YBRHs:00000000000000000000000000000000000006kg+ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 74.125.82.169 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:155619 Archived-At: Stefan Monnier 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