The Emacs count-lines-region Command

I’ve been working on a Lisp program that generates combinations of certain objects. During development, I like to print them out to see what, exactly, is getting generated. Often, I’ll realize that I also need to know how many objects got generated. Because I’m using slime, all the output is going into an Emacs buffer so I have all the normal Emacs tools available.

I didn’t know a command for counting lines but I was pretty sure there would be one and after a quick trip to the built-in documentation I found count-lines-region, which was just what I needed. All I had to do was mark the output and call count-lines-region. Happily, there’s even a shortcut for it so I can just mark the region and type 【Meta+=】 to get a line count of the output.

This entry was posted in General and tagged . Bookmark the permalink.