6

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

| improve this question | | | | |
  • 4
    "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 1:37
13

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

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

| improve this answer | | | | |
2

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

(count-lines (point-min) (point-max))
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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