emacs 23 has been released!

Emacs 23(.1) has been released! After only just over two years since the previous version, emacs 23 has been released on July 29 2009. Time to celebrate! And a big thanks all the talented hackers that made it possible!

Emacs 23 brings many new features. Some of those have been discussed before in emacs-fu, and of course you can get the full list from the NEWS-file (C-h n). This is just a list of some of the highlights, in particular the end-user-visible ones. Let's go through them - of course I cannot mention all of them, so feel free to add your favorite one in the comments.

fonts & anti-aliasing

Finally, emacs 23 brings support for anti-aliased fonts to X (Mac/Windows users have had this for a while). If you're running emacs on X, this one change is enough to never want to go back to an older version of Emacs again.

The new font system mentioned in some posts before: setting fonts and emacs 23.

support for D-Bus and Zeroconf

You can now call other services on the desktop using the DBUS IPC system (popular on X); using d-bus: an example shows how to communicate with the Tomboy note taker program from emacs. As more and more desktop services are accessible using D-BUS, this offers great opportunities for better integrating emacs with the rest of the desktop. For example, one could imagine that emacs could communicate with a network manager when it needs a connection. Or it could show a desktop notification when an appointment is near. And all without adding hard dependencies or calling external binaries.

Using Zeroconf is also quite easy; for example, to get a list of all zeroconf-support printers, you could do something silly like:

(require 'zeroconf)
(dolist (srv (zeroconf-list-services "_printer._tcp"))
  (insert (format "\nprinter: %s" (nth 2 srv))))

to insert a list of the available printers in your current buffer. As with D-Bus, it's really an enabler for a lot of cool things.

support for 'headless' emacs-daemon

If you have a lot of support packages, emacs startup can be a bit slow. However, emacs 23 brings emacs --daemon, which enables you to start emacs in the background (for example when you log in). You can instantly pop up new emacs windows (frames) with emacsclient. Of course, you could already have an emacs 'server' in older versions, but being able to start it in the background makes this a much nicer solution.

The Emacs-daemon was discussed in emacs-fu in emacs –daemon and windows and daemons (for MS-Windows). Popping up new emacs windows is so fast that you can use emacs for any editing job, for example as an editor for an email program, or for quick rememember notes.

You can even combine X and console clients in one session now.

Emacs now support Xembed

This enables you to embed emacs in other programs (on X) using XEmbed. Haven't played with that yet. There is some more information in EmacsWiki/Xembed.

Support for frame opacity

You can now make you emacs frames transparent. Discussed before in transparent emacs. Not sure how useful this is, but it surely looks nice :)


Emacs's character set is a superset of Unicode, with about four times the space available. That should be enough for the foreseeable future… There are also many new character sets available, as well as new language environments, such as Chinese-GB18030, Khmer, Bengali, Punjabi, Gujarati, Oriya, Telugu, Sinhala, and TaiViet.

Note that, internally, emacs uses UTF-8 now.

New defaults

  • Screen motion now goes by screen lines by default, that is when you move the cursor up or down, it follows the line as you see them. Nice.
  • Transient mark mode (visible selection) is now on by default, so no need for (transient-mark-mode t) in your .emacs anymore. However, you still need to put (delete-selection-mode t) if you like replace the current selection with your typing.
  • Also shift-select mode is enabled by default, so you can select with shift + the arrow keys.

New modes and packages, and updated ones


stepping through your window configurations

As a small addendum to the entry about keeping related buffers together (with Elscreen): there is also winner-mode, as was mentioned by ustunozgur. winner-mode is a bit simpler than Elscreen. It allows you to step through the various window configuration you had before - instead of having separate 'tabs' as in elscreen, you just step through your history.

I have the following in my .emacs:

(require 'winner)
(setq winner-dont-bind-my-keys t) ;; default bindings conflict with org-mode

(global-set-key (kbd "<C-s-left>") 'winner-undo)
(global-set-key (kbd "<C-s-right>") 'winner-redo)
(winner-mode t) ;; turn on the global minor mode

As you see, I am using the windows-key in the key bindings once more, but of course you can use something else as well.


keeping related buffers together with elscreen

I wrote about switching buffers a couple of times. Switching buffers is one of the things I do a lot when using emacs – switching between e-mail, IRC and some blog entry. Or simply between a couple of source files in a project.

With some of the tricks mentioned, switching buffers can be made pretty easy.

However, what about programs that consist of multiple buffers? For example, my e-mail program (Wanderlust) splits the screen in separate buffers with mail headers, mail folders and the contents of one message. The same for fancy debugging with gdb, or simply when I have split my screen in two (C-x 2) to view two files at the same time. When I then try to switch buffers, only one of the related buffers will be switched – which is usually not what I want.

I'd like to treat a set of related buffers plus their screen layout as a logical unit.

There are different ways to do that in emacs. One obvious way is to use multiple frames (windows). But I prefer to keep everything in one - and I found the that the easiest solution is elscreen.

Installation is simple; download from here, and follow the instructions in the package. I've set up some easy key-bindings in my .emacs:

(load "elscreen" "ElScreen" )

;; F9 creates a new elscreen, shift-F9 kills it
(global-set-key (kbd "<f9>"    ) 'elscreen-create)
(global-set-key (kbd "S-<f9>"  ) 'elscreen-kill)  

;; Windowskey+PgUP/PgDown switches between elscreens
(global-set-key (kbd "<s-prior>") 'elscreen-previous) 
(global-set-key (kbd "<s-next>")  'elscreen-next) 

Now, whenever I want to switch to a new task, say, read e-mail, I press F9, and a new elscreen will appear (it's visible as a sort-of 'tab' at the top of your screen), and start e-mail there. I can then switch to other elscreens, and all of them maintain their buffers and window layout. I have found this very useful. There are some more tricks, and some add-on packages, but this should give you a good start.

There is one small item on my todo-list. Example: when I push M-x wl, emacs automatically switches to the Wanderlust-buffer – or starts it. Now, when using elscreen, I'd like to automatically switch to the correct screen instead of switching the current buffer.


keyboard shortcuts

Emacs has many useful functions, but for the most efficient use you really need to make keybindings (as previously discussed) for the ones you use often. There's no shortage of possible shortcuts, but the number of easy-to-remember bindings is fairly limited.

I can remember bindings that I use all the time like M-w for copy (well, kill-ring-save), or M-q (fill-paragraph) to word-wrap a paragraph, even if they're not that mnemonic (interestingly, it can be hard to verbalize these bindings when someone ask me – but my fingers have no such trouble).

For functions that I use every minute, any weird key binding will do (as long as it is short). And functions that I use seldomly I can look up in a menu. The trouble is with those functions in between :)

Bindings that involve the arrow-keys are attractive, but I've found that e.g. org-mode binds many of those already. And in the olden days, the C-c-prefix was reserved for user-defined key bindings – but again, org-mode and other packages have overtaken that those. So what's left? Recently, I have been using the Windows-key a bit more. Under (my) X, it's bound to super, and emacs does not use it for anything else, so I have been using it to create a set of useful key bindings. I am trying to be a bit systematic, where super + lowercase letter starts some 'application':

(global-set-key (kbd "s-a") 'org-agenda-list) ;; Agenda
(global-set-key (kbd "s-n") 'org-todo-list)   ;; todo-list (nextactions)

;; program shortcuts
(global-set-key (kbd "s-b") 'browse-url)  ;; Browse (W3M)
(global-set-key (kbd "s-f") 'browse-url-firefox)  ;; Firefox...
(global-set-key (kbd "s-t") 'twitter-get-friends-timeline) ;; Twitter
(global-set-key (kbd "s-w") 'wl)            ;; Wanderlust

and super + uppercase opens a file / special buffer, for example:

(global-set-key (kbd "s-S") ;; scratch
  (lambda()(interactive)(switch-to-buffer "*scratch*")))
(global-set-key (kbd "s-E") ;; .emacs
  (lambda()(interactive)(find-file "~/.emacs")))
(global-set-key (kbd "s-G") ;; gtd.org
  (lambda()(interactive)(find-file "~/.emacs.d/org/agenda/gtd.org"))) 

super + arrow keys I now use for windmove (see here).

The windows-keys are not perfect of course – they don't work from the console (easily) or, ironically, on Windows. But they are mnemonic – I can remember s-t for twitter; contrast this with C-x 5 2 to create a new frame.

So, I wonder, does anyone have some clever scheme for their key bindings? I think I am getting much of the efficiency from emacs from the fact that I can do just about anything with some quick actions on the keyboard, so I'm very interested.