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

  • 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


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

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


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 you have read our privacy policy.

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