From 269a3eb93d4432a514a886e93af5cde47ef3ab8f Mon Sep 17 00:00:00 2001 From: Pengji Zhang Date: Wed, 11 Dec 2024 09:05:09 +0200 Subject: [PATCH] Do not call custom-reevaluate-setting in comint.el (bug#74287) * lisp/comint.el (comint--force-history-isearch): New internal variable. (comint-history-isearch-backward, comint-history-isearch-backward-regexp): Set comint--force-history-isearch to t. (comint-history-isearch-setup): Check comint--force-history-isearch. (comint-history-isearch-end): Set comint--force-history-isearch back to nil instead of calling custom-reevaluate-setting. (cherry picked from commit 5db9471453af4a47d7665295ea007faf35c069b6) --- lisp/comint.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/comint.el b/lisp/comint.el index 519ad8322b8..d80bc358881 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1538,16 +1538,20 @@ If nil, Isearch operates on the whole comint buffer." :group 'comint :version "23.2") +(defvar comint--force-history-isearch nil + "Non-nil means to force searching in input history. +If nil, respect the option `comint-history-isearch'.") + (defun comint-history-isearch-backward () "Search for a string backward in input history using Isearch." (interactive nil comint-mode) - (setq comint-history-isearch t) + (setq comint--force-history-isearch t) (isearch-backward nil t)) (defun comint-history-isearch-backward-regexp () "Search for a regular expression backward in input history using Isearch." (interactive nil comint-mode) - (setq comint-history-isearch t) + (setq comint--force-history-isearch t) (isearch-backward-regexp nil t)) (defvar-local comint-history-isearch-message-overlay nil) @@ -1563,7 +1567,8 @@ Intended to be added to `isearch-mode-hook' in `comint-mode'." (forward-line 0) (point)) (comint-line-beginning-position))) - (or (eq comint-history-isearch t) + (or comint--force-history-isearch + (eq comint-history-isearch t) (and (eq comint-history-isearch 'dwim) ;; Point is at command line. (comint-after-pmark-p)))) @@ -1593,7 +1598,7 @@ Intended to be added to `isearch-mode-hook' in `comint-mode'." (kill-local-variable 'isearch-lazy-count) (remove-hook 'isearch-mode-end-hook 'comint-history-isearch-end t) (unless isearch-suspended - (custom-reevaluate-setting 'comint-history-isearch))) + (setq comint--force-history-isearch nil))) (defun comint-goto-input (pos) "Put input history item of the absolute history position POS." -- 2.39.2