]> code.delx.au - gnu-emacs/blobdiff - lisp/icomplete.el
*** empty log message ***
[gnu-emacs] / lisp / icomplete.el
index 085c111d85655a70cd62b65989925a4a16210290..44c854f2f460fc51f8ab47ff97680bd92820ffe0 100644 (file)
@@ -1,7 +1,7 @@
 ;;; icomplete.el --- minibuffer completion incremental feedback
 
 ;; Copyright (C) 1992, 1993, 1994, 1997, 1999, 2001, 2002, 2003,
-;;   2004, 2005 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Ken Manheimer <klm@i.am>
 ;; Maintainer: Ken Manheimer <klm@i.am>
@@ -13,7 +13,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -99,7 +99,7 @@ completions - see `icomplete-delay-completions-threshold'."
 (defcustom icomplete-minibuffer-setup-hook nil
   "*Icomplete-specific customization of minibuffer setup.
 
-This hook is run during minibuffer setup iff icomplete will be active.
+This hook is run during minibuffer setup if icomplete is active.
 It is intended for use in customizing icomplete for interoperation
 with other features and packages.  For instance:
 
@@ -146,7 +146,7 @@ is minibuffer."
   (if (commandp func-name)
     (save-excursion
       (let* ((sym (intern func-name))
-            (buf (other-buffer))
+            (buf (other-buffer nil t))
             (map (save-excursion (set-buffer buf) (current-local-map)))
             (keys (where-is-internal sym map)))
        (if keys
@@ -157,12 +157,19 @@ is minibuffer."
                                         (< (length x) (length y))))
                               ", ")
                    ">"))))))
+;;;_  = icomplete-with-completion-tables
+(defvar icomplete-with-completion-tables '(internal-complete-buffer)
+  "Specialized completion tables with which icomplete should operate.
+
+Icomplete does not operate with any specialized completion tables
+except those on this list.")
 
 ;;;_ > icomplete-mode (&optional prefix)
 ;;;###autoload
 (define-minor-mode icomplete-mode
   "Toggle incremental minibuffer completion for this Emacs session.
-With a numeric argument, turn Icomplete mode on iff ARG is positive."
+With a numeric argument, turn Icomplete mode on if ARG is positive,
+otherwise turn it off."
   :global t :group 'icomplete
   (if icomplete-mode
       ;; The following is not really necessary after first time -
@@ -184,8 +191,9 @@ Conditions are:
   (and (window-minibuffer-p (selected-window))
        (not executing-kbd-macro)
        minibuffer-completion-table
-       ;; (or minibuffer-completing-file-name
-       (not (functionp minibuffer-completion-table)))) ;; )
+       (or (not (functionp minibuffer-completion-table))
+           (member minibuffer-completion-table
+                   icomplete-with-completion-tables))))
 
 ;;;_ > icomplete-minibuffer-setup ()
 (defun icomplete-minibuffer-setup ()
@@ -209,10 +217,11 @@ Usually run by inclusion in `minibuffer-setup-hook'."
   "Remove completions display \(if any) prior to new user input.
 Should be run in on the minibuffer `pre-command-hook'.  See `icomplete-mode'
 and `minibuffer-setup-hook'."
-  (when icomplete-eoinput
+  (when (and icomplete-mode icomplete-eoinput)
 
     (unless (>= icomplete-eoinput (point-max))
-      (let ((buffer-undo-list t)) ; prevent entry
+      (let ((buffer-undo-list t) ; prevent entry
+           deactivate-mark)
        (delete-region icomplete-eoinput (point-max))))
 
     ;; Reestablish the safe value.
@@ -223,7 +232,7 @@ and `minibuffer-setup-hook'."
   "Insert icomplete completions display.
 Should be run via minibuffer `post-command-hook'.  See `icomplete-mode'
 and `minibuffer-setup-hook'."
-  (when (icomplete-simple-completing-p)
+  (when (and icomplete-mode (icomplete-simple-completing-p))
     (save-excursion
       (goto-char (point-max))
       ;; Register the end of input, so we know where the extra stuff
@@ -249,7 +258,8 @@ and `minibuffer-setup-hook'."
                          minibuffer-completion-table
                          minibuffer-completion-predicate
                          (not minibuffer-completion-confirm)))))
-               (buffer-undo-list t))
+               (buffer-undo-list t)
+               deactivate-mark)
            ;; Do nothing if while-no-input was aborted.
            (if (consp text) (insert (car text))))))))
 
@@ -325,7 +335,7 @@ are exhibited within the square braces.)"
 
 ;;;_* Local emacs vars.
 ;;;Local variables:
-;;;outline-layout: (-2 :)
+;;;allout-layout: (-2 :)
 ;;;End:
 
 ;; arch-tag: 339ec25a-0741-4eb6-be63-997532e89b0f