Emacs 23.1 New Features (released 2009-07)

By Xah Lee. Date: 2009-08-12. Last updated: 2014-09-28.

This page is a list of major new features in emacs 23 (technically, 23.1.1), released in 2009-07-30. It also includes practical tips about using the new features. This page only lists the most important or practical changes relevant to average emacs users. It may miss features or changes you find important.

If you have personal keyboard macros, they usually rely on up/down arrow keys moving lines determined by line breaks. So, when you need to call your macros, or record new, you may want to temporarily set line-move-visual to nil.

Wildcard in Keyword Completion

For example, if you start to open a file, and emacs prompts you for file name in the minibuffer, you can type *report then Tab, and emacs will suggest all file names that has the word “report” in it. You can use more than one wildcard at different places and in dir paths, for example: 〔~/*/report/ja*〕.

Completion with wildcard works in minibuffer prompt whenever it makes sense. For example, when you Alt+xswitch-to-buffer 【Ctrl+xb】, execute-extended-command 【Alt+x】, describe-function 【Ctrl+hf】, etc.

Note: this new completion feature applies in minibuffer only. When you are in a programing mode and pressing 【Meta+Tab】 for completing function names, wildcard does not apply, nor substring matching.

In emacs 22, you can turn on partial-completion-mode or ido-mode for similar features. Both are still available in emacs 23.

Make Whitespace Visible

whitespace-mode is a mode that make whitespace visible. Calling it toggles it. whitespace-newline-mode is similar, except that it is only for newline char. (Thanks to
Vinicius Jose Latorre
for this feature)

This feature is useful when you need to trim your whitespaces. For example, Python code copied from the web, or working with tab delimited files of spreadsheets and address books.

File Management

Opening Multiple Files in Buffer

Now you can open multiple files in dired in one shot. When you open a file (find-file; 【Ctrl+xCtrl+f】), you can type for example *.html, and emacs will open all those files in background buffers. (call ibuffer to see your buffers.)

Renaming Files

In dired, the function wdired-change-to-wdired-mode now has a shortcut 【Ctrl+xCtrl+q】. For detail, see: Emacs: Batch Rename Files.

Find Replace on Multiple Files

In emacs 23, there are 2 new functionalities. During query replace, Pressing Y replaces all remaining matches in ALL REMAINING FILES. Pressing N stops doing replacements in the current file and skips to the next file. These 2 new functionalities is available for all commands that use tags-query-replace.

Note the lines “buffer code:” and “file code:” above. In emacs 23, the info also shows the char's Unicode name.

The new character engine is a critical improvement, although you may not feel it much in your daily use of emacs. Because of the new character engine, new in emacs 23 are support for languages, encodings, input systems that was not there before. See: list-input-methods, list-coding-systems, list-character-sets, list-charset-chars.

Byte compiled elisp files (byte-compile-file) that contains non-ASCII chars now will not be compatible with emacs 22. This means elisp files that contains non-ASCII chars and is byte compiled in emacs 23, cannot run in emacs 22. However, emacs 22 byte compiled files still runs in emacs 23, because emacs 23 still understand the mule encoding used by 22. You should byte compile your emacs 22's.elc files if you don't plan to use emacs 22 anymore, because it saves a decoding process and loads faster. (if you don't understand this paragraph, you need not worry about it.)

This also means that autosave file are utf-8 encoded, instead of emacs 22's emacs-mule encoding. This means, those “#autosave#” files containing non-ASCII chars can be viewed legibly by any editor that supports Unicode, not just emacs.

The ucs-insert command now has the shortcut 【Ctrl+x8Enter】, and it also support wildcard completion on Unicode char names. For example, suppose you are looking for a Unicode char that represent a star. Alt+xucs-insert, then type *star then Tab, then emacs will list all Unicode char names that have a “star” in it.

Emacs Server/Client

Emacs can be run as a server/client. This allows you to start emacs in remote machine, and have multiple terminal emacs instances connected to it, without the delay or resource in starting another emacs instance. You can of course still start multiple emacs full process as before.

To launch a emacs server, type emacs --daemon in shell. Or, within emacs, Alt+xserver-start. Note that a emacs server simply runs in the background, ready for clients to launch and connect.

To start a emacs client, type emacsclient ~ in shell. Note that you must provide a file name or dir. When a client starts, it starts in text mode in shell, not GUI.

You can set your environment variable “EDITOR” to “emacsclient”, so that, other shell apps such as mail, cron, etc will automatically launch emacs client. Multiple clients can connect to the same server.

On Windows, you start emacs server by first launching emacs, then call the command server-start. Running emacs --daemon in shell is not supported. (The error message is: “This platform does not support the -daemon flag.”)

On Mac, you launch server like this: /Applications/Emacs.app/Contents/MacOS/Emacs --daemon, then client like this: /Applications/Emacs.app/Contents/MacOS/bin/emacsclient ~. Of course, you can setup a alias in Bash to avoid typing the long path. Like this:

Deleting Files to Trash Folder

However, this feature has a few problems. When this is on, your trash folder will be filled with tens or hundreds of emacs temp files, such as those “#autosave#” files, “backup~” files, “.emacs.desktop”, “emacs00164”, “server”, etc. Also, when deleting a directory from dired, your system trash will end up with each individual files, instead of just a folder. If the folder has few hundred files, the process will be super slow. This happens at least on emacs for Windows.

Quick Note Taking

Remember mode by John Wiegley. It lets you write down notes quickly. Basically, it is a shortcut that always opens a particular file, so you can press a button and start writing down notes. I don't find this useful.

To start, Alt+xremember. Then type your notes. When done, type 【Ctrl+cCtrl+c】, then it should save the data to ~/.notes and close the buffer.

(info "(remember) Top")

Linux Specific Features

Support for D-BUS, thanks to
Michael Albinus. This feature allows emacs to provide and receive services from other apps. (info "(dbus) Top")

Support for Xesam spec for desktop search. Thanks to Michael Albinus. If you have desktop search tools installed such as Beagle, Strigi, then you can invoke search by the command xesam-search. You'll need to load it first by (require 'xesam).

Support for X11's XEmbed protocol. This means, you can embed emacs in other apps.