]> code.delx.au - gnu-emacs/blobdiff - lisp/eshell/em-cmpl.el
* lisp/eshell/esh-io.el (eshell-get-target): Better detection of read-only file ...
[gnu-emacs] / lisp / eshell / em-cmpl.el
index 734d0a87eb569157e342613fdab3a94ba7bcbbdf..b0aad0f149915d5ef41142fae53670a7f6552999 100644 (file)
@@ -1,15 +1,16 @@
 ;;; em-cmpl.el --- completion using the TAB key
 
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; 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)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-(provide 'em-cmpl)
-
-(eval-when-compile (require 'esh-maint))
-(require 'esh-util)
-
-(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)
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -81,6 +68,21 @@ variable names, arguments, etc."
 ;; This only works well if the completion function has provided Eshell
 ;; with sufficient pointers to locate the relevant help text.
 
+;;; Code:
+
+(eval-when-compile
+  (require 'cl)
+  (require 'eshell))
+(require 'esh-util)
+
+;;;###autoload
+(eshell-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)
+
 ;;; User Variables:
 
 (defcustom eshell-cmpl-load-hook '(eshell-cmpl-initialize)
@@ -295,7 +297,7 @@ to writing a completion function."
   (define-key eshell-mode-map [tab] 'pcomplete)
   (define-key eshell-mode-map [(control ?i)] 'pcomplete)
   ;; jww (1999-10-19): Will this work on anything but X?
-  (if (eshell-under-xemacs-p)
+  (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))
@@ -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 ())
@@ -447,7 +449,11 @@ to writing a completion function."
                        (all-completions filename obarray 'functionp))
                   completions)))))))
 
-;;; Code:
+(provide 'em-cmpl)
+
+;; Local Variables:
+;; generated-autoload-file: "esh-groups.el"
+;; End:
 
-;;; arch-tag: 0e914699-673a-45f8-8cbf-82e1dbc571bc
+;; arch-tag: 0e914699-673a-45f8-8cbf-82e1dbc571bc
 ;;; em-cmpl.el ends here