Faceted search in Emacs | skybert.net

Faceted search in Emacs


Emacs 24 has a great feature built-in called occur, it lets you search for strings in the current buffer. I've applied a slight tweak to it so that it defaults to searching for the thing under the cursor and bound it to Alt+s o.

Here, I've opened /etc/passwd and I want to view all users that use the shell /usr/sbin/nologin, so I have navigated to that string and hit the shortcut for occur:

occur

It suggests searching for the thing at point, to which I answer yes, please and hit Enter:

occur

In this search result, I want to drill further down through the results, displaying only the /usr/sbin/nologin entries that have something to do with mail. so I do the same thing again, put my cursor somewhere it says mail and run occur again:

occur

The lines in the occur search result buffers are of course clickable and will take you to the line of interest in the /etc/passwd file itself.

Cool, eh?

Wait a minute! That's not facted search ...

Well, it's not really facted search, but filtered search, but still, you get my point: continuously narrow down your search results 😃


Licensed under CC BY Creative Commons License ~ gmail torstein.k.johansen @ gmail ~ twitter @torsteinkrause ~