aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-08-22 20:30:57 +0000
committerRichard M. Stallman1995-08-22 20:30:57 +0000
commitd183f322f974fadbf2302c603ebe7ec3fb9646cd (patch)
tree132d0d0e6d092881c7b2bc1f8e51f7b97b7a7004
parentc2bf3f2e59ab666307fed33da761907bf2d11254 (diff)
downloademacs-d183f322f974fadbf2302c603ebe7ec3fb9646cd.tar.gz
emacs-d183f322f974fadbf2302c603ebe7ec3fb9646cd.zip
(icomplete-minibuffer-setup): Use make-local-hook
and add and remove hooks locally.
-rw-r--r--lisp/icomplete.el32
1 files changed, 15 insertions, 17 deletions
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index e7d53a1f8a5..8a9d0984704 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -136,34 +136,31 @@ Conditions are:
136 (and (window-minibuffer-p (selected-window)) 136 (and (window-minibuffer-p (selected-window))
137 (not executing-macro) 137 (not executing-macro)
138 (not (symbolp minibuffer-completion-table)))) 138 (not (symbolp minibuffer-completion-table))))
139
139;;;_ > icomplete-minibuffer-setup () 140;;;_ > icomplete-minibuffer-setup ()
140;;;###autoload 141;;;###autoload
141(defun icomplete-minibuffer-setup () 142(defun icomplete-minibuffer-setup ()
142
143 "Run in minibuffer on activation to establish incremental completion. 143 "Run in minibuffer on activation to establish incremental completion.
144 144Usually run by inclusion in `minibuffer-setup-hook'."
145Usually run by inclusion in minibuffer-setup-hook."
146
147 (cond ((and icomplete-mode (icomplete-simple-completing-p)) 145 (cond ((and icomplete-mode (icomplete-simple-completing-p))
148 (make-local-variable 'pre-command-hook) 146 (make-local-hook 'pre-command-hook)
149 (setq pre-command-hook (copy-sequence pre-command-hook))
150 (add-hook 'pre-command-hook 147 (add-hook 'pre-command-hook
151 (function (lambda () 148 (function (lambda ()
152 (run-hooks 'icomplete-pre-command-hook)))) 149 (run-hooks 'icomplete-pre-command-hook)))
153 (make-local-variable 'post-command-hook) 150 nil t)
154 (setq post-command-hook (copy-sequence post-command-hook)) 151 (make-local-hook 'post-command-hook)
155 (add-hook 'post-command-hook 152 (add-hook 'post-command-hook
156 (function (lambda () 153 (function (lambda ()
157 (run-hooks 'icomplete-post-command-hook)))) 154 (run-hooks 'icomplete-post-command-hook)))
155 nil t)
158 (run-hooks 'icomplete-minibuffer-setup-hook)))) 156 (run-hooks 'icomplete-minibuffer-setup-hook))))
159 157
160;;;_* Completion 158;;;_* Completion
161 159
162;;;_ > icomplete-tidy () 160;;;_ > icomplete-tidy ()
163(defun icomplete-tidy () 161(defun icomplete-tidy ()
164 "Remove completions display \(if any) prior to new user input. 162 "Remove completions display \(if any) prior to new user input.
165 163Should be run in on the minibuffer `pre-command-hook'. See `icomplete-mode'
166Should be run in on the minibuffer pre-command-hook. See `icomplete-mode'
167and `minibuffer-setup-hook'." 164and `minibuffer-setup-hook'."
168 (if (icomplete-simple-completing-p) 165 (if (icomplete-simple-completing-p)
169 (if (and (boundp 'icomplete-eoinput) 166 (if (and (boundp 'icomplete-eoinput)
@@ -178,11 +175,11 @@ and `minibuffer-setup-hook'."
178 ;; Reestablish the local variable 'cause minibuffer-setup is weird: 175 ;; Reestablish the local variable 'cause minibuffer-setup is weird:
179 (make-local-variable 'icomplete-eoinput) 176 (make-local-variable 'icomplete-eoinput)
180 (setq icomplete-eoinput 1)))) 177 (setq icomplete-eoinput 1))))
178
181;;;_ > icomplete-exhibit () 179;;;_ > icomplete-exhibit ()
182(defun icomplete-exhibit () 180(defun icomplete-exhibit ()
183 "Insert icomplete completions display. 181 "Insert icomplete completions display.
184 182Should be run via minibuffer `post-command-hook'. See `icomplete-mode'
185Should be run via minibuffer post-command-hook. See `icomplete-mode'
186and `minibuffer-setup-hook'." 183and `minibuffer-setup-hook'."
187 (if (icomplete-simple-completing-p) 184 (if (icomplete-simple-completing-p)
188 (let ((contents (buffer-substring (point-min)(point-max))) 185 (let ((contents (buffer-substring (point-min)(point-max)))
@@ -204,6 +201,7 @@ and `minibuffer-setup-hook'."
204 minibuffer-completion-predicate 201 minibuffer-completion-predicate
205 (not 202 (not
206 minibuffer-completion-confirm)))))))) 203 minibuffer-completion-confirm))))))))
204
207;;;_ > icomplete-completions (name candidates predicate require-match) 205;;;_ > icomplete-completions (name candidates predicate require-match)
208(defun icomplete-completions (name candidates predicate require-match) 206(defun icomplete-completions (name candidates predicate require-match)
209 "Identify prospective candidates for minibuffer completion. 207 "Identify prospective candidates for minibuffer completion.
@@ -219,8 +217,8 @@ one of \(), \[], or \{} pairs. The choice of brackets is as follows:
219 \{...} - multiple prospects, separated by commas, are indicated, and 217 \{...} - multiple prospects, separated by commas, are indicated, and
220 further input is required to distingish a single one. 218 further input is required to distingish a single one.
221 219
222The displays for disambiguous matches have \" [Matched]\" appended 220The displays for disambiguous matches have ` [Matched]' appended
223\(whether complete or not), or \" \[No matches]\", if no eligible 221\(whether complete or not), or ` \[No matches]', if no eligible
224matches exist." 222matches exist."
225 223
226 (let ((comps (all-completions name candidates predicate)) 224 (let ((comps (all-completions name candidates predicate))