0

Sample org file:

* H1
** H1.1
*** H1.1.1
** H1.2
*** H1.2.1
** H1.3
*** H1.3.1
** H1.4
*** H1.1.1

I want to append some text to lines

** H1.2
** H1.3

First, cycle visibility of the file to show only the H1.x headlines, and not their children. I then eval (setq search-invisible nil)), and select the two headlines above. I do regexp-replace $ with foo, expecting foo to be appended to only the two lines mentioned. What actually happends is that foo is appended to all lines in the selected range, regardless of whether they are folded.

If instead I do regexp-replace H with foo, then H is replaced with foo only in the unfolded lines, which is what I want, just with a different search value ($).

Why is the regexp-replace using a $ seemingly ignoring the value of search-invisible?

0

Your Answer

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

Browse other questions tagged or ask your own question.