More Elisp posts
December 21, 2001
Extending emacs for editing java I've written some emacs extensions in the past. I've even written a couple of pretty large, in terms of lines of code, complete modes for editing programs stored in a proprietary file format. The pieces of elisp code linked to here are not that large but automate a couple of functions I like to perform for the Java I write. And what are those functions. The first is to sort the import statements. I find this makes it much easier to see what a program is actually using. You can probably guess that I really don't like import java.foo.*;. In emacs I can use M-x java-sort-imports to order the statements the way I like to see them. The second is to make sure that I'm not importing more classes than I need to. I know it doesn't actually make a difference to the generated bytecode but it makes it difficult to use the import statements to help see the inter class dependencies when looking at the source code. I can use M-x java-check-imports to comment out import statements that import classes that appear not to be referenced in the source code. Obviously it can't check import statements that don't specify the class, i.e. that end in *. Here's the code for downloading and here it is formatted for easy reading in a browser. The formatting was done using the htmlize package, which does a great job. Posted by Alex at December 21, 2001 07:15 PM
Comments
If you take a look at JDEE [http://jdee.sunsite.dk/] you'll see that it provides this functionality and a whole lot more already. Posted by: Ade on February 6, 2002 04:12 AM
I've tried several times to use JDEE. It is very comprehensive, but setup is a bear, and it has always either conflicted with some other thing in my ancient, baroque (14-year-old) .emacs file set. This looks like a nice light alternative. Thanks! Posted by: Bill O'Donnell on December 23, 2004 10:40 AM
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?