changeset 86356:93df56120f01

(dired-read-dir-and-switches): For C-x d, set the value for M-n to the visited file name of the current buffer. Use minibuffer-with-setup-hook to set minibuffer-default to buffer-file-name inside read-file-name.
author Juri Linkov <juri@jurta.org>
date Fri, 23 Nov 2007 00:33:23 +0000
parents a5e1b70f3ddf
children 8cf75689ce3d
files lisp/dired.el
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired.el	Fri Nov 23 00:32:42 2007 +0000
+++ b/lisp/dired.el	Fri Nov 23 00:33:23 2007 +0000
@@ -595,8 +595,12 @@
 	    (if (next-read-file-uses-dialog-p)
 		(read-directory-name (format "Dired %s(directory): " str)
 				     nil default-directory nil)
-	      (read-file-name (format "Dired %s(directory): " str)
-			      nil default-directory nil)))))
+	      (let ((default (and buffer-file-name
+				  (abbreviate-file-name buffer-file-name))))
+		(minibuffer-with-setup-hook
+		    (lambda () (setq minibuffer-default default))
+		  (read-file-name (format "Dired %s(directory): " str)
+				  nil default-directory nil)))))))
 
 ;;;###autoload (define-key ctl-x-map "d" 'dired)
 ;;;###autoload