ido.el 166 KB
Newer Older
Kim F. Storm's avatar
Kim F. Storm committed
1 2
;;; ido.el --- interactively do things with buffers and files.

3
;; Copyright (C) 1996-2011 Free Software Foundation, Inc.
Kim F. Storm's avatar
Kim F. Storm committed
4 5 6 7 8 9 10

;; Author: Kim F. Storm <storm@cua.dk>
;; Based on: iswitchb by Stephen Eglen <stephen@cns.ed.ac.uk>
;; Keywords: extensions convenience

;; This file is part of GNU Emacs.

11
;; GNU Emacs is free software: you can redistribute it and/or modify
Kim F. Storm's avatar
Kim F. Storm committed
12
;; it under the terms of the GNU General Public License as published by
13 14
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
Kim F. Storm's avatar
Kim F. Storm committed
15 16 17 18 19 20 21

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
22
;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
Kim F. Storm's avatar
Kim F. Storm committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54


;;; Commentary:

;; Ido - interactive do - switches between buffers and opens files and
;; directories with a minimum of keystrokes.  It is a superset of
;; iswitchb, the interactive buffer switching package by Stephen Eglen.

;; Interactive substring matching
;; ------------------------------
;;
;; As you type in a substring, the list of buffers or files currently
;; matching the substring are displayed as you type.  The list is
;; ordered so that the most recent buffers or files visited come at
;; the start of the list.
;;
;; The buffer or file at the start of the list will be the one visited
;; when you press RETURN.  By typing more of the substring, the list is
;; narrowed down so that gradually the buffer or file you want will be
;; at the top of the list.  Alternatively, you can use C-s and C-r (or
;; the right and left arrow keys) to rotate buffer or file names in the
;; list until the one you want is at the top of the list.
;;
;; Completion is also available so that you can see what is common to
;; all of the matching buffers or files as you type.
;;
;; Example:
;;
;; If I have two buffers called "123456" and "123", with "123456" the
;; most recent, when I use ido-switch-buffer, I first of all get
;; presented with the list of all the buffers
;;
55
;;       Buffer: {123456 | 123}
Kim F. Storm's avatar
Kim F. Storm committed
56 57
;;
;; If I then press 2:
58
;;       Buffer: 2[3]{123456 | 123}
Kim F. Storm's avatar
Kim F. Storm committed
59 60 61 62
;;
;; The list in {...} are the matching buffers, most recent first
;; (buffers visible in the current frame are put at the end of the
;; list by default).  At any time I can select the item at the head of
Kim F. Storm's avatar
Kim F. Storm committed
63 64 65
;; the list by pressing RET.  I can also put the first element at the
;; end of the list by pressing C-s or [right], or bring the last
;; element to the head of the list by pressing C-r or [left].
Kim F. Storm's avatar
Kim F. Storm committed
66 67 68 69 70
;;
;; The item in [...] indicates what can be added to my input by
;; pressing TAB.  In this case, I will get "3" added to my input.

;; So, I press TAB:
71
;;	 Buffer: 23{123456 | 123}
Kim F. Storm's avatar
Kim F. Storm committed
72 73 74 75 76 77 78
;;
;; At this point, I still have two matching buffers.
;; If I want the first buffer in the list, I simply press RET.  If I
;; wanted the second in the list, I could press C-s to move it to the
;; top of the list and then RET to select it.
;;
;; However, if I type 4, I only have one match left:
79 80 81 82 83
;;       Buffer: 234[123456]
;;
;; Since there is only one matching buffer left, it is given in [] and
;; it is shown in the `ido-only-match' face (ForestGreen).  I can now
;; press TAB or RET to go to that buffer.
Kim F. Storm's avatar
Kim F. Storm committed
84
;;
85 86
;; If I want to create a new buffer named "234", I press C-j instead of
;; TAB or RET.
Kim F. Storm's avatar
Kim F. Storm committed
87
;;
88
;; If instead, I type "a":
Kim F. Storm's avatar
Kim F. Storm committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
;;       Buffer: 234a [No match]
;; There are no matching buffers.  If I press RET or TAB, I can be
;; prompted to create a new buffer called "234a".
;;
;; Of course, where this function comes in really useful is when you
;; can specify the buffer using only a few keystrokes.  In the above
;; example, the quickest way to get to the "123456" file would be
;; just to type 4 and then RET (assuming there isn't any newer buffer
;; with 4 in its name).

;; Likewise, if you use C-x C-f (ido-find-file), the list of files and
;; directories in the current directory is provided in the same
;; fashion as the buffers above.  The files and directories are
;; normally sorted in alphabetical order, but the most recently
;; visited directory is placed first to speed up navigating to
;; directories that you have visited recently.
;;
;; In addition to scrolling through the list using [right] and [left],
;; you can use [up] and [down] to quickly scroll the list to the next
;; or previous subdirectory.
;;
;; To go down into a subdirectory, and continue the file selection on
;; the files in that directory, simply move the directory to the head
;; of the list and hit RET.
;;
;; To go up to the parent directory, delete any partial file name
;; already specified (e.g. using [backspace]) and hit [backspace].
;;
;; To go to the root directory (on the current drive), enter two
;; slashes.  On MS-DOS or Windows, to select the root of another
;; drive, enter X:/ where X is the drive letter.  You can also visit
;; files on other hosts using the ange-ftp notations `/host:' and
;; `/user@host:'.  See the variable `ido-slow-ftp-hosts' if you want
122
;; to inhibit the ido substring matching for ftp access.
Kim F. Storm's avatar
Kim F. Storm committed
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
;;
;; If for some reason you cannot specify the proper file using
;; ido-find-file, you can press C-f to enter the normal find-file.
;; You can also press C-b to drop into ido-switch-buffer.

;; See the doc string of ido-switch-buffer and ido-find-file for full
;; keybindings and features.
;;  (describe-function 'ido-find-file)

;; Hidden buffers and files
;; ------------------------
;;
;; Normally, ido does not include hidden buffers (whose name starts
;; with a space) and hidden files and directories (whose name starts
;; with `.') in the list of possible completions.  However, if the
;; substring you enter does not match any of the visible buffers or
;; files, ido will automatically look for completions among the hidden
;; buffers or files.
;;
;; You can toggle display of the hidden buffers and files with C-a.

;; Additional functionality
;; ------------------------
;;
;; After C-x b, the buffer at the head of the list can be killed by
;; pressing C-k.  If the buffer needs saving, you will be queried
;; before the buffer is killed.
;;
;; Likewise, after C-x C-f, you can delete (i.e. physically remove)
;; the file at the head of the list with C-k.  You will always be
;; asked for confirmation before the file is deleted.
;;
;; If you enter C-x b to switch to a buffer visiting a given file, and
;; you find that the file you are after is not in any buffer, you can
;; press C-f to immediately drop into ido-find-file.  And you can
;; switch back to buffer selection with C-b.

;; Prefix matching
;; ---------------
;;
;; The standard way of completion with Unix-shells and Emacs is to insert a
;; PREFIX and then hitting TAB (or another completion key). Cause of this
;; behavior has become second nature to a lot of emacs users `ido' offers in
;; addition to the default substring-matching-method (look above) also the
;; prefix-matching-method. The kind of matching is the only difference to
;; the description of the substring-matching above.
;;
;; You can toggle prefix matching with C-p.
;;
;; Example:
;;
;; If you have again two Buffers "123456" and "123" then hitting "2" does
Kim F. Storm's avatar
Kim F. Storm committed
175
;; not match because "2" is not a PREFIX in any of the buffer-names.
Kim F. Storm's avatar
Kim F. Storm committed
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199

;; Flexible matching
;; -----------------
;;
;; If you set ido-enable-flex-matching, ido will do a more flexible
;; matching (unless regexp matching is active) to find possible matches
;; among the available buffer or file names if no matches are found using
;; the normal prefix or substring matching.
;;
;; The flexible matching implies that any item which simply contains all
;; of the entered characters in the specified sequence will match.
;;
;; Example:
;;
;; If you have four files "alpha", "beta", "gamma", and "delta",
;; entering "aa" will match "alpha" and "gamma", while "ea" matches
;; "beta" and "delta".  If prefix matching is also active, "aa" only
;; matches "alpha", while "ea" does not match any files.

;; Regexp matching
;; ---------------
;;
;; There is limited provision for regexp matching within ido,
;; enabled through `ido-enable-regexp' (toggle with C-t).
Kim F. Storm's avatar
Kim F. Storm committed
200 201 202 203
;; This allows you to type `[ch]$' for example and see all file names
;; ending in `c' or `h'.
;;
;; Note: ido-style completion is inhibited when you enable regexp matching.
Kim F. Storm's avatar
Kim F. Storm committed
204 205 206 207 208 209 210


;; Customization
;; -------------
;;
;; Customize the `ido' group to change the `ido' functionality.
;;
Kim F. Storm's avatar
Kim F. Storm committed
211 212
;; To modify the keybindings, use the ido-setup-hook.  For example:
;;(add-hook 'ido-setup-hook 'ido-my-keys)
Kim F. Storm's avatar
Kim F. Storm committed
213 214 215
;;
;;(defun ido-my-keys ()
;;  "Add my keybindings for ido."
216
;;  (define-key ido-completion-map " " 'ido-next-match)
Kim F. Storm's avatar
Kim F. Storm committed
217 218 219 220 221 222 223 224 225 226
;;  )

;; Seeing all the matching buffers or files
;; ----------------------------------------
;;
;; If you have many matching files, they may not all fit onto one
;; line of the minibuffer.  Normally, the minibuffer window will grow
;; to show you more of the matching files (depending on the setting
;; of the variables `resize-mini-windows' and `max-mini-window-height').
;; If you want ido to behave differently from the default minibuffer
Glenn Morris's avatar
Glenn Morris committed
227
;; resizing behavior, set the variable `ido-max-window-height'.
Kim F. Storm's avatar
Kim F. Storm committed
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
;;
;; Also, to improve the responsiveness of ido, the maximum number of
;; matching items is limited to 12, but you can increase or removed
;; this limit via the `ido-max-prospects' variable.

;; To see a full list of all matching buffers in a separate buffer,
;; hit ? or press TAB when there are no further completions to the
;; substring.  Repeated TAB presses will scroll you through this
;; separate buffer.

;; Changing the list of files
;; --------------------------

;; By default, the list of current files is most recent first,
;; oldest last, with the exception that the files visible in the
;; current frame are put at the end of the list.  A hook exists to
;; allow other functions to order the list.  For example, if you add:
;;
;; (add-hook 'ido-make-buffer-list-hook 'ido-summary-buffers-to-end)
;;
;; then all files matching "Summary" are moved to the end of the
;; list.  (I find this handy for keeping the INBOX Summary and so on
;; out of the way.)  It also moves files matching "output\*$" to the
David Kastrup's avatar
David Kastrup committed
251
;; end of the list (these are created by AUCTeX when compiling.)
Kim F. Storm's avatar
Kim F. Storm committed
252 253 254 255 256 257 258
;; Other functions could be made available which alter the list of
;; matching files (either deleting or rearranging elements.)

;; Highlighting
;; ------------

;; The highlighting of matching items is controlled via ido-use-faces.
259 260
;; The faces used are ido-first-match, ido-only-match and
;; ido-subdir.
Kim F. Storm's avatar
Kim F. Storm committed
261 262 263 264 265 266 267 268 269 270 271 272 273
;; Colouring of the matching item was suggested by
;; Carsten Dominik (dominik@strw.leidenuniv.nl).

;; Replacement for read-buffer and read-file-name
;; ----------------------------------------------

;; ido-read-buffer and ido-read-file-name have been written to be drop
;; in replacements for the normal buffer and file name reading
;; functions `read-buffer' and `read-file-name'.

;; To use ido for all buffer and file selections in Emacs, customize the
;; variable `ido-everywhere'.

Glenn Morris's avatar
Glenn Morris committed
274
;; Using ido-like behavior in other lisp packages
Kim F. Storm's avatar
Kim F. Storm committed
275 276 277 278 279 280 281
;; -----------------------------------------------

;; If you don't want to rely on the `ido-everywhere' functionality,
;; ido-read-buffer, ido-read-file-name, and ido-read-directory-name
;; can be used by other packages to read a buffer name, a file name,
;; or a directory name in the `ido' way.

282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
;;; Acknowledgements

;; Infinite amounts of gratitude goes to Stephen Eglen <stephen@cns.ed.ac.uk>
;; who wrote iswitch-buffer mode - from which I ripped off 99% of the code
;; for ido-switch-buffer and found the inspiration for ido-find-file.
;; The ido package would never have existed without his work.

;; Also thanks to Klaus Berndl, Rohit Namjoshi, Robert Fenk, Alex
;; Schroeder, Bill Benedetto, Stephen Eglen, and many others for bug
;; fixes and improvements.

;;; History

;; Since I discovered Stephen Eglen's excellent iswitchb package, I just
;; couldn't live without it, but once being addicted to switching buffers
;; with a minimum of keystrokes, I soon found that opening files in the
;; old-fashioned way was just too slow - so I decided to write a package
;; which could open files with the same speed and ease as iswitchb could
;; switch buffers.

;; I originally wrote a separate ifindf.el package based on a copy of
;; iswitchb.el, which did for opening files what iswitchb did for
;; switching buffers.  Along the way, I corrected a few errors in
;; ifindf which could have found its way back into iswitchb, but since
;; most of the functionality of the two package was practically
;; identical, I decided that the proper thing to do was to merge my
;; ifindf package back into iswitchb.
;;
;; This is basically what ido (interactively do) is all about; but I
;; found it ackward to merge my changes into the "iswitchb-" namespace,
;; so I invented a common "ido-" namespace for the merged packages.
;;
;; This version is based on ido.el version 1.57 released on
;; gnu.emacs.sources adapted for emacs 22.1 to use command remapping
;; and optionally hooking the read-buffer and read-file-name functions.
;;
;; Prefix matching was added by Klaus Berndl <klaus.berndl@sdm.de> based on
;; an idea of Yuji Minejima <ggb01164@nifty.ne.jp> and his mcomplete-package.

Kim F. Storm's avatar
Kim F. Storm committed
321 322 323

;;; Code:

324
(defvar recentf-list)
325

Kim F. Storm's avatar
Kim F. Storm committed
326 327 328 329 330 331 332 333 334 335 336
;;; User Variables
;;
;; These are some things you might want to change.

(defun ido-fractionp (n)
  (and (numberp n) (> n 0.0) (<= n 1.0)))

(defgroup ido nil
  "Switch between files using substrings."
  :group 'extensions
  :group 'convenience
337
  :version "22.1"
Kim F. Storm's avatar
Kim F. Storm committed
338 339 340 341 342 343
  :link '(emacs-commentary-link :tag "Commentary" "ido.el")
  :link '(emacs-library-link :tag "Lisp File" "ido.el"))

;;;###autoload
(defcustom ido-mode nil
  "Determines for which functional group \(buffer and files) ido behavior
344
should be enabled.  The following values are possible:
Richard M. Stallman's avatar
Richard M. Stallman committed
345
- `buffer': Turn only on ido buffer behavior \(switching, killing,
346
  displaying...)
Richard M. Stallman's avatar
Richard M. Stallman committed
347 348 349
- `file': Turn only on ido file behavior \(finding, writing, inserting...)
- `both': Turn on ido buffer and file behavior.
- `nil': Turn off any ido switching.
Kim F. Storm's avatar
Kim F. Storm committed
350 351 352 353 354

Setting this variable directly does not take effect;
use either \\[customize] or the function `ido-mode'."
  :set #'(lambda (symbol value)
	   (ido-mode value))
355
  :initialize 'custom-initialize-default
Kim F. Storm's avatar
Kim F. Storm committed
356 357
  :require 'ido
  :link '(emacs-commentary-link "ido.el")
358
  :set-after '(ido-save-directory-list-file
359
	       ;; This will clear ido-unc-hosts-cache, so set it
360
	       ;; before loading history file.
361
	       ido-unc-hosts)
362
  :type '(choice (const :tag "Turn on only buffer" buffer)
Kim F. Storm's avatar
Kim F. Storm committed
363 364 365 366 367 368
                 (const :tag "Turn on only file" file)
                 (const :tag "Turn on both buffer and file" both)
                 (const :tag "Switch off all" nil))
  :group 'ido)

(defcustom ido-case-fold case-fold-search
Lute Kamstra's avatar
Lute Kamstra committed
369
  "Non-nil if searching of buffer and file names should ignore case."
Kim F. Storm's avatar
Kim F. Storm committed
370 371 372 373 374
  :type 'boolean
  :group 'ido)

(defcustom ido-ignore-buffers
  '("\\` ")
Lute Kamstra's avatar
Lute Kamstra committed
375
  "List of regexps or functions matching buffer names to ignore.
Kim F. Storm's avatar
Kim F. Storm committed
376 377
For example, traditional behavior is not to list buffers whose names begin
with a space, for which the regexp is `\\` '.  See the source file for
378
example functions that filter buffer names."
Kim F. Storm's avatar
Kim F. Storm committed
379 380 381 382 383
  :type '(repeat (choice regexp function))
  :group 'ido)

(defcustom ido-ignore-files
  '("\\`CVS/" "\\`#" "\\`.#" "\\`\\.\\./" "\\`\\./")
Lute Kamstra's avatar
Lute Kamstra committed
384
  "List of regexps or functions matching file names to ignore.
Kim F. Storm's avatar
Kim F. Storm committed
385 386 387 388 389 390 391
For example, traditional behavior is not to list files whose names begin
with a #, for which the regexp is `\\`#'.  See the source file for
example functions that filter filenames."
  :type '(repeat (choice regexp function))
  :group 'ido)

(defcustom ido-ignore-extensions t
Lute Kamstra's avatar
Lute Kamstra committed
392
  "Non-nil means ignore files in `completion-ignored-extensions' list."
Kim F. Storm's avatar
Kim F. Storm committed
393 394 395 396
  :type 'boolean
  :group 'ido)

(defcustom ido-show-dot-for-dired nil
Lute Kamstra's avatar
Lute Kamstra committed
397
  "Non-nil means to always put . as the first item in file name lists.
398
This allows the current directory to be opened immediately with `dired'."
Kim F. Storm's avatar
Kim F. Storm committed
399 400 401
  :type 'boolean
  :group 'ido)

402
(defcustom ido-file-extensions-order nil
Lute Kamstra's avatar
Lute Kamstra committed
403
  "List of file extensions specifying preferred order of file selections.
404 405
Each element is either a string with `.' as the first char, an empty
string matching files without extension, or t which is the default order
406
for files with an unlisted file extension."
407 408 409 410
  :type '(repeat (choice string
			 (const :tag "Default order" t)))
  :group 'ido)

Kim F. Storm's avatar
Kim F. Storm committed
411 412
(defcustom ido-ignore-directories
  '("\\`CVS/" "\\`\\.\\./" "\\`\\./")
Lute Kamstra's avatar
Lute Kamstra committed
413
  "List of regexps or functions matching sub-directory names to ignore."
Kim F. Storm's avatar
Kim F. Storm committed
414 415 416 417
  :type '(repeat (choice regexp function))
  :group 'ido)

(defcustom ido-ignore-directories-merge nil
Lute Kamstra's avatar
Lute Kamstra committed
418
  "List of regexps or functions matching directory names to ignore during merge.
419
Directory names matched by one of the regexps in this list are not inserted
Kim F. Storm's avatar
Kim F. Storm committed
420 421 422 423
in merged file and directory lists."
  :type '(repeat (choice regexp function))
  :group 'ido)

424 425 426 427 428 429 430
;; Examples for setting the value of ido-ignore-buffers
;;(defun ido-ignore-c-mode (name)
;;  "Ignore all c mode buffers -- example function for ido."
;;  (with-current-buffer name
;;    (derived-mode-p 'c-mode)))
;;
;;(setq ido-ignore-buffers '("^ " ido-ignore-c-mode))
Kim F. Storm's avatar
Kim F. Storm committed
431

432 433
;; Examples for setting the value of ido-ignore-files
;;(setq ido-ignore-files '("^ " "\\.c\\'" "\\.h\\'"))
Kim F. Storm's avatar
Kim F. Storm committed
434

435
(defcustom ido-default-file-method  'raise-frame
Lute Kamstra's avatar
Lute Kamstra committed
436
  "How to visit a new file when using `ido-find-file'.
Kim F. Storm's avatar
Kim F. Storm committed
437
Possible values:
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
`selected-window' Show new file in selected window
`other-window'	  Show new file in another window (same frame)
`display'	  Display file in another window without selecting to it
`other-frame'	  Show new file in another frame
`maybe-frame'	  If a file is visible in another frame, prompt to ask if you
		  you want to see the file in the same window of the current
  		  frame or in the other frame
`raise-frame'     If a file is visible in another frame, raise that
		  frame; otherwise, visit the file in the same window"
    :type '(choice (const :tag "Visit in selected window" selected-window)
		   (const :tag "Visit in other window" other-window)
		   (const :tag "Display (no select) in other window" display)
		   (const :tag "Visit in other frame" other-frame)
		   (const :tag "Ask to visit in other frame" maybe-frame)
		   (const :tag "Raise frame if already visited" raise-frame))
Kim F. Storm's avatar
Kim F. Storm committed
453 454
    :group 'ido)

455
(defcustom ido-default-buffer-method  'raise-frame
Lute Kamstra's avatar
Lute Kamstra committed
456
  "How to switch to new buffer when using `ido-switch-buffer'.
457
See `ido-default-file-method' for details."
458 459 460 461 462 463 464 465
    :type '(choice (const :tag "Show in selected window" selected-window)
		   (const :tag "Show in other window" other-window)
		   (const :tag "Display (no select) in other window" display)
		   (const :tag "Show in other frame" other-frame)
		   (const :tag "Ask to show in other frame" maybe-frame)
		   (const :tag "Raise frame if already shown" raise-frame))
    :type '(choice (const selected-window)
		   (const other-window)
Kim F. Storm's avatar
Kim F. Storm committed
466
		   (const display)
467
		   (const other-frame)
Kim F. Storm's avatar
Kim F. Storm committed
468
		   (const maybe-frame)
469
		   (const raise-frame))
Kim F. Storm's avatar
Kim F. Storm committed
470 471 472
    :group 'ido)

(defcustom ido-enable-flex-matching nil
Lute Kamstra's avatar
Lute Kamstra committed
473
  "Non-nil means that `ido' will do flexible string matching.
Kim F. Storm's avatar
Kim F. Storm committed
474 475 476 477 478 479 480 481
Flexible matching means that if the entered string does not
match any item, any item containing the entered characters
in the given sequence will match."
  :type 'boolean
  :group 'ido)


(defcustom ido-enable-regexp nil
Lute Kamstra's avatar
Lute Kamstra committed
482
  "Non-nil means that `ido' will do regexp matching.
Kim F. Storm's avatar
Kim F. Storm committed
483 484 485 486 487
Value can be toggled within `ido' using `ido-toggle-regexp'."
  :type 'boolean
  :group 'ido)

(defcustom ido-enable-prefix nil
Lute Kamstra's avatar
Lute Kamstra committed
488
  "Non-nil means only match if the entered text is a prefix of file name.
489
This behavior is like the standard Emacs completion.
490
If nil, match if the entered text is an arbitrary substring.
Kim F. Storm's avatar
Kim F. Storm committed
491 492 493 494
Value can be toggled within `ido' using `ido-toggle-prefix'."
  :type 'boolean
  :group 'ido)

495
(defcustom ido-enable-dot-prefix nil
Lute Kamstra's avatar
Lute Kamstra committed
496
  "Non-nil means to match leading dot as prefix.
497 498 499 500 501
I.e. hidden files and buffers will match only if you type a dot
as first char even if `ido-enable-prefix' is nil."
  :type 'boolean
  :group 'ido)

502
(defcustom ido-confirm-unique-completion nil
Lute Kamstra's avatar
Lute Kamstra committed
503
  "Non-nil means that even a unique completion must be confirmed.
504 505 506 507 508
This means that \\[ido-complete] must always be followed by \\[ido-exit-minibuffer]
even when there is only one unique completion."
  :type 'boolean
  :group 'ido)

509
(defcustom ido-cannot-complete-command 'ido-completion-help
Lute Kamstra's avatar
Lute Kamstra committed
510
  "Command run when `ido-complete' can't complete any more.
511 512 513 514 515 516 517
The most useful values are `ido-completion-help', which pops up a
window with completion alternatives, or `ido-next-match' or
`ido-prev-match', which cycle the buffer list."
  :type 'function
  :group 'ido)


Kim F. Storm's avatar
Kim F. Storm committed
518
(defcustom ido-record-commands t
Lute Kamstra's avatar
Lute Kamstra committed
519
  "Non-nil means that `ido' will record commands in command history.
Kim F. Storm's avatar
Kim F. Storm committed
520 521 522 523 524
Note that the non-ido equivalent command is recorded."
  :type 'boolean
  :group 'ido)

(defcustom ido-max-prospects 12
Lute Kamstra's avatar
Lute Kamstra committed
525
  "Non-zero means that the prospect list will be limited to that number of items.
Kim F. Storm's avatar
Kim F. Storm committed
526
For a long list of prospects, building the full list for the minibuffer can take a
527
non-negligible amount of time; setting this variable reduces that time."
Kim F. Storm's avatar
Kim F. Storm committed
528 529 530
  :type 'integer
  :group 'ido)

531
(defcustom ido-max-file-prompt-width 0.35
Lute Kamstra's avatar
Lute Kamstra committed
532
  "Non-zero means that the prompt string be limited to that number of characters.
Kim F. Storm's avatar
Kim F. Storm committed
533 534 535 536 537 538 539 540 541
If value is a floating point number, it specifies a fraction of the frame width."
  :type '(choice
	  (integer :tag "Characters" :value 20)
	  (restricted-sexp :tag "Fraction of frame width"
			   :value 0.35
			   :match-alternatives (ido-fractionp)))
  :group 'ido)

(defcustom ido-max-window-height nil
Lute Kamstra's avatar
Lute Kamstra committed
542
  "Non-nil specifies a value to override `max-mini-window-height'."
Kim F. Storm's avatar
Kim F. Storm committed
543 544 545 546 547 548 549 550 551 552
  :type '(choice
	  (const :tag "Don't override" nil)
	  (integer :tag "Number of lines" :value 1)
	  (restricted-sexp
	   :tag "Fraction of window height"
	   :value 0.25
	   :match-alternatives (ido-fractionp)))
  :group 'ido)

(defcustom ido-enable-last-directory-history t
Lute Kamstra's avatar
Lute Kamstra committed
553
  "Non-nil means that `ido' will remember latest selected directory names.
Kim F. Storm's avatar
Kim F. Storm committed
554 555 556 557 558
See `ido-last-directory-list' and `ido-save-directory-list-file'."
  :type 'boolean
  :group 'ido)

(defcustom ido-max-work-directory-list 50
Lute Kamstra's avatar
Lute Kamstra committed
559
  "Maximum number of working directories to record.
Kim F. Storm's avatar
Kim F. Storm committed
560 561 562 563 564 565
This is the list of directories where files have most recently been opened.
See `ido-work-directory-list' and `ido-save-directory-list-file'."
  :type 'integer
  :group 'ido)

(defcustom ido-work-directory-list-ignore-regexps nil
Lute Kamstra's avatar
Lute Kamstra committed
566
  "List of regexps matching directories which should not be recorded.
567
Directory names matched by one of the regexps in this list are not inserted in
Kim F. Storm's avatar
Kim F. Storm committed
568 569 570 571
the `ido-work-directory-list' list."
  :type '(repeat regexp)
  :group 'ido)

572

573
(defcustom ido-use-filename-at-point nil
Lute Kamstra's avatar
Lute Kamstra committed
574
  "Non-nil means that ido shall look for a filename at point.
575
May use `ffap-guesser' to guess whether text at point is a filename.
576
If found, use that as the starting point for filename selection."
577 578 579 580
  :type '(choice
	  (const :tag "Disabled" nil)
	  (const :tag "Guess filename" guess)
	  (other :tag "Use literal filename" t))
581 582 583 584
  :group 'ido)


(defcustom ido-use-url-at-point nil
Lute Kamstra's avatar
Lute Kamstra committed
585
  "Non-nil means that ido shall look for a URL at point.
586 587 588 589 590
If found, call `find-file-at-point' to visit it."
  :type 'boolean
  :group 'ido)


591
(defcustom ido-enable-tramp-completion t
Lute Kamstra's avatar
Lute Kamstra committed
592
  "Non-nil means that ido shall perform tramp method and server name completion.
593
A tramp file name uses the following syntax: /method:user@host:filename."
594 595 596
  :type 'boolean
  :group 'ido)

Kim F. Storm's avatar
Kim F. Storm committed
597
(defcustom ido-record-ftp-work-directories t
Lute Kamstra's avatar
Lute Kamstra committed
598
  "Non-nil means record ftp file names in the work directory list."
Kim F. Storm's avatar
Kim F. Storm committed
599 600 601 602
  :type 'boolean
  :group 'ido)

(defcustom ido-merge-ftp-work-directories nil
Lute Kamstra's avatar
Lute Kamstra committed
603
  "If nil, merging ignores ftp file names in the work directory list."
Kim F. Storm's avatar
Kim F. Storm committed
604 605 606 607
  :type 'boolean
  :group 'ido)

(defcustom ido-cache-ftp-work-directory-time 1.0
Lute Kamstra's avatar
Lute Kamstra committed
608
  "Maximum time to cache contents of an ftp directory (in hours).
609
Use C-l in prompt to refresh list.
Kim F. Storm's avatar
Kim F. Storm committed
610 611 612 613 614
If zero, ftp directories are not cached."
  :type 'number
  :group 'ido)

(defcustom ido-slow-ftp-hosts nil
Lute Kamstra's avatar
Lute Kamstra committed
615
  "List of slow ftp hosts where ido prompting should not be used.
Kim F. Storm's avatar
Kim F. Storm committed
616
If an ftp host is on this list, ido automatically switches to the non-ido
617
equivalent function, e.g. `find-file' rather than `ido-find-file'."
Kim F. Storm's avatar
Kim F. Storm committed
618 619 620 621
  :type '(repeat string)
  :group 'ido)

(defcustom ido-slow-ftp-host-regexps nil
Lute Kamstra's avatar
Lute Kamstra committed
622
  "List of regexps matching slow ftp hosts (see `ido-slow-ftp-hosts')."
Kim F. Storm's avatar
Kim F. Storm committed
623 624 625
  :type '(repeat regexp)
  :group 'ido)

626
(defvar ido-unc-hosts-cache t
627
  "Cached value from `ido-unc-hosts' function.")
628

629
(defcustom ido-unc-hosts nil
Lute Kamstra's avatar
Lute Kamstra committed
630
  "List of known UNC host names to complete after initial //.
631 632 633 634 635 636 637 638 639 640 641
If value is a function, that function is called to search network for
hosts on first use of UNC path."
  :type '(choice (repeat :tag "List of UNC host names" string)
		 (function-item :tag "Use `NET VIEW'"
				:value ido-unc-hosts-net-view)
		 (function :tag "Your own function"))
  :set #'(lambda (symbol value)
	   (set symbol value)
	   (setq ido-unc-hosts-cache t))
  :group 'ido)

642
(defcustom ido-downcase-unc-hosts t
Lute Kamstra's avatar
Lute Kamstra committed
643
  "Non-nil if UNC host names should be downcased."
644 645 646
  :type 'boolean
  :group 'ido)

647
(defcustom ido-ignore-unc-host-regexps nil
Lute Kamstra's avatar
Lute Kamstra committed
648
  "List of regexps matching UNC hosts to ignore.
649
Case is ignored if `ido-downcase-unc-hosts' is set."
650
  :type '(repeat regexp)
651 652 653
  :group 'ido)

(defcustom ido-cache-unc-host-shares-time 8.0
Lute Kamstra's avatar
Lute Kamstra committed
654
  "Maximum time to cache shares of an UNC host (in hours).
655
Use C-l in prompt to refresh list.
656
If zero, UNC host shares are not cached."
657 658 659
  :type 'number
  :group 'ido)

Kim F. Storm's avatar
Kim F. Storm committed
660
(defcustom ido-max-work-file-list 10
Lute Kamstra's avatar
Lute Kamstra committed
661
  "Maximum number of names of recently opened files to record.
662
This is the list of the file names (sans directory) which have most recently
663
been opened.  See `ido-work-file-list' and `ido-save-directory-list-file'."
Kim F. Storm's avatar
Kim F. Storm committed
664 665 666 667
  :type 'integer
  :group 'ido)

(defcustom ido-work-directory-match-only t
Lute Kamstra's avatar
Lute Kamstra committed
668
  "Non-nil means to skip non-matching directories in the directory history.
Kim F. Storm's avatar
Kim F. Storm committed
669 670 671 672 673 674 675
When some text is already entered at the `ido-find-file' prompt, using
\\[ido-prev-work-directory] or \\[ido-next-work-directory] will skip directories
without any matching entries."
  :type 'boolean
  :group 'ido)

(defcustom ido-auto-merge-work-directories-length 0
Lute Kamstra's avatar
Lute Kamstra committed
676
  "Automatically switch to merged work directories during file name input.
Kim F. Storm's avatar
Kim F. Storm committed
677 678 679 680 681 682 683
The value is number of characters to type before switching to merged mode.
If zero, the switch happens when no matches are found in the current directory.
Automatic merging is disabled if the value is negative."
  :type 'integer
  :group 'ido)

(defcustom ido-auto-merge-delay-time 0.70
Lute Kamstra's avatar
Lute Kamstra committed
684
  "Delay in seconds to wait for more input before doing auto merge."
Kim F. Storm's avatar
Kim F. Storm committed
685 686 687 688
  :type 'number
  :group 'ido)

(defcustom ido-auto-merge-inhibit-characters-regexp "[][*?~]"
Lute Kamstra's avatar
Lute Kamstra committed
689
  "Regexp matching characters which should inhibit automatic merging.
Kim F. Storm's avatar
Kim F. Storm committed
690 691 692 693 694 695 696 697 698 699
When a (partial) file name matches this regexp, merging is inhibited."
  :type 'regexp
  :group 'ido)

(defcustom ido-merged-indicator "^"
  "The string appended to first choice if it has multiple directory choices."
  :type 'string
  :group 'ido)

(defcustom ido-max-dir-file-cache 100
Lute Kamstra's avatar
Lute Kamstra committed
700
  "Maximum number of working directories to be cached.
701
This is the size of the cache of `file-name-all-completions' results.
Kim F. Storm's avatar
Kim F. Storm committed
702 703 704 705 706 707 708 709 710
Each cache entry is time stamped with the modification time of the
directory.  Some systems, like Windows, have unreliable directory
modification times, so you may choose to disable caching on such
systems, or explicitly refresh the cache contents using the command
`ido-reread-directory' command (C-l) in the minibuffer.
See also `ido-dir-file-cache' and `ido-save-directory-list-file'."
  :type 'integer
  :group 'ido)

711
(defcustom ido-max-directory-size 30000
Lute Kamstra's avatar
Lute Kamstra committed
712
  "Maximum size (in bytes) for directories to use ido completion.
713 714 715 716 717 718
If you enter a directory with a size larger than this size, ido will
not provide the normal completion.  To show the completions, use C-a."
  :type '(choice (const :tag "No limit" nil)
		 (integer :tag "Size in bytes" 30000))
  :group 'ido)

Kim F. Storm's avatar
Kim F. Storm committed
719
(defcustom ido-rotate-file-list-default nil
Lute Kamstra's avatar
Lute Kamstra committed
720
  "Non-nil means that `ido' will always rotate file list to get default in front."
Kim F. Storm's avatar
Kim F. Storm committed
721 722 723
  :type 'boolean
  :group 'ido)

724
(defcustom ido-enter-matching-directory 'only
Lute Kamstra's avatar
Lute Kamstra committed
725
  "Additional methods to enter sub-directory of first/only matching item.
726 727 728 729 730
If value is 'first, enter first matching sub-directory when typing a slash.
If value is 'only, typing a slash only enters the sub-directory if it is
the only matching item.
If value is t, automatically enter a sub-directory when it is the only
matching item, even without typing a slash."
731
  :type '(choice (const :tag "Never" nil)
732 733 734
		 (const :tag "Slash enters first directory" first)
		 (const :tag "Slash enters first and only directory" only)
		 (other :tag "Always enter unique directory" t))
Kim F. Storm's avatar
Kim F. Storm committed
735 736 737
  :group 'ido)

(defcustom ido-create-new-buffer 'prompt
Lute Kamstra's avatar
Lute Kamstra committed
738
  "Specify whether a new buffer is created if no buffer matches substring.
Kim F. Storm's avatar
Kim F. Storm committed
739 740
Choices are 'always to create new buffers unconditionally, 'prompt to
ask user whether to create buffer, or 'never to never create new buffer."
741
  :type '(choice (const always)
Kim F. Storm's avatar
Kim F. Storm committed
742 743 744 745
		 (const prompt)
		 (const never))
  :group 'ido)

Kim F. Storm's avatar
Kim F. Storm committed
746
(defcustom ido-setup-hook  nil
Lute Kamstra's avatar
Lute Kamstra committed
747
  "Hook run after the ido variables and keymap have been setup.
Kim F. Storm's avatar
Kim F. Storm committed
748
The dynamic variable `ido-cur-item' contains the current type of item that
749
is read by ido; possible values are file, dir, buffer, and list.
750
Additional keys can be defined in `ido-completion-map'."
Kim F. Storm's avatar
Kim F. Storm committed
751 752 753 754
  :type 'hook
  :group 'ido)

(defcustom ido-separator nil
Lute Kamstra's avatar
Lute Kamstra committed
755
  "String used by ido to separate the alternatives in the minibuffer.
Kim F. Storm's avatar
Kim F. Storm committed
756
Obsolete.  Set 3rd element of `ido-decorations' instead."
Markus Rost's avatar
Markus Rost committed
757
  :type '(choice string (const nil))
Kim F. Storm's avatar
Kim F. Storm committed
758 759
  :group 'ido)

760
(defcustom ido-decorations '( "{" "}" " | " " | ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]")
Lute Kamstra's avatar
Lute Kamstra committed
761
  "List of strings used by ido to display the alternatives in the minibuffer.
Kim F. Storm's avatar
Kim F. Storm committed
762
There are 11 elements in this list:
Kim F. Storm's avatar
Kim F. Storm committed
763
1st and 2nd elements are used as brackets around the prospect list,
764
3rd element is the separator between prospects (ignored if `ido-separator' is set),
Kim F. Storm's avatar
Kim F. Storm committed
765 766 767
4th element is the string inserted at the end of a truncated list of prospects,
5th and 6th elements are used as brackets around the common match string which
can be completed using TAB,
768 769 770
7th element is the string displayed when there are no matches, and
8th element is displayed if there is a single match (and faces are not used),
9th element is displayed when the current directory is non-readable,
771 772
10th element is displayed when directory exceeds `ido-max-directory-size',
11th element is displayed to confirm creating new file or buffer."
Kim F. Storm's avatar
Kim F. Storm committed
773 774 775
  :type '(repeat string)
  :group 'ido)

776 777
(defcustom ido-use-virtual-buffers nil
  "If non-nil, refer to past buffers as well as existing ones.
778 779 780 781
Essentially it works as follows: Say you are visiting a file and
the buffer gets cleaned up by mignight.el.  Later, you want to
switch to that buffer, but find it's no longer open.  With
virtual buffers enabled, the buffer name stays in the buffer
782
list (using the `ido-virtual' face, and always at the end), and if
783 784 785 786 787 788
you select it, it opens the file back up again.  This allows you
to think less about whether recently opened files are still open
or not.  Most of the time you can quit Emacs, restart, and then
switch to a file buffer that was previously open as if it still
were.
    This feature relies upon the `recentf' package, which will be
789
enabled if this variable is configured to a non-nil value."
790
  :version "24.1"
791 792 793
  :type 'boolean
  :group 'ido)

Kim F. Storm's avatar
Kim F. Storm committed
794
(defcustom ido-use-faces t
Lute Kamstra's avatar
Lute Kamstra committed
795
  "Non-nil means use ido faces to highlighting first match, only match and
Kim F. Storm's avatar
Kim F. Storm committed
796 797 798 799
subdirs in the alternatives."
  :type 'boolean
  :group 'ido)

800
(defface ido-first-match  '((t (:bold t)))
Lute Kamstra's avatar
Lute Kamstra committed
801
  "Face used by ido for highlighting first match."
Kim F. Storm's avatar
Kim F. Storm committed
802 803
  :group 'ido)

804
(defface ido-only-match  '((((class color))
Kim F. Storm's avatar
Kim F. Storm committed
805 806
                                 (:foreground "ForestGreen"))
                                (t (:italic t)))
Lute Kamstra's avatar
Lute Kamstra committed
807
  "Face used by ido for highlighting only match."
Kim F. Storm's avatar
Kim F. Storm committed
808 809
  :group 'ido)

810
(defface ido-subdir  '((((min-colors 88) (class color))
811 812
                             (:foreground "red1"))
			    (((class color))
Kim F. Storm's avatar
Kim F. Storm committed
813 814
                             (:foreground "red"))
                            (t (:underline t)))
Lute Kamstra's avatar
Lute Kamstra committed
815
  "Face used by ido for highlighting subdirs in the alternatives."
Kim F. Storm's avatar
Kim F. Storm committed
816 817
  :group 'ido)

818 819
(defface ido-virtual '((t (:inherit font-lock-builtin-face)))
  "Face used by ido for matching virtual buffer names."
820
  :version "24.1"
821 822
  :group 'ido)

823
(defface ido-indicator  '((((min-colors 88) (class color))
824 825 826 827
				(:foreground "yellow1"
				 :background "red1"
				 :width condensed))
			       (((class color))
Kim F. Storm's avatar
Kim F. Storm committed
828 829 830 831
				(:foreground "yellow"
				 :background "red"
				 :width condensed))
			       (t (:inverse-video t)))
Lute Kamstra's avatar
Lute Kamstra committed
832
  "Face used by ido for highlighting its indicators."
Kim F. Storm's avatar
Kim F. Storm committed
833 834
  :group 'ido)

835 836 837 838 839 840
(defface ido-incomplete-regexp
  '((t
     (:inherit font-lock-warning-face)))
  "Ido face for indicating incomplete regexps."
  :group 'ido)

Kim F. Storm's avatar
Kim F. Storm committed
841
(defcustom ido-make-file-list-hook  nil
Lute Kamstra's avatar
Lute Kamstra committed
842
  "List of functions to run when the list of matching files is created.
Kim F. Storm's avatar
Kim F. Storm committed
843 844 845 846 847 848
Each function on the list may modify the dynamically bound variable
`ido-temp-list' which contains the current list of matching files."
  :type 'hook
  :group 'ido)

(defcustom ido-make-dir-list-hook  nil
Lute Kamstra's avatar
Lute Kamstra committed
849
  "List of functions to run when the list of matching directories is created.
Kim F. Storm's avatar
Kim F. Storm committed
850 851 852 853 854 855
Each function on the list may modify the dynamically bound variable
`ido-temp-list' which contains the current list of matching directories."
  :type 'hook
  :group 'ido)

(defcustom ido-make-buffer-list-hook  nil
Lute Kamstra's avatar
Lute Kamstra committed
856
  "List of functions to run when the list of matching buffers is created.
Kim F. Storm's avatar
Kim F. Storm committed
857 858 859 860 861
Each function on the list may modify the dynamically bound variable
`ido-temp-list' which contains the current list of matching buffer names."
  :type 'hook
  :group 'ido)

862
(defcustom ido-rewrite-file-prompt-functions nil
Lute Kamstra's avatar
Lute Kamstra committed
863
  "List of functions to run when the find-file prompt is created.
Kim F. Storm's avatar
Kim F. Storm committed
864 865
Each function on the list may modify the following dynamically bound
variables:
Richard M. Stallman's avatar
Richard M. Stallman committed
866 867 868 869 870
  dirname   - the (abbreviated) directory name
		 to be modified by the hook functions
  max-width - the max width of the resulting dirname; nil means no limit
  prompt    - the basic prompt (e.g. \"Find File: \")
  literal   - the string shown if doing \"literal\" find; set to nil to omit
871
  vc-off    - the string shown if version control is inhibited; set to nil to omit
Richard M. Stallman's avatar
Richard M. Stallman committed
872 873
  prefix    - either nil or a fixed prefix for the dirname

Kim F. Storm's avatar
Kim F. Storm committed
874
The following variables are available, but should not be changed:
875
  `ido-current-directory' - the unabbreviated directory name
Richard M. Stallman's avatar
Richard M. Stallman committed
876
  item - equals `file' or `dir' depending on the current mode."
Kim F. Storm's avatar
Kim F. Storm committed
877 878 879
  :type 'hook
  :group 'ido)

880 881 882 883 884 885 886 887 888
(defvar ido-rewrite-file-prompt-rules nil
  "*Alist of rewriting rules for directory names in ido prompts.
A list of elements of the form (FROM . TO) or (FROM . FUNC), each
meaning to rewrite the directory name if matched by FROM by either
substituting the matched string by TO or calling the function FUNC
with the current directory name as its only argument and using the
return value as the new directory name.  In addition, each FUNC may
also modify the dynamic variables described for the variable
`ido-rewrite-file-prompt-functions'.")
Kim F. Storm's avatar
Kim F. Storm committed
889 890

(defcustom ido-completion-buffer "*Ido Completions*"
Lute Kamstra's avatar
Lute Kamstra committed
891
  "Name of completion buffer used by ido.
Kim F. Storm's avatar
Kim F. Storm committed
892 893 894 895 896
Set to nil to disable completion buffers popping up."
  :type 'string
  :group 'ido)

(defcustom ido-completion-buffer-all-completions nil
Lute Kamstra's avatar
Lute Kamstra committed
897
  "Non-nil means to show all completions in completion buffer.
Kim F. Storm's avatar
Kim F. Storm committed
898 899 900 901 902 903 904 905 906
Otherwise, only the current list of matches is shown."
  :type 'boolean
  :group 'ido)

(defvar ido-all-frames 'visible
  "*Argument to pass to `walk-windows' when finding visible files.
See documentation of `walk-windows' for useful values.")

(defcustom ido-minibuffer-setup-hook nil
Lute Kamstra's avatar
Lute Kamstra committed
907
  "Ido-specific customization of minibuffer setup.
Kim F. Storm's avatar
Kim F. Storm committed
908

909
This hook is run during minibuffer setup if `ido' is active.
Kim F. Storm's avatar
Kim F. Storm committed
910 911 912
It is intended for use in customizing ido for interoperation
with other packages.  For instance:

913
  \(add-hook 'ido-minibuffer-setup-hook
Kim F. Storm's avatar
Kim F. Storm committed
914 915
	    \(function
	     \(lambda ()
916 917
	       \(make-local-variable 'max-mini-window-height)
	       \(setq max-mini-window-height 3))))
Kim F. Storm's avatar
Kim F. Storm committed
918

919
will constrain Emacs to a maximum minibuffer height of 3 lines when
Kim F. Storm's avatar
Kim F. Storm committed
920 921 922 923
ido is running.  Copied from `icomplete-minibuffer-setup-hook'."
  :type 'hook
  :group 'ido)

924
(defcustom ido-save-directory-list-file (convert-standard-filename "~/.ido.last")
Kim F. Storm's avatar
Kim F. Storm committed
925 926 927 928 929 930 931 932
  "File in which the ido state is saved between invocations.
Variables stored are: `ido-last-directory-list', `ido-work-directory-list',
`ido-work-file-list', and `ido-dir-file-cache'.
Must be set before enabling ido mode."
  :type 'string
  :group 'ido)

(defcustom ido-read-file-name-as-directory-commands '()
933
  "List of commands which uses `read-file-name' to read a directory name.
Kim F. Storm's avatar
Kim F. Storm committed
934
When `ido-everywhere' is non-nil, the commands in this list will read
935
the directory using `ido-read-directory-name'."
Kim F. Storm's avatar
Kim F. Storm committed
936 937 938 939 940 941
  :type '(repeat symbol)
  :group 'ido)

(defcustom ido-read-file-name-non-ido '()
  "List of commands which shall not read file names the ido way.
When `ido-everywhere' is non-nil, the commands in this list will read
942
the file name using normal `read-file-name' style."
Kim F. Storm's avatar
Kim F. Storm committed
943 944 945
  :type '(repeat symbol)
  :group 'ido)

946 947 948 949 950 951
(defcustom ido-before-fallback-functions '()
  "List of functions to call before calling a fallback command.
The fallback command is passed as an argument to the functions."
  :type 'hook
  :group 'ido)

Kim F. Storm's avatar
Kim F. Storm committed
952 953 954 955
;;; Internal Variables

;; Persistent variables

956
(defvar ido-completion-map nil
Kim F. Storm's avatar
Kim F. Storm committed
957 958
  "Currently active keymap for ido commands.")

959
(defvar ido-common-completion-map nil
Kim F. Storm's avatar
Kim F. Storm committed
960 961
  "Keymap for all ido commands.")

962
(defvar ido-file-completion-map nil
Kim F. Storm's avatar
Kim F. Storm committed
963 964
  "Keymap for ido file commands.")

965
(defvar ido-file-dir-completion-map nil
Kim F. Storm's avatar
Kim F. Storm committed
966 967
  "Keymap for ido file and directory commands.")

968
(defvar ido-buffer-completion-map nil
Kim F. Storm's avatar
Kim F. Storm committed
969
  "Keymap for ido buffer commands.")
Kim F. Storm's avatar
Kim F. Storm committed
970 971 972 973 974 975 976 977

(defvar  ido-file-history nil
  "History of files selected using `ido-find-file'.")

(defvar  ido-buffer-history nil
  "History of buffers selected using `ido-switch-buffer'.")

(defvar ido-last-directory-list nil
978
  "List of last selected directory names.
Kim F. Storm's avatar
Kim F. Storm committed
979 980 981
See `ido-enable-last-directory-history' for details.")

(defvar ido-work-directory-list nil
982
  "List of actual working directory names.
Kim F. Storm's avatar
Kim F. Storm committed
983
The current directory is inserted at the front of this list whenever a
984
file is opened with `ido-find-file' and family.")
Kim F. Storm's avatar
Kim F. Storm committed
985 986 987

(defvar ido-work-file-list nil
  "List of actual work file names.
Richard M. Stallman's avatar
Richard M. Stallman committed
988 989 990
Opening a file with `ido-find-file' and similar functions
inserts the current file name (relative to its containing directory)
at the front of this list.")
Kim F. Storm's avatar
Kim F. Storm committed
991 992

(defvar ido-dir-file-cache nil
Richard M. Stallman's avatar
Richard M. Stallman committed
993 994
  "List of `file-name-all-completions' results.
Each element in the list is of the form (DIR (MTIME) FILE...).")
Kim F. Storm's avatar
Kim F. Storm committed
995

996 997
(defvar ido-ignore-item-temp-list nil
  "List of items to ignore in current ido invocation.
998
Intended to be let-bound by functions which call ido repeatedly.
999 1000
Should never be set permanently.")

Kim F. Storm's avatar
Kim F. Storm committed
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022
;; Temporary storage

(defvar ido-eoinput 1
  "Point where minibuffer input ends and completion info begins.
Copied from `icomplete-eoinput'.")
(make-variable-buffer-local 'ido-eoinput)

(defvar ido-common-match-string  nil
  "Stores the string that is common to all matching files.")

(defvar ido-rescan nil
  "Non-nil means we need to regenerate the list of matching items.")

(defvar ido-rotate nil
  "Non-nil means we are rotating list of matches.")

(defvar ido-text nil
  "Stores the users string as it is typed in.")

(defvar ido-text-init nil
  "The initial string for the users string it is typed in.")

Kim F. Storm's avatar
Kim F. Storm committed
1023 1024 1025
(defvar ido-input-stack nil
  "Stores the users strings when user hits M-b/M-f.")

Kim F. Storm's avatar
Kim F. Storm committed
1026 1027 1028 1029
(defvar ido-matches nil
  "List of files currently matching `ido-text'.")

(defvar ido-report-no-match t
1030
  "Report [No Match] when no completions matches `ido-text'.")
Kim F. Storm's avatar
Kim F. Storm committed
1031

1032 1033
(defvar ido-exit nil
  "Flag to monitor how `ido-find-file' exits.
Kim F. Storm's avatar
Kim F. Storm committed
1034 1035 1036 1037
If equal to `takeprompt', we use the prompt as the file name to be
selected.")

(defvar ido-current-directory nil
1038
  "Current directory for `ido-find-file'.")
Kim F. Storm's avatar
Kim F. Storm committed
1039 1040 1041 1042 1043

(defvar ido-auto-merge-timer nil
  "Delay timer for auto merge.")

(defvar ido-use-mycompletion-depth 0
1044
  "Non-nil means use `ido' completion feedback.
1045 1046
Is set by ido functions to the current `minibuffer-depth',
so that it doesn't interfere with other minibuffer usage.")
Kim F. Storm's avatar
Kim F. Storm committed
1047

1048 1049
(defvar ido-incomplete-regexp nil
  "Non-nil if an incomplete regexp is entered.")
Kim F. Storm's avatar
Kim F. Storm committed
1050

1051 1052 1053 1054
(defvar ido-initial-position nil
  "Non-nil means to explicitly cursor on entry to minibuffer.
Value is an integer which is number of chars to right of prompt.")

1055 1056 1057 1058 1059
(defvar ido-virtual-buffers nil
  "List of virtual buffers, that is, past visited files.
This is a copy of `recentf-list', pared down and with faces applied.
Only used if `ido-use-virtual-buffers' is non-nil.")

Kim F. Storm's avatar
Kim F. Storm committed
1060 1061 1062
;;; Variables with dynamic bindings.
;;; Declared here to keep the byte compiler quiet.

1063
;; Stores the current ido item type ('file, 'dir, 'buffer, or 'list).
Kim F. Storm's avatar
Kim F. Storm committed
1064 1065
(defvar ido-cur-item)

1066 1067 1068
;;; Stores the current default item
(defvar ido-default-item)

Kim F. Storm's avatar
Kim F. Storm committed
1069 1070 1071
;; Stores the current list of items that will be searched through.
;; The list is ordered, so that the most interesting item comes first,
;; although by default, the files visible in the current frame are put
1072 1073
;; at the end of the list.  Created by `ido-make-item-list'.
(defvar ido-cur-list)
Kim F. Storm's avatar
Kim F. Storm committed
1074

1075
;; Stores the choice list for ido-completing-read
1076
(defvar ido-choice-list)
1077

Kim F. Storm's avatar
Kim F. Storm committed
1078 1079 1080 1081
;; Stores the list of items which are ignored when building
;; `ido-cur-list'.  It is in no specific order.
(defvar ido-ignored-list)

1082 1083 1084
;; Remember if current directory is non-readable (so we cannot do completion).
(defvar ido-directory-nonreadable)

1085 1086 1087
;; Remember if current directory is 'huge' (so we don't want to do completion).
(defvar ido-directory-too-big)

Kim F. Storm's avatar
Kim F. Storm committed
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102
;; Keep current item list if non-nil.
(defvar ido-keep-item-list)

;; Process ido-ignore-* lists.
(defvar ido-process-ignore-lists)

;; Don't process ido-ignore- lists once.
(defvar ido-process-ignore-lists-inhibit)