Emacs: How do you want to be distracted today?

2002 October 23
by darkness

Perhaps unsurprisingly, my coding was side-tracked by some work on Emacs.

Really it started with a customer call about a WAN turn-up that’s supposed to happen next week (*snicker*). Then I remembered the network things that were on my plate so I tried to tackle them first. Unfortunately the requisite documentation was at work, and by then it was too close to deadly traffic time for me to voyage out of my apartment.

So after I handled the customer call/interfacing with telco, I was going to start coding. I had previously decided that I needed to extend java.nio.ByteBuffer, which wasn’t going to be pleasant. ByteBuffer has no interface that defines many of its methods, is an abstract class, and has two static constructor methods. So this means I have to make a concrete proxy class and override the static constructor methods to return my proxy class. ByteBuffer has plenty of methods, so I thought “hey, why can’t JDE make the proxy class for me?”

[Laughing ensues.]

It actually kind of does what I want. (It may do exactly what I want, but I’ll be damned if I can find where. I’ll check in to that in a minute via Google, actually.) It has a “extend abstract class” wizard. This makes little template methods for every abstract method in the superclass. Still, I will have to go into each method, delete the JDE default statement (which is usually something like “return null” or “return false” for methods which return; I’d imagine it’s non-existent for a void method), and then enter in the proxy dispatch. Something that should be automated.

Then I find that JDE is inserting Javadoc over each of the methods. I have no desire to delete this. It’s also not doing formatting of the methods the way I like. Unacceptable. I tracked down most of what I need to modify to jde-gen.el. The formatting was easy to fix. The method Javadoc, however, is part of the whole method template, which is basically a list of strings eventually parsed by something called “tempo”. I didn’t really want to quote this whole thing verbatim into my .emacs, so instead I wrote a function to do a regular expression search-and-replace on all strings in a list. I don’t think the function I came up with might be the right thing to do, since I think it creates a whole bunch of intermediate lists, but it does appear to work. Then I had to copy the contents of the :set property from the defcustom statement for jde-gen-method-template, since a simple setq of the property wasn’t cutting it.

After all this, I no longer generate Javadoc, and my methods are formatted the way I like them. You can see the results in (yet another update of) my .emacs.

I have what I believe to be a second degree burn on my right hand, on the top of the hand between my thumb and first finger, or so. It was kind of disturbing when I quickly stuck a Band-Aid on it last night (I had to finish dinner!) only to pull it off later… with a patch of skin on the adhesive part. Whoops. I’ve got gauze on it now, and I think I look like I have a much more serious injury than I really do. I feel like a gimp, though, since I’m doing everything one-handed – including showering. (Get your minds out of the gutter. Besides, it’s barely big enough for one hand.)

No Comments

Leave A Comment

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS