Showing posts with label emacs lisp. Show all posts
Showing posts with label emacs lisp. Show all posts

Saturday, January 15, 2011

Emacs Find File in Project Updated Plus defun toggle-test

I've updated my fork of the Emacs Find File in Project with caching and storage of the file list in a map instead of an alist. Both of these should improve the performance with the latter possibly being a bit of an overkill for anything but very large projects.

I also put together a little function to toggle back and forth between class and test case for Java code per the directory layout we use at work. If the corresponding toggle file does not exist you will be prompted to create it:



Emacs rules with its quick customizations.

Thursday, December 09, 2010

Emacs Find File in Project

Note: This is already out of date. I have found, forked, and tweaked a github repo that did most of what I wanted and my version can be found there. Further tweaks may include caching and other speed increases for large projects.

Increasingly for Java projects I've been relying on IntelliJ IDEA, an amazing IDE. There are still times, however, when I need the sharp tool capabilities of Emacs. I've never been completely satisfied with the "find file in project" capabilities I have been able to configure in Emacs (especially after using IntelliJ IDEA) so I set out to fix that. Building on the ideas found in Stuart Halloway's What you can learn from ido.el and the find file in project snippet given on the emacs wiki page for ido.el I can up with the following improved find file in project approach - well actually two approaches as I have created approaches that gather their file lists from either 1) a TAG file or 2) by issuing a shell find command.

The main tweaks provided are:

  • I am limiting the search to file name rather than full path. This makes the flex finding much more effective and much faster when working with large projects
  • I turn on case sensitive searching making capital letter camel case matching work very well
  • Name conflicts are handled by a second disambiguation prompt.

I'm sure there is still plenty of room for improvement here so you can check for updates in my .emacs file. The following indicates the present state of things with hopefully enough comments so that you can follow along: