This page is a list of major new features in emacs 23 (technically, 23.1.1), released in . 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.
For features in emacs 23.2, see: Emacs 23.2 Features (released 2010-05).
Text selection is highlighted by default. This is done by having
transient-mark-mode on by default. To turn it off, put the following in your emacs init file:
(transient-mark-mode 0) ; 1 for on, 0 for off
transient-mark-mode is on, several emacs commands now will work on the selected text if you have text selected. These commands are:
|purpose||emacs command name||shortcut|
|add line breaks||【Alt+q】|
|indenting code||【Tab ↹】|
Also, now you can hold down the ⇧ Shift key then press arrows key to select text. To turn this off, put:
(setq shift-select-mode nil) ; “t” for true, “nil” for false
However, by default, pressing delete key will not delete selected text. If you want this, put:
(delete-selection-mode 1) ; make typing override text selection
Pressing down arrow key moves the cursor by a screen line. In emacs 22, pressing down arrow moves the cursor by newline as determined by line breaks. (thanks to Stefan Monnier for implementing this.)
To have emacs 22 behavior, put this:
(setq line-move-visual nil) ; use “t” for true, “nil” for false
If you just want it temporarily on or off, you can call
Following is a command definition that lets you toggle line-move-visual.
(defun toggle-line-move-visual () "Toggle behavior of up/down arrow key, by visual line vs logical line." (interactive) (if line-move-visual (setq line-move-visual nil) (setq line-move-visual t)) )
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.
See: Emacs: Visual Line Mode, Wrap Lines at Word Boundaries.
Now you can show line numbers on the margin, a common feature in other editors. (Thanks to Markus Triska for this feature)
See: Emacs: Display Line Numbers linum-mode
Minibuffer's command completion supports wildcard char
*, and also supports substring matching in some situations.
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 call
switch-to-buffer 【Ctrl+x b】,
describe-function 【F1 f】, 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.
(info "(emacs) Completion")
In emacs 22, you can turn on
ido-mode for similar features. Both are still available in emacs 23.
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.
For some tips and detail, see: How to use and setup Emacs's whitespace-mode.
Now you can open multiple files in dired in one shot. When you open a file (find-file; 【Ctrl+x Ctrl+f】), you can type for example
*.html, and emacs will open all those files in background buffers. (call
ibuffer to see your buffers.)
In dired, the function
wdired-change-to-wdired-mode now has a shortcut 【Ctrl+x Ctrl+q】. For detail, see: Emacs: Rename Files Interactively.
In dired, the command
dired-do-query-replace-regexp 【Q】 does interactive find/replace on multiple files. 〔➤ tutorial〕
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
This is a implementation of suggestion in bug 267 〔➤ Emacs Suggestion: dired-do-query-replace-regex Replace ALL〕.
The font engine has been rewritten. Now it support the operating system's fonts, and also supports anti-aliasing, on Windows, Mac, Linux.
To choose font, use menu 〖Options ▸ Set Default Font…〗. Use 〖Options ▸ Save Options〗 to save for future sessions.
(Font rendering with Fontconfig and Xft. (Thanks to Keith Packard (keithp.com) for work on this.))
Characters are now represented by Unicode's utf-8 encoding internally. Much thanks to Kenichi Handa for implementing this.
You can see a effect of the change by calling
Output of “describe-char” on char “★” in Emacs 22 character: ★ (299365, #o1110545, #x49165, U+2605) charset: mule-unicode-2500-33ff (Unicode characters of the range U+2500..U+33FF.) code point: #x22 #x65 syntax: w which means: word buffer code: #x9C #xF2 #xA2 #xE5 file code: #xE2 #x98 #x85 (encoded by coding system mule-utf-8-unix) display: by this font (glyph code) -apple-monaco-medium-r-normal--12-120-72-72-m-120-iso10646-1 (#x2605)
Output of “describe-char” on char “★” in Emacs 23 character: ★ (9733, #o23005, #x2605) preferred charset: Unicode (Unicode (ISO10646)) code point: 0x2605 syntax: _ which means: symbol category: .:Base, c:Chinese, h:Korean, j:Japanese buffer code: #xE2 #x98 #x85 file code: #xE2 #x98 #x85 (encoded by coding system utf-8-unix) display: by this font (glyph code) uniscribe:-outline-BatangChe-normal-normal-normal-mono-13-*-*-*-c-*-gb2312.1980*-* (#xB18) Character code properties: customize what to show name: BLACK STAR general-category: So (Symbol, Other)
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:
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.
ucs-insert command now has the shortcut 【Ctrl+x 8 Enter ↵】, and it also support wildcard completion on Unicode char names. For example, suppose you are looking for a Unicode char that represent a star. Call
ucs-insert, then type
*star then Tab ↹, then emacs will list all Unicode char names that have a “star” in it.
(info "(emacs) International")
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.
Thanks to Károly Lőrentey, Dan Nicolaescu for this great feature.
To launch a emacs server, type
emacs --daemon in shell. Or, within emacs, call
server-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
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:
(info "(emacs) Emacs Server")
nxml-mode by James Clark (jclark.com).
This is a superb mode for working with XML documents. It validates your XML as you type.
However, in emacs 23.1.50, the default mode for
.xml file is still the old XML mode (
xml-mode based on
nxml-mode. (Fixed in emacs 23.2.x) To fix that, put:
; for xml files, use nxml-mode instead of sgml-mode (add-to-list 'auto-mode-alist '("\\.xml\\'" . nxml-mode))
Note that James Clark is one of the world's top expert on SGML and XML, author of the widely used Expat XML parser. The nxml-mode + emacs is probably the world's most advanced XML editor.
(info "(nxml-mode) Top")
proced by Roland Winkler, for managing OS processes, similar to dired in managing files.
Start it by calling
You can click on the column at the top to sort by that. In the mode, call
describe-mode 【F1 m】 to see its inline doc, as usual.
You use it pretty much like dired. Type m to mark the process; Type u to unmark; Type x to send a signal to the process; Type Tab ↹ to see what signal you can send.
Be sure to check the menu “Proced” while you are in proced mode.
Note that this feature does not work on Mac OS X out of the box.
ruby-mode by Yukihiro Matsumoto and Nobuyoshi Nakada.
rst-mode by Martin Blais et al.
ReStructuredText is a lightweight markup format, mostly used in Python community for inline documentation of code, pretty much like Perl's
rst-mode documentation is at: http://docutils.sourceforge.net/docs/user/emacs.html.
doc-view-mode by Tassilo Horn. This allows you to view PDF documents within emacs, as well as PostScript and DVI files.
This feature does not work on Windows or Mac OS X out of the box.
If you want it to work out of the box on Windows, use ErgoEmacs.
(info "(emacs) Document View")
EasyPG Assistant (epa) is interface to GNU Privacy Guard (gpg).
The tools can be invoked in the menu 〖Tools ▸ Encryption/Decryption〗. To see what command are available, type 【Alt+x】 then “epa-” then Tab ↹.
In dired, you can call these function with keyboard shortcuts:
These are listed in the menu “Immediate” while in dired.
(info "(epa) Top")
Deleting files in emacs can now be set so that they move to the OS's trash folder
<span class="comment-delimiter">; </span><span class="comment">deleting files goes to OS's trash folder </span>(setq delete-by-moving-to-trash t) <span class="comment-delimiter">; </span><span class="comment">“t” for true, “nil” for false </span>
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.
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, call
remember. Then type your notes. When done, type 【Ctrl+c Ctrl+c】, then it should save the data to
~/.notes and close the buffer.
(info "(remember) Top")
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
Support for X11's XEmbed protocol. This means, you can embed emacs in other apps.
Thanks to all the Emacs developers.