summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-05-13 08:39:54 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-05-13 08:39:54 +0000
commit833e7ac3fcc6652177daf10c01e9656587df87eb (patch)
tree375c066eacb4fe1dd1e3ed0a83108a3998a8943f /lisp
parent44f249c0558f1dab796118fe4e95a31d320badac (diff)
downloademacs-833e7ac3fcc6652177daf10c01e9656587df87eb.tar.gz
* dired.el (dired-read-dir-and-switches): Use read-file-name.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/dired.el54
2 files changed, 25 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d290e1bbea0..a9aae768dbb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
2008-05-13 Stefan Monnier <monnier@iro.umontreal.ca>
+ * dired.el (dired-read-dir-and-switches): Use read-file-name.
+
* dired.el (dired-read-dir-and-switches): Ignore ., .., and
completion-ignored-extension directories if there's something else.
(dired-mark-if, dired-map-over-marks, dired-readin, dired-revert)
diff --git a/lisp/dired.el b/lisp/dired.el
index e5e3dd2358b..fd1456a3332 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -600,7 +600,6 @@ Don't use that together with FILTER."
nil default-directory nil)
(lexical-let ((default (and buffer-file-name
(abbreviate-file-name buffer-file-name)))
- (defdir default-directory)
(cie ()))
(dolist (ext completion-ignored-extensions)
(if (eq ?/ (aref ext (1- (length ext)))) (push ext cie)))
@@ -608,36 +607,29 @@ Don't use that together with FILTER."
(minibuffer-with-setup-hook
(lambda ()
(setq minibuffer-default default)
- (set (make-local-variable 'minibuffer-completing-file-name)
- ;; t means "from now until the next minibuffer", whereas
- ;; `lambda' means "only here".
- 'lambda)
- (set (make-local-variable 'completion-ignore-case)
- read-file-name-completion-ignore-case)
- (setq default-directory defdir))
- (substitute-in-file-name
- (completing-read
- (format "Dired %s(directory): " str)
- ;; We need a mix of read-file-name and read-directory-name
- ;; so that completion to directories is preferred, but if
- ;; the user wants to enter a global pattern, he can still
- ;; use completion on filenames to help him write the pattern.
- ;; Essentially, we want to use
- ;; (completion-table-with-predicate
- ;; 'read-file-name-internal 'file-directory-p nil)
- ;; but that doesn't work because read-file-name-internal
- ;; does not obey its `predicate' argument.
- (completion-table-in-turn
- (lambda (str pred action)
- (let ((read-file-name-predicate
- (lambda (f) (and (not (member f '("./" "../")))
- ;; Hack! Faster than file-directory-p!
- (eq (aref f (1- (length f))) ?/)
- (not (string-match cie f))))))
- (complete-with-action
- action 'read-file-name-internal str nil)))
- 'read-file-name-internal)
- nil nil (abbreviate-file-name defdir) 'file-name-history))))))))
+ (setq minibuffer-completion-table
+ ;; We need a mix of read-file-name and
+ ;; read-directory-name so that completion to directories
+ ;; is preferred, but if the user wants to enter a global
+ ;; pattern, he can still use completion on filenames to
+ ;; help him write the pattern.
+ ;; Essentially, we want to use
+ ;; (completion-table-with-predicate
+ ;; 'read-file-name-internal 'file-directory-p nil)
+ ;; but that doesn't work because read-file-name-internal
+ ;; does not obey its `predicate' argument.
+ (completion-table-in-turn
+ (lambda (str pred action)
+ (let ((read-file-name-predicate
+ (lambda (f) (and (not (member f '("./" "../")))
+ ;; Hack! Faster than file-directory-p!
+ (eq (aref f (1- (length f))) ?/)
+ (not (string-match cie f))))))
+ (complete-with-action
+ action 'read-file-name-internal str nil)))
+ 'read-file-name-internal)))
+ (read-file-name (format "Dired %s(directory): " str)
+ nil default-directory nil)))))))
;;;###autoload (define-key ctl-x-map "d" 'dired)
;;;###autoload