I want to count the number of lines shown with hide-lines-matching.
count-lines seems to return the wrong number.
(length hide-lines-invisible-areas) seems to be related in that we hide the regions between the lines.
I want to count the number of lines shown with hide-lines-matching.
count-lines seems to return the wrong number.
(length hide-lines-invisible-areas) seems to be related in that we hide the regions between the lines.
C-h f count-lines says:
(count-lines START END &optional IGNORE-INVISIBLE-LINES)
...
When IGNORE-INVISIBLE-LINES is non-nil, invisible lines are not included in the count.
So, in order to count visible lines between start and end, use
(count-lines start end t), setting the optional argument IGNORE-INVISIBLE-LINES to t.