emacs 23.2 features

Perm url with updates: http://xahlee.org/emacs/emacs23.2_features.html

Emacs 23.2 Features

Xah Lee, 2010-06-02, 2011-01-14

Some preliminary report on new features in emacs 23.2.

Emacs 23.2 is released on 2010-05-08, just 9 months from the previous major release, Emacs 23 (23.1). (See: New Features in Emacs 23.)

New Modes


Emacs 23.2 has lots of significant new features. The most significant is probably the inclusion of the CEDET package, which is a huge IDE-like package with features to parse different languages. CEDET is written by Eric Ludlam. I'll be studying this package and document its features for practical use.

javascript mode

A javascript mode, is finally bundled. Activated by the command “js-mode”. This is renamed from the “espresso” mode by Daniel Colascione, which is based on a earlier javascript mode by Karl Landstrom.

Note that Steve Yegge's js2-mode is not chosen. Rather sad. Steve's mode is more radical, in that it features a on-the-fly js parser (written in elisp). It actually validate js code as you type, similar to nxml mode by the xml expert James Clark.

Steve's js2-mode was being attacked in the gnu dev mailing list in 2009-08. Steve, is a humble guy at least in his public writing. He promised to fix whatever the mentioned issues to combine it with (alleged) advantages of espresso mode. (Source lists.gnu.org)

The included js mode is the espresso mode, not Steve's js2 mode. Espresso mode's feature is very basic, pretty much just a regex based syntax coloring, like vast majority of emacs's major modes.

Steve's blog about the js2 mode is here: Source steve-yegge.blogspot.com

Full thread on js2-mode at Source lists.gnu.org. Look for subject name “Why js2-mode in Emacs 23.2” dated 2009-08-09.

nxml for XML now default

The nxml-mode, by the xml expert James Clark, was included in emacs 23.1, but somehow isn't default when you open a xml file. Now it is. I filed a bug report on this. See: bug#4169.


A new package, htmlfontify.el turns a syntax colored buffer into HTML code. Written by Vivek Dasmohapatra. This is used for publishing code on the web. The command name is “htmlfontify-buffer”. This package is similar to the “htmlize.el” package by Hrvoje Niksic. I've been using Hrvoje's htmlize for the past 4 years. See: Using Emacs To Syntax Color Source Code In HTML.

Note that htmlfontify is known among emacs users since at least 2006. Same with CEDET, and javascript modes, and nxml mode. It usually take some 4 years for things to get into GNU Emacs. This inefficiency is a major problem.

Also, “htmlize.el” existed since at least 2007. However, in a private email Hrvoje Niksic told me he refuse to work with FSF (or something like that), even though the code is released in GPL. I completely sympathizes with him, and i have come to dislike the bureaucratic inefficiency and propaganda from FSF. (See: “Free” Software Morality, Richard Stallman, and Paperwork BureaucracyMy Experience of Emacs vs XEmacs.)

Opening Large Files

Emacs can now open files up to 512MB in size, doubling previous.

async-shell-command; M-&

New command “async-shell-command” with hotkey 【Alt+&】. You can use it to call shell command, and the shell command will run in the background. If you used 【Alt+!】 (shell-command), it will freeze emacs while your shell command is running. It is basically the same as calling shell-command with a “&” appended (for bash).

Convenient Cursor Moving

A new command “move-to-window-line-top-bottom”, with hotkey 【Alt+r】, will move cursor to top, center, or bottom of current window. Repeated call cycle these locations. This is a complement to 【Ctrl+l】 (recenter-top-bottom).

I don't think this is necessarily a good feature. Emacs's is filled with tens of these little commands for text editing. Their problem is that there are too many specific commands with hard to remember keys that are also many keystrokes, and puts a burden on user to become familiar with all these commands and call them in specific situations. Better would be a few powerful commands on easy keys that are context sensitive. So, you can just remember 10 commands, and call 2 or 3 of them in sequence, instead of remembering 20 or 30 special commands each having complicated combo keystrokes. For examples, see: mark-word problem, fill-paragraph problem, isearch problem.

For Elisp Coders

Glad to note that recursive option is added to the elisp commands “copy-directory” and “delete-directory”. A great feature for those who use elisp for sys admin and text processing. This fixed a bug i've reported, see: A Function For Copying and Deleting Whole Dir. This means, lots of my text processing scripts don't have to make system calls cp -r and rm -r anymore. This solves many cross-platform complexities especially on Windows.

For reasons why elisp is perhaps the best text processing lang, see: Text Processing: Emacs Lisp vs Perl.

Centralize Config Files to 〔~/.emacs.d/〕

Some config files are moved from the 〔~/〕 dir to 〔~/.emacs.d/〕. Examples are Emacs calculator “calc”'s 〔~/.calc.el〕, abbreviation system's 〔~/.abbrev_defs〕. If you already have these files at 〔~/〕, your file will still work and won't be moved automatically. You might want to move them. Also, the path 〔~/emacs.d/〕 is the default value of the variable “user-emacs-directory”.

Note, that Bookmark's file is still at 〔~/.emacs.bmk〕, and recently opened file (recentf-mode) data is still at 〔~/.recentf〕.

Emacs does not have a policy on where package's data should be saved, nor a unified location for user installed packages. By this emacs 23.2 move, it appears that program data should now be at the var “user-emacs-directory”.

On a separate note, the “desktop-save-mode”'s data is at 〔~/.emacs.d/.emacs.desktop〕, however, one problem is when emacs quit, it bugs the user by asking them to save the desktop file location. There are 2 problem with this: ① if emacs crashed or OS crashed, the currently opened files are not saved. ② it bothers the user by asking.

dired auto refresh

dired has new variable “dired-auto-revert-buffer”. If set to “t”, then when you open a directory, the listing will be refreshed (that is, it automatically calls revert-buffer).

This improvement doesn't really do much. The problems are:

  • ① The default value of dired-auto-revert-buffer is false (“nil”).
  • ② Even set to t, it does not refresh if you switch to a existing dired buffer. It works when you actually “visit” a existing dired buffer. That is, you call dired or call find-file.

I think xemacs has a robust auto-refresh feature long ago.


There are quite a few other features i didn't cover here. Many are related to emacs running in linux. If you like to read the official release notes, see: emacs23.2_features_official.txt.

2010-06-10 Addendum: David Capello and me released a new ErgoEmacs distribution based on 23.2, download it at: http://code.google.com/p/ergoemacs/downloads/list.

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs