[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] show difference when recovering file
From: |
Wolfgang Jenkner |
Subject: |
Re: [PATCH] show difference when recovering file |
Date: |
Mon, 17 Dec 2012 18:03:36 +0100 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (berkeley-unix) |
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.
Re: [PATCH] show difference when recovering file, Juri Linkov, 2012/12/17