diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index c85e7704eca..4bcf434f6e4 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -218,6 +218,9 @@ eshell--history-isearch-message-overlay "Overlay for Isearch message when searching through input history.") (defvar-local eshell--stored-incomplete-input nil "Stored input for history cycling.") +(defvar eshell--force-history-isearch nil + "Non-nil means to force searching in input history. +If nil, respect the option `eshell-history-isearch'.") (defvar-keymap eshell-hist-mode-map "" #'eshell-previous-matching-input-from-input @@ -951,7 +954,8 @@ eshell--isearch-setup (when (and ;; Eshell is busy running a foreground process (not eshell-foreground-command) - (or (eq eshell-history-isearch t) + (or eshell--force-history-isearch + (eq eshell-history-isearch t) (and (eq eshell-history-isearch 'dwim) (>= (point) eshell-last-output-end)))) (setq isearch-message-prefix-add "history ") @@ -975,7 +979,7 @@ eshell-history-isearch-end (remove-hook 'isearch-mode-end-hook #'eshell-history-isearch-end t) (setq isearch-opoint (point)) (unless isearch-suspended - (custom-reevaluate-setting 'eshell-history-isearch))) + (setq eshell--force-history-isearch nil))) (defun eshell-history-isearch-search () "Return search function for Isearch in input history." @@ -1077,7 +1081,7 @@ eshell-history-isearch-push-state (defun eshell-isearch-backward (&optional invert) "Do incremental search backward through past commands." (interactive nil eshell-mode) - (setq eshell-history-isearch t) + (setq eshell--force-history-isearch t) (if invert (isearch-forward nil t) (isearch-backward nil t))) @@ -1090,7 +1094,7 @@ eshell-isearch-forward (defun eshell-isearch-backward-regexp (&optional invert) "Do incremental regexp search backward through past commands." (interactive nil eshell-mode) - (setq eshell-history-isearch t) + (setq eshell--force-history-isearch t) (if invert (isearch-forward-regexp nil t) (isearch-backward-regexp nil t)))