Highlighting

Mbork has another nice post on some of the lessor known corners of Emacs. This time it’s about highlighting words in a buffer. There are lots of ways of doing that, of course, but they have subtle differences that make them suitable for different tasks.

The most common such command is isearch. It’s what most people use all the time for searching or even navigation. As mbork points out, isearch highlights the target word only until you exit the command, which may not be what you need.

The second command is occur. I use this all the time but as mbork says many people are probably not familiar with it. What I didn’t know was that you can edit the original buffer directly from the occur buffer and you can enable a mode where the original buffer will display the line that the point is on in the occur buffer. See mbork’s post for the details.

Finally, there is highlight-regexp, which allows you to highlight any expression matching a regular expression. I’ve only used that command once. I tried it and couldn’t figure out how to turn it off short of killing the buffer. It turns out to be easy, of course, but that was back when I was a n00b and didn’t even know enough to bring up the help buffer for it.

Take a couple of minutes to read mbork’s post. You might learn something you didn’t know.

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