Is there a command similar to count-words-region
to count the total number of lines of a selected region?
Asked
Active
Viewed 6,846 times
15

Name
- 7,689
- 4
- 38
- 84
-
5"The `count-words-region` command, when called interactively, reports the number of lines, words, and characters in the region. It is a superset of the old `count-lines-region`, which is now an obsolete alias for it." -- NEWS.24 – phils Mar 20 '18 at 01:37
2 Answers
24
M-=
(command count-words-region
).
(The region does not even need to be activated, but activating it lets you see it.)

Basil
- 12,019
- 43
- 69

manandearth
- 2,068
- 1
- 11
- 23
-
1How do you get the number of lines from this command? It's displayed but how do you get it in a variable? – PierreE Jan 02 '19 at 00:42
-
4
Count lines does the trick, it is defined in simple.el
(count-lines (point-min) (point-max))

Dan
- 32,584
- 6
- 98
- 168

Sebastian G.
- 41
- 1