Just how I’ve used Emacs for over twenty five years and never used occurs mode until tonight I will never know!
Just recently I have been spending a lot of time developing a small project, an editor of sorts, using SDL with Haskell bindings, and the time came to split up the code into modules.
Anyway, to cut a long story short, the only reason at that time to do this was because I was finding it hard to find a specific function in the buffer in a convenient manner. So, thinks I, perhaps I should….hang on…. what about grep in buffers for
.*::.*, which as a rudimentary first pass should at least find those lines that have function signatures.
So I googled and….
M-s o came up trumps! This is the result of running it in a buffer full of Haskell code:
As you can see, the buffer below shows all the candidates in the buffer and all I have to do is switch buffers (F12 for my setup) and select one. A simple and effective solution.
For added ease, it’s simple enough to bind it to a keystroke.