]> git.eshelyaron.com Git - emacs.git/commitdiff
(shell-mode): Don't reinit comint-input-ring if that was already done.
authorRichard M. Stallman <rms@gnu.org>
Wed, 3 Apr 2002 15:23:59 +0000 (15:23 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 3 Apr 2002 15:23:59 +0000 (15:23 +0000)
lisp/ChangeLog
lisp/shell.el

index 60f0ce948aae08db11d48950c3a14981767a50ab..b309e920fc9611119264eeebbe400c335455b8ba 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-03  Richard M. Stallman  <rms@gnu.org>
+
+       * shell.el (shell-mode): Don't reinit comint-input-ring
+       if that was already done.
+
 2002-04-03  Edward M. Reingold  <reingold@emr.cs.iit.edu>
 
        * solar.el (solar-spring-or-summer-season): Deleted.
index 5ff107bb8c2b72dd76d16289b7892e3e4f4cc202..fb427aa9f72dc5e1cbc67c931ccffac5da09a604 100644 (file)
@@ -415,28 +415,29 @@ buffer."
   (make-local-variable 'list-buffers-directory)
   (setq list-buffers-directory (expand-file-name default-directory))
   ;; shell-dependent assignments.
-  (let ((shell (file-name-nondirectory (car
-                (process-command (get-buffer-process (current-buffer)))))))
-    (setq comint-input-ring-file-name
-         (or (getenv "HISTFILE")
-             (cond ((string-equal shell "bash") "~/.bash_history")
-                   ((string-equal shell "ksh") "~/.sh_history")
-                   (t "~/.history"))))
-    (if (or (equal comint-input-ring-file-name "")
-           (equal (file-truename comint-input-ring-file-name)
-                  (file-truename "/dev/null")))
-       (setq comint-input-ring-file-name nil))
-    ;; Arrange to write out the input ring on exit, if the shell doesn't
-    ;; do this itself.
-    (if (and comint-input-ring-file-name
-            (string-match shell-dumb-shell-regexp shell))
-       (set-process-sentinel (get-buffer-process (current-buffer))
-                             #'shell-write-history-on-exit))
-    (setq shell-dirstack-query
-         (cond ((string-equal shell "sh") "pwd")
-               ((string-equal shell "ksh") "echo $PWD ~-")
-               (t "dirs"))))
-  (comint-read-input-ring t))
+  (unless comint-input-ring
+    (let ((shell (file-name-nondirectory (car
+                  (process-command (get-buffer-process (current-buffer)))))))
+      (setq comint-input-ring-file-name
+           (or (getenv "HISTFILE")
+               (cond ((string-equal shell "bash") "~/.bash_history")
+                     ((string-equal shell "ksh") "~/.sh_history")
+                     (t "~/.history"))))
+      (if (or (equal comint-input-ring-file-name "")
+             (equal (file-truename comint-input-ring-file-name)
+                    (file-truename "/dev/null")))
+         (setq comint-input-ring-file-name nil))
+      ;; Arrange to write out the input ring on exit, if the shell doesn't
+      ;; do this itself.
+      (if (and comint-input-ring-file-name
+              (string-match shell-dumb-shell-regexp shell))
+         (set-process-sentinel (get-buffer-process (current-buffer))
+                               #'shell-write-history-on-exit))
+      (setq shell-dirstack-query
+           (cond ((string-equal shell "sh") "pwd")
+                 ((string-equal shell "ksh") "echo $PWD ~-")
+                 (t "dirs"))))
+    (comint-read-input-ring t)))
 
 (defun shell-write-history-on-exit (process event)
   "Called when the shell process is stopped.