summaryrefslogtreecommitdiff
path: root/lisp/shell.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2002-04-03 15:23:59 +0000
committerRichard M. Stallman <rms@gnu.org>2002-04-03 15:23:59 +0000
commitee8107c0ea11f5b2ee4b58c25dd43e227c9665e5 (patch)
tree97e34b47dbf93c7b9f4276a0cc6b397c03b3bdda /lisp/shell.el
parent8bd800dbd965a12d7ced4eb3172871f1f38b156e (diff)
downloademacs-ee8107c0ea11f5b2ee4b58c25dd43e227c9665e5.tar.gz
(shell-mode): Don't reinit comint-input-ring if that was already done.
Diffstat (limited to 'lisp/shell.el')
-rw-r--r--lisp/shell.el45
1 files changed, 23 insertions, 22 deletions
diff --git a/lisp/shell.el b/lisp/shell.el
index 5ff107bb8c2..fb427aa9f72 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -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.