aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-11-08 14:24:54 +0000
committerChong Yidong2008-11-08 14:24:54 +0000
commit6f6c43ffe03120fa8eea1f0d8a27e56bf2f30c3d (patch)
tree92bb44f9915119e5fafbf960ab3f34554f3e098e
parent7ae105c81d5521eb4256d58d958c8caeca7be80b (diff)
downloademacs-6f6c43ffe03120fa8eea1f0d8a27e56bf2f30c3d.tar.gz
emacs-6f6c43ffe03120fa8eea1f0d8a27e56bf2f30c3d.zip
(dired-read-dir-and-switches): Revert to 2007-11-22 version
(bug@1285).
-rw-r--r--lisp/dired.el115
1 files changed, 69 insertions, 46 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 4fddb5d5600..f4087b1323e 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -589,52 +589,75 @@ Don't use that together with FILTER."
589 589
590(defun dired-read-dir-and-switches (str) 590(defun dired-read-dir-and-switches (str)
591 ;; For use in interactive. 591 ;; For use in interactive.
592 (reverse 592 (reverse (list
593 (list 593 (if current-prefix-arg
594 (if current-prefix-arg 594 (read-string "Dired listing switches: "
595 (read-string "Dired listing switches: " 595 dired-listing-switches))
596 dired-listing-switches)) 596 ;; If a dialog is about to be used, call read-directory-name so
597 ;; If a dialog is about to be used, call read-directory-name so 597 ;; the dialog code knows we want directories. Some dialogs can
598 ;; the dialog code knows we want directories. Some dialogs can 598 ;; only select directories or files when popped up, not both.
599 ;; only select directories or files when popped up, not both. 599 (if (next-read-file-uses-dialog-p)
600 (if (next-read-file-uses-dialog-p) 600 (read-directory-name (format "Dired %s(directory): " str)
601 (read-directory-name (format "Dired %s(directory): " str) 601 nil default-directory nil)
602 nil default-directory nil) 602 (let ((default (and buffer-file-name
603 (let ((cie ())) 603 (abbreviate-file-name buffer-file-name))))
604 (dolist (ext completion-ignored-extensions) 604 (minibuffer-with-setup-hook
605 (if (eq ?/ (aref ext (1- (length ext)))) (push ext cie))) 605 (lambda () (setq minibuffer-default default))
606 (setq cie (concat (regexp-opt cie "\\(?:") "\\'")) 606 (read-file-name (format "Dired %s(directory): " str)
607 (lexical-let* ((default (and buffer-file-name 607 nil default-directory nil)))))))
608 (abbreviate-file-name buffer-file-name))) 608
609 (cie cie) 609;; We want to switch to a more sophisticated version of
610 (completion-table 610;; dired-read-dir-and-switches like the following, if there is a way
611 ;; We need a mix of read-file-name and 611;; to make it more intuitive. See bug#1285.
612 ;; read-directory-name so that completion to directories 612
613 ;; is preferred, but if the user wants to enter a global 613;; (defun dired-read-dir-and-switches (str)
614 ;; pattern, he can still use completion on filenames to 614;; ;; For use in interactive.
615 ;; help him write the pattern. 615;; (reverse
616 ;; Essentially, we want to use 616;; (list
617 ;; (completion-table-with-predicate 617;; (if current-prefix-arg
618 ;; 'read-file-name-internal 'file-directory-p nil) 618;; (read-string "Dired listing switches: "
619 ;; but that doesn't work because read-file-name-internal 619;; dired-listing-switches))
620 ;; does not obey its `predicate' argument. 620;; ;; If a dialog is about to be used, call read-directory-name so
621 (completion-table-in-turn 621;; ;; the dialog code knows we want directories. Some dialogs can
622 (lambda (str pred action) 622;; ;; only select directories or files when popped up, not both.
623 (let ((read-file-name-predicate 623;; (if (next-read-file-uses-dialog-p)
624 (lambda (f) 624;; (read-directory-name (format "Dired %s(directory): " str)
625 (and (not (member f '("./" "../"))) 625;; nil default-directory nil)
626 ;; Hack! Faster than file-directory-p! 626;; (let ((cie ()))
627 (eq (aref f (1- (length f))) ?/) 627;; (dolist (ext completion-ignored-extensions)
628 (not (string-match cie f)))))) 628;; (if (eq ?/ (aref ext (1- (length ext)))) (push ext cie)))
629 (complete-with-action 629;; (setq cie (concat (regexp-opt cie "\\(?:") "\\'"))
630 action 'read-file-name-internal str nil))) 630;; (lexical-let* ((default (and buffer-file-name
631 'read-file-name-internal))) 631;; (abbreviate-file-name buffer-file-name)))
632 (minibuffer-with-setup-hook 632;; (cie cie)
633 (lambda () 633;; (completion-table
634 (setq minibuffer-default default) 634;; ;; We need a mix of read-file-name and
635 (setq minibuffer-completion-table completion-table)) 635;; ;; read-directory-name so that completion to directories
636 (read-file-name (format "Dired %s(directory): " str) 636;; ;; is preferred, but if the user wants to enter a global
637 nil default-directory nil)))))))) 637;; ;; pattern, he can still use completion on filenames to
638;; ;; help him write the pattern.
639;; ;; Essentially, we want to use
640;; ;; (completion-table-with-predicate
641;; ;; 'read-file-name-internal 'file-directory-p nil)
642;; ;; but that doesn't work because read-file-name-internal
643;; ;; does not obey its `predicate' argument.
644;; (completion-table-in-turn
645;; (lambda (str pred action)
646;; (let ((read-file-name-predicate
647;; (lambda (f)
648;; (and (not (member f '("./" "../")))
649;; ;; Hack! Faster than file-directory-p!
650;; (eq (aref f (1- (length f))) ?/)
651;; (not (string-match cie f))))))
652;; (complete-with-action
653;; action 'read-file-name-internal str nil)))
654;; 'read-file-name-internal)))
655;; (minibuffer-with-setup-hook
656;; (lambda ()
657;; (setq minibuffer-default default)
658;; (setq minibuffer-completion-table completion-table))
659;; (read-file-name (format "Dired %s(directory): " str)
660;; nil default-directory nil))))))))
638 661
639;;;###autoload (define-key ctl-x-map "d" 'dired) 662;;;###autoload (define-key ctl-x-map "d" 'dired)
640;;;###autoload 663;;;###autoload