diff options
author | Juri Linkov <juri@jurta.org> | 2009-11-25 17:15:19 +0000 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2009-11-25 17:15:19 +0000 |
commit | e237085f039fd84695c0ccd7ffba68b1d218b361 (patch) | |
tree | 69f5ae86e98ccac8c64c01e423db373b99f86739 /lisp/ediff-util.el | |
parent | 7d371eac644665cdc4afcac57e7a09560e010a31 (diff) | |
download | emacs-e237085f039fd84695c0ccd7ffba68b1d218b361.tar.gz |
Provide additional default values (directories at other Dired
windows) via M-n in the minibuffer of some Dired commands.
* dired-aux.el (dired-diff, dired-compare-directories)
(dired-do-create-files): Use `dired-dwim-target-defaults' to set
`minibuffer-default' in `minibuffer-with-setup-hook'.
(dired-dwim-target-directory): Find a window that displays Dired
buffer instead of failing when the next window is not Dired.
Use `get-window-with-predicate' to find for the next Dired window.
(dired-dwim-target-defaults): New function.
* ediff-util.el (ediff-read-file-name):
Use `dired-dwim-target-defaults' to set `minibuffer-default'
in `minibuffer-with-setup-hook'.
Diffstat (limited to 'lisp/ediff-util.el')
-rw-r--r-- | lisp/ediff-util.el | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el index ea12ef7532a..e8a171bf517 100644 --- a/lisp/ediff-util.el +++ b/lisp/ediff-util.el @@ -3113,21 +3113,25 @@ Hit \\[ediff-recenter] to reset the windows afterward." (if (string= default-file "") (setq default-file nil)) - (let (f) - (setq f (expand-file-name - (read-file-name - (format "%s%s " - prompt - (cond (default-file - (concat " (default " default-file "):")) - (t (concat " (default " default-dir "):")))) - default-dir - (or default-file default-dir) - t ; must match, no-confirm - (if default-file (file-name-directory default-file)) - ) - default-dir - )) + (let ((defaults (and (fboundp 'dired-dwim-target-defaults) + (dired-dwim-target-defaults + (and default-file (list default-file)) + default-dir))) + f) + (setq f (minibuffer-with-setup-hook + (lambda () (when defaults + (setq minibuffer-default defaults))) + (read-file-name + (format "%s%s " + prompt + (cond (default-file + (concat " (default " default-file "):")) + (t (concat " (default " default-dir "):")))) + default-dir + (or default-file default-dir) + t ; must match, no-confirm + (if default-file (file-name-directory default-file))))) + (setq f (expand-file-name f default-dir)) ;; If user entered a directory name, expand the default file in that ;; directory. This allows the user to enter a directory name for the ;; B-file and diff against the default-file in that directory instead |