-;;;_+ icomplete.el - minibuffer completion incremental feedback
+;;; icomplete.el --- minibuffer completion incremental feedback
-;; Copyright (C) 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1994, 1997, 1999, 2001
+;;; Free Software Foundation, Inc.
;; Author: Ken Manheimer <klm@i.am>
;; Maintainer: Ken Manheimer <klm@i.am>
(defcustom icomplete-mode nil
"*Toggle incremental minibuffer completion.
-As text is typed into the minibuffer, prospective completions are indicated
+As text is typed into the minibuffer, prospective completions are indicated
in the minibuffer.
Setting this variable directly does not take effect;
use either \\[customize] or the function `icomplete-mode'."
This hook is run during minibuffer setup iff icomplete will be active.
It is intended for use in customizing icomplete for interoperation
-with other packages. For instance:
+with other features and packages. For instance:
\(add-hook 'icomplete-minibuffer-setup-hook
\(function
\(lambda ()
- \(make-local-variable 'resize-minibuffer-window-max-height)
- \(setq resize-minibuffer-window-max-height 3))))
+ \(make-local-variable 'max-mini-window-height)
+ \(setq max-mini-window-height 3))))
-will constrain rsz-mini to a maximum minibuffer height of 3 lines when
+will constrain Emacs to a maximum minibuffer height of 3 lines when
icompletion is occurring."
:type 'hook
:group 'icomplete)
;;;_ > icomplete-mode (&optional prefix)
;;;###autoload
-(defun icomplete-mode (&optional prefix)
- "Activate incremental minibuffer completion for this Emacs session.
-Deactivates with negative universal argument."
- (interactive "p")
- (or prefix (setq prefix 0))
- (cond ((>= prefix 0)
- (setq icomplete-mode t)
- ;; The following is not really necessary after first time -
- ;; no great loss.
- (add-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup))
- (t (setq icomplete-mode nil))))
+(defun icomplete-mode (&optional arg)
+ "Toggle incremental minibuffer completion for this Emacs session.
+With a numeric argument, turn Icomplete mode on iff ARG is positive."
+ (interactive "P")
+ (let ((on-p (if (null arg)
+ (not icomplete-mode)
+ (> (prefix-numeric-value arg) 0))))
+ (setq icomplete-mode on-p)
+ (when on-p
+ ;; The following is not really necessary after first time -
+ ;; no great loss.
+ (add-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup))))
;;;_ > icomplete-simple-completing-p ()
(defun icomplete-simple-completing-p ()
"Run in minibuffer on activation to establish incremental completion.
Usually run by inclusion in `minibuffer-setup-hook'."
(cond ((and icomplete-mode (icomplete-simple-completing-p))
- (make-local-hook 'pre-command-hook)
(add-hook 'pre-command-hook
(function (lambda ()
(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)))
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)))
+ (let ((contents (buffer-substring (minibuffer-prompt-end)(point-max)))
(buffer-undo-list t))
(save-excursion
(goto-char (point-max))
(make-local-variable 'icomplete-eoinput))
(setq icomplete-eoinput (point))
; Insert the match-status information:
- (if (and (> (point-max) 1)
+ (if (and (> (point-max) (minibuffer-prompt-end))
(or
;; Don't bother with delay after certain number of chars:
(> (point-max) icomplete-max-delay-chars)
;; Delay - give some grace time for next keystroke, before
;; embarking on computing completions:
(sit-for icomplete-compute-delay)))
- (insert-string
+ (insert
(icomplete-completions contents
minibuffer-completion-table
minibuffer-completion-predicate
;;;outline-layout: (-2 :)
;;;End:
+;;; arch-tag: 339ec25a-0741-4eb6-be63-997532e89b0f
;;; icomplete.el ends here