Quantcast
Channel: lisp service
Viewing all articles
Browse latest Browse all 20

How to find a file in Emacs using Icicles

$
0
0

Since I've last posted, I've been trying to level up even more with Emacs, since I really do think it's going to pay off. I've made ParEdit mode work in the SLIME REPL, and switched around some keyboard bindings to facilitate working with s-experessions.
 
But the main thing I've done recently is installing and trying to become familiar with Icicles. Installing wasn't particularly hard. I just downloaded the necessary files and added them to my ~/Library/Application Support/Aquamacs/ folder, and added (require 'icicles nil t) to my .emacs file. The first time I used it I had to do M-x icy-mode, but Emacs seems to be remembering that now, I think because I've been saving my sessions.
 
Icicles is extremely useful for all sorts of things. As the quote on home page says:

In case you never heard of it, icicles is to TAB completion what TAB completion is to typing things manually every time.

http://article.gmane.org/gmane.emacs.orgmode/4574/match=icicles
 
One thing I wanted to be able to use it for was opening files by name even if I didn't know what directory they were in. It took me a little bit of poking around around to figure out how to do this, and I'm still not sure what I'm doing is best, but I figured I'd share it here. This page, all about file name input, led me to the command "icicle-locate-file", which seems to be what I want. Here's the key part:

By default, the target directory for ‘icicle-locate-file’ is the current directory, but if you supply a non-negative numeric prefix argument (non-positive means include the date), then you are prompted for the directory to search. If you use the root of your file system as the search directory, then the locate-file commands will match completion candidates anywhere in your file system.

From what I can tell, it doesn't matter what numeric argument you give it, so I've been doing C-u 9 M-x icicle-locate-file, doing C-backspace a few times to go up to the directory I want to search within (for me usually ~/Projects/clbuild/source), pressing enter, then typing the name and doing Shift-Tab to get the wonderfully fuzzy Icicles completion.
 
Though this does work, there are a few issues.

  1. Generating the list of files in the directory takes a nontrivial amount of time: for my clbuild source folder, maybe 15 seconds. 
  2. This fuzzy completion doesn't know to exclude Mercurial files in .hg folders, which is pretty annoying, since all of the code files I'm searching within are under version control. 

The first problem I probably can't do anything about, unless solving the second helps with it, but I'd like to find a solution to the second one. Ideas are welcome, and if I come up with anything myself later I'll be sure to post it.

Update: I ran byte-compile-file on all the Icicles files to see if that would make things faster, but it didn't especially seem to.  Oh well.

Update 2: I'm reported my issue in the Open Issues section of the Icicles wiki, and Drew Adams is helping me figure it out, but in trying to fix it, so far I've just broken it more.

Permalink | Leave a comment  »


Viewing all articles
Browse latest Browse all 20

Trending Articles