]> git.eshelyaron.com Git - emacs.git/commitdiff
(explicit-bash-args): Bash 1.x doesn't grook
authorKim F. Storm <storm@cua.dk>
Thu, 31 Oct 2002 23:37:15 +0000 (23:37 +0000)
committerKim F. Storm <storm@cua.dk>
Thu, 31 Oct 2002 23:37:15 +0000 (23:37 +0000)
--noediting option; added run-time check to exclude it.

lisp/shell.el

index 0eaea9af27f62fcbd5916a4887d53da023e5c319..fa4f31ce5f0fc33e58e92c4d9e05e0a486540ae8 100644 (file)
@@ -276,8 +276,18 @@ Value is a list of strings, which may be nil."
   :group 'shell)
 
 (defcustom explicit-bash-args
-    ;; Tell bash not to use readline.
-    '("--noediting" "-i")
+  ;; Tell bash not to use readline, except for bash 1.x which doesn't grook --noediting.
+  ;; Bash 1.x has -nolineediting, but process-send-eof cannot terminate bash if we use it.
+  (let* ((prog (or (and (boundp 'explicit-shell-file-name) explicit-shell-file-name)
+                  (getenv "ESHELL") shell-file-name))
+        (name (file-name-nondirectory prog)))
+    (if (and (not purify-flag)
+            (equal name "bash")
+            (file-executable-p prog)
+            (string-match "bad option"
+                          (shell-command-to-string (concat prog " --noediting"))))
+       '("-i")
+      '("--noediting" "-i")))
   "*Args passed to inferior shell by M-x shell, if the shell is bash.
 Value is a list of strings, which may be nil."
   :type '(repeat (string :tag "Argument"))