Monday, May 25, 2009

Tabs of Genius

Since I am going to be coding full-time (or nearly) for my summer job, I took this as an opportunity to undertake some long-overdue changes to my Emacs installation. Among the changes are:


  • Adding Drupal file extensions (.module, .incto the recognized PHP patterns

  • Using notify.el to pop up the cool new notification system in the latest version of Ubuntu whenever my nickname is mentioned on an IRC channel which I have joined.

  • Replacing my own ido-enhanced M-x with the pimptacularSmex program.

  • Updated nXhtml to the latest version. For a good example of how NOT to write commit messages, check out the (otherwise excellent) repository on Launchpad.

  • Move some more packages from my elisp directory to ELPA. This lets me cut down on the amount of path configuration and autoloading in my configuration files, as well as managing its own updates.

  • Replace pabbrev with Smart Tab, (hence the name of this post) which uses the massively powerful hippie-expand to return better results. I ended up developing it from a simple function rebinding tab to a full-fledged global-minor-mode (which does nothing but rebind tab :) and a git repository on github. My next move is to clean up all the little issues and try to get it included in ELPA. It is my first time maintaining any sort of package for public use, and a lot more goes into it than I thought. It's kind of neat.

  • Shuffle some configuration files about and update the copyright dates on my config files. Not like anyone is going to infringe them, right?

  • Spent FAR more time than should ever be necessary hunting down a (relatively benign) bug in anything.el which clobbered the key binding for occur. Long story short: there is actually a difference between copy-keymap and set-keymap-parent. I'm going to see about pushing that change back upstream, though I'm not exactly sure what the "official" repository for anything.el is, aside from some files on EmacsWiki.

  • Spent a great deal of time figuring out how to get Smart Tab and auto-complete to play nice with each other. It eventually turned out that the bulk of my problems was that I was setting up my autoloads after loading Custom, so libraries which were expecting Custom to initialize them were left hanging.

  • Started, but got sidetracked from, setting up some form of tags file for at least PHP, since that is what I'm going to be spending most of my time working on. Unfortunately, given the nature of the interaction between the program which generates the tags and Emacs, it is non-trivial to have an automatically continually updated base of tags. Additionally, the format Emacs uses is apparently fairly inefficient (requires linear scans for all/most operations), but there is a rich ecosystem of libraries and helpers around it. I'll have to look at it some more later.

  • Looked into being able to use ido-completing-read everywhere the vanilla completing-read is used, making variable and function lookups much more pleasant. It is not as easy as simply defaliasing ido-completing-read to completing-read, since ido-completing-read itself calls completing-read during its execution. I asked StackOverflow if anyone had a solution, and nothing has come back so far. It would be really convenient if there was a completing-read-function variable which you could simply set to code>completing-read or ido-completing-read and be done with it. What's worse, ido-completing-read is a drop-in replacement for completing-read, so most libraries likely would not notice or care.



Whew! That was a lot! I haven't had a good Emacs indulgence in a while, and I forgot how fun it is!

Many of the changes I made were a bit more under-the-hood, but I've already fallen in love with Smex, and from what I hear, Anything.el is pure bliss (I haven't had a chance to set it up and get used to it fully).

The big thing I'd like to spend some more time on is improving the situation around EmacsWiki. It is a great site, with a healthy community of interested people, but a Wiki is a pretty bad form of version control. Once need only look at something like line numbering, where there is one for Xemacs only, line-num.el, linum.el, setnu.el, setnu+.el, lineo.el, and a number of patches for each of them, mingling around in a long page which also serves as the bug tracker. I would like to see much more organization (though obviously not at the expense of productivity) and ease of deployment (like with ELPA). Even for packaging, there are at least six different and incomplete (in that they don't index all or even most packages) implementations of packaging programs. Competition and diversity are good, but there comes a point when it means that nothing actually ends up usable.

Well, I've certainly got a lot cut out for myself, but it all looks interesting. And maybe, when I'm done fiddling around with Emacs, I might actually get to some Drupal programming. You know, the thing that's supposed to be my job.

No comments:

Post a Comment