(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)))
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.
(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)