15

Is there a command similar to count-words-region to count the total number of lines of a selected region?

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 Answers2

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
4

Count lines does the trick, it is defined in simple.el

(count-lines (point-min) (point-max))
Dan
  • 32,584
  • 6
  • 98
  • 168