Commit d183f322 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(icomplete-minibuffer-setup): Use make-local-hook

and add and remove hooks locally.
parent c2bf3f2e
...@@ -136,34 +136,31 @@ Conditions are: ...@@ -136,34 +136,31 @@ Conditions are:
(and (window-minibuffer-p (selected-window)) (and (window-minibuffer-p (selected-window))
(not executing-macro) (not executing-macro)
(not (symbolp minibuffer-completion-table)))) (not (symbolp minibuffer-completion-table))))
;;;_ > icomplete-minibuffer-setup () ;;;_ > icomplete-minibuffer-setup ()
;;;###autoload ;;;###autoload
(defun icomplete-minibuffer-setup () (defun icomplete-minibuffer-setup ()
"Run in minibuffer on activation to establish incremental completion. "Run in minibuffer on activation to establish incremental completion.
Usually run by inclusion in `minibuffer-setup-hook'."
Usually run by inclusion in minibuffer-setup-hook."
(cond ((and icomplete-mode (icomplete-simple-completing-p)) (cond ((and icomplete-mode (icomplete-simple-completing-p))
(make-local-variable 'pre-command-hook) (make-local-hook 'pre-command-hook)
(setq pre-command-hook (copy-sequence pre-command-hook))
(add-hook 'pre-command-hook (add-hook 'pre-command-hook
(function (lambda () (function (lambda ()
(run-hooks 'icomplete-pre-command-hook)))) (run-hooks 'icomplete-pre-command-hook)))
(make-local-variable 'post-command-hook) nil t)
(setq post-command-hook (copy-sequence post-command-hook)) (make-local-hook 'post-command-hook)
(add-hook 'post-command-hook (add-hook 'post-command-hook
(function (lambda () (function (lambda ()
(run-hooks 'icomplete-post-command-hook)))) (run-hooks 'icomplete-post-command-hook)))
nil t)
(run-hooks 'icomplete-minibuffer-setup-hook)))) (run-hooks 'icomplete-minibuffer-setup-hook))))
;;;_* Completion ;;;_* Completion
;;;_ > icomplete-tidy () ;;;_ > icomplete-tidy ()
(defun icomplete-tidy () (defun icomplete-tidy ()
"Remove completions display \(if any) prior to new user input. "Remove completions display \(if any) prior to new user input.
Should be run in on the minibuffer `pre-command-hook'. See `icomplete-mode'
Should be run in on the minibuffer pre-command-hook. See `icomplete-mode'
and `minibuffer-setup-hook'." and `minibuffer-setup-hook'."
(if (icomplete-simple-completing-p) (if (icomplete-simple-completing-p)
(if (and (boundp 'icomplete-eoinput) (if (and (boundp 'icomplete-eoinput)
...@@ -178,11 +175,11 @@ and `minibuffer-setup-hook'." ...@@ -178,11 +175,11 @@ and `minibuffer-setup-hook'."
;; Reestablish the local variable 'cause minibuffer-setup is weird: ;; Reestablish the local variable 'cause minibuffer-setup is weird:
(make-local-variable 'icomplete-eoinput) (make-local-variable 'icomplete-eoinput)
(setq icomplete-eoinput 1)))) (setq icomplete-eoinput 1))))
;;;_ > icomplete-exhibit () ;;;_ > icomplete-exhibit ()
(defun icomplete-exhibit () (defun icomplete-exhibit ()
"Insert icomplete completions display. "Insert icomplete completions display.
Should be run via minibuffer `post-command-hook'. See `icomplete-mode'
Should be run via minibuffer post-command-hook. See `icomplete-mode'
and `minibuffer-setup-hook'." and `minibuffer-setup-hook'."
(if (icomplete-simple-completing-p) (if (icomplete-simple-completing-p)
(let ((contents (buffer-substring (point-min)(point-max))) (let ((contents (buffer-substring (point-min)(point-max)))
...@@ -204,6 +201,7 @@ and `minibuffer-setup-hook'." ...@@ -204,6 +201,7 @@ and `minibuffer-setup-hook'."
minibuffer-completion-predicate minibuffer-completion-predicate
(not (not
minibuffer-completion-confirm)))))))) minibuffer-completion-confirm))))))))
;;;_ > icomplete-completions (name candidates predicate require-match) ;;;_ > icomplete-completions (name candidates predicate require-match)
(defun icomplete-completions (name candidates predicate require-match) (defun icomplete-completions (name candidates predicate require-match)
"Identify prospective candidates for minibuffer completion. "Identify prospective candidates for minibuffer completion.
...@@ -219,8 +217,8 @@ one of \(), \[], or \{} pairs. The choice of brackets is as follows: ...@@ -219,8 +217,8 @@ one of \(), \[], or \{} pairs. The choice of brackets is as follows:
\{...} - multiple prospects, separated by commas, are indicated, and \{...} - multiple prospects, separated by commas, are indicated, and
further input is required to distingish a single one. further input is required to distingish a single one.
The displays for disambiguous matches have \" [Matched]\" appended The displays for disambiguous matches have ` [Matched]' appended
\(whether complete or not), or \" \[No matches]\", if no eligible \(whether complete or not), or ` \[No matches]', if no eligible
matches exist." matches exist."
(let ((comps (all-completions name candidates predicate)) (let ((comps (all-completions name candidates predicate))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment