]> code.delx.au - gnu-emacs/blobdiff - lisp/icomplete.el
(recover-session): Add leading space on added text lines.
[gnu-emacs] / lisp / icomplete.el
index 218b2c32f00fba5d72834ac901fffb7836148783..7609e3a11ab66189e7d351e931900a9b72da7fe0 100644 (file)
@@ -1,4 +1,4 @@
-;;;_. icomplete.el - minibuffer completion incremental feedback
+;;; icomplete.el --- minibuffer completion incremental feedback
 
 ;; Copyright (C) 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
 
 ;; indicated within the minibuffer itself, with each successive
 ;; keystroke.
 
-;; See 'icomplete-completions' docstring for a description of the
+;; See `icomplete-completions' docstring for a description of the
 ;; icomplete display format.
 
 ;; See the `icomplete-minibuffer-setup-hook' docstring for a means to
 ;; customize icomplete setup for interoperation with other
 ;; minibuffer-oriented packages.
 
-;; To activate icomplete mode, simply load the package.  You can
-;; subsequently deactivate it by invoking the function icomplete-mode
-;; with a negative prefix-arg (C-U -1 ESC-x icomplete-mode).  Also,
-;; you can prevent activation of the mode during package load by
-;; first setting the variable `icomplete-mode' to nil.  Icompletion
-;; can be enabled any time after the package is loaded by invoking
-;; icomplete-mode without a prefix arg.
+;; To activate icomplete mode, simply add the following to .emacs:
+;; (icomplete-mode)
+;; You can subsequently deactivate it by invoking the function
+;; icomplete-mode with a negative prefix-arg (C-U -1 ESC-x
+;; icomplete-mode).  Also, you can prevent activation of the mode
+;; during package load by first setting the variable `icomplete-mode'
+;; to nil.  Icompletion can be enabled any time after the package is
+;; loaded by invoking icomplete-mode without a prefix arg.
 
 ;; This version of icomplete runs on Emacs 19.18 and later.  (It
 ;; depends on the incorporation of minibuffer-setup-hook.)  The elisp
@@ -55,7 +56,7 @@
 ;; package.  I particularly have to credit Michael Cook, who
 ;; implemented an incremental completion style in his 'iswitch'
 ;; functions that served as a model for icomplete.  Some other
-;; contributors: Noah Freidman (restructuring as minor mode), Colin
+;; contributors: Noah Friedman (restructuring as minor mode), Colin
 ;; Rafferty (lemacs reconciliation), Lars Lindberg, RMS, and others.
 
 ;; klm.
 ;;;_* Provide
 (provide 'icomplete)
 
+
+(defgroup icomplete nil
+  "Show completions dynamically in minibuffer."
+  :prefix "icomplete-"
+  :group 'minibuffer)
+
 ;;;_* User Customization variables
-(defvar icomplete-compute-delay .3
+(defcustom icomplete-mode nil
+  "*Non-nil enables incremental minibuffer completion.
+As text is typed into the minibuffer, prospective completions are indicated 
+in the minibuffer.
+You must modify via \\[customize] for this variable to have an effect."
+  :set (lambda (symbol value)
+        (icomplete-mode (if value 1 -1)))
+  :initialize 'custom-initialize-default
+  :type 'boolean
+  :group 'icomplete
+  :require 'icomplete)
+
+(defcustom icomplete-compute-delay .3
   "*Completions-computation stall, used only with large-number
-completions - see `icomplete-delay-completions-threshold'.")
-(defvar icomplete-delay-completions-threshold 400
-  "*Pending-completions number over which to apply icomplete-compute-delay.")
-(defvar icomplete-max-delay-chars 3
-  "*Maximum number of initial chars to apply icomplete compute delay.")
-
-;;;_* Initialization
-;;;_  = icomplete-minibuffer-setup-hook
-(defvar icomplete-minibuffer-setup-hook nil
+completions - see `icomplete-delay-completions-threshold'."
+  :type 'number
+  :group 'icomplete)
+
+(defcustom icomplete-delay-completions-threshold 400
+  "*Pending-completions number over which to apply icomplete-compute-delay."
+  :type 'integer
+  :group 'icomplete)
+
+(defcustom icomplete-max-delay-chars 3
+  "*Maximum number of initial chars to apply icomplete compute delay."
+  :type 'integer
+  :group 'icomplete)
+
+(defcustom icomplete-show-key-bindings t
+  "*If non-nil, show key bindings as well as completion for sole matches."
+  :type 'boolean
+  :group 'icomplete)
+
+(defcustom icomplete-minibuffer-setup-hook nil
   "*Icomplete-specific customization of minibuffer setup.
 
 This hook is run during minibuffer setup iff icomplete will be active.
@@ -90,12 +120,14 @@ with other packages.  For instance:
               \(setq resize-minibuffer-window-max-height 3))))
 
 will constrain rsz-mini to a maximum minibuffer height of 3 lines when
-icompletion is occurring.")
+icompletion is occurring."
+  :type 'hook
+  :group 'icomplete)
+
+
+;;;_* Initialization
 
 ;;;_ + Internal Variables
-;;;_  = icomplete-mode
-(defvar icomplete-mode t
-  "*Non-nil enables incremental minibuffer completion (see \\[icomplete-mode].")
 ;;;_  = icomplete-eoinput 1
 (defvar icomplete-eoinput 1
   "Point where minibuffer input ends and completion info begins.")
@@ -117,9 +149,6 @@ Use `icomplete-mode' function to set it up properly for incremental
 minibuffer completion.")
 (add-hook 'icomplete-post-command-hook 'icomplete-exhibit)
 
-(defvar icomplete-show-key-bindings t
-  "*When non-nil, show key bindings as well as completion for sole matches.")
-
 (defun icomplete-get-keys (func-name)
   "Return strings naming keys bound to `func-name', or nil if none.
 Examines the prior, not current, buffer, presuming that current buffer
@@ -347,6 +376,9 @@ are exhibited within the square braces.)"
                         alternatives)
                       close-bracket-prospects)))))))
 
+(if icomplete-mode
+    (icomplete-mode 1))
+
 ;;;_* Local emacs vars.
 ;;;Local variables:
 ;;;outline-layout: (-2 :)