From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Wolfgang Jenkner Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] show difference when recovering file Date: Mon, 17 Dec 2012 18:03:36 +0100 Message-ID: <85sj74zk47.fsf@iznogoud.viz> 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 1355763828 22528 80.91.229.3 (17 Dec 2012 17:03:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Dec 2012 17:03:48 +0000 (UTC) Cc: Ivan Kanis , emacs devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 17 18:04:02 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 1Tke6j-00083i-CW for ged-emacs-devel@m.gmane.org; Mon, 17 Dec 2012 18:04:01 +0100 Original-Received: from localhost ([::1]:47375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tke6W-0002Cn-23 for ged-emacs-devel@m.gmane.org; Mon, 17 Dec 2012 12:03:48 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:34578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tke6S-0002C8-De for emacs-devel@gnu.org; Mon, 17 Dec 2012 12:03:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tke6R-0001aQ-0t for emacs-devel@gnu.org; Mon, 17 Dec 2012 12:03:44 -0500 Original-Received: from mx15.lb01.inode.at ([62.99.145.17]:23671 helo=mx.inode.at) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tke6Q-0001ZE-R1 for emacs-devel@gnu.org; Mon, 17 Dec 2012 12:03:42 -0500 Original-Received: from [91.119.206.19] (port=2674 helo=iznogoud.viz) by smartmx-15.inode.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Tke6N-00074T-DE; Mon, 17 Dec 2012 18:03:39 +0100 Original-Received: from wolfgang by iznogoud.viz with local (Exim 4.80.1 (FreeBSD)) (envelope-from ) id 1Tke6L-0000ZM-5C; Mon, 17 Dec 2012 18:03:37 +0100 Mail-Followup-To: Stefan Monnier , Ivan Kanis , emacs devel In-Reply-To: (Stefan Monnier's message of "Mon, 17 Dec 2012 09:16:15 -0500") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (berkeley-unix) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 62.99.145.17 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:155620 Archived-At: On Mon, Dec 17 2012, Stefan Monnier wrote: > Rather than always popping up a *diff* buffer, we could also change the > prompt from "yes/no" to "yes/no/diff". Instead of surprising the user with an additional choice, how about putting the *Directory* buffer in dired-mode, via dired-virtual from the dired-x package (which comes with emacs, after all). The user could than use = or whatever in the usual way (though the default is to diff with a backup-file instead of an auto-save file, but that's a SMOP). Proof of concept below, just to convey the idea. Wolfgang === modified file 'lisp/files.el' --- lisp/files.el 2012-12-14 18:59:00 +0000 +++ lisp/files.el 2012-12-17 16:57:10 +0000 @@ -5371,6 +5371,8 @@ (interactive) (recover-file buffer-file-name)) +(require 'dired-x) + (defun recover-file (file) "Visit file FILE, but get contents from its last auto-save file." ;; Actually putting the file name in the minibuffer should be used @@ -5406,7 +5408,8 @@ ;; The code in v20.x called `ls' directly, so we need ;; to emulate what `ls' did in that case. (insert-directory-safely file switches) - (insert-directory-safely file-name switches)))) + (insert-directory-safely file-name switches)) + (dired-virtual (file-name-directory file)))) (switch-to-buffer (find-file-noselect file t)) (let ((inhibit-read-only t) ;; Keep the current buffer-file-coding-system.