]> code.delx.au - gnu-emacs/blobdiff - lisp/eshell/em-cmpl.el
merge trunk
[gnu-emacs] / lisp / eshell / em-cmpl.el
index 0451c379ac206d1eae8d8f294ee946f00ed6e5e1..a67861e83a9a8b847805536751087393562b1ee5 100644 (file)
@@ -1,7 +1,6 @@
 ;;; em-cmpl.el --- completion using the TAB key
 
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2012  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
 ;;; Code:
 
 (eval-when-compile
+  (require 'cl-lib)
   (require 'eshell))
 (require 'esh-util)
 
+;;;###autoload
+(progn
 (defgroup eshell-cmpl nil
   "This module provides a programmable completion function bound to
 the TAB key, which allows for completing command names, file names,
 variable names, arguments, etc."
   :tag "Argument completion"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
-(defcustom eshell-cmpl-load-hook '(eshell-cmpl-initialize)
-  "*A list of functions to run when `eshell-cmpl' is loaded."
+(defcustom eshell-cmpl-load-hook nil
+  "A list of functions to run when `eshell-cmpl' is loaded."
+  :version "24.1"                      ; removed eshell-cmpl-initialize
   :type 'hook
   :group 'eshell-cmpl)
 
 (defcustom eshell-show-lisp-completions nil
-  "*If non-nil, include Lisp functions in the command completion list.
+  "If non-nil, include Lisp functions in the command completion list.
 If this variable is nil, Lisp completion can still be done in command
 position by using M-TAB instead of TAB."
   :type 'boolean
   :group 'eshell-cmpl)
 
 (defcustom eshell-show-lisp-alternatives t
-  "*If non-nil, and no other completions found, show Lisp functions.
+  "If non-nil, and no other completions found, show Lisp functions.
 Setting this variable means nothing if `eshell-show-lisp-completions'
 is non-nil."
   :type 'boolean
   :group 'eshell-cmpl)
 
 (defcustom eshell-no-completion-during-jobs t
-  "*If non-nil, don't allow completion while a process is running."
+  "If non-nil, don't allow completion while a process is running."
   :type 'boolean
   :group 'eshell-cmpl)
 
@@ -124,7 +127,7 @@ is non-nil."
     ("dbx"      . "\\`\\([^.]*\\|a\\.out\\)\\'")
     ("sdb"      . "\\`\\([^.]*\\|a\\.out\\)\\'")
     ("adb"      . "\\`\\([^.]*\\|a\\.out\\)\\'"))
-  "*An alist that defines simple argument type correlations.
+  "An alist that defines simple argument type correlations.
 This is provided for common commands, as a simplistic alternative
 to writing a completion function."
   :type '(repeat (cons string regexp))
@@ -297,8 +300,7 @@ to writing a completion function."
   ;; jww (1999-10-19): Will this work on anything but X?
   (if (featurep 'xemacs)
       (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse)
-    (define-key eshell-mode-map [(shift iso-lefttab)] 'pcomplete-reverse)
-    (define-key eshell-mode-map [(shift control ?i)] 'pcomplete-reverse))
+    (define-key eshell-mode-map [backtab] 'pcomplete-reverse))
   (define-key eshell-mode-map [(meta ??)] 'pcomplete-list))
 
 (defun eshell-completion-command-name ()
@@ -356,7 +358,7 @@ to writing a completion function."
            (nconc posns (list pos)))
        (setq pos (1+ pos))))
     (setq posns (cdr posns))
-    (assert (= (length args) (length posns)))
+    (cl-assert (= (length args) (length posns)))
     (let ((a args)
          (i 0)
          l final)
@@ -368,7 +370,7 @@ to writing a completion function."
       (and l
           (setq args (nthcdr (1+ l) args)
                 posns (nthcdr (1+ l) posns))))
-    (assert (= (length args) (length posns)))
+    (cl-assert (= (length args) (length posns)))
     (when (and args (eq (char-syntax (char-before end)) ? )
               (not (eq (char-before (1- end)) ?\\)))
       (nconc args (list ""))
@@ -381,7 +383,7 @@ to writing a completion function."
                         (let ((result
                                (eshell-do-eval
                                 (list 'eshell-commands arg) t)))
-                          (assert (eq (car result) 'quote))
+                          (cl-assert (eq (car result) 'quote))
                           (cadr result))
                       arg)))
                (if (numberp val)
@@ -400,7 +402,7 @@ to writing a completion function."
          (setq filename (substring filename 1)
                pcomplete-stub filename
                glob-name t))
-      (let* ((paths (split-string (getenv "PATH") path-separator))
+      (let* ((paths (eshell-parse-colon-path eshell-path-env))
             (cwd (file-name-as-directory
                   (expand-file-name default-directory)))
             (path "") (comps-in-path ())
@@ -449,5 +451,8 @@ to writing a completion function."
 
 (provide 'em-cmpl)
 
-;; arch-tag: 0e914699-673a-45f8-8cbf-82e1dbc571bc
+;; Local Variables:
+;; generated-autoload-file: "esh-groups.el"
+;; End:
+
 ;;; em-cmpl.el ends here