Mac OS: index source code #
A few weeks ago I posted how to make Mac OS Spotlight index source code. Mac OS is already indexing my C, C++, ObjC, Java, Fortran, Shell, Python, Perl, Ruby, Pascal, Ada, Javascript, and HTML files, but it doesn't get the other languages and text files I use. Here's the followup post.
Problem to solve: I want to search the contents of *.css and other text files with Spotlight.
In my previous blog post, I went into the Spotlight configuration file and told it to index certain file types like dyn.ah62d4rv4ge80e8drru
, which I had determined was *.css. This wasn't satisfying. Instead of telling Spotlight, I wanted a solution at the Mac OS level.
Emacs: Find files anywhere #
Update: [2017-12-29] See the update for 2017
A typical way to use Emacs is to open lots of files as buffers. In the default Emacs setup, the command to switch to a file depends on whether the file is open:
File | Non-file | |
---|---|---|
Opened | C-x b | |
Not opened | C-x f | N/A |
I don't want to have to remember whether a file is open. Instead, I want the command to depend on whether I'm switching to a file or a non-file. I also want to find files without having to switch folders first, because I work on lots of small projects in different folders. I use these bindings:
File | Non-file | |
---|---|---|
Opened | Cmd T | C-x b |
Not opened | N/A |
In a previous post, I described my previous attempt, using helm-for-files
to open files from many different directories, using locate
(mdfind
on Mac). As part of that, I improved my Mac OS mdfind setup to include all my text files. I was hoping that I could make mdfind fast and precise enough that I'd use it all the time. Unfortunately I couldn't get the queries to run faster than 300 milliseconds, and it didn't feel fast enough to run on every keystroke. There are other emacs packages to do this but I ended up with my own custom setup to make this:
Labels: emacs