diff options
| author | Stephen Eglen | 1998-01-24 11:35:59 +0000 |
|---|---|---|
| committer | Stephen Eglen | 1998-01-24 11:35:59 +0000 |
| commit | 5e537651cb7fc73c61ff96c2469ffbb6ab9b8e67 (patch) | |
| tree | 8da8d5bc5cfa58ba972a3f574aae4220b74ceb2b | |
| parent | 9d26aa53a2149546ac00deb1cc5b225c7f2696d3 (diff) | |
| download | emacs-5e537651cb7fc73c61ff96c2469ffbb6ab9b8e67.tar.gz emacs-5e537651cb7fc73c61ff96c2469ffbb6ab9b8e67.zip | |
Customized.
| -rw-r--r-- | lisp/icomplete.el | 84 |
1 files changed, 58 insertions, 26 deletions
diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 218b2c32f00..bf64dfdec46 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el | |||
| @@ -31,20 +31,21 @@ | |||
| 31 | ;; indicated within the minibuffer itself, with each successive | 31 | ;; indicated within the minibuffer itself, with each successive |
| 32 | ;; keystroke. | 32 | ;; keystroke. |
| 33 | 33 | ||
| 34 | ;; See 'icomplete-completions' docstring for a description of the | 34 | ;; See `icomplete-completions' docstring for a description of the |
| 35 | ;; icomplete display format. | 35 | ;; icomplete display format. |
| 36 | 36 | ||
| 37 | ;; See the `icomplete-minibuffer-setup-hook' docstring for a means to | 37 | ;; See the `icomplete-minibuffer-setup-hook' docstring for a means to |
| 38 | ;; customize icomplete setup for interoperation with other | 38 | ;; customize icomplete setup for interoperation with other |
| 39 | ;; minibuffer-oriented packages. | 39 | ;; minibuffer-oriented packages. |
| 40 | 40 | ||
| 41 | ;; To activate icomplete mode, simply load the package. You can | 41 | ;; To activate icomplete mode, simply add the following to .emacs: |
| 42 | ;; subsequently deactivate it by invoking the function icomplete-mode | 42 | ;; (icomplete-mode) |
| 43 | ;; with a negative prefix-arg (C-U -1 ESC-x icomplete-mode). Also, | 43 | ;; You can subsequently deactivate it by invoking the function |
| 44 | ;; you can prevent activation of the mode during package load by | 44 | ;; icomplete-mode with a negative prefix-arg (C-U -1 ESC-x |
| 45 | ;; first setting the variable `icomplete-mode' to nil. Icompletion | 45 | ;; icomplete-mode). Also, you can prevent activation of the mode |
| 46 | ;; can be enabled any time after the package is loaded by invoking | 46 | ;; during package load by first setting the variable `icomplete-mode' |
| 47 | ;; icomplete-mode without a prefix arg. | 47 | ;; to nil. Icompletion can be enabled any time after the package is |
| 48 | ;; loaded by invoking icomplete-mode without a prefix arg. | ||
| 48 | 49 | ||
| 49 | ;; This version of icomplete runs on Emacs 19.18 and later. (It | 50 | ;; This version of icomplete runs on Emacs 19.18 and later. (It |
| 50 | ;; depends on the incorporation of minibuffer-setup-hook.) The elisp | 51 | ;; depends on the incorporation of minibuffer-setup-hook.) The elisp |
| @@ -55,7 +56,7 @@ | |||
| 55 | ;; package. I particularly have to credit Michael Cook, who | 56 | ;; package. I particularly have to credit Michael Cook, who |
| 56 | ;; implemented an incremental completion style in his 'iswitch' | 57 | ;; implemented an incremental completion style in his 'iswitch' |
| 57 | ;; functions that served as a model for icomplete. Some other | 58 | ;; functions that served as a model for icomplete. Some other |
| 58 | ;; contributors: Noah Freidman (restructuring as minor mode), Colin | 59 | ;; contributors: Noah Friedman (restructuring as minor mode), Colin |
| 59 | ;; Rafferty (lemacs reconciliation), Lars Lindberg, RMS, and others. | 60 | ;; Rafferty (lemacs reconciliation), Lars Lindberg, RMS, and others. |
| 60 | 61 | ||
| 61 | ;; klm. | 62 | ;; klm. |
| @@ -65,18 +66,47 @@ | |||
| 65 | ;;;_* Provide | 66 | ;;;_* Provide |
| 66 | (provide 'icomplete) | 67 | (provide 'icomplete) |
| 67 | 68 | ||
| 69 | |||
| 70 | (defgroup icomplete nil | ||
| 71 | "Show completions dynamically in minibuffer." | ||
| 72 | :prefix "icomplete-" | ||
| 73 | :group 'minibuffer) | ||
| 74 | |||
| 68 | ;;;_* User Customization variables | 75 | ;;;_* User Customization variables |
| 69 | (defvar icomplete-compute-delay .3 | 76 | (defcustom icomplete-mode nil |
| 77 | "*Non-nil enables incremental minibuffer completion. | ||
| 78 | As text is typed into the minibuffer, prospective completions are indicated | ||
| 79 | in the minibuffer. | ||
| 80 | You must modify via \\[customize] for this variable to have an effect." | ||
| 81 | :set (lambda (symbol value) | ||
| 82 | (icomplete-mode (if value 1 -1))) | ||
| 83 | :initialize 'custom-initialize-default | ||
| 84 | :type 'boolean | ||
| 85 | :group 'icomplete | ||
| 86 | :require 'icomplete) | ||
| 87 | |||
| 88 | (defcustom icomplete-compute-delay .3 | ||
| 70 | "*Completions-computation stall, used only with large-number | 89 | "*Completions-computation stall, used only with large-number |
| 71 | completions - see `icomplete-delay-completions-threshold'.") | 90 | completions - see `icomplete-delay-completions-threshold'." |
| 72 | (defvar icomplete-delay-completions-threshold 400 | 91 | :type 'number |
| 73 | "*Pending-completions number over which to apply icomplete-compute-delay.") | 92 | :group 'icomplete) |
| 74 | (defvar icomplete-max-delay-chars 3 | 93 | |
| 75 | "*Maximum number of initial chars to apply icomplete compute delay.") | 94 | (defcustom icomplete-delay-completions-threshold 400 |
| 76 | 95 | "*Pending-completions number over which to apply icomplete-compute-delay." | |
| 77 | ;;;_* Initialization | 96 | :type 'integer |
| 78 | ;;;_ = icomplete-minibuffer-setup-hook | 97 | :group 'icomplete) |
| 79 | (defvar icomplete-minibuffer-setup-hook nil | 98 | |
| 99 | (defcustom icomplete-max-delay-chars 3 | ||
| 100 | "*Maximum number of initial chars to apply icomplete compute delay." | ||
| 101 | :type 'integer | ||
| 102 | :group 'icomplete) | ||
| 103 | |||
| 104 | (defcustom icomplete-show-key-bindings t | ||
| 105 | "*If non-nil, show key bindings as well as completion for sole matches." | ||
| 106 | :type 'boolean | ||
| 107 | :group 'icomplete) | ||
| 108 | |||
| 109 | (defcustom icomplete-minibuffer-setup-hook nil | ||
| 80 | "*Icomplete-specific customization of minibuffer setup. | 110 | "*Icomplete-specific customization of minibuffer setup. |
| 81 | 111 | ||
| 82 | This hook is run during minibuffer setup iff icomplete will be active. | 112 | This hook is run during minibuffer setup iff icomplete will be active. |
| @@ -90,12 +120,14 @@ with other packages. For instance: | |||
| 90 | \(setq resize-minibuffer-window-max-height 3)))) | 120 | \(setq resize-minibuffer-window-max-height 3)))) |
| 91 | 121 | ||
| 92 | will constrain rsz-mini to a maximum minibuffer height of 3 lines when | 122 | will constrain rsz-mini to a maximum minibuffer height of 3 lines when |
| 93 | icompletion is occurring.") | 123 | icompletion is occurring." |
| 124 | :type 'hook | ||
| 125 | :group 'icomplete) | ||
| 126 | |||
| 127 | |||
| 128 | ;;;_* Initialization | ||
| 94 | 129 | ||
| 95 | ;;;_ + Internal Variables | 130 | ;;;_ + Internal Variables |
| 96 | ;;;_ = icomplete-mode | ||
| 97 | (defvar icomplete-mode t | ||
| 98 | "*Non-nil enables incremental minibuffer completion (see \\[icomplete-mode].") | ||
| 99 | ;;;_ = icomplete-eoinput 1 | 131 | ;;;_ = icomplete-eoinput 1 |
| 100 | (defvar icomplete-eoinput 1 | 132 | (defvar icomplete-eoinput 1 |
| 101 | "Point where minibuffer input ends and completion info begins.") | 133 | "Point where minibuffer input ends and completion info begins.") |
| @@ -117,9 +149,6 @@ Use `icomplete-mode' function to set it up properly for incremental | |||
| 117 | minibuffer completion.") | 149 | minibuffer completion.") |
| 118 | (add-hook 'icomplete-post-command-hook 'icomplete-exhibit) | 150 | (add-hook 'icomplete-post-command-hook 'icomplete-exhibit) |
| 119 | 151 | ||
| 120 | (defvar icomplete-show-key-bindings t | ||
| 121 | "*When non-nil, show key bindings as well as completion for sole matches.") | ||
| 122 | |||
| 123 | (defun icomplete-get-keys (func-name) | 152 | (defun icomplete-get-keys (func-name) |
| 124 | "Return strings naming keys bound to `func-name', or nil if none. | 153 | "Return strings naming keys bound to `func-name', or nil if none. |
| 125 | Examines the prior, not current, buffer, presuming that current buffer | 154 | Examines the prior, not current, buffer, presuming that current buffer |
| @@ -347,6 +376,9 @@ are exhibited within the square braces.)" | |||
| 347 | alternatives) | 376 | alternatives) |
| 348 | close-bracket-prospects))))))) | 377 | close-bracket-prospects))))))) |
| 349 | 378 | ||
| 379 | (if icomplete-mode | ||
| 380 | (icomplete-mode 1)) | ||
| 381 | |||
| 350 | ;;;_* Local emacs vars. | 382 | ;;;_* Local emacs vars. |
| 351 | ;;;Local variables: | 383 | ;;;Local variables: |
| 352 | ;;;outline-layout: (-2 :) | 384 | ;;;outline-layout: (-2 :) |