Emacs 23.2 (Released 2010-05)

By Xah Lee. Date: . Last updated: .

This page is a preliminary report on new features in emacs 23.2.

Emacs 23.2 is released on , just 9 months from the previous major release, Emacs 23 (23.1). [see Emacs 23 (Released 2009-07)]

New Modes

CEDET IDE

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.

[see JavaScript in Depth]

A much more advanced js mode, named js2-mode, by Steve Yegge, is not chosen. Rather sad. Steve's mode 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 (by more or less just one guy). 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)

[see Emacs JavaScript Mode War]

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.

htmlfontify

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 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 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, Paperwork BureaucracyMy Experience of GNU Emacs vs XEmacs (2007).)

Other New Features

Opening Large Files

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

async-shell-command; M-&

New command async-shell-commandAlt+&】. It runs a shell command in the background.

This is equivalent to Alt+x shell-commandAlt+!】, with a & appended.

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:

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: (1) if emacs crashed or OS crashed, the currently opened files are not saved. (2) 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:

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

Emacs 23.2 Changes on Minor Mode Command Parameter

Before emacs 23.2, when a minor mode function is called in lisp code, no argument such as (auto-fill-mode) will toggle the mode.

After emacs 23.x, a mode command without any argument used in emacs lisp code will always turn it on.

Though, there might still be some minor mode having the old behavior.

Here's historical note about this change, by Stefan Monnier (one of the current emacs maintainer) in a post in comp.emacs on , see http://groups.google.com/group/gnu.emacs.help/msg/053750ca833da940

bug#6611

Misc Notes

There are quite a few other features i didn't cover here. Many are related to emacs running in Linux.

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.