# HG changeset patch # User Richard M. Stallman # Date 809123457 0 # Node ID 61f11030ecc99006aa1a3b54d82ec92aabd57594 # Parent 00ee215f022ea37f3174f892cb8df56055f9da61 (icomplete-minibuffer-setup): Use make-local-hook and add and remove hooks locally. diff -r 00ee215f022e -r 61f11030ecc9 lisp/icomplete.el --- a/lisp/icomplete.el Tue Aug 22 20:27:05 1995 +0000 +++ b/lisp/icomplete.el Tue Aug 22 20:30:57 1995 +0000 @@ -136,34 +136,31 @@ (and (window-minibuffer-p (selected-window)) (not executing-macro) (not (symbolp minibuffer-completion-table)))) + ;;;_ > icomplete-minibuffer-setup () ;;;###autoload (defun icomplete-minibuffer-setup () - "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)) - (make-local-variable 'pre-command-hook) - (setq pre-command-hook (copy-sequence pre-command-hook)) + (make-local-hook 'pre-command-hook) (add-hook 'pre-command-hook (function (lambda () - (run-hooks 'icomplete-pre-command-hook)))) - (make-local-variable 'post-command-hook) - (setq post-command-hook (copy-sequence post-command-hook)) + (run-hooks 'icomplete-pre-command-hook))) + nil t) + (make-local-hook 'post-command-hook) (add-hook 'post-command-hook (function (lambda () - (run-hooks 'icomplete-post-command-hook)))) + (run-hooks 'icomplete-post-command-hook))) + nil t) (run-hooks 'icomplete-minibuffer-setup-hook)))) - + ;;;_* Completion ;;;_ > icomplete-tidy () (defun icomplete-tidy () "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'." (if (icomplete-simple-completing-p) (if (and (boundp 'icomplete-eoinput) @@ -178,11 +175,11 @@ ;; Reestablish the local variable 'cause minibuffer-setup is weird: (make-local-variable 'icomplete-eoinput) (setq icomplete-eoinput 1)))) + ;;;_ > icomplete-exhibit () (defun icomplete-exhibit () "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'." (if (icomplete-simple-completing-p) (let ((contents (buffer-substring (point-min)(point-max))) @@ -204,6 +201,7 @@ minibuffer-completion-predicate (not minibuffer-completion-confirm)))))))) + ;;;_ > icomplete-completions (name candidates predicate require-match) (defun icomplete-completions (name candidates predicate require-match) "Identify prospective candidates for minibuffer completion. @@ -219,8 +217,8 @@ \{...} - multiple prospects, separated by commas, are indicated, and further input is required to distingish a single one. -The displays for disambiguous matches have \" [Matched]\" appended -\(whether complete or not), or \" \[No matches]\", if no eligible +The displays for disambiguous matches have ` [Matched]' appended +\(whether complete or not), or ` \[No matches]', if no eligible matches exist." (let ((comps (all-completions name candidates predicate))