Emacs Update

I know you couldn’t possibly get bored by another Emacs post.

Emacs is really the one thing I come back to when I want to hack joyfully. Other things are interesting or relevant, but I find Emacs fun.

How could I have missed goto-address for so long? This command will buttonize URLs in a buffer; I enable it by default in change-log-mode, but I’m considering just enabling it globally. It isn’t perfect — it doesn’t recognize URLs as you type. But this is probably fairly easy to fix, and in the meantime it is still handy.

Second, my calendar (really appointment) code to use the notification area worked for the first time today. This is still a bit fragile, I don’t quite know what is going on. But, it does mean I am very close to not ever using Evolution. (Speaking of which I finally set things up so I can easily send email from my various personal accounts via Gnus. This was an incredible pain, involving writing elisp functions, etc. No wonder this stuff is so unpopular.)

I wrote a little hack over the weekend to emulate the Gnome sticky notes applet. This was pretty simple, a couple hundred lines of lisp. But, I didn’t like the result very much. Instead I think I am going to finally upgrade to Emacs 22 (which is something of a pain since I’m using some RPMs that aren’t updated) and use linkd, which looks pretty cool.

Work proceeds on package.el, but it isn’t quite ready for the next release.

I’ve been working steadily on project.el, a way to encapsulate project-specific settings in a simple data structure. The idea is, a project like GCC can publish a set of settings, and when you hack on that project, Emacs will automatically set the correct C style, correct new-file copyright template, correct tabs setting, etc. I’ve seen various projects do this already — they publish little .el files, usually bad ones, for their users. I really don’t understand why this functionality isn’t already in Emacs… right now everyone has to roll their own.

17 Comments

  • Possibly related to project.el; one bit of functionality I would really like to see in Emacs is a way to define projects in the Eclipse sense. Basically just a directory path, but obviously lots of other metadata like the tabs settings could be associated. Oh one other useful bit of metadata would be importing the relevant .cvsignore/.hgignore etc files.

    Useful things from this would be implementing the equivalent of Eclipse’s Ctrl-Shift-R (open any resource in current project). I don’t know of any way to do this in Emacs right now. Possibly override C-x C-f to offer completions from the whole tree.

  • Yeah, my project.el thing is partly about Eclipse-style projects: a collection of settings that will automatically be applied to code in that project’s directory tree. Currently I just have various local variables working — stuff like the C indentation style, indent-tabs, etc.

    I’ve been thinking a bit about ways to expand this… for instance per-project TAGS files, a way to close a project (kill all associated buffers) and then perhaps reopen it, some sort of bugzilla integration, automatically save gud and compile command lines for a project (this would be a user setting, not a project setting) — the sky’s the limit really.

    As for opening files — there are some packages for this kicking around but I haven’t tried any of them. recentf is for recent files. I also heard about iswitchb-fc, which adds file completion support to iswitchb. I guess the cache for this could be primed, per-project, somehow. I made a note about this and the cvsignore thing in project.el — thanks for the ideas!

    But, yeah, in general I’d like to pull a few of Eclipse’s nice ideas back to Emacs. Now if somebody would only duplicate eclim for Emacs, I’d be really happy :-)

    I did once have a patch to update the TAGS file whenever you saved a buffer, but I never fixed it the way RMS wanted, so it didn’t go in. I occasionally think about reviving this, not sure. This always seemed kinda IDE-ish to me…

  • I really enjoy your Emacs posts; I always learn several cool things in each one about the joy of Emacs. I would much rather read ten of these than another blog about anime.

  • Tom, any chance of skipping emacs 22 and going for the gold, ie XFT emacs?

    http://www.emacswiki.org/cgi-bin/wiki/XftGnuEmacs

    Talk about dragging emacs kicking and screaming into the modern age!

    (FYI is this packaged for FC6/7? I am having problems building it.)

  • I haven’t tried XFT Emacs. I wasn’t sure about this stuff but the screenshots there sure look nice. I don’t think it is packaged. I’ve heard though that this will be the first branch merged to trunk after Emacs 22 ships — which should be any day now. That may result in a lot of little problems being ironed out…

  • One kind of “project awareness” thing I’ve wanted in emacs is better tracking of multiple instantiations of the *same* project. In particular, I often have multiple checkouts of the same project, with each checkout a different branch or different patch-in-progress. Then if I’m going back and forth hacking on several of these checkouts, or hacking on one while occasionally looking at another for reference, then it’s all kinds of fun — very easy to accidentally switch to the wrong “commands.cc” buffer, start making changes in the wrong place, etc.

    One useful thing would just be having some way to put some kind of current-project info into the status bar — much easier than remembering that commands.cc and ui.hh are the buffers that correspond to branch A… Project aware find-file and buffer-switching would also help a lot.

  • P.S.: “unicorn with rainbows” what?

  • Oh, and that was supposed to be ‘commands.cc<3> and ui.hh<2>’.

    *crosses fingers, hits submit*

  • FYI build works as of today. Looks nice!

  • Nathaniel — thanks, I’ll make an note. Those are good ideas… I also get bitten by this quite a bit.

  • AFAIK the XFT branch has been merged into the emacs-unicode-2 branch. Try that one if you want XFT

  • Nathaniel – Check out uniquify-buffer-name-style. You can set it so that emacs will use parts of the path to uniquify the buffer name instead of the default <2>. I’ve found it very useful.

    http://www.gnu.org/software/emacs/manual/html_node/Uniquify.html

    I would also love to see something like CTRL-SHIFT-R in Emacs.

  • Uniquify-buffer-name-style: Thanks!

    What’s Ctrl-Shift-R? My brain suggests “reverse-i-search-across-project”, which is probably total nonsense… but a good and useful thing nonetheless!

    (A convenient grep-find over projects would be useful too, I am usually too lazy to actually use grep-find because it has such clunky setup, but if it was as easy to run as i-search…)

  • In Eclipse, Ctrl-Shift-R lets you choose a file to open from the files in the current project — a restricted find-file. I found a few things like this on the Emacs wiki, I think, but I didn’t try any of them.

    I never knew about grep-find and I always used igrep instead. However in Emacs 22 there is a new “rgrep” which is like igrep but perhaps even a bit nicer. Unlike grep-find it tries to pick endings nicely, so if you rgrep from a .h buffer it will, by default, look in *.[ch].

  • Where did project.el go? I saw some buzz about it on emacs-devel but I can’t find in in the tree :/

  • Fredrik — I rewrote it to conform to what the Emacs devels wanted, but I have not quite finished that.
    So, it is still sitting here. I will get to it sometime :-)

  • ahh, I keep my ear close to emacs-devel then :)

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>