Locate and Emacs

Bozhidar Batsov over at the excellent Emacs Redux tells us something that I didn’t know: It’s possible to call locate from Emacs. For those of you without a Unix background, locate is a utility that will return a list of any files on your system whose name contains a given string. The locate utility has been around for a long time and for years it was the best way of locating a file on your system.

I’m not a Windows guy so I don’t know what, if any, corresponding utility exists there1 but OS X has an additional, similar but more useful utility called Spotlight. Normally you access that directly from the GUI but there’s also a command line interface, mdfind, for it—another thing I didn’t know. The nice thing about the Emacs interface is that you can specify the command to use so if you want to use Spotlight you can just tell Emacs to use mdfind instead of locate. Yet another example of the flexibility of Emacs.

Footnotes:

1 The locate utility is pretty simple and should be easily portable to Windows—or most any OS—for those who might find it useful.

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