1

(I am using Aquamacs 3.5 which is based on GNU Emacs 25.3.50.1, in case this matters.)

While searching (isearch-forward) in a buffer it often happens that I need to see some lines before/after the matched string. It happens regularly (as shown in the screenshot below) that the matched string appears at the bottom of the buffer. In that case I was searching for [h!] and there is not even one line showing below the matched line.

enter image description here

I tried to customise the variable list-matching-lines-default-context-lines without success. In the screenshot above list-matching-lines-default-context-lines was set to 5. I suspect that isearch does not pay attention to that variable.

list-matching-lines-default-context-lines is a variable defined in ‘replace.el’.
Its value is 5
Original value was 0

Documentation:
Default number of context lines included around ‘list-matching-lines’ matches.
A negative number means to include that many lines before the match.
A positive number means to include that many lines both before and after.

Is there a variable I can set to get the desired behaviour?

1

You can just use C-l at any time during Isearch, to center the current search hit vertically in the window.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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