unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Wolfgang Jenkner <wjenkner@inode.at>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Ivan Kanis <ivan.kanis@googlemail.com>,
	emacs devel <emacs-devel@gnu.org>
Subject: Re: [PATCH] show difference when recovering file
Date: Mon, 17 Dec 2012 18:03:36 +0100	[thread overview]
Message-ID: <85sj74zk47.fsf@iznogoud.viz> (raw)
In-Reply-To: <jwvpq286adc.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 17 Dec 2012 09:16:15 -0500")

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.




  parent reply	other threads:[~2012-12-17 17:03 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
2012-12-17 17:50         ` Stefan Monnier
2012-12-17 20:27           ` Ivan Kanis
2012-12-17 17:03       ` Wolfgang Jenkner [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=85sj74zk47.fsf@iznogoud.viz \
    --to=wjenkner@inode.at \
    --cc=emacs-devel@gnu.org \
    --cc=ivan.kanis@googlemail.com \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).