diff --git a/lisp/isearch.el b/lisp/isearch.el index 0624858993..37f9b50724 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -452,17 +452,17 @@ lazy-count :group 'isearch :group 'matching) -(defcustom lazy-count-prefix-format "%s/%s " +(defcustom lazy-count-prefix-format "%s/%s%s " "Format of the current/total number of matches for the prompt prefix." :type '(choice (const :tag "No prefix" nil) - (string :tag "Prefix format string" "%s/%s ")) + (string :tag "Prefix format string" "%s/%s%s ")) :group 'lazy-count :version "27.1") (defcustom lazy-count-suffix-format nil "Format of the current/total number of matches for the prompt suffix." :type '(choice (const :tag "No suffix" nil) - (string :tag "Suffix format string" " [%s of %s]")) + (string :tag "Suffix format string" " [%s of %s]%s")) :group 'lazy-count :version "27.1") @@ -1277,6 +1277,7 @@ isearch-mode isearch-lazy-count-current nil isearch-lazy-count-total nil + isearch-lazy-count-invisible nil ;; Save the original value of `minibuffer-message-timeout', and ;; set it to nil so that isearch's messages don't get timed out. @@ -3528,7 +3533,11 @@ isearch-lazy-count-format (- isearch-lazy-count-total isearch-lazy-count-current -1))) - (or isearch-lazy-count-total "?")) + (or isearch-lazy-count-total "?") + (if isearch-lazy-count-invisible + ;; "invisible" means "unreachable", "intangible" + (format " (invisible %s)" isearch-lazy-count-invisible) + "")) ""))) @@ -4007,6 +4017,7 @@ isearch-lazy-highlight-forward (defvar isearch-lazy-highlight-error nil) (defvar isearch-lazy-count-current nil) (defvar isearch-lazy-count-total nil) +(defvar isearch-lazy-count-invisible nil) (defvar isearch-lazy-count-hash (make-hash-table)) (defvar lazy-count-update-hook nil "Hook run after new lazy count results are computed.") @@ -4085,7 +4096,8 @@ isearch-lazy-highlight-new-loop ;; Reset old counter before going to count new numbers (clrhash isearch-lazy-count-hash) (setq isearch-lazy-count-current nil - isearch-lazy-count-total nil) + isearch-lazy-count-total nil + isearch-lazy-count-invisible nil) ;; Delay updating the message if possible, to avoid flicker (when (string-equal isearch-string "") (when (and isearch-mode (null isearch-message-function)) @@ -4327,11 +4349,14 @@ isearch-lazy-highlight-buffer-update (setq found nil) (forward-char -1))) (when isearch-lazy-count - (setq isearch-lazy-count-total - (1+ (or isearch-lazy-count-total 0))) - (puthash (if isearch-lazy-highlight-forward me mb) - isearch-lazy-count-total - isearch-lazy-count-hash)) + (if (and search-invisible (invisible-p (get-text-property (point) 'invisible))) + (setq isearch-lazy-count-invisible + (1+ (or isearch-lazy-count-invisible 0))) + (setq isearch-lazy-count-total + (1+ (or isearch-lazy-count-total 0))) + (puthash (if isearch-lazy-highlight-forward me mb) + isearch-lazy-count-total + isearch-lazy-count-hash))) ;; Don't highlight the match when this loop is used ;; only to count matches or when matches were already ;; highlighted within the current window boundaries