An Occur Video

Occur is, I think, an underappreciated command. At first glance, it seems sort of like grep except it works on buffers rather than files. You give it a regular expression and it opens a new buffer that lists the matches. So far, just like grep but each of those listed matches is actually a link to the line it matches.

Just this capability is very useful. I use it when I’m entering items from my monthly bank statement into my tax file. The tax file is an Org file with a headline or subheadline for each category of items I’ll need for my tax return. I run Occur with the regular expression "^\\*+ ", which lists all the headers of the tax file in an Occur buffer. That makes it easy to jump directly to the correct place in the tax file for each relevant item in my bank statement.

But wait; there’s more. You can also make the Occur buffer editable and every change you make there will be reflected back into the original buffer. As with the similar grep buffer capability, this is obviously a powerful feature.

All of this and more is discussed in the recent Emacs Elements video, All you need to know about the Emacs OCCUR command in 4 minutes. Occur is a simple but powerful tool. All you need to do is add is a little bit of imagination to enhance your workflow. A nice example of this is the comment from the reddit post for the video.

If you’re not already familiar with Occur, the video is a nice introduction. The video is only four minutes, ten seconds so it should be easy to fit it.

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