From 216c32ad2f74abf08ea10eb2b11a5c93a146fbe1 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Tue, 15 Mar 2022 22:11:36 +0100 Subject: [PATCH] Changes after Juri's comments * lisp/comint.el (comint-history-isearch-setup, comint-history-isearch-end): Make sure no lazy count is displayed. * lisp/simple.el (minibuffer-history-isearch-setup): Make sure no lazy count is displayed. --- lisp/comint.el | 2 ++ lisp/isearch.el | 2 +- lisp/replace.el | 10 ++++++++-- lisp/simple.el | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lisp/comint.el b/lisp/comint.el index 4c82e74e4b..56082f622a 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1515,6 +1515,7 @@ comint-history-isearch-setup #'comint-history-isearch-wrap) (setq-local isearch-push-state-function #'comint-history-isearch-push-state) + (setq-local isearch-lazy-count nil) (add-hook 'isearch-mode-end-hook 'comint-history-isearch-end nil t))) (defun comint-history-isearch-end () @@ -1526,6 +1527,7 @@ comint-history-isearch-end (setq isearch-message-function nil) (setq isearch-wrap-function nil) (setq isearch-push-state-function nil) + (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))) diff --git a/lisp/isearch.el b/lisp/isearch.el index e8e3218256..bd337f38b7 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -4372,7 +4372,7 @@ minibuffer-lazy-highlight--count "Display total match count in the minibuffer prompt." (when minibuffer-lazy-highlight--overlay (overlay-put minibuffer-lazy-highlight--overlay - 'after-string + 'before-string (and isearch-lazy-count-total (not isearch-error) (format minibuffer-lazy-count-format diff --git a/lisp/replace.el b/lisp/replace.el index 3e1be6f940..f45fb5fb25 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -378,7 +378,12 @@ query-replace-read-args (lazy-highlight-cleanup nil) (isearch-lazy-highlight query-replace-lazy-highlight) (isearch-regexp regexp-flag) - (isearch-regexp-function nil) + (isearch-regexp-function (or replace-regexp-function + (and current-prefix-arg + (not (eq current-prefix-arg '-))) + (and replace-char-fold + (not regexp-flag) + #'char-fold-to-regexp))) (isearch-case-fold-search case-fold-search) (minibuffer-lazy-highlight-transform (lambda (string) @@ -2915,7 +2920,8 @@ perform-replace ;; Unless a single contiguous chunk is selected, operate on multiple chunks. (when region-noncontiguous-p (setq region-filter (replace--region-filter - (funcall region-extract-function 'bounds)))) + (funcall region-extract-function 'bounds))) + (add-function :after-while isearch-filter-predicate region-filter)) ;; If region is active, in Transient Mark mode, operate on region. (if backward diff --git a/lisp/simple.el b/lisp/simple.el index accc119e2b..61319b6060 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2840,6 +2840,7 @@ minibuffer-history-isearch-setup #'minibuffer-history-isearch-wrap) (setq-local isearch-push-state-function #'minibuffer-history-isearch-push-state) + (setq-local isearch-lazy-count nil) (add-hook 'isearch-mode-end-hook 'minibuffer-history-isearch-end nil t)) (defun minibuffer-history-isearch-end () -- 2.35.1