16

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

1
  • 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, 2018 at 1:37

2 Answers 2

26

M-= (command count-words-region).

(The region does not even need to be activated, but activating it lets you see it.)

2
4

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

(count-lines (point-min) (point-max))

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.