]> code.delx.au - gnu-emacs/blobdiff - lisp/pcomplete.el
(ibuffer-update): Call `minibufferp' with argument
[gnu-emacs] / lisp / pcomplete.el
index 218bc670f492b5e78d1eeffcf7a9b08e59eb14a9..cde0f07064f41687725669469b22cac61f0588ce 100644 (file)
@@ -1,10 +1,9 @@
-;;; pcomplete --- programmable completion
+;;; pcomplete.el --- programmable completion
 
-;; Copyright (C) 1999, 2000 Free Sofware Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002 Free Sofware Foundation
 
 ;; Author: John Wiegley <johnw@gnu.org>
-;; Keywords: processes
-;; X-URL: http://www.emacs.org/~johnw/emacs.html
+;; Keywords: processes abbrev
 
 ;; This file is part of GNU Emacs.
 
 
 (defgroup pcomplete nil
   "Programmable completion."
+  :version "21.1"
   :group 'processes)
 
 ;;; User Variables:
 
 (defcustom pcomplete-file-ignore nil
   "*A regexp of filenames to be disregarded during file completion."
-  :type 'regexp
+  :type '(choice regexp (const :tag "None" nil))
   :group 'pcomplete)
 
 (defcustom pcomplete-dir-ignore nil
   "*A regexp of names to be disregarded during directory completion."
-  :type 'regexp
+  :type '(choice regexp (const :tag "None" nil))
   :group 'pcomplete)
 
 (defcustom pcomplete-ignore-case (memq system-type '(ms-dos windows-nt))
@@ -582,8 +582,7 @@ dynamic-complete-functions are kept.  For comint mode itself, this is
                    (symbol-value completef-sym))))
     (if elem
        (setcar elem 'pcomplete)
-      (nconc (symbol-value completef-sym)
-            (list 'pcomplete)))))
+      (add-to-list completef-sym 'pcomplete))))
 
 ;;;###autoload
 (defun pcomplete-shell-setup ()
@@ -695,15 +694,13 @@ Magic characters are those in `pcomplete-arg-quote-list'."
 
 (defun pcomplete-entries (&optional regexp predicate)
   "Complete against a list of directory candidates.
-This function always uses the last argument as the basis for
-completion.
 If REGEXP is non-nil, it is a regular expression used to refine the
 match (files not matching the REGEXP will be excluded).
 If PREDICATE is non-nil, it will also be used to refine the match
 \(files for which the PREDICATE returns nil will be excluded).
-If PATH is non-nil, it will be used for completion instead of
-consulting the last argument."
-  (let* ((name pcomplete-stub)
+If no directory information can be extracted from the completed
+component, DEFAULT-DIRECTORY is used as the basis for completion."
+  (let* ((name (substitute-env-vars pcomplete-stub))
         (default-directory (expand-file-name
                             (or (file-name-directory name)
                                 default-directory)))
@@ -738,8 +735,9 @@ consulting the last argument."
                             (string-match pcomplete-dir-ignore file))
                      (and pcomplete-file-ignore
                           (string-match pcomplete-file-ignore file))))))))
-      (setq above-cutoff (> (length completions)
-                           pcomplete-cycle-cutoff-length))
+      (setq above-cutoff (and pcomplete-cycle-cutoff-length
+                            (> (length completions)
+                               pcomplete-cycle-cutoff-length)))
       (sort completions
            (function
             (lambda (l r)