summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/eshell/em-hist.el13
-rw-r--r--lisp/eshell/eshell.el5
2 files changed, 8 insertions, 10 deletions
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index b171a2850ff..2749749bb93 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -294,13 +294,13 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil."
(make-local-variable 'eshell-save-history-index)
(setq-local eshell-hist--new-items 0)
+ (setq-local eshell-history-ring nil)
(if (minibuffer-window-active-p (selected-window))
- (setq-local eshell-save-history-on-exit nil)
- (setq-local eshell-history-ring nil)
+ (progn
+ (setq-local eshell-history-append t)
+ (add-hook 'minibuffer-exit-hook #'eshell-add-command-to-history nil t))
(if eshell-history-file-name
- (eshell-read-history nil t))
-
- (add-hook 'eshell-exit-hook #'eshell--save-history nil t))
+ (eshell-read-history nil t)))
(unless eshell-history-ring
(setq eshell-history-ring (make-ring eshell-history-size)))
@@ -421,7 +421,8 @@ command.
This function is supposed to be called from the minibuffer, presumably
as a `minibuffer-exit-hook'."
(eshell-add-input-to-history
- (buffer-substring (minibuffer-prompt-end) (point-max))))
+ (buffer-substring (minibuffer-prompt-end) (point-max)))
+ (eshell--save-history))
(defun eshell-add-to-history ()
"Add last Eshell command to the history ring.
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index 503f64add41..18e05a371a4 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -281,10 +281,7 @@ information on Eshell, see Info node `(eshell)Top'."
(minibuffer-with-setup-hook (lambda ()
(eshell-mode)
(eshell-command-mode +1))
- (let ((command (read-from-minibuffer prompt)))
- (when (eshell-using-module 'eshell-hist)
- (eshell-add-input-to-history command))
- command))))
+ (read-from-minibuffer prompt))))
;;;###autoload
(defun eshell-command (command &optional to-current-buffer)