comparison lisp/ido.el @ 90195:a1b34dec1104

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-63 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 358-423) - Update from CVS - Remove "-face" suffix from widget faces - Remove "-face" suffix from custom faces - Remove "-face" suffix from change-log faces - Remove "-face" suffix from compilation faces - Remove "-face" suffix from diff-mode faces - lisp/longlines.el (longlines-visible-face): Face removed - Remove "-face" suffix from woman faces - Remove "-face" suffix from whitespace-highlight face - Remove "-face" suffix from ruler-mode faces - Remove "-face" suffix from show-paren faces - Remove "-face" suffix from log-view faces - Remove "-face" suffix from smerge faces - Remove "-face" suffix from show-tabs faces - Remove "-face" suffix from highlight-changes faces - Remove "-face" suffix from and downcase info faces - Remove "-face" suffix from pcvs faces - Update uses of renamed pcvs faces - Tweak ChangeLog - Remove "-face" suffix from strokes-char face - Remove "-face" suffix from compare-windows face - Remove "-face" suffix from calendar faces - Remove "-face" suffix from diary-button face - Remove "-face" suffix from testcover faces - Remove "-face" suffix from viper faces - Remove "-face" suffix from org faces - Remove "-face" suffix from sgml-namespace face - Remove "-face" suffix from table-cell face - Remove "-face" suffix from tex-mode faces - Remove "-face" suffix from texinfo-heading face - Remove "-face" suffix from flyspell faces - Remove "-face" suffix from gomoku faces - Remove "-face" suffix from mpuz faces - Merge from gnus--rel--5.10 - Remove "-face" suffix from Buffer-menu-buffer face - Remove "-face" suffix from antlr-mode faces - Remove "-face" suffix from ebrowse faces - Remove "-face" suffix from flymake faces - Remove "-face" suffix from idlwave faces - Remove "-face" suffix from sh-script faces - Remove "-face" suffix from vhdl-mode faces - Remove "-face" suffix from which-func face - Remove "-face" suffix from cperl-mode faces - Remove "-face" suffix from ld-script faces - Fix cperl-mode font-lock problem - Tweak which-func face * gnus--rel--5.10 (patch 80-82) - Merge from emacs--cvs-trunk--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 15 Jun 2005 23:32:15 +0000
parents 173dee4e2611 0e0fb0040526
children 82d495f87e7b
comparison
equal deleted inserted replaced
90194:d940db5a66b9 90195:a1b34dec1104
343 :link '(emacs-library-link :tag "Lisp File" "ido.el")) 343 :link '(emacs-library-link :tag "Lisp File" "ido.el"))
344 344
345 ;;;###autoload 345 ;;;###autoload
346 (defcustom ido-mode nil 346 (defcustom ido-mode nil
347 "Determines for which functional group \(buffer and files) ido behavior 347 "Determines for which functional group \(buffer and files) ido behavior
348 should be enabled. The following values are possible: 348 should be enabled. The following values are possible:
349 - `buffer': Turn only on ido buffer behavior \(switching, killing, 349 - `buffer': Turn only on ido buffer behavior \(switching, killing,
350 displaying...) 350 displaying...)
351 - `file': Turn only on ido file behavior \(finding, writing, inserting...) 351 - `file': Turn only on ido file behavior \(finding, writing, inserting...)
352 - `both': Turn on ido buffer and file behavior. 352 - `both': Turn on ido buffer and file behavior.
353 - `nil': Turn off any ido switching. 353 - `nil': Turn off any ido switching.
412 412
413 (defcustom ido-file-extensions-order nil 413 (defcustom ido-file-extensions-order nil
414 "*List of file extensions specifying preferred order of file selections. 414 "*List of file extensions specifying preferred order of file selections.
415 Each element is either a string with `.' as the first char, an empty 415 Each element is either a string with `.' as the first char, an empty
416 string matching files without extension, or t which is the default order 416 string matching files without extension, or t which is the default order
417 of for files with an unlisted file extension." 417 for files with an unlisted file extension."
418 :type '(repeat (choice string 418 :type '(repeat (choice string
419 (const :tag "Default order" t))) 419 (const :tag "Default order" t)))
420 :group 'ido) 420 :group 'ido)
421 421
422 (defcustom ido-ignore-directories 422 (defcustom ido-ignore-directories
451 `otherwindow' Show new file in another window (same frame) 451 `otherwindow' Show new file in another window (same frame)
452 `display' Display file in another window without switching to it 452 `display' Display file in another window without switching to it
453 `otherframe' Show new file in another frame 453 `otherframe' Show new file in another frame
454 `maybe-frame' If a file is visible in another frame, prompt to ask if you 454 `maybe-frame' If a file is visible in another frame, prompt to ask if you
455 you want to see the file in the same window of the current 455 you want to see the file in the same window of the current
456 frame or in the other frame. 456 frame or in the other frame
457 `always-frame' If a file is visible in another frame, raise that 457 `always-frame' If a file is visible in another frame, raise that
458 frame. Otherwise, visit the file in the same window." 458 frame; otherwise, visit the file in the same window"
459 :type '(choice (const samewindow) 459 :type '(choice (const samewindow)
460 (const otherwindow) 460 (const otherwindow)
461 (const display) 461 (const display)
462 (const otherframe) 462 (const otherframe)
463 (const maybe-frame) 463 (const maybe-frame)
464 (const always-frame)) 464 (const always-frame))
465 :group 'ido) 465 :group 'ido)
466 466
467 (defcustom ido-default-buffer-method 'always-frame 467 (defcustom ido-default-buffer-method 'always-frame
468 "*How to switch to new buffer when using `ido-switch-buffer'. 468 "*How to switch to new buffer when using `ido-switch-buffer'.
469 See ido-default-file-method for details." 469 See `ido-default-file-method' for details."
470 :type '(choice (const samewindow) 470 :type '(choice (const samewindow)
471 (const otherwindow) 471 (const otherwindow)
472 (const display) 472 (const display)
473 (const otherframe) 473 (const otherframe)
474 (const maybe-frame) 474 (const maybe-frame)
528 :group 'ido) 528 :group 'ido)
529 529
530 (defcustom ido-max-prospects 12 530 (defcustom ido-max-prospects 12
531 "*Non-zero means that the prospect list will be limited to than number of items. 531 "*Non-zero means that the prospect list will be limited to than number of items.
532 For a long list of prospects, building the full list for the minibuffer can take a 532 For a long list of prospects, building the full list for the minibuffer can take a
533 non-negletable amount of time; setting this variable reduces that time." 533 non-negligible amount of time; setting this variable reduces that time."
534 :type 'integer 534 :type 'integer
535 :group 'ido) 535 :group 'ido)
536 536
537 (defcustom ido-max-file-prompt-width 0.35 537 (defcustom ido-max-file-prompt-width 0.35
538 "*Non-zero means that the prompt string be limited to than number of characters. 538 "*Non-zero means that the prompt string be limited to than number of characters.
613 :group 'ido) 613 :group 'ido)
614 614
615 (defcustom ido-slow-ftp-hosts nil 615 (defcustom ido-slow-ftp-hosts nil
616 "*List of slow ftp hosts where ido prompting should not be used. 616 "*List of slow ftp hosts where ido prompting should not be used.
617 If an ftp host is on this list, ido automatically switches to the non-ido 617 If an ftp host is on this list, ido automatically switches to the non-ido
618 equivalent function, e.g. find-file rather than ido-find-file." 618 equivalent function, e.g. `find-file' rather than `ido-find-file'."
619 :type '(repeat string) 619 :type '(repeat string)
620 :group 'ido) 620 :group 'ido)
621 621
622 (defcustom ido-slow-ftp-host-regexps nil 622 (defcustom ido-slow-ftp-host-regexps nil
623 "*List of regexps matching slow ftp hosts (see `ido-slow-ftp-hosts')." 623 "*List of regexps matching slow ftp hosts (see `ido-slow-ftp-hosts')."
704 (const prompt) 704 (const prompt)
705 (const never)) 705 (const never))
706 :group 'ido) 706 :group 'ido)
707 707
708 (defcustom ido-setup-hook nil 708 (defcustom ido-setup-hook nil
709 "*Hook run after the ido variables and keymap has been setup. 709 "*Hook run after the ido variables and keymap have been setup.
710 The dynamic variable `ido-cur-item' contains the current type of item that 710 The dynamic variable `ido-cur-item' contains the current type of item that
711 is read by ido, possible values are file, dir, buffer, and list. 711 is read by ido, possible values are file, dir, buffer, and list.
712 Additional keys can be defined in `ido-mode-map'." 712 Additional keys can be defined in `ido-mode-map'."
713 :type 'hook 713 :type 'hook
714 :group 'ido) 714 :group 'ido)
725 1st and 2nd elements are used as brackets around the prospect list, 725 1st and 2nd elements are used as brackets around the prospect list,
726 3rd element is the separator between prospects (ignored if ido-separator is set), 726 3rd element is the separator between prospects (ignored if ido-separator is set),
727 4th element is the string inserted at the end of a truncated list of prospects, 727 4th element is the string inserted at the end of a truncated list of prospects,
728 5th and 6th elements are used as brackets around the common match string which 728 5th and 6th elements are used as brackets around the common match string which
729 can be completed using TAB, 729 can be completed using TAB,
730 7th element is the string displayed when there are a no matches, and 730 7th element is the string displayed when there are no matches, and
731 8th element is displayed if there is a single match (and faces are not used). 731 8th element is displayed if there is a single match (and faces are not used),
732 9th element is displayed when the current directory is non-readable. 732 9th element is displayed when the current directory is non-readable,
733 10th element is displayed when directory exceeds `ido-max-directory-size'." 733 10th element is displayed when directory exceeds `ido-max-directory-size'."
734 :type '(repeat string) 734 :type '(repeat string)
735 :group 'ido) 735 :group 'ido)
736 736
737 (defcustom ido-use-faces t 737 (defcustom ido-use-faces t
862 :group 'ido) 862 :group 'ido)
863 863
864 (defcustom ido-read-file-name-as-directory-commands '() 864 (defcustom ido-read-file-name-as-directory-commands '()
865 "List of commands which uses read-file-name to read a directory name. 865 "List of commands which uses read-file-name to read a directory name.
866 When `ido-everywhere' is non-nil, the commands in this list will read 866 When `ido-everywhere' is non-nil, the commands in this list will read
867 the directory using ido-read-directory-name." 867 the directory using `ido-read-directory-name'."
868 :type '(repeat symbol) 868 :type '(repeat symbol)
869 :group 'ido) 869 :group 'ido)
870 870
871 (defcustom ido-read-file-name-non-ido '() 871 (defcustom ido-read-file-name-non-ido '()
872 "List of commands which shall not read file names the ido way. 872 "List of commands which shall not read file names the ido way.
873 When `ido-everywhere' is non-nil, the commands in this list will read 873 When `ido-everywhere' is non-nil, the commands in this list will read
874 the file name using normal read-file-name style." 874 the file name using normal `read-file-name' style."
875 :type '(repeat symbol) 875 :type '(repeat symbol)
876 :group 'ido) 876 :group 'ido)
877 877
878 ;;; Internal Variables 878 ;;; Internal Variables
879 879
893 See `ido-enable-last-directory-history' for details.") 893 See `ido-enable-last-directory-history' for details.")
894 894
895 (defvar ido-work-directory-list nil 895 (defvar ido-work-directory-list nil
896 "List of actual working directory names. 896 "List of actual working directory names.
897 The current directory is inserted at the front of this list whenever a 897 The current directory is inserted at the front of this list whenever a
898 file is opened with ido-find-file and family.") 898 file is opened with `ido-find-file' and family.")
899 899
900 (defvar ido-work-file-list nil 900 (defvar ido-work-file-list nil
901 "List of actual work file names. 901 "List of actual work file names.
902 Opening a file with `ido-find-file' and similar functions 902 Opening a file with `ido-find-file' and similar functions
903 inserts the current file name (relative to its containing directory) 903 inserts the current file name (relative to its containing directory)
907 "List of `file-name-all-completions' results. 907 "List of `file-name-all-completions' results.
908 Each element in the list is of the form (DIR (MTIME) FILE...).") 908 Each element in the list is of the form (DIR (MTIME) FILE...).")
909 909
910 (defvar ido-ignore-item-temp-list nil 910 (defvar ido-ignore-item-temp-list nil
911 "List of items to ignore in current ido invocation. 911 "List of items to ignore in current ido invocation.
912 Intended to be let-bound by functions which calls ido repeatedly. 912 Intended to be let-bound by functions which call ido repeatedly.
913 Should never be set permanently.") 913 Should never be set permanently.")
914 914
915 ;; Temporary storage 915 ;; Temporary storage
916 916
917 (defvar ido-eoinput 1 917 (defvar ido-eoinput 1
947 "Flag to monitor how `ido-find-file' exits. 947 "Flag to monitor how `ido-find-file' exits.
948 If equal to `takeprompt', we use the prompt as the file name to be 948 If equal to `takeprompt', we use the prompt as the file name to be
949 selected.") 949 selected.")
950 950
951 (defvar ido-current-directory nil 951 (defvar ido-current-directory nil
952 "Current directory for ido-find-file.") 952 "Current directory for `ido-find-file'.")
953 953
954 (defvar ido-auto-merge-timer nil 954 (defvar ido-auto-merge-timer nil
955 "Delay timer for auto merge.") 955 "Delay timer for auto merge.")
956 956
957 (defvar ido-use-mycompletion-depth 0 957 (defvar ido-use-mycompletion-depth 0
1318 (add-hook 'choose-completion-string-functions 'ido-choose-completion-string) 1318 (add-hook 'choose-completion-string-functions 'ido-choose-completion-string)
1319 (ido-load-history) 1319 (ido-load-history)
1320 1320
1321 (add-hook 'kill-emacs-hook 'ido-kill-emacs-hook) 1321 (add-hook 'kill-emacs-hook 'ido-kill-emacs-hook)
1322 1322
1323 (unless ido-minor-mode-map-entry 1323 (if ido-minor-mode-map-entry
1324 (setcdr ido-minor-mode-map-entry (make-sparse-keymap))
1324 (setq ido-minor-mode-map-entry (cons 'ido-mode (make-sparse-keymap))) 1325 (setq ido-minor-mode-map-entry (cons 'ido-mode (make-sparse-keymap)))
1325 (add-to-list 'minor-mode-map-alist ido-minor-mode-map-entry)) 1326 (add-to-list 'minor-mode-map-alist ido-minor-mode-map-entry))
1326 1327
1327 (let ((map (cdr ido-minor-mode-map-entry))) 1328 (let ((map (cdr ido-minor-mode-map-entry)))
1328 (when (memq ido-mode '(file both)) 1329 (when (memq ido-mode '(file both))
2269 2270
2270 ;;; Magic C-f 2271 ;;; Magic C-f
2271 2272
2272 (defun ido-magic-forward-char () 2273 (defun ido-magic-forward-char ()
2273 "Move forward in user input or perform magic action. 2274 "Move forward in user input or perform magic action.
2274 If no user input is present or at end of input, perform magic actions: 2275 If no user input is present, or at end of input, perform magic actions:
2275 C-x C-b ... C-f switch to ido-find-file. 2276 C-x C-b ... C-f switch to ido-find-file.
2276 C-x C-f ... C-f fallback to non-ido find-file. 2277 C-x C-f ... C-f fallback to non-ido find-file.
2277 C-x C-d ... C-f fallback to non-ido brief dired. 2278 C-x C-d ... C-f fallback to non-ido brief dired.
2278 C-x d ... C-f fallback to non-ido dired." 2279 C-x d ... C-f fallback to non-ido dired."
2279 (interactive) 2280 (interactive)
2412 (push (aref ido-text (setq i (1- i))) unread-command-events))) 2413 (push (aref ido-text (setq i (1- i))) unread-command-events)))
2413 (setq ido-exit 'fallback) 2414 (setq ido-exit 'fallback)
2414 (exit-minibuffer)) 2415 (exit-minibuffer))
2415 2416
2416 (defun ido-enter-find-file () 2417 (defun ido-enter-find-file ()
2417 "Drop into find-file from buffer switching." 2418 "Drop into `find-file' from buffer switching."
2418 (interactive) 2419 (interactive)
2419 (setq ido-exit 'find-file) 2420 (setq ido-exit 'find-file)
2420 (exit-minibuffer)) 2421 (exit-minibuffer))
2421 2422
2422 (defun ido-enter-switch-buffer () 2423 (defun ido-enter-switch-buffer ()
2423 "Drop into ido-switch-buffer from file switching." 2424 "Drop into `ido-switch-buffer' from file switching."
2424 (interactive) 2425 (interactive)
2425 (setq ido-exit 'switch-to-buffer) 2426 (setq ido-exit 'switch-to-buffer)
2426 (exit-minibuffer)) 2427 (exit-minibuffer))
2427 2428
2428 (defun ido-enter-dired () 2429 (defun ido-enter-dired ()
3014 (buffer-list frame)))) 3015 (buffer-list frame))))
3015 3016
3016 (defun ido-make-buffer-list (default) 3017 (defun ido-make-buffer-list (default)
3017 ;; Return the current list of buffers. 3018 ;; Return the current list of buffers.
3018 ;; Currently visible buffers are put at the end of the list. 3019 ;; Currently visible buffers are put at the end of the list.
3019 ;; The hook `ido-make-buflist-hook' is run after the list has been 3020 ;; The hook `ido-make-buffer-list-hook' is run after the list has been
3020 ;; created to allow the user to further modify the order of the buffer names 3021 ;; created to allow the user to further modify the order of the buffer names
3021 ;; in this list. If DEFAULT is non-nil, and corresponds to an existing buffer, 3022 ;; in this list. If DEFAULT is non-nil, and corresponds to an existing buffer,
3022 ;; it is put to the start of the list. 3023 ;; it is put to the start of the list.
3023 (let* ((ido-current-buffers (ido-get-buffers-in-frames 'current)) 3024 (let* ((ido-current-buffers (ido-get-buffers-in-frames 'current))
3024 (ido-temp-list (ido-make-buffer-list-1 (selected-frame) ido-current-buffers))) 3025 (ido-temp-list (ido-make-buffer-list-1 (selected-frame) ido-current-buffers)))
3494 3495
3495 3496
3496 ;;; VISIT CHOSEN BUFFER 3497 ;;; VISIT CHOSEN BUFFER
3497 (defun ido-visit-buffer (buffer method &optional record) 3498 (defun ido-visit-buffer (buffer method &optional record)
3498 "Visit file named FILE according to METHOD. 3499 "Visit file named FILE according to METHOD.
3499 Record command in command-history if optional RECORD is non-nil." 3500 Record command in `command-history' if optional RECORD is non-nil."
3500 3501
3501 (let (win newframe) 3502 (let (win newframe)
3502 (cond 3503 (cond
3503 ((eq method 'kill) 3504 ((eq method 'kill)
3504 (if record 3505 (if record
3567 default is to show it in the same window, unless it is already visible 3568 default is to show it in the same window, unless it is already visible
3568 in another frame. 3569 in another frame.
3569 3570
3570 As you type in a string, all of the buffers matching the string are 3571 As you type in a string, all of the buffers matching the string are
3571 displayed if substring-matching is used \(default). Look at 3572 displayed if substring-matching is used \(default). Look at
3572 `ido-enable-prefix' and `ido-toggle-prefix'. When you have found the 3573 `ido-enable-prefix' and `ido-toggle-prefix'. When you have found the
3573 buffer you want, it can then be selected. As you type, most keys have their 3574 buffer you want, it can then be selected. As you type, most keys have
3574 normal keybindings, except for the following: \\<ido-mode-map> 3575 their normal keybindings, except for the following: \\<ido-mode-map>
3575 3576
3576 RET Select the buffer at the front of the list of matches. If the 3577 RET Select the buffer at the front of the list of matches. If the
3577 list is empty, possibly prompt to create new buffer. 3578 list is empty, possibly prompt to create new buffer.
3578 3579
3579 \\[ido-select-text] Select the current prompt as the buffer. 3580 \\[ido-select-text] Select the current prompt as the buffer.
3652 "Edit file with name obtained via minibuffer. 3653 "Edit file with name obtained via minibuffer.
3653 The file is displayed according to `ido-default-file-method' -- the 3654 The file is displayed according to `ido-default-file-method' -- the
3654 default is to show it in the same window, unless it is already 3655 default is to show it in the same window, unless it is already
3655 visible in another frame. 3656 visible in another frame.
3656 3657
3657 The file name is selected interactively by typing a substring. As you type 3658 The file name is selected interactively by typing a substring. As you
3658 in a string, all of the filenames matching the string are displayed if 3659 type in a string, all of the filenames matching the string are displayed
3659 substring-matching is used \(default). Look at `ido-enable-prefix' and 3660 if substring-matching is used \(default). Look at `ido-enable-prefix' and
3660 `ido-toggle-prefix'. When you have found the filename you want, it can 3661 `ido-toggle-prefix'. When you have found the filename you want, it can
3661 then be selected. As you type, most keys have their normal keybindings, 3662 then be selected. As you type, most keys have their normal keybindings,
3662 except for the following: \\<ido-mode-map> 3663 except for the following: \\<ido-mode-map>
3663 3664
3664 RET Select the file at the front of the list of matches. If the 3665 RET Select the file at the front of the list of matches. If the
3665 list is empty, possibly prompt to create new file. 3666 list is empty, possibly prompt to create new file.
3666 3667
4169 (defun ido-read-buffer (prompt &optional default require-match) 4170 (defun ido-read-buffer (prompt &optional default require-match)
4170 "Ido replacement for the built-in `read-buffer'. 4171 "Ido replacement for the built-in `read-buffer'.
4171 Return the name of a buffer selected. 4172 Return the name of a buffer selected.
4172 PROMPT is the prompt to give to the user. DEFAULT if given is the default 4173 PROMPT is the prompt to give to the user. DEFAULT if given is the default
4173 buffer to be selected, which will go to the front of the list. 4174 buffer to be selected, which will go to the front of the list.
4174 If REQUIRE-MATCH is non-nil, an existing-buffer must be selected." 4175 If REQUIRE-MATCH is non-nil, an existing buffer must be selected."
4175 (let* ((ido-current-directory nil) 4176 (let* ((ido-current-directory nil)
4176 (ido-directory-nonreadable nil) 4177 (ido-directory-nonreadable nil)
4177 (ido-directory-too-big nil) 4178 (ido-directory-too-big nil)
4178 (ido-context-switch-command 'ignore) 4179 (ido-context-switch-command 'ignore)
4179 (buf (ido-read-internal 'buffer prompt 'ido-buffer-history default require-match))) 4180 (buf (ido-read-internal 'buffer prompt 'ido-buffer-history default require-match)))