Add arch taglines
[bpt/emacs.git] / lisp / eshell / esh-ext.el
index 25abb68..9730536 100644 (file)
@@ -1,4 +1,4 @@
-;;; esh-ext --- commands external to Eshell
+;;; esh-ext.el --- commands external to Eshell
 
 ;; Copyright (C) 1999, 2000 Free Software Foundation
 
@@ -24,6 +24,7 @@
 (provide 'esh-ext)
 
 (eval-when-compile (require 'esh-maint))
+(require 'esh-util)
 
 (defgroup eshell-ext nil
   "External commands are invoked when operating system executables are
@@ -48,10 +49,7 @@ loaded into memory, thus beginning a new process."
   :type 'hook
   :group 'eshell-ext)
 
-(defcustom eshell-binary-suffixes
-  (if (eshell-under-windows-p)
-      '(".exe" ".com" ".bat" ".cmd" "")
-    '(""))
+(defcustom eshell-binary-suffixes exec-suffixes
   "*A list of suffixes used when searching for executable files."
   :type '(repeat string)
   :group 'eshell-ext)
@@ -150,18 +148,24 @@ by the user on the command line."
   :type 'integer
   :group 'eshell-ext)
 
+(defcustom eshell-explicit-command-char ?*
+  "*If this char occurs before a command name, call it externally.
+That is, although vi may be an alias, *vi will always call the
+external version.  UNIX users may prefer this variable to be \."
+  :type 'character
+  :group 'eshell-ext)
+
 ;;; Functions:
 
 (defun eshell-ext-initialize ()
   "Initialize the external command handling code."
-  (make-local-hook 'eshell-named-command-hook)
   (add-hook 'eshell-named-command-hook 'eshell-explicit-command nil t))
 
 (defun eshell-explicit-command (command args)
   "If a command name begins with `*', call it externally always.
 This bypasses all Lisp functions and aliases."
   (when (and (> (length command) 1)
-            (eq (aref command 0) ?*))
+            (eq (aref command 0) eshell-explicit-command-char))
     (let ((cmd (eshell-search-path (substring command 1))))
       (if cmd
          (or (eshell-external-command cmd args)
@@ -205,7 +209,9 @@ causing the user to wonder if anything's really going on..."
                                        default-directory)))
           (find-file-name-handler default-directory
                                   'shell-command))))
-    (if handler
+    (if (and handler
+            (not (and (eshell-under-xemacs-p)
+                      (eq handler 'dired-handler-fn))))
        (eshell-remote-command handler command args))
     (let ((interp (eshell-find-interpreter command)))
       (assert interp)
@@ -251,7 +257,7 @@ Return nil, or a list of the form:
             (file-regular-p file))
        (with-temp-buffer
          (insert-file-contents-literally file nil 0 maxlen)
-         (if (looking-at "#!\\([^ \t\n]+\\)\\([ \t]+\\(.+\\)\\)?")
+         (if (looking-at "#![ \t]*\\([^ \r\t\n]+\\)\\([ \t]+\\(.+\\)\\)?")
              (if (match-string 3)
                  (list (match-string 1)
                        (match-string 3)
@@ -310,4 +316,5 @@ line of the form #!<interp>."
 
 ;;; Code:
 
+;;; arch-tag: 178d4064-7e60-4745-b81f-bab5d8d7c40f
 ;;; esh-ext.el ends here