2009-01-21

emacs 23

As per January 2009, the current stable version of GNU/Emacs is 22. However, there is a development version 23 available from CVS. The development version should become the next stable version in the not-too-distant future. I've been using emacs 23 for more than one year now, and have found it very reliable.

I'll be discussing some of the Emacs 23 specific tricks in some future entries, here I will discuss a small number of visible ones. This does not even scratch the surface of what is new - it's just a little taster.

One of the biggest, user-visible changes in Emacs 23 is the support for anti-aliased fonts on X11. This means that the fonts will look much smoother -- and as noted, users feel more effective when using pretty technology. In this case, some pictures are probably in order; the two screenshots show emacs-22 versus emacs-23, using default settings. The difference is striking, to say the least.

Emacs also supports variable-width fonts, so you could use any TrueType (and some other) font. However, I prefer to use a fixed-width font; a nice one is the Inconsolata font (ttf-inconsolata in Ubuntu/Debian, inconsolata-fonts in Fedora).

Another interesting new feature is DBUS-support; D-Bus is an IPC system used on Linux/Unix to communicate between applications. Using D-Bus, Emacs now even has support for querying the network for ZeroConf-devices when you are using Avahi; for example, insert a list of all printers in the local network into the current buffer, you could do something like:

(require 'zeroconf)
(zeroconf-init)
(dolist (srv (zeroconf-list-services "_printer._tcp"))
  (insert (format "\nprinter: %s" (nth 2 srv))))
Of course, this is not so useful. But being able to use Zeroconf (and D-Bus) easily from within emacs enables all kinds of interesting hacks... to be continued.

A maybe-useful graphical gimmick is that you can now change the 'opacity' (non-transparency) of your emacs frame (window) if you're on MS-Windows, or on some X with compositing enabled (Compiz, metacity-with-compositing, ...).

(modify-frame-parameters (selected-frame) 
  `((alpha . 90)))
will make your frame (window) 90% opaque (ie., 10% transparant).

If you're very conservative, you should of course wait for the official release of the new emacs. If you are a bit more adventurous, I can definitely recommend it. I have not come across any bugs. Of course, your mileage may vary.

The easiest way to get emacs 23 is to get some prebuilt packages;

  • For Windows, Ian Eure's MacOS-packages (haven't tested those);
  • For Debian, you can get emacs-snapshot-packages from orebokech, which are update weekly;
  • For Ubuntu, there are emacs-snapshot-packages from Ubuntu-Elisp
I guess there must be similar packages for Fedora/Suse/... but I could only find some older packages from EmacsCvsAndFedora. That says more about my searching skill than anything else, I guess... You can however also compile the new emacs yourself; it's not too difficult and there are some instructions in EmacsWiki, but note that the page is partly outdated.

Final note: if you have to have some emacs-23 specific code in your .emacs, but you also need emacs-22, you can use some like:

(when (>= emacs-major-version 23)
  ;; do something only in emacs 23
  )

14 comments:

Marc-André Lureau said...

I guess you will write an article later about "-daemon", won't you !? :)

Anonymous said...

Yeah, Inconsolata is the best fixed width font i ever used.

Tad said...

For Mac, get MacPorts and install emacs-app-devel. Saves you from having to go to some dude's nightly repository whenever you want everything updated.

Anonymous said...

re: " (when (>= emacs-major-version 23) ", haven't we traditionally been encouraged to test for features rather than versions?

Deon Garrett said...

Emacs 23 also has a Cocoa backend on the Mac.

djcb said...

@cos: fair point; in this case it's just meant for temporarily trying out some emacs23 things when your still also using an older version. for the longer term, it's indeed better to figure out how to test for specific features.

Anonymous said...

Emacs 23 packages for Fedora 10:

http://rpm.bradmwalker.com/bmw-release-1-1.fc10.noarch.rpm

This is well hidden. On his homepage http://bradmwalker.com/, the last post announces the closure of his repository.... Don't believe it. The sidebar has links for Fedora 8/9/10 and RHEL5.

Anonymous said...

can you describe how you use the inconsolata font?

djcb said...

@Anonymous: regarding Inconsolata, see e.g. http://joost.zeekat.nl/2008/02/26/inconsolata-a-nice-programming-font/#comment-726

Anonymous said...

The beta is officially available at
http://alpha.gnu.org/gnu/emacs/pretest/

Mike said...

Maybe it exists already, but I think there's some interesting things you could do with the opacity feature.

I remember lifting two pages of paper to the light to 'diff' them. That would be handy as a diff that would let us slide one over the other.

HelloWorld said...

Just to be clear, pretty fonts is not just eye candy--specially if you stare at the freakin' screen all day. A properly designed font actually helps keep eye strain and fatigue at bay.

I run NT emacs in Windows. My favorite Emacs font is "Constantia" by Microsoft. (Yeah Microsoft.) They commisioned this font (along with Cambria and others) to be specially designed for screen use...

Unknown said...

Inconsolata font is nice. Thanks

Anonymous said...

does anybody knows how to install emacs23 on fedora16