1

upon having used Isearch or C-u C-s to highlight a word, when I use then C-v or M-v for scrolling the highlights remain due to setting

    (setq-default
     isearch-allow-scroll t
     lazy-highlight-cleanup nil
     lazy-highlight-initial-delay 0)

But isearch only highlights words which were visible when the search was triggered, and if I scroll up or down identical words are not highlighted. How can I change this behavior?

1 Answer 1

1

By default, lazy highlighting is lazy. It doesn't highlight beyond what's visible or has already been visible. You want to make it highlight matches everywhere, even those not yet visible.

Try setting option lazy-highlight-buffer to t. C-h v tells us:

lazy-highlight-buffer is a variable defined in isearch.el. Its value is nil

You can customize this variable.

This variable was introduced, or its default value was changed, in version 27.1 of Emacs.

Documentation:

Controls the lazy-highlighting of the full buffer.

When non-nil, all text in the buffer matching the current search string is highlighted lazily (see lazy-highlight-initial-delay, lazy-highlight-interval and lazy-highlight-buffer-max-at-a-time). This is useful when lazy-highlight-cleanup is customized to nil and doesn’t remove full-buffer highlighting after a search.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.