• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/

Lines Matching +defs:directory +defs:list

37 ;; As you type in a substring, the list of buffers or files currently
38 ;; matching the substring are displayed as you type. The list is
40 ;; the start of the list.
42 ;; The buffer or file at the start of the list will be the one visited
43 ;; when you press RETURN. By typing more of the substring, the list is
45 ;; at the top of the list. Alternatively, you can use C-s and C-r (or
47 ;; list until the one you want is at the top of the list.
56 ;; presented with the list of all the buffers
63 ;; The list in {...} are the matching buffers, most recent first
65 ;; list by default). At any time I can select the item at the head of
66 ;; the list by pressing RET. I can also put the first element at the
67 ;; end of the list by pressing C-s or [right], or bring the last
68 ;; element to the head of the list by pressing C-r or [left].
77 ;; If I want the first buffer in the list, I simply press RET. If I
78 ;; wanted the second in the list, I could press C-s to move it to the
79 ;; top of the list and then RET to select it.
102 ;; Likewise, if you use C-x C-f (ido-find-file), the list of files and
103 ;; directories in the current directory is provided in the same
106 ;; visited directory is placed first to speed up navigating to
109 ;; In addition to scrolling through the list using [right] and [left],
110 ;; you can use [up] and [down] to quickly scroll the list to the next
114 ;; the files in that directory, simply move the directory to the head
115 ;; of the list and hit RET.
117 ;; To go up to the parent directory, delete any partial file name
120 ;; To go to the root directory (on the current drive), enter two
140 ;; with `.') in the list of possible completions. However, if the
150 ;; After C-x b, the buffer at the head of the list can be killed by
155 ;; the file at the head of the list with C-k. You will always be
236 ;; To see a full list of all matching buffers in a separate buffer,
241 ;; Changing the list of files
244 ;; By default, the list of current files is most recent first,
246 ;; current frame are put at the end of the list. A hook exists to
247 ;; allow other functions to order the list. For example, if you add:
249 ;; (add-hook 'ido-make-buffer-list-hook 'ido-summary-buffers-to-end)
252 ;; list. (I find this handy for keeping the INBOX Summary and so on
254 ;; end of the list (these are created by AUCTeX when compiling.)
255 ;; Other functions could be made available which alter the list of
281 ;; ido-read-buffer, ido-read-file-name, and ido-read-directory-name
283 ;; or a directory name in the `ido' way.
363 :set-after '(ido-save-directory-list-file
391 For example, traditional behavior is not to list buffers whose names begin
400 For example, traditional behavior is not to list files whose names begin
407 "*Non-nil means ignore files in `completion-ignored-extensions' list."
413 This allows the current directory to be opened immediately with `dired'."
428 "*List of regexps or functions matching sub-directory names to ignore."
433 "*List of regexps or functions matching directory names to ignore during merge.
434 Directory names matched by one of the regexps in this list are not inserted
435 in merged file and directory lists."
529 `ido-prev-match', which cycle the buffer list."
541 "*Non-zero means that the prospect list will be limited to than number of items.
542 For a long list of prospects, building the full list for the minibuffer can take a
568 (defcustom ido-enable-last-directory-history t
569 "*Non-nil means that `ido' will remember latest selected directory names.
570 See `ido-last-directory-list' and `ido-save-directory-list-file'."
574 (defcustom ido-max-work-directory-list 50
576 This is the list of directories where files have most recently been opened.
577 See `ido-work-directory-list' and `ido-save-directory-list-file'."
581 (defcustom ido-work-directory-list-ignore-regexps nil
583 Directory names matched by one of the regexps in this list are not inserted in
584 the `ido-work-directory-list' list."
614 "*Non-nil means record ftp file names in the work directory list."
619 "*If nil means merging ignores ftp file names in the work directory list."
623 (defcustom ido-cache-ftp-work-directory-time 1.0
624 "*Maximum time to cache contents of an ftp directory (in hours).
625 Use C-l in prompt to refresh list.
632 If an ftp host is on this list, ido automatically switches to the non-ido
671 Use C-l in prompt to refresh list.
676 (defcustom ido-max-work-file-list 10
678 This is the list the file names (sans directory) which have most recently
679 been opened. See `ido-work-file-list' and `ido-save-directory-list-file'."
683 (defcustom ido-work-directory-match-only t
684 "*Non-nil means to skip non-matching directories in the directory history.
686 \\[ido-prev-work-directory] or \\[ido-next-work-directory] will skip directories
694 If zero, the switch happens when no matches are found in the current directory.
711 "The string appended to first choice if it has multiple directory choices."
719 directory. Some systems, like Windows, have unreliable directory
722 `ido-reread-directory' command (C-l) in the minibuffer.
723 See also `ido-dir-file-cache' and `ido-save-directory-list-file'."
727 (defcustom ido-max-directory-size 30000
729 If you enter a directory with a size larger than this size, ido will
735 (defcustom ido-rotate-file-list-default nil
736 "*Non-nil means that `ido' will always rotate file list to get default in front."
740 (defcustom ido-enter-matching-directory 'only
741 "*Additional methods to enter sub-directory of first/only matching item.
742 If value is 'first, enter first matching sub-directory when typing a slash.
743 If value is 'only, typing a slash only enters the sub-directory if it is
745 If value is t, automatically enter a sub-directory when it is the only
748 (const :tag "Slash enters first directory" first)
749 (const :tag "Slash enters first and only directory" only)
750 (other :tag "Always enter unique directory" t))
765 is read by ido, possible values are file, dir, buffer, and list.
778 There are 10 elements in this list:
779 1st and 2nd elements are used as brackets around the prospect list,
781 4th element is the string inserted at the end of a truncated list of prospects,
786 9th element is displayed when the current directory is non-readable,
787 10th element is displayed when directory exceeds `ido-max-directory-size'."
833 (defcustom ido-make-file-list-hook nil
834 "*List of functions to run when the list of matching files is created.
835 Each function on the list may modify the dynamically bound variable
836 `ido-temp-list' which contains the current list of matching files."
840 (defcustom ido-make-dir-list-hook nil
841 "*List of functions to run when the list of matching directories is created.
842 Each function on the list may modify the dynamically bound variable
843 `ido-temp-list' which contains the current list of matching directories."
847 (defcustom ido-make-buffer-list-hook nil
848 "*List of functions to run when the list of matching buffers is created.
849 Each function on the list may modify the dynamically bound variable
850 `ido-temp-list' which contains the current list of matching buffer names."
856 Each function on the list may modify the following dynamically bound
858 dirname - the (abbreviated) directory name
867 `ido-current-directory' - the unabbreviated directory name
873 "*Alist of rewriting rules for directory names in ido prompts.
874 A list of elements of the form (FROM . TO) or (FROM . FUNC), each
875 meaning to rewrite the directory name if matched by FROM by either
877 with the current directory name as its only argument and using the
878 return value as the new directory name. In addition, each FUNC may
890 Otherwise, only the current list of matches is shown."
916 (defcustom ido-save-directory-list-file "~/.ido.last"
918 Variables stored are: `ido-last-directory-list', `ido-work-directory-list',
919 `ido-work-file-list', and `ido-dir-file-cache'.
924 (defcustom ido-read-file-name-as-directory-commands '()
925 "List of commands which uses `read-file-name' to read a directory name.
926 When `ido-everywhere' is non-nil, the commands in this list will read
927 the directory using `ido-read-directory-name'."
933 When `ido-everywhere' is non-nil, the commands in this list will read
958 "Keymap for ido file and directory commands.")
969 (defvar ido-last-directory-list nil
970 "List of last selected directory names.
971 See `ido-enable-last-directory-history' for details.")
973 (defvar ido-work-directory-list nil
974 "List of actual working directory names.
975 The current directory is inserted at the front of this list whenever a
978 (defvar ido-work-file-list nil
981 inserts the current file name (relative to its containing directory)
982 at the front of this list.")
986 Each element in the list is of the form (DIR (MTIME) FILE...).")
988 (defvar ido-ignore-item-temp-list nil
1004 "Non-nil means we need to regenerate the list of matching items.")
1007 "Non-nil means we are rotating list of matches.")
1029 (defvar ido-current-directory nil
1030 "Current directory for `ido-find-file'.")
1050 ;; Stores the current ido item type ('file, 'dir, 'buffer, or 'list).
1056 ;; Stores the current list of items that will be searched through.
1057 ;; The list is ordered, so that the most interesting item comes first,
1059 ;; at the end of the list. Created by `ido-make-item-list'.
1060 (defvar ido-cur-list)
1062 ;; Stores the choice list for ido-completing-read
1063 (defvar ido-choice-list)
1065 ;; Stores the list of items which are ignored when building
1066 ;; `ido-cur-list'. It is in no specific order.
1067 (defvar ido-ignored-list)
1069 ;; Remember if current directory is non-readable (so we cannot do completion).
1070 (defvar ido-directory-nonreadable)
1072 ;; Remember if current directory is 'huge' (so we don't want to do completion).
1073 (defvar ido-directory-too-big)
1075 ;; Keep current item list if non-nil.
1076 (defvar ido-keep-item-list)
1090 ;; Stores a temporary version of the file list being created.
1091 (defvar ido-temp-list)
1093 ;; Non-nil if default list element should be rotated into place.
1096 ;; Stores current index in ido-work-directory-list.
1097 (defvar ido-work-directory-index)
1099 ;; Stores current index in ido-work-file-list.
1102 ;; Set when merged work directory list is in use.
1103 (defvar ido-use-merged-list)
1105 ;; Set when merged work directory list not yet built.
1106 (defvar ido-try-merged-list)
1108 ;; Saved state prior to last work directory merge.
1109 ;; Value is a list (ido-text dir cur-list ignored-list matches).
1125 ido-use-merged-list
1160 "Return list of UNC host names."
1164 ido-unc-hosts) ;; static list or nil
1177 res host re-list re)
1181 re-list (and ido-process-ignore-lists
1183 (while re-list
1184 (setq re (car re-list)
1185 re-list (cdr re-list))
1187 (setq re-list nil
1197 "Query network for list of UNC host names using `NET VIEW'."
1209 (or dir ido-current-directory))))
1214 (or dir ido-current-directory))))
1219 (or dir ido-current-directory))))
1221 (defun ido-is-root-directory (&optional dir)
1222 (setq dir (or dir ido-current-directory))
1231 (defun ido-is-ftp-directory (&optional dir)
1236 (or dir ido-current-directory)))
1240 (setq dir (or dir ido-current-directory))
1261 (and (numberp ido-cache-ftp-work-directory-time)
1262 (> ido-cache-ftp-work-directory-time 0)
1264 (< (- (ido-time-stamp) time) ido-cache-ftp-work-directory-time))))
1272 (defun ido-may-cache-directory (&optional dir)
1273 (setq dir (or dir ido-current-directory))
1275 ((ido-directory-too-big-p dir)
1277 ((and (ido-is-root-directory dir)
1283 ((ido-is-ftp-directory dir)
1287 (defun ido-pp (list &optional sep)
1290 (insert "\n;; ----- " (symbol-name list) " -----\n(\n ")
1291 (setq list (symbol-value list))
1292 (while list
1293 (let* ((elt (car list))
1299 (if (and (setq list (cdr list)) s)
1306 (when (and ido-last-directory-list ido-save-directory-list-file)
1312 (ido-pp 'ido-last-directory-list)
1313 (ido-pp 'ido-work-directory-list)
1314 (ido-pp 'ido-work-file-list)
1320 (write-file ido-save-directory-list-file nil))
1327 (if (or arg (and ido-save-directory-list-file (not ido-last-directory-list)))
1328 (let ((file (expand-file-name ido-save-directory-list-file))
1337 (setq ido-last-directory-list (read (current-buffer))
1338 ido-work-directory-list (read (current-buffer))
1339 ido-work-file-list (read (current-buffer))
1351 (setq ido-last-directory-list
1352 (and (listp ido-last-directory-list)
1353 (let ((l ido-last-directory-list) r)
1361 (setq ido-work-directory-list
1362 (and (listp ido-work-directory-list)
1363 (let ((l ido-work-directory-list) r)
1367 (not (ido-is-ftp-directory (car l)))))
1371 (setq ido-work-file-list
1372 (and (listp ido-work-file-list)
1373 (let ((l ido-work-file-list) r)
1396 (ido-may-cache-directory dir)))
1399 (ido-is-ftp-directory dir)
1416 ;; Remove ignored directories from work directory list
1417 ;; according to ido-work-directory-list-ignore-regexps
1418 (if ido-work-directory-list
1419 (let ((dirs (reverse ido-work-directory-list)))
1420 (setq ido-work-directory-list nil)
1422 (ido-record-work-directory (car dirs))
1425 (let ((l ido-last-directory-list) e)
1430 (let ((l ido-work-directory-list) e)
1434 (let ((l ido-work-file-list) e)
1493 (define-key map [remap list-directory] 'ido-list-directory)
1511 (add-to-list 'minor-mode-map-alist ido-minor-mode-map-entry)))))
1515 "Toggle using ido speed-ups everywhere file and directory names are read.
1553 (define-key map "\C-z" 'ido-undo-merge-work-directory)
1567 ;; File and directory map
1574 (define-key map [(meta up)] 'ido-prev-work-directory)
1575 (define-key map [(meta down)] 'ido-next-work-directory)
1581 (define-key map [(control backspace)] 'ido-up-directory)
1582 (define-key map "\C-l" 'ido-reread-directory)
1587 (define-key map [(meta ?k)] 'ido-forget-work-directory)
1588 (define-key map [(meta ?m)] 'ido-make-directory)
1589 (define-key map [(meta ?n)] 'ido-next-work-directory)
1592 (define-key map [(meta ?p)] 'ido-prev-work-directory)
1668 (defun ido-nonreadable-directory-p (dir)
1669 ;; Return t if dir is a directory, but not readable
1675 (file-directory-p dir)
1678 (defun ido-directory-too-big-p (dir)
1679 ;; Return t if dir is a directory, but too big to show
1683 (and (numberp ido-max-directory-size)
1686 (file-directory-p dir)
1687 (> (nth 7 (file-attributes dir)) ido-max-directory-size))))
1689 (defun ido-set-current-directory (dir &optional subdir no-merge)
1690 ;; Set ido's current directory to DIR or DIR/SUBDIR
1694 (setq ido-use-merged-list nil
1695 ido-try-merged-list (not no-merge))
1704 ((equal dir ido-current-directory)
1708 (setq ido-current-directory dir)
1709 (setq ido-directory-nonreadable nil)
1710 (setq ido-directory-too-big nil)
1714 (setq ido-current-directory dir)
1717 (setq ido-directory-nonreadable (ido-nonreadable-directory-p dir))
1718 (setq ido-directory-too-big (and (not ido-directory-nonreadable)
1719 (ido-directory-too-big-p dir)))
1723 ;; Set ido's current directory to user's home directory
1724 (ido-set-current-directory (expand-file-name (or dir "~/"))))
1729 (let ((cmd (list command arg)))
1737 ((and (memq item '(file dir)) ido-current-directory)
1738 (let ((dirname (abbreviate-file-name ido-current-directory))
1773 ;; set ido-current-directory
1776 ;; (ido-make-item-list ...)
1789 ;; 'refresh - repeat loop (make-item-list, set-matches)
1791 ;; 'keep - repeat loop but don't (re)make-item-list
1792 ;; 'updir - go up one directory, repeat loop
1794 ;; optionally update ido-current-directory and repeat loop, or
1798 ;; e.g. the file name may be ignored or joined with ido-current-directory, and
1820 ido-cur-list
1821 ido-ignored-list
1823 (ido-keep-item-list nil)
1824 (ido-use-merged-list nil)
1825 (ido-try-merged-list t)
1854 (and ido-enable-last-directory-history
1855 (let ((d (assoc ido-current-directory ido-last-directory-list)))
1857 (if (member ido-default-item ido-ignore-item-temp-list)
1867 (if (and ido-use-merged-list (memq ido-try-merged-list '(t wide)) (not ido-keep-item-list))
1868 (let ((olist ido-cur-list)
1869 (oign ido-ignored-list)
1871 (l (ido-make-merged-file-list ido-text-init
1872 (eq ido-use-merged-list 'auto)
1873 (eq ido-try-merged-list 'wide))))
1877 (if (eq ido-try-merged-list 'wide)
1879 (list "" ido-current-directory olist oign omat)
1880 ido-cur-list nil
1881 ido-ignored-list nil
1883 ido-keep-item-list t
1884 ido-try-merged-list (if (eq ido-use-merged-list 'auto) 'auto nil)
1885 ido-use-merged-list nil)
1886 (setq ido-cur-list olist
1887 ido-ignored-list oign
1889 ido-keep-item-list t
1890 ido-try-merged-list (if (eq ido-use-merged-list 'auto) 'auto nil)
1891 ido-use-merged-list nil)))
1893 (setq ido-use-merged-list nil))
1895 (setq ido-try-merged-list t
1896 ido-use-merged-list nil))
1899 (list ido-text-init ido-current-directory olist oign omat))
1900 (ido-set-current-directory (car (cdr (car l))))
1903 (setq ido-cur-list l
1904 ido-ignored-list nil
1907 ido-keep-item-list t
1908 ido-use-merged-list t)
1913 (ido-keep-item-list
1914 (setq ido-keep-item-list nil
1917 (setq ido-ignored-list nil
1918 ido-cur-list (and (not ido-directory-nonreadable)
1919 (not ido-directory-too-big)
1920 (ido-make-file-list ido-default-item))))
1922 (setq ido-ignored-list nil
1923 ido-cur-list (and (not ido-directory-nonreadable)
1924 (not ido-directory-too-big)
1925 (ido-make-dir-list ido-default-item))))
1927 (setq ido-ignored-list nil
1928 ido-cur-list (ido-make-buffer-list ido-default-item)))
1929 ((eq ido-cur-item 'list)
1930 (setq ido-ignored-list nil
1931 ido-cur-list (ido-make-choice-list ido-default-item)))
1940 (if (and ido-matches (eq ido-try-merged-list 'auto))
1941 (setq ido-try-merged-list t))
1974 (if (and (eq ido-use-merged-list 'auto)
1976 (setq ido-use-merged-list nil
1977 ido-keep-item-list t))
1990 (d ido-current-directory)
2002 d (or (file-name-directory new) "/")
2006 (file-directory-p d)
2007 (and (yes-or-no-p (format "Create directory %s? " d))
2009 (progn (make-directory d t) t)
2011 (message "Could not create directory")
2015 (ido-set-current-directory d nil (eq ido-exit 'chdir))
2027 (setq ido-keep-item-list t))
2036 (when (string-match "\\`\\(/\\([^/]+[:@]\\)*\\)\\([^/]+\\)[:@]\\'" ido-current-directory)
2037 (setq ido-text-init (match-string 3 ido-current-directory))
2038 (ido-set-current-directory (match-string 1 ido-current-directory))
2040 (unless (ido-is-root-directory)
2044 (setq ido-text-init (file-name-nondirectory (substring ido-current-directory 0 -1)))
2046 (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1)))
2053 (ido-set-current-directory (concat ido-current-directory ido-text))
2062 (ido-set-current-directory (concat ido-current-directory ido-text))
2068 (not (if ido-directory-too-big
2069 (file-exists-p (concat ido-current-directory ido-final-text))
2078 ;; else take head of list
2082 ((memq item '(buffer list))
2091 (or (ido-is-root-directory)
2092 (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1))))
2096 (ido-is-root-directory) ;; Ange-ftp or Tramp
2098 (ido-set-current-directory ido-current-directory ido-selected)
2108 (ido-set-current-directory (file-name-directory ido-selected))
2115 (if ido-enable-last-directory-history
2116 (let ((x (assoc ido-current-directory ido-last-directory-list)))
2119 (setq ido-last-directory-list
2120 (cons (cons ido-current-directory ido-selected) ido-last-directory-list)))))
2121 (ido-set-current-directory ido-current-directory ido-selected)
2126 (file-exists-p (concat ido-current-directory (cdr elt))))
2128 (ido-set-current-directory ido-current-directory (cdr elt))
2156 (ido-current-directory nil)
2157 (ido-directory-nonreadable nil)
2158 (ido-directory-too-big nil)
2162 ;; of the list of matches
2209 (defun ido-record-work-directory (&optional dir)
2210 (when (and (numberp ido-max-work-directory-list) (> ido-max-work-directory-list 0))
2211 (if (and (setq dir (or dir ido-current-directory)) (> (length dir) 0))
2212 (let ((items ido-work-directory-list-ignore-regexps)
2219 (setq ido-work-directory-list (cons dir (delete dir ido-work-directory-list))))))
2220 (if (> (length ido-work-directory-list) ido-max-work-directory-list)
2221 (setcdr (nthcdr (1- ido-max-work-directory-list) ido-work-directory-list) nil))))
2223 (defun ido-forget-work-directory ()
2225 (when (and ido-current-directory ido-work-directory-list)
2226 (setq ido-work-directory-list (delete ido-current-directory ido-work-directory-list))
2227 (when ido-use-merged-list
2228 (ido-undo-merge-work-directory)
2230 ido-try-merged-list t
2231 ido-use-merged-list t
2237 ;; Save NAME in ido-work-file-list
2238 (when (and (numberp ido-max-work-file-list) (> ido-max-work-file-list 0))
2240 (and ido-work-file-list (equal (car ido-work-file-list) name))
2241 (setq ido-work-file-list (cons name (delete name ido-work-file-list))))
2242 (if (> (length ido-work-file-list) ido-max-work-file-list)
2243 (setcdr (nthcdr (1- ido-max-work-file-list) ido-work-file-list) nil))))
2245 (defun ido-expand-directory (dir)
2248 (ido-final-slash (expand-file-name (or dir default-directory)) t))
2254 (let ((ido-current-directory (ido-expand-directory default))
2256 ido-directory-nonreadable ido-directory-too-big
2262 (setq ido-directory-nonreadable
2263 (ido-nonreadable-directory-p ido-current-directory)
2264 ido-directory-too-big
2265 (and (not ido-directory-nonreadable)
2266 (ido-directory-too-big-p ido-current-directory))))
2287 (setq d (file-name-directory fn))
2288 (file-directory-p d))
2289 (setq ido-current-directory d)
2294 (ido-work-directory-index -1)
2308 ;; of the list of matches
2312 ;; Need to guard setting of default-directory here, since
2313 ;; we don't want to change directory of current buffer.
2314 (let ((default-directory ido-current-directory)
2327 (dired (concat ido-current-directory (or ido-text ""))))
2334 (setq default-directory ido-current-directory)
2335 (ido-record-work-directory)
2338 ((memq method '(dired list-directory))
2341 (let* ((dirname (ido-final-slash (concat ido-current-directory filename) t))
2344 ((file-directory-p dirname)
2346 (ido-record-work-directory dirname)
2348 ((file-directory-p ido-current-directory)
2351 (ido-record-command method ido-current-directory)
2352 (ido-record-work-directory)
2353 (funcall method ido-current-directory)
2358 (setq dirname (concat ido-current-directory filename))
2360 (ido-record-work-directory)
2364 (ido-record-work-directory dirname)
2365 (make-directory-internal dirname)
2368 ;; put make-directory command on history
2369 (ido-record-command 'make-directory dirname))))
2370 (t (error "No such directory")))))
2374 (setq default-directory ido-current-directory)
2375 (setq filename (concat ido-current-directory filename))
2378 (ido-record-work-directory)
2383 (setq filename (concat ido-current-directory filename))
2385 (ido-record-work-directory)
2391 (setq filename (concat ido-current-directory filename))
2396 (ido-record-work-directory)
2404 (setq filename (concat ido-current-directory filename))
2407 (ido-record-work-directory)
2439 (let ((evar (substitute-in-file-name (concat ido-current-directory ido-text))))
2440 (if (not (file-exists-p (file-name-directory evar)))
2441 (message "Expansion generates non-existing directory name")
2442 (if (file-directory-p evar)
2443 (ido-set-current-directory evar)
2444 (let ((d (or (file-name-directory evar) "/"))
2446 (when (file-directory-p d)
2447 (ido-set-current-directory d)
2452 (ido-directory-too-big
2453 (setq ido-directory-too-big nil)
2464 (string-equal ido-current-directory "/")
2509 (defun ido-undo-merge-work-directory (&optional text try refresh)
2510 "Undo or redo last ido directory merge operation.
2515 (ido-set-current-directory (nth 1 ido-pre-merge-state))
2517 ido-cur-list (nth 2 ido-pre-merge-state)
2518 ido-ignored-list (nth 3 ido-pre-merge-state)
2520 ido-use-merged-list nil
2521 ido-try-merged-list try
2522 ido-keep-item-list (not refresh)
2529 (ido-try-merged-list
2530 (setq ido-try-merged-list nil))
2532 (setq ido-try-merged-list t))
2533 ((not ido-use-merged-list)
2585 C-x C-f ... C-d enter dired on current directory."
2602 ;; ask for list to be regenerated.
2609 ;; ask for list to be regenerated.
2616 ;; ask for list to be regenerated.
2624 (if ido-directory-too-big
2626 (message "Reading directory...")
2627 (setq ido-directory-too-big nil))
2654 (defun ido-reread-directory ()
2655 "Read current directory again.
2656 May be useful if cached version is no longer valid, but directory
2663 (ido-remove-cached-dir ido-current-directory))
2724 (defun ido-up-directory (&optional clear)
2725 "Go up one directory level."
2738 (ido-up-directory t)))
2740 (ido-undo-merge-work-directory (substring ido-text 0 -1) t t))
2753 (ido-up-directory t))
2758 (defun ido-get-work-directory (&optional incr must-match)
2759 (let ((n (length ido-work-directory-list))
2760 (i ido-work-directory-index)
2771 (setq dir (nth i ido-work-directory-list))
2773 (not (equal dir ido-current-directory))
2774 (file-directory-p dir)
2779 (ido-make-file-list-1 dir)
2780 (ido-make-dir-list-1 dir)))))
2784 (setq ido-work-directory-index i))
2787 (defun ido-prev-work-directory ()
2788 "Change to next working directory in list."
2790 (let ((dir (ido-get-work-directory 1 ido-work-directory-match-only)))
2792 (ido-set-current-directory dir)
2798 (defun ido-next-work-directory ()
2799 "Change to previous working directory in list."
2801 (let ((dir (ido-get-work-directory -1 ido-work-directory-match-only)))
2803 (ido-set-current-directory dir)
2812 (setq ido-use-merged-list t ido-try-merged-list t)
2819 "Prompt for FILE to search for using find, starting from current directory."
2825 (read-string (concat "Wide find file: " ido-current-directory) ido-text)
2828 (setq ido-use-merged-list t ido-try-merged-list 'wide)
2835 "Prompt for DIR to search for using find, starting from current directory."
2841 (read-string (concat "Wide find directory: " ido-current-directory) ido-text)
2844 (setq ido-use-merged-list t ido-try-merged-list 'wide)
2851 "Prompt for DIR to search for using find, starting from current directory.
2852 If input stack is non-empty, delete current directory component."
2867 "Move to previous directory in file name, push current input on stack."
2873 "Move to previous directory in file name, push first match on stack."
2881 "Pop directory from input stack back to input.
2894 (defun ido-make-directory (&optional dir)
2895 "Prompt for DIR to create in current directory."
2900 (read-string (concat "Make directory: " ido-current-directory) ido-text))))
2902 (setq dir (concat ido-current-directory dir))
2904 (make-directory dir t)
2905 (ido-set-current-directory dir)
2912 (let ((n (length ido-work-file-list))
2918 (setq name (nth i ido-work-file-list))
2923 "Change to next working file name in list."
2932 "Change to previous working file name in list."
2951 (not (equal (file-name-directory bfname) ido-current-directory))
2956 ido-try-merged-list nil)
2960 "Insert current word (file or directory name) from current buffer."
2984 ido-try-merged-list nil
2987 (setq ido-text-init (concat ido-current-directory word)
2988 ido-try-merged-list nil
2992 ido-try-merged-list nil
2997 "Put first element of `ido-matches' at the end of the list."
3001 (setq ido-cur-list (ido-chop ido-cur-list next))
3006 "Put last element of `ido-matches' at the front of the list."
3010 (setq ido-cur-list (ido-chop ido-cur-list prev))
3015 "Find next directory in match list.
3019 (if ido-use-merged-list
3031 (setq ido-cur-list (ido-chop ido-cur-list (nth i ido-matches)))))))
3034 "Find previous directory in match list.
3038 (if ido-use-merged-list
3050 (setq ido-cur-list (ido-chop ido-cur-list (nth i ido-matches)))))))
3053 "Set current item list to the currently matched items."
3056 (setq ido-cur-list ido-matches
3078 ;; Return file name for current item, whether in a normal list
3079 ;; or a merged work directory list.
3086 ;; Return unsorted list of all competions.
3088 (ido-directory-too-big nil))
3091 (ido-make-file-list-1 ido-current-directory))
3093 (ido-make-dir-list-1 ido-current-directory))
3095 (ido-make-buffer-list-1))
3096 ((eq ido-cur-item 'list)
3097 ido-choice-list)
3101 ;; File list sorting
3109 ;; Compare file names according to ido-file-extensions-order list.
3167 (defun ido-sort-merged-list (items promote)
3168 ;; Input is list of ("file" . "dir") cons cells.
3169 ;; Output is sorted list of ("file "dir" ...) lists
3178 (if (and promote (string-equal ido-current-directory (cdr a)))
3180 (setq res (cons (list (car a) (cdr a)) res)
3185 ;; As ido-run-find-command, but returns a list of cons pairs ("file" . "dir")
3202 (setq d (file-name-directory filename)
3207 (defun ido-flatten-merged-list (items)
3208 ;; Create a list of directory names based on a merged directory list.
3221 (defun ido-make-merged-file-list-1 (text auto wide)
3226 ido-current-directory (substring text 0 -1) ido-enable-prefix t))
3227 ;; Use list of cached directories
3237 (file-directory-p dir))
3240 d (file-name-directory b)
3259 ido-current-directory text ido-enable-prefix nil))
3261 (dirs ido-work-directory-list)
3264 (if (and auto (not (member ido-current-directory dirs)))
3265 (setq dirs (cons ido-current-directory dirs)))
3271 (not (ido-is-ftp-directory dir)))
3272 (file-directory-p dir)
3275 (ido-make-file-list-1 dir t)
3276 (ido-make-dir-list-1 dir t))))
3286 (defun ido-make-merged-file-list (text auto wide)
3292 (ido-make-merged-file-list-1 text auto wide))))
3296 ido-try-merged-list nil
3297 ido-use-merged-list nil)))
3299 (setq res (ido-sort-merged-list res auto)))
3300 (when (and (or ido-rotate-temp ido-rotate-file-list-default)
3310 (defun ido-make-buffer-list-1 (&optional frame visible)
3311 ;; Return list of non-ignored buffer names
3318 (buffer-list frame))))
3320 (defun ido-make-buffer-list (default)
3321 ;; Return the current list of buffers.
3322 ;; Currently visible buffers are put at the end of the list.
3323 ;; The hook `ido-make-buffer-list-hook' is run after the list has been
3325 ;; in this list. If DEFAULT is non-nil, and corresponds to an existing buffer,
3326 ;; it is put to the start of the list.
3328 (ido-temp-list (ido-make-buffer-list-1 (selected-frame) ido-current-buffers)))
3329 (if ido-temp-list
3330 (nconc ido-temp-list ido-current-buffers)
3331 (setq ido-temp-list ido-current-buffers))
3334 (setq ido-temp-list
3335 (delete default ido-temp-list))
3336 (setq ido-temp-list
3337 (cons default ido-temp-list))))
3338 (run-hooks 'ido-make-buffer-list-hook)
3339 ido-temp-list))
3341 (defun ido-make-choice-list (default)
3342 ;; Return the current list of choices.
3344 ;; it is put to the start of the list.
3345 (let ((ido-temp-list ido-choice-list))
3348 (setq ido-temp-list
3349 (delete default ido-temp-list))
3350 (setq ido-temp-list
3351 (cons default ido-temp-list))))
3352 ; (run-hooks 'ido-make-choice-list-hook)
3353 ido-temp-list))
3356 ;; Move the elements from ITEMS to the end of `ido-temp-list'
3359 (setq ido-temp-list (delq elem ido-temp-list)))
3361 (if ido-temp-list
3362 (nconc ido-temp-list items)
3363 (setq ido-temp-list items)))
3367 ((ido-nonreadable-directory-p dir) '())
3368 ;; do not check (ido-directory-too-big-p dir) here.
3409 (ido-may-cache-directory dir))
3412 (ftp (ido-is-ftp-directory dir))
3457 (defun ido-make-file-list-1 (dir &optional merged)
3458 ;; Return list of non-ignored files in DIR
3461 (file-directory-p dir))
3469 (defun ido-make-file-list (default)
3470 ;; Return the current list of files.
3471 ;; Currently visible files are put at the end of the list.
3472 ;; The hook `ido-make-file-list-hook' is run after the list has been
3474 ;; in this list.
3475 (let ((ido-temp-list (ido-make-file-list-1 ido-current-directory)))
3476 (setq ido-temp-list (sort ido-temp-list
3480 (unless (ido-is-tramp-root ido-current-directory)
3481 (let ((default-directory ido-current-directory))
3489 ido-temp-list)))))
3493 ido-temp-list)))
3494 (if (and default (member default ido-temp-list))
3495 (if (or ido-rotate-temp ido-rotate-file-list-default)
3496 (unless (equal default (car ido-temp-list))
3497 (let ((l ido-temp-list) k)
3502 (nconc k ido-temp-list)
3503 (setq ido-temp-list k)))
3504 (setq ido-temp-list
3505 (delete default ido-temp-list))
3506 (setq ido-temp-list
3507 (cons default ido-temp-list))))
3509 (setq ido-temp-list (delete "." ido-temp-list))
3510 (setq ido-temp-list (cons "." ido-temp-list)))
3511 (run-hooks 'ido-make-file-list-hook)
3512 ido-temp-list))
3514 (defun ido-make-dir-list-1 (dir &optional merged)
3515 ;; Return list of non-ignored subdirs in DIR
3517 (and (or (ido-is-tramp-root dir) (file-directory-p dir))
3525 (defun ido-make-dir-list (default)
3526 ;; Return the current list of directories.
3527 ;; The hook `ido-make-dir-list-hook' is run after the list has been
3529 ;; directory names in this list.
3530 (let ((ido-temp-list (ido-make-dir-list-1 ido-current-directory)))
3531 (setq ido-temp-list (sort ido-temp-list #'ido-file-lessp))
3535 ido-temp-list)))
3536 (if (and default (member default ido-temp-list))
3537 (if (or ido-rotate-temp ido-rotate-file-list-default)
3538 (unless (equal default (car ido-temp-list))
3539 (let ((l ido-temp-list) k)
3544 (nconc k ido-temp-list)
3545 (setq ido-temp-list k)))
3546 (setq ido-temp-list
3547 (delete default ido-temp-list))
3548 (setq ido-temp-list
3549 (cons default ido-temp-list))))
3550 (setq ido-temp-list (delete "." ido-temp-list))
3552 (setq ido-temp-list (cons "." ido-temp-list)))
3553 (run-hooks 'ido-make-dir-list-hook)
3554 ido-temp-list))
3560 ;; Return the list of buffers that are visible in the current frame.
3575 (member buf ido-ignore-item-temp-list))
3576 ;; Only add buf if it is not already in list.
3578 ;; put into the list twice.
3585 ;; Return list of matches in items
3639 (ido-trace "suffix match" (list text suffix-re suffix-matches))
3642 (ido-trace "full match" (list text full-re full-matches))
3661 ;; Set `ido-matches' to the list of items matching prompt
3663 (setq ido-matches (ido-set-matches-1 (reverse ido-cur-list) (not ido-rotate))
3666 (defun ido-ignore-item-p (name re-list &optional ignore-ext)
3668 (or (member name ido-ignore-item-temp-list)
3670 ido-process-ignore-lists re-list
3672 (let ((ext-list (and ignore-ext ido-ignore-extensions
3677 (while ext-list
3678 (setq nextstr (car ext-list))
3686 ext-list nil
3687 re-list nil)
3688 (setq ext-list (cdr ext-list))))
3689 (while re-list
3690 (setq nextstr (car re-list))
3696 re-list nil)
3697 (setq re-list (cdr re-list))))
3700 (setq ido-ignored-list (cons name ido-ignored-list)))
3746 ((ido-active t) ;; ido-use-merged-list
3747 (setq ido-current-directory ""
3754 (ido-set-current-directory ido-current-directory choice)
3764 display-it full-list)
3777 (setq full-list t
3784 (let ((completion-list (sort
3786 (ido-directory-too-big
3787 (message "Reading directory...")
3788 (setq ido-directory-too-big nil
3789 ido-ignored-list nil
3790 ido-cur-list (ido-all-completions)
3793 (or ido-matches ido-cur-list))
3794 (ido-use-merged-list
3795 (ido-flatten-merged-list (or ido-matches ido-cur-list)))
3796 ((or full-list ido-completion-buffer-all-completions)
3799 (copy-sequence (or ido-matches ido-cur-list))))
3805 (let ((f 'display-completion-list))
3806 (funcall f completion-list
3812 (display-completion-list completion-list)))))))
3829 ;; else buffer was killed so remove name from list.
3830 (setq ido-cur-list (delq buf ido-cur-list)))))))
3842 (setq file (concat ido-current-directory file)))
3845 (not (file-directory-p file))
3846 (file-writable-p ido-current-directory)
3853 ;; else file was killed so remove name from list.
3854 (setq ido-cur-list (delq (car ido-matches) ido-cur-list)))))))
3927 RET Select the buffer at the front of the list of matches. If the
3928 list is empty, possibly prompt to create new buffer.
3933 \\[ido-next-match] Put the first element at the end of the list.
3934 \\[ido-prev-match] Put the last element at the start of the list.
3937 If there is no common suffix, show a list of all matching buffers
3944 \\[ido-completion-help] Show list of matching buffers in separate window.
3946 \\[ido-kill-buffer-at-head] Kill buffer at head of buffer list.
4015 RET Select the file at the front of the list of matches. If the
4016 list is empty, possibly prompt to create new file.
4021 \\[ido-next-match] Put the first element at the end of the list.
4022 \\[ido-prev-match] Put the last element at the start of the list.
4025 If there is no common suffix, show a list of all matching files
4027 \\[ido-edit-input] Edit input string (including directory).
4028 \\[ido-prev-work-directory] or \\[ido-next-work-directory] go to previous/next directory in work directory history.
4029 \\[ido-merge-work-directories] search for file in the work directory history.
4030 \\[ido-forget-work-directory] removes current directory from the work directory history.
4033 \\[ido-make-directory] prompts for a directory to create in current directory.
4040 \\[ido-completion-help] Show list of matching files in separate window.
4109 (ido-work-directory-match-only nil)
4127 The directory is selected interactively by typing a substring.
4134 (defun ido-list-directory ()
4135 "Call `list-directory' the ido way.
4136 The directory is selected interactively by typing a substring.
4141 (ido-file-internal 'list-directory 'list-directory nil "List directory: " 'dir)))
4164 (setq ido-use-merged-list 'auto
4175 ;; Find matching files and display a list in the minibuffer.
4182 (buffer-undo-list t)
4188 (ido-trace "dir" ido-current-directory)
4190 (ido-trace "list" ido-cur-list)
4202 ;; Handle explicit directory changes
4204 ((memq ido-cur-item '(buffer list))
4213 (ido-set-current-directory ido-current-directory contents)
4217 (ido-is-root-directory)))
4218 (ido-set-current-directory "//")
4223 (ido-is-root-directory) ;; Ange-ftp or tramp
4225 (ido-set-current-directory ido-current-directory contents)
4238 (ido-up-directory t)
4250 ido-current-directory)
4253 (when (and exp (file-directory-p exp))
4254 (ido-set-current-directory (file-name-directory exp))
4259 (ido-set-current-directory (file-name-directory contents))
4262 (ido-set-current-directory
4264 (expand-file-name "/" ido-current-directory)
4267 ((and (or ido-directory-nonreadable ido-directory-too-big)
4268 (file-directory-p (concat ido-current-directory (file-name-directory contents))))
4269 (ido-set-current-directory
4270 (concat ido-current-directory (file-name-directory contents)))
4278 (ido-set-current-directory
4283 (concat ido-current-directory (ido-name (car ido-matches))))
4285 (concat ido-current-directory (substring contents 0 -1)))))
4289 ((and (not ido-use-merged-list)
4291 (eq ido-try-merged-list t)
4298 (setq ido-use-merged-list 'auto
4310 ;; Update the list of matches
4315 (when (and ido-enter-matching-directory
4317 (or (eq ido-enter-matching-directory 'first)
4321 (eq ido-enter-matching-directory t)))
4323 (ido-set-current-directory
4324 (concat ido-current-directory (ido-name (car ido-matches))))
4329 (not ido-directory-nonreadable)
4330 (not ido-directory-too-big)
4333 ido-ignored-list)
4336 (ido-cur-list ido-ignored-list))
4337 (ido-trace "try all" ido-ignored-list)
4351 (not (ido-is-root-directory))
4354 (not ido-directory-nonreadable)
4355 (not ido-directory-too-big))
4357 (if ido-use-merged-list
4358 (ido-undo-merge-work-directory contents nil)
4359 (when (and (eq ido-try-merged-list t)
4371 (if (and ido-use-merged-list
4373 (not (string-equal (car (cdr (car ido-matches))) ido-current-directory)))
4375 (ido-set-current-directory (car (cdr (car ido-matches))))
4376 (setq ido-use-merged-list t
4420 (ido-directory-nonreadable
4422 (ido-directory-too-big
4457 ((= items 0) (list (nth 3 ido-decorations))) ; " | ..."
4459 (list (or ido-separator (nth 2 ido-decorations)) ; " | "
4475 ;; list all alternatives
4512 (let ((buffer-undo-list t))
4520 ;; Move the summaries to the end of the buffer list.
4522 ;; `ido-make-buffer-list-hook'. Any buffer matching the regexps
4523 ;; `Summary' or `output\*$'are put to the end of the list.
4530 ido-temp-list))))
4544 buffer to be selected, which will go to the front of the list.
4546 (let* ((ido-current-directory nil)
4547 (ido-directory-nonreadable nil)
4548 (ido-directory-too-big nil)
4560 Read file name, prompting with PROMPT and completing in directory DIR.
4564 ((or (eq predicate 'file-directory-p)
4566 (memq this-command ido-read-file-name-as-directory-commands))
4568 (ido-read-directory-name prompt dir default-filename mustmatch initial))
4579 (ido-current-directory (ido-expand-directory dir))
4580 (ido-directory-nonreadable (not (file-readable-p ido-current-directory)))
4581 (ido-directory-too-big (and (not ido-directory-nonreadable)
4582 (ido-directory-too-big-p ido-current-directory)))
4583 (ido-work-directory-index -1)
4595 (setq filename ido-current-directory))
4598 (concat ido-current-directory filename))))))
4608 (defun ido-read-directory-name (prompt &optional dir default-dirname mustmatch initial)
4609 "Ido replacement for the built-in `read-directory-name'.
4610 Read directory name, prompting with PROMPT and completing in directory DIR.
4611 See `read-directory-name' for additional parameters."
4616 (ido-current-directory (ido-expand-directory dir))
4617 (ido-directory-nonreadable (not (file-readable-p ido-current-directory)))
4618 (ido-directory-too-big (and (not ido-directory-nonreadable)
4619 (ido-directory-too-big-p ido-current-directory)))
4620 (ido-work-directory-index -1)
4626 ido-current-directory
4627 (concat ido-current-directory filename)))))
4634 CHOICES is a list of strings which are the possible completions.
4643 HIST, if non-nil, specifies a history list.
4645 (let ((ido-current-directory nil)
4646 (ido-directory-nonreadable nil)
4647 (ido-directory-too-big nil)
4649 (ido-choice-list choices))
4650 (ido-read-internal 'list prompt hist def require-match initial-input)))