aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/ido.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ido.el')
-rw-r--r--lisp/ido.el260
1 files changed, 140 insertions, 120 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 24b8ba34b75..2d9313bb0ea 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -299,8 +299,8 @@
299;; ------------ 299;; ------------
300 300
301;; The highlighting of matching items is controlled via ido-use-faces. 301;; The highlighting of matching items is controlled via ido-use-faces.
302;; The faces used are ido-first-match-face, ido-only-match-face and 302;; The faces used are ido-first-match, ido-only-match and
303;; ido-subdir-face. 303;; ido-subdir.
304;; Colouring of the matching item was suggested by 304;; Colouring of the matching item was suggested by
305;; Carsten Dominik (dominik@strw.leidenuniv.nl). 305;; Carsten Dominik (dominik@strw.leidenuniv.nl).
306 306
@@ -345,7 +345,7 @@
345;;;###autoload 345;;;###autoload
346(defcustom ido-mode nil 346(defcustom ido-mode nil
347 "Determines for which functional group \(buffer and files) ido behavior 347 "Determines for which functional group \(buffer and files) ido behavior
348should be enabled. The following values are possible: 348should be enabled. The following values are possible:
349- `buffer': Turn only on ido buffer behavior \(switching, killing, 349- `buffer': Turn only on ido buffer behavior \(switching, killing,
350 displaying...) 350 displaying...)
351- `file': Turn only on ido file behavior \(finding, writing, inserting...) 351- `file': Turn only on ido file behavior \(finding, writing, inserting...)
@@ -414,7 +414,7 @@ This allows the current directory to be opened immediate with `dired'."
414 "*List of file extensions specifying preferred order of file selections. 414 "*List of file extensions specifying preferred order of file selections.
415Each element is either a string with `.' as the first char, an empty 415Each element is either a string with `.' as the first char, an empty
416string matching files without extension, or t which is the default order 416string matching files without extension, or t which is the default order
417of for files with an unlisted file extension." 417for files with an unlisted file extension."
418 :type '(repeat (choice string 418 :type '(repeat (choice string
419 (const :tag "Default order" t))) 419 (const :tag "Default order" t)))
420 :group 'ido) 420 :group 'ido)
@@ -453,9 +453,9 @@ Possible values:
453`otherframe' Show new file in another frame 453`otherframe' Show new file in another frame
454`maybe-frame' If a file is visible in another frame, prompt to ask if you 454`maybe-frame' If a file is visible in another frame, prompt to ask if you
455 you want to see the file in the same window of the current 455 you want to see the file in the same window of the current
456 frame or in the other frame. 456 frame or in the other frame
457`always-frame' If a file is visible in another frame, raise that 457`always-frame' If a file is visible in another frame, raise that
458 frame. Otherwise, visit the file in the same window." 458 frame; otherwise, visit the file in the same window"
459 :type '(choice (const samewindow) 459 :type '(choice (const samewindow)
460 (const otherwindow) 460 (const otherwindow)
461 (const display) 461 (const display)
@@ -466,7 +466,7 @@ Possible values:
466 466
467(defcustom ido-default-buffer-method 'always-frame 467(defcustom ido-default-buffer-method 'always-frame
468 "*How to switch to new buffer when using `ido-switch-buffer'. 468 "*How to switch to new buffer when using `ido-switch-buffer'.
469See ido-default-file-method for details." 469See `ido-default-file-method' for details."
470 :type '(choice (const samewindow) 470 :type '(choice (const samewindow)
471 (const otherwindow) 471 (const otherwindow)
472 (const display) 472 (const display)
@@ -530,7 +530,7 @@ Note that the non-ido equivalent command is recorded."
530(defcustom ido-max-prospects 12 530(defcustom ido-max-prospects 12
531 "*Non-zero means that the prospect list will be limited to than number of items. 531 "*Non-zero means that the prospect list will be limited to than number of items.
532For a long list of prospects, building the full list for the minibuffer can take a 532For a long list of prospects, building the full list for the minibuffer can take a
533non-negletable amount of time; setting this variable reduces that time." 533non-negligible amount of time; setting this variable reduces that time."
534 :type 'integer 534 :type 'integer
535 :group 'ido) 535 :group 'ido)
536 536
@@ -615,7 +615,7 @@ If zero, ftp directories are not cached."
615(defcustom ido-slow-ftp-hosts nil 615(defcustom ido-slow-ftp-hosts nil
616 "*List of slow ftp hosts where ido prompting should not be used. 616 "*List of slow ftp hosts where ido prompting should not be used.
617If an ftp host is on this list, ido automatically switches to the non-ido 617If an ftp host is on this list, ido automatically switches to the non-ido
618equivalent function, e.g. find-file rather than ido-find-file." 618equivalent function, e.g. `find-file' rather than `ido-find-file'."
619 :type '(repeat string) 619 :type '(repeat string)
620 :group 'ido) 620 :group 'ido)
621 621
@@ -706,7 +706,7 @@ ask user whether to create buffer, or 'never to never create new buffer."
706 :group 'ido) 706 :group 'ido)
707 707
708(defcustom ido-setup-hook nil 708(defcustom ido-setup-hook nil
709 "*Hook run after the ido variables and keymap has been setup. 709 "*Hook run after the ido variables and keymap have been setup.
710The dynamic variable `ido-cur-item' contains the current type of item that 710The dynamic variable `ido-cur-item' contains the current type of item that
711is read by ido, possible values are file, dir, buffer, and list. 711is read by ido, possible values are file, dir, buffer, and list.
712Additional keys can be defined in `ido-mode-map'." 712Additional keys can be defined in `ido-mode-map'."
@@ -727,9 +727,9 @@ There are 10 elements in this list:
7274th element is the string inserted at the end of a truncated list of prospects, 7274th element is the string inserted at the end of a truncated list of prospects,
7285th and 6th elements are used as brackets around the common match string which 7285th and 6th elements are used as brackets around the common match string which
729can be completed using TAB, 729can be completed using TAB,
7307th element is the string displayed when there are a no matches, and 7307th element is the string displayed when there are no matches, and
7318th element is displayed if there is a single match (and faces are not used). 7318th element is displayed if there is a single match (and faces are not used),
7329th element is displayed when the current directory is non-readable. 7329th element is displayed when the current directory is non-readable,
73310th element is displayed when directory exceeds `ido-max-directory-size'." 73310th element is displayed when directory exceeds `ido-max-directory-size'."
734 :type '(repeat string) 734 :type '(repeat string)
735 :group 'ido) 735 :group 'ido)
@@ -740,17 +740,17 @@ subdirs in the alternatives."
740 :type 'boolean 740 :type 'boolean
741 :group 'ido) 741 :group 'ido)
742 742
743(defface ido-first-match-face '((t (:bold t))) 743(defface ido-first-match '((t (:bold t)))
744 "*Font used by ido for highlighting first match." 744 "*Font used by ido for highlighting first match."
745 :group 'ido) 745 :group 'ido)
746 746
747(defface ido-only-match-face '((((class color)) 747(defface ido-only-match '((((class color))
748 (:foreground "ForestGreen")) 748 (:foreground "ForestGreen"))
749 (t (:italic t))) 749 (t (:italic t)))
750 "*Font used by ido for highlighting only match." 750 "*Font used by ido for highlighting only match."
751 :group 'ido) 751 :group 'ido)
752 752
753(defface ido-subdir-face '((((min-colors 88) (class color)) 753(defface ido-subdir '((((min-colors 88) (class color))
754 (:foreground "red1")) 754 (:foreground "red1"))
755 (((class color)) 755 (((class color))
756 (:foreground "red")) 756 (:foreground "red"))
@@ -758,7 +758,7 @@ subdirs in the alternatives."
758 "*Font used by ido for highlighting subdirs in the alternatives." 758 "*Font used by ido for highlighting subdirs in the alternatives."
759 :group 'ido) 759 :group 'ido)
760 760
761(defface ido-indicator-face '((((min-colors 88) (class color)) 761(defface ido-indicator '((((min-colors 88) (class color))
762 (:foreground "yellow1" 762 (:foreground "yellow1"
763 :background "red1" 763 :background "red1"
764 :width condensed)) 764 :width condensed))
@@ -864,14 +864,14 @@ Must be set before enabling ido mode."
864(defcustom ido-read-file-name-as-directory-commands '() 864(defcustom ido-read-file-name-as-directory-commands '()
865 "List of commands which uses read-file-name to read a directory name. 865 "List of commands which uses read-file-name to read a directory name.
866When `ido-everywhere' is non-nil, the commands in this list will read 866When `ido-everywhere' is non-nil, the commands in this list will read
867the directory using ido-read-directory-name." 867the directory using `ido-read-directory-name'."
868 :type '(repeat symbol) 868 :type '(repeat symbol)
869 :group 'ido) 869 :group 'ido)
870 870
871(defcustom ido-read-file-name-non-ido '() 871(defcustom ido-read-file-name-non-ido '()
872 "List of commands which shall not read file names the ido way. 872 "List of commands which shall not read file names the ido way.
873When `ido-everywhere' is non-nil, the commands in this list will read 873When `ido-everywhere' is non-nil, the commands in this list will read
874the file name using normal read-file-name style." 874the file name using normal `read-file-name' style."
875 :type '(repeat symbol) 875 :type '(repeat symbol)
876 :group 'ido) 876 :group 'ido)
877 877
@@ -895,7 +895,7 @@ See `ido-enable-last-directory-history' for details.")
895(defvar ido-work-directory-list nil 895(defvar ido-work-directory-list nil
896 "List of actual working directory names. 896 "List of actual working directory names.
897The current directory is inserted at the front of this list whenever a 897The current directory is inserted at the front of this list whenever a
898file is opened with ido-find-file and family.") 898file is opened with `ido-find-file' and family.")
899 899
900(defvar ido-work-file-list nil 900(defvar ido-work-file-list nil
901 "List of actual work file names. 901 "List of actual work file names.
@@ -909,7 +909,7 @@ Each element in the list is of the form (DIR (MTIME) FILE...).")
909 909
910(defvar ido-ignore-item-temp-list nil 910(defvar ido-ignore-item-temp-list nil
911 "List of items to ignore in current ido invocation. 911 "List of items to ignore in current ido invocation.
912Intended to be let-bound by functions which calls ido repeatedly. 912Intended to be let-bound by functions which call ido repeatedly.
913Should never be set permanently.") 913Should never be set permanently.")
914 914
915;; Temporary storage 915;; Temporary storage
@@ -949,7 +949,7 @@ If equal to `takeprompt', we use the prompt as the file name to be
949selected.") 949selected.")
950 950
951(defvar ido-current-directory nil 951(defvar ido-current-directory nil
952 "Current directory for ido-find-file.") 952 "Current directory for `ido-find-file'.")
953 953
954(defvar ido-auto-merge-timer nil 954(defvar ido-auto-merge-timer nil
955 "Delay timer for auto merge.") 955 "Delay timer for auto merge.")
@@ -1320,7 +1320,8 @@ This function also adds a hook to the minibuffer."
1320 1320
1321 (add-hook 'kill-emacs-hook 'ido-kill-emacs-hook) 1321 (add-hook 'kill-emacs-hook 'ido-kill-emacs-hook)
1322 1322
1323 (unless ido-minor-mode-map-entry 1323 (if ido-minor-mode-map-entry
1324 (setcdr ido-minor-mode-map-entry (make-sparse-keymap))
1324 (setq ido-minor-mode-map-entry (cons 'ido-mode (make-sparse-keymap))) 1325 (setq ido-minor-mode-map-entry (cons 'ido-mode (make-sparse-keymap)))
1325 (add-to-list 'minor-mode-map-alist ido-minor-mode-map-entry)) 1326 (add-to-list 'minor-mode-map-alist ido-minor-mode-map-entry))
1326 1327
@@ -1646,6 +1647,7 @@ If INITIAL is non-nil, it specifies the initial input string."
1646 (l (ido-make-merged-file-list ido-text-init 1647 (l (ido-make-merged-file-list ido-text-init
1647 (eq ido-use-merged-list 'auto) 1648 (eq ido-use-merged-list 'auto)
1648 (eq ido-try-merged-list 'wide)))) 1649 (eq ido-try-merged-list 'wide))))
1650 (ido-trace "merged" l)
1649 (cond 1651 (cond
1650 ((not l) 1652 ((not l)
1651 (if (eq ido-try-merged-list 'wide) 1653 (if (eq ido-try-merged-list 'wide)
@@ -1665,6 +1667,9 @@ If INITIAL is non-nil, it specifies the initial input string."
1665 ido-use-merged-list nil))) 1667 ido-use-merged-list nil)))
1666 ((eq l t) 1668 ((eq l t)
1667 (setq ido-use-merged-list nil)) 1669 (setq ido-use-merged-list nil))
1670 ((eq l 'input-pending-p)
1671 (setq ido-try-merged-list t
1672 ido-use-merged-list nil))
1668 (t 1673 (t
1669 (setq ido-pre-merge-state 1674 (setq ido-pre-merge-state
1670 (list ido-text-init ido-current-directory olist oign omat)) 1675 (list ido-text-init ido-current-directory olist oign omat))
@@ -2267,7 +2272,7 @@ If no merge has yet taken place, toggle automatic merging option."
2267 2272
2268(defun ido-magic-forward-char () 2273(defun ido-magic-forward-char ()
2269 "Move forward in user input or perform magic action. 2274 "Move forward in user input or perform magic action.
2270If no user input is present or at end of input, perform magic actions: 2275If no user input is present, or at end of input, perform magic actions:
2271C-x C-b ... C-f switch to ido-find-file. 2276C-x C-b ... C-f switch to ido-find-file.
2272C-x C-f ... C-f fallback to non-ido find-file. 2277C-x C-f ... C-f fallback to non-ido find-file.
2273C-x C-d ... C-f fallback to non-ido brief dired. 2278C-x C-d ... C-f fallback to non-ido brief dired.
@@ -2410,13 +2415,13 @@ If no buffer or file exactly matching the prompt exists, maybe create a new one.
2410 (exit-minibuffer)) 2415 (exit-minibuffer))
2411 2416
2412(defun ido-enter-find-file () 2417(defun ido-enter-find-file ()
2413 "Drop into find-file from buffer switching." 2418 "Drop into `find-file' from buffer switching."
2414 (interactive) 2419 (interactive)
2415 (setq ido-exit 'find-file) 2420 (setq ido-exit 'find-file)
2416 (exit-minibuffer)) 2421 (exit-minibuffer))
2417 2422
2418(defun ido-enter-switch-buffer () 2423(defun ido-enter-switch-buffer ()
2419 "Drop into ido-switch-buffer from file switching." 2424 "Drop into `ido-switch-buffer' from file switching."
2420 (interactive) 2425 (interactive)
2421 (setq ido-exit 'switch-to-buffer) 2426 (setq ido-exit 'switch-to-buffer)
2422 (exit-minibuffer)) 2427 (exit-minibuffer))
@@ -2493,10 +2498,10 @@ If no buffer or file exactly matching the prompt exists, maybe create a new one.
2493 (file-directory-p dir) 2498 (file-directory-p dir)
2494 (or (not must-match) 2499 (or (not must-match)
2495 ;; TODO. check for nonreadable and too-big. 2500 ;; TODO. check for nonreadable and too-big.
2496 (ido-set-matches1 2501 (ido-set-matches-1
2497 (if (eq ido-cur-item 'file) 2502 (if (eq ido-cur-item 'file)
2498 (ido-make-file-list1 dir) 2503 (ido-make-file-list-1 dir)
2499 (ido-make-dir-list1 dir))))) 2504 (ido-make-dir-list-1 dir)))))
2500 (setq j n) 2505 (setq j n)
2501 (setq dir nil))) 2506 (setq dir nil)))
2502 (if dir 2507 (if dir
@@ -2786,11 +2791,11 @@ for first matching file."
2786 (ido-directory-too-big nil)) 2791 (ido-directory-too-big nil))
2787 (cond 2792 (cond
2788 ((eq ido-cur-item 'file) 2793 ((eq ido-cur-item 'file)
2789 (ido-make-file-list1 ido-current-directory)) 2794 (ido-make-file-list-1 ido-current-directory))
2790 ((eq ido-cur-item 'dir) 2795 ((eq ido-cur-item 'dir)
2791 (ido-make-dir-list1 ido-current-directory)) 2796 (ido-make-dir-list-1 ido-current-directory))
2792 ((eq ido-cur-item 'buffer) 2797 ((eq ido-cur-item 'buffer)
2793 (ido-make-buffer-list1)) 2798 (ido-make-buffer-list-1))
2794 ((eq ido-cur-item 'list) 2799 ((eq ido-cur-item 'list)
2795 ido-choice-list) 2800 ido-choice-list)
2796 (t nil)))) 2801 (t nil))))
@@ -2908,74 +2913,87 @@ for first matching file."
2908 (setq items (cdr items))) 2913 (setq items (cdr items)))
2909 res)) 2914 res))
2910 2915
2911(defun ido-make-merged-file-list (text auto wide) 2916
2917(defun ido-make-merged-file-list-1 (text auto wide)
2912 (let (res) 2918 (let (res)
2913 (message "Searching for `%s'...." text) 2919 (if (and (ido-final-slash text) ido-dir-file-cache)
2914 (condition-case nil 2920 (if wide
2915 (if (and (ido-final-slash text) ido-dir-file-cache) 2921 (setq res (ido-wide-find-dirs-or-files
2916 (if wide 2922 ido-current-directory (substring text 0 -1) ido-enable-prefix t))
2917 (setq res (ido-wide-find-dirs-or-files 2923 ;; Use list of cached directories
2918 ido-current-directory (substring text 0 -1) ido-enable-prefix t)) 2924 (let ((re (concat (regexp-quote (substring text 0 -1)) "[^/:]*/\\'"))
2919 ;; Use list of cached directories 2925 (dirs ido-dir-file-cache)
2920 (let ((re (concat (regexp-quote (substring text 0 -1)) "[^/:]*/\\'")) 2926 dir b d f)
2921 (dirs ido-dir-file-cache) 2927 (if nil ;; simple
2922 dir b d f) 2928 (while dirs
2923 (if nil ;; simple 2929 (setq dir (car (car dirs))
2924 (while dirs 2930 dirs (cdr dirs))
2925 (setq dir (car (car dirs)) 2931 (when (and (string-match re dir)
2926 dirs (cdr dirs)) 2932 (not (ido-ignore-item-p dir ido-ignore-directories-merge))
2927 (when (and (string-match re dir) 2933 (file-directory-p dir))
2928 (not (ido-ignore-item-p dir ido-ignore-directories-merge)) 2934 (setq b (substring dir 0 -1)
2929 (file-directory-p dir)) 2935 f (concat (file-name-nondirectory b) "/")
2930 (setq b (substring dir 0 -1) 2936 d (file-name-directory b)
2931 f (concat (file-name-nondirectory b) "/") 2937 res (cons (cons f d) res))))
2932 d (file-name-directory b)
2933 res (cons (cons f d) res))))
2934 (while dirs
2935 (setq dir (car dirs)
2936 d (car dir)
2937 dirs (cdr dirs))
2938 (when (not (ido-ignore-item-p d ido-ignore-directories-merge))
2939 (setq dir (cdr (cdr dir)))
2940 (while dir
2941 (setq f (car dir)
2942 dir (cdr dir))
2943 (if (and (string-match re f)
2944 (not (ido-ignore-item-p f ido-ignore-directories)))
2945 (setq res (cons (cons f d) res)))))
2946 (if (and auto (input-pending-p))
2947 (setq dirs nil
2948 res t))))))
2949 (if wide
2950 (setq res (ido-wide-find-dirs-or-files
2951 ido-current-directory text ido-enable-prefix nil))
2952 (let ((ido-text text)
2953 (dirs ido-work-directory-list)
2954 (must-match (and text (> (length text) 0)))
2955 dir fl)
2956 (if (and auto (not (member ido-current-directory dirs)))
2957 (setq dirs (cons ido-current-directory dirs)))
2958 (while dirs 2938 (while dirs
2959 (setq dir (car dirs) 2939 (setq dir (car dirs)
2940 d (car dir)
2960 dirs (cdr dirs)) 2941 dirs (cdr dirs))
2961 (when (and dir (stringp dir) 2942 (when (not (ido-ignore-item-p d ido-ignore-directories-merge))
2962 (or ido-merge-ftp-work-directories 2943 (setq dir (cdr (cdr dir)))
2963 (not (ido-is-ftp-directory dir))) 2944 (while dir
2964 (file-directory-p dir) 2945 (setq f (car dir)
2965 ;; TODO. check for nonreadable and too-big. 2946 dir (cdr dir))
2966 (setq fl (if (eq ido-cur-item 'file) 2947 (if (and (string-match re f)
2967 (ido-make-file-list1 dir t) 2948 (not (ido-ignore-item-p f ido-ignore-directories)))
2968 (ido-make-dir-list1 dir t)))) 2949 (setq res (cons (cons f d) res)))))
2969 (if must-match
2970 (setq fl (ido-set-matches1 fl)))
2971 (if fl
2972 (setq res (nconc fl res))))
2973 (if (and auto (input-pending-p)) 2950 (if (and auto (input-pending-p))
2974 (setq dirs nil 2951 (setq dirs nil
2975 res t)))))) 2952 res t))))))
2976 (quit (setq res t))) 2953 (if wide
2977 (if (and res (not (eq res t))) 2954 (setq res (ido-wide-find-dirs-or-files
2978 (setq res (ido-sort-merged-list res auto))) 2955 ido-current-directory text ido-enable-prefix nil))
2956 (let ((ido-text text)
2957 (dirs ido-work-directory-list)
2958 (must-match (and text (> (length text) 0)))
2959 dir fl)
2960 (if (and auto (not (member ido-current-directory dirs)))
2961 (setq dirs (cons ido-current-directory dirs)))
2962 (while dirs
2963 (setq dir (car dirs)
2964 dirs (cdr dirs))
2965 (when (and dir (stringp dir)
2966 (or ido-merge-ftp-work-directories
2967 (not (ido-is-ftp-directory dir)))
2968 (file-directory-p dir)
2969 ;; TODO. check for nonreadable and too-big.
2970 (setq fl (if (eq ido-cur-item 'file)
2971 (ido-make-file-list-1 dir t)
2972 (ido-make-dir-list-1 dir t))))
2973 (if must-match
2974 (setq fl (ido-set-matches-1 fl)))
2975 (if fl
2976 (setq res (nconc fl res))))
2977 (if (and auto (input-pending-p))
2978 (setq dirs nil
2979 res t))))))
2980 res))
2981
2982(defun ido-make-merged-file-list (text auto wide)
2983 (let (res)
2984 (message "Searching for `%s'...." text)
2985 (condition-case nil
2986 (unless (catch 'input-pending-p
2987 (let ((throw-on-input 'input-pending-p))
2988 (setq res (ido-make-merged-file-list-1 text auto wide))
2989 t))
2990 (setq res 'input-pending-p))
2991 (quit
2992 (setq res t
2993 ido-try-merged-list nil
2994 ido-use-merged-list nil)))
2995 (when (and res (listp res))
2996 (setq res (ido-sort-merged-list res auto)))
2979 (when (and (or ido-rotate-temp ido-rotate-file-list-default) 2997 (when (and (or ido-rotate-temp ido-rotate-file-list-default)
2980 (listp res) 2998 (listp res)
2981 (> (length text) 0)) 2999 (> (length text) 0))
@@ -2986,7 +3004,7 @@ for first matching file."
2986 (message nil) 3004 (message nil)
2987 res)) 3005 res))
2988 3006
2989(defun ido-make-buffer-list1 (&optional frame visible) 3007(defun ido-make-buffer-list-1 (&optional frame visible)
2990 ;; Return list of non-ignored buffer names 3008 ;; Return list of non-ignored buffer names
2991 (delq nil 3009 (delq nil
2992 (mapcar 3010 (mapcar
@@ -2999,12 +3017,12 @@ for first matching file."
2999(defun ido-make-buffer-list (default) 3017(defun ido-make-buffer-list (default)
3000 ;; Return the current list of buffers. 3018 ;; Return the current list of buffers.
3001 ;; Currently visible buffers are put at the end of the list. 3019 ;; Currently visible buffers are put at the end of the list.
3002 ;; The hook `ido-make-buflist-hook' is run after the list has been 3020 ;; The hook `ido-make-buffer-list-hook' is run after the list has been
3003 ;; created to allow the user to further modify the order of the buffer names 3021 ;; created to allow the user to further modify the order of the buffer names
3004 ;; in this list. If DEFAULT is non-nil, and corresponds to an existing buffer, 3022 ;; in this list. If DEFAULT is non-nil, and corresponds to an existing buffer,
3005 ;; it is put to the start of the list. 3023 ;; it is put to the start of the list.
3006 (let* ((ido-current-buffers (ido-get-buffers-in-frames 'current)) 3024 (let* ((ido-current-buffers (ido-get-buffers-in-frames 'current))
3007 (ido-temp-list (ido-make-buffer-list1 (selected-frame) ido-current-buffers))) 3025 (ido-temp-list (ido-make-buffer-list-1 (selected-frame) ido-current-buffers)))
3008 (if ido-temp-list 3026 (if ido-temp-list
3009 (nconc ido-temp-list ido-current-buffers) 3027 (nconc ido-temp-list ido-current-buffers)
3010 (setq ido-temp-list ido-current-buffers)) 3028 (setq ido-temp-list ido-current-buffers))
@@ -3041,7 +3059,7 @@ for first matching file."
3041 (nconc ido-temp-list items) 3059 (nconc ido-temp-list items)
3042 (setq ido-temp-list items))) 3060 (setq ido-temp-list items)))
3043 3061
3044(defun ido-file-name-all-completions1 (dir) 3062(defun ido-file-name-all-completions-1 (dir)
3045 (cond 3063 (cond
3046 ((ido-nonreadable-directory-p dir) '()) 3064 ((ido-nonreadable-directory-p dir) '())
3047 ;; do not check (ido-directory-too-big-p dir) here. 3065 ;; do not check (ido-directory-too-big-p dir) here.
@@ -3098,13 +3116,13 @@ for first matching file."
3098 (if (and ftp (file-readable-p dir)) 3116 (if (and ftp (file-readable-p dir))
3099 (setq mtime (cons 'ftp (ido-time-stamp)))) 3117 (setq mtime (cons 'ftp (ido-time-stamp))))
3100 (if mtime 3118 (if mtime
3101 (setq cached (cons dir (cons mtime (ido-file-name-all-completions1 dir))) 3119 (setq cached (cons dir (cons mtime (ido-file-name-all-completions-1 dir)))
3102 ido-dir-file-cache (cons cached ido-dir-file-cache))) 3120 ido-dir-file-cache (cons cached ido-dir-file-cache)))
3103 (if (> (length ido-dir-file-cache) ido-max-dir-file-cache) 3121 (if (> (length ido-dir-file-cache) ido-max-dir-file-cache)
3104 (setcdr (nthcdr (1- ido-max-dir-file-cache) ido-dir-file-cache) nil))) 3122 (setcdr (nthcdr (1- ido-max-dir-file-cache) ido-dir-file-cache) nil)))
3105 (and cached 3123 (and cached
3106 (cdr (cdr cached)))) 3124 (cdr (cdr cached))))
3107 (ido-file-name-all-completions1 dir))) 3125 (ido-file-name-all-completions-1 dir)))
3108 3126
3109(defun ido-remove-cached-dir (dir) 3127(defun ido-remove-cached-dir (dir)
3110 ;; Remove dir from ido-dir-file-cache 3128 ;; Remove dir from ido-dir-file-cache
@@ -3115,7 +3133,7 @@ for first matching file."
3115 (setq ido-dir-file-cache (delq cached ido-dir-file-cache)))))) 3133 (setq ido-dir-file-cache (delq cached ido-dir-file-cache))))))
3116 3134
3117 3135
3118(defun ido-make-file-list1 (dir &optional merged) 3136(defun ido-make-file-list-1 (dir &optional merged)
3119 ;; Return list of non-ignored files in DIR 3137 ;; Return list of non-ignored files in DIR
3120 ;; If MERGED is non-nil, each file is cons'ed with DIR 3138 ;; If MERGED is non-nil, each file is cons'ed with DIR
3121 (and (or (ido-is-tramp-root dir) (file-directory-p dir)) 3139 (and (or (ido-is-tramp-root dir) (file-directory-p dir))
@@ -3132,7 +3150,7 @@ for first matching file."
3132 ;; The hook `ido-make-file-list-hook' is run after the list has been 3150 ;; The hook `ido-make-file-list-hook' is run after the list has been
3133 ;; created to allow the user to further modify the order of the file names 3151 ;; created to allow the user to further modify the order of the file names
3134 ;; in this list. 3152 ;; in this list.
3135 (let ((ido-temp-list (ido-make-file-list1 ido-current-directory))) 3153 (let ((ido-temp-list (ido-make-file-list-1 ido-current-directory)))
3136 (setq ido-temp-list (sort ido-temp-list 3154 (setq ido-temp-list (sort ido-temp-list
3137 (if ido-file-extensions-order 3155 (if ido-file-extensions-order
3138 #'ido-file-extension-lessp 3156 #'ido-file-extension-lessp
@@ -3168,7 +3186,7 @@ for first matching file."
3168 (run-hooks 'ido-make-file-list-hook) 3186 (run-hooks 'ido-make-file-list-hook)
3169 ido-temp-list)) 3187 ido-temp-list))
3170 3188
3171(defun ido-make-dir-list1 (dir &optional merged) 3189(defun ido-make-dir-list-1 (dir &optional merged)
3172 ;; Return list of non-ignored subdirs in DIR 3190 ;; Return list of non-ignored subdirs in DIR
3173 ;; If MERGED is non-nil, each subdir is cons'ed with DIR 3191 ;; If MERGED is non-nil, each subdir is cons'ed with DIR
3174 (and (or (ido-is-tramp-root dir) (file-directory-p dir)) 3192 (and (or (ido-is-tramp-root dir) (file-directory-p dir))
@@ -3184,7 +3202,7 @@ for first matching file."
3184 ;; The hook `ido-make-dir-list-hook' is run after the list has been 3202 ;; The hook `ido-make-dir-list-hook' is run after the list has been
3185 ;; created to allow the user to further modify the order of the 3203 ;; created to allow the user to further modify the order of the
3186 ;; directory names in this list. 3204 ;; directory names in this list.
3187 (let ((ido-temp-list (ido-make-dir-list1 ido-current-directory))) 3205 (let ((ido-temp-list (ido-make-dir-list-1 ido-current-directory)))
3188 (setq ido-temp-list (sort ido-temp-list #'ido-file-lessp)) 3206 (setq ido-temp-list (sort ido-temp-list #'ido-file-lessp))
3189 (ido-to-end ;; move . files to end 3207 (ido-to-end ;; move . files to end
3190 (delq nil (mapcar 3208 (delq nil (mapcar
@@ -3238,7 +3256,7 @@ for first matching file."
3238 3256
3239;;; FIND MATCHING ITEMS 3257;;; FIND MATCHING ITEMS
3240 3258
3241(defun ido-set-matches1 (items &optional do-full) 3259(defun ido-set-matches-1 (items &optional do-full)
3242 ;; Return list of matches in items 3260 ;; Return list of matches in items
3243 (let* ((case-fold-search ido-case-fold) 3261 (let* ((case-fold-search ido-case-fold)
3244 (slash (and (not ido-enable-prefix) (ido-final-slash ido-text))) 3262 (slash (and (not ido-enable-prefix) (ido-final-slash ido-text)))
@@ -3296,7 +3314,7 @@ for first matching file."
3296(defun ido-set-matches () 3314(defun ido-set-matches ()
3297 ;; Set `ido-matches' to the list of items matching prompt 3315 ;; Set `ido-matches' to the list of items matching prompt
3298 (when ido-rescan 3316 (when ido-rescan
3299 (setq ido-matches (ido-set-matches1 (reverse ido-cur-list) (not ido-rotate)) 3317 (setq ido-matches (ido-set-matches-1 (reverse ido-cur-list) (not ido-rotate))
3300 ido-rotate nil))) 3318 ido-rotate nil)))
3301 3319
3302(defun ido-ignore-item-p (name re-list &optional ignore-ext) 3320(defun ido-ignore-item-p (name re-list &optional ignore-ext)
@@ -3479,7 +3497,7 @@ for first matching file."
3479;;; VISIT CHOSEN BUFFER 3497;;; VISIT CHOSEN BUFFER
3480(defun ido-visit-buffer (buffer method &optional record) 3498(defun ido-visit-buffer (buffer method &optional record)
3481 "Visit file named FILE according to METHOD. 3499 "Visit file named FILE according to METHOD.
3482Record command in command-history if optional RECORD is non-nil." 3500Record command in `command-history' if optional RECORD is non-nil."
3483 3501
3484 (let (win newframe) 3502 (let (win newframe)
3485 (cond 3503 (cond
@@ -3552,9 +3570,9 @@ in another frame.
3552 3570
3553As you type in a string, all of the buffers matching the string are 3571As you type in a string, all of the buffers matching the string are
3554displayed if substring-matching is used \(default). Look at 3572displayed if substring-matching is used \(default). Look at
3555`ido-enable-prefix' and `ido-toggle-prefix'. When you have found the 3573`ido-enable-prefix' and `ido-toggle-prefix'. When you have found the
3556buffer you want, it can then be selected. As you type, most keys have their 3574buffer you want, it can then be selected. As you type, most keys have
3557normal keybindings, except for the following: \\<ido-mode-map> 3575their normal keybindings, except for the following: \\<ido-mode-map>
3558 3576
3559RET Select the buffer at the front of the list of matches. If the 3577RET Select the buffer at the front of the list of matches. If the
3560list is empty, possibly prompt to create new buffer. 3578list is empty, possibly prompt to create new buffer.
@@ -3637,11 +3655,11 @@ The file is displayed according to `ido-default-file-method' -- the
3637default is to show it in the same window, unless it is already 3655default is to show it in the same window, unless it is already
3638visible in another frame. 3656visible in another frame.
3639 3657
3640The file name is selected interactively by typing a substring. As you type 3658The file name is selected interactively by typing a substring. As you
3641in a string, all of the filenames matching the string are displayed if 3659type in a string, all of the filenames matching the string are displayed
3642substring-matching is used \(default). Look at `ido-enable-prefix' and 3660if substring-matching is used \(default). Look at `ido-enable-prefix' and
3643`ido-toggle-prefix'. When you have found the filename you want, it can 3661`ido-toggle-prefix'. When you have found the filename you want, it can
3644then be selected. As you type, most keys have their normal keybindings, 3662then be selected. As you type, most keys have their normal keybindings,
3645except for the following: \\<ido-mode-map> 3663except for the following: \\<ido-mode-map>
3646 3664
3647RET Select the file at the front of the list of matches. If the 3665RET Select the file at the front of the list of matches. If the
@@ -4022,7 +4040,7 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
4022 first) 4040 first)
4023 4041
4024 (if (and ind ido-use-faces) 4042 (if (and ind ido-use-faces)
4025 (put-text-property 0 1 'face 'ido-indicator-face ind)) 4043 (put-text-property 0 1 'face 'ido-indicator ind))
4026 4044
4027 (if (and ido-use-faces comps) 4045 (if (and ido-use-faces comps)
4028 (let* ((fn (ido-name (car comps))) 4046 (let* ((fn (ido-name (car comps)))
@@ -4030,8 +4048,8 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
4030 (setq first (format "%s" fn)) 4048 (setq first (format "%s" fn))
4031 (put-text-property 0 ln 'face 4049 (put-text-property 0 ln 'face
4032 (if (= (length comps) 1) 4050 (if (= (length comps) 1)
4033 'ido-only-match-face 4051 'ido-only-match
4034 'ido-first-match-face) 4052 'ido-first-match)
4035 first) 4053 first)
4036 (if ind (setq first (concat first ind))) 4054 (if ind (setq first (concat first ind)))
4037 (setq comps (cons first (cdr comps))))) 4055 (setq comps (cons first (cdr comps)))))
@@ -4074,7 +4092,7 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
4074 (if (and ido-use-faces 4092 (if (and ido-use-faces
4075 (not (string= str first)) 4093 (not (string= str first))
4076 (ido-final-slash str)) 4094 (ido-final-slash str))
4077 (put-text-property 0 (length str) 'face 'ido-subdir-face str)) 4095 (put-text-property 0 (length str) 'face 'ido-subdir str))
4078 str))))) 4096 str)))))
4079 comps)))))) 4097 comps))))))
4080 4098
@@ -4154,7 +4172,7 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
4154Return the name of a buffer selected. 4172Return the name of a buffer selected.
4155PROMPT is the prompt to give to the user. DEFAULT if given is the default 4173PROMPT is the prompt to give to the user. DEFAULT if given is the default
4156buffer to be selected, which will go to the front of the list. 4174buffer to be selected, which will go to the front of the list.
4157If REQUIRE-MATCH is non-nil, an existing-buffer must be selected." 4175If REQUIRE-MATCH is non-nil, an existing buffer must be selected."
4158 (let* ((ido-current-directory nil) 4176 (let* ((ido-current-directory nil)
4159 (ido-directory-nonreadable nil) 4177 (ido-directory-nonreadable nil)
4160 (ido-directory-too-big nil) 4178 (ido-directory-too-big nil)
@@ -4176,7 +4194,9 @@ See `read-file-name' for additional parameters."
4176 (eq (get this-command 'ido) 'dir) 4194 (eq (get this-command 'ido) 'dir)
4177 (memq this-command ido-read-file-name-as-directory-commands)) 4195 (memq this-command ido-read-file-name-as-directory-commands))
4178 (setq filename 4196 (setq filename
4179 (ido-read-directory-name prompt dir default-filename mustmatch initial))) 4197 (ido-read-directory-name prompt dir default-filename mustmatch initial))
4198 (if (eq ido-exit 'fallback)
4199 (setq filename 'fallback)))
4180 ((and (not (eq (get this-command 'ido) 'ignore)) 4200 ((and (not (eq (get this-command 'ido) 'ignore))
4181 (not (memq this-command ido-read-file-name-non-ido)) 4201 (not (memq this-command ido-read-file-name-non-ido))
4182 (or (null predicate) (eq predicate 'file-exists-p))) 4202 (or (null predicate) (eq predicate 'file-exists-p)))