[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 0f014a7 2/2: Extend the default value in dired-diff to all the ba
master 0f014a7 2/2: Extend the default value in dired-diff to all the backup files
Mon, 24 Aug 2020 13:15:43 -0400 (EDT)
Author: Lars Ingebrigtsen <email@example.com>
Commit: Lars Ingebrigtsen <firstname.lastname@example.org>
Extend the default value in dired-diff to all the backup files
* lisp/dired-aux.el (dired-diff): When diffing files with backup
files, put all the backup files into the defaults so that they can
be reached with `M-n' from `read-file-name' (bug#24089).
etc/NEWS | 5 +++++
lisp/dired-aux.el | 15 ++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/etc/NEWS b/etc/NEWS
index cd8cc31..6d8379b 100644
@@ -235,6 +235,11 @@ time zones will use a form like "+0100" instead of "CET".
+*** '=' ('dired-diff') will now put all backup files into the 'M-n' history.
+When using '=' on a file with backup files, the default file to use
+when diffing the newest backup file. You can now use 'M-n' to quickly
+select a different backup file instead.
*** New user option 'dired-maybe-use-globstar'.
If set, enables globstar (recursive globbing) in shells that support
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index c197ed0..ab13b3e 100644
@@ -134,7 +134,20 @@ the string of command switches used as the third argument
- (defaults (dired-dwim-target-defaults (list current) target-dir)))
+ (defaults (append
+ (if (backup-file-name-p current)
+ ;; This is a backup file -- put the other
+ ;; main file, and the other backup files into
+ ;; the `M-n' list.
+ (delete (expand-file-name current)
+ (cons (expand-file-name
+ (file-name-sans-versions current))
+ (file-name-sans-versions current))))
+ ;; Non-backup file -- use the backup files as
+ ;; `M-n' candidates.
+ (file-backup-file-names current))
+ (dired-dwim-target-defaults (list current) target-dir))))