Is there a command similar to count-words-region
to count the total number of lines of a selected region?
2 Answers
M-=
(command count-words-region
).
(The region does not even need to be activated, but activating it lets you see it.)
-
1How do you get the number of lines from this command? It's displayed but how do you get it in a variable? Commented Jan 2, 2019 at 0:42
-
Count lines does the trick, it is defined in simple.el
(count-lines (point-min) (point-max))
count-words-region
command, when called interactively, reports the number of lines, words, and characters in the region. It is a superset of the oldcount-lines-region
, which is now an obsolete alias for it." -- NEWS.24