Emacs 23 Features

perm url with updates: http://xahlee.org/emacs/emacs23_features.html

The following version lacks images.

New Features in Emacs 23

Xah Lee, 2009-07

This page is a list of major new features in emacs 23, released in 2009-07-30. It also includes practical tips about using the new feature. This page only list the most important or practical changes. It may miss features or changes you find important.

Editing Text

transient-mark-mode

Text selection is highlighted by default.

The command fill-paragraph (“Alt+q”) now automatically applies to the whole text selection if there is one.

Also, now you can hold down the Shift key then press arrows key to select text.

However, by default, pressing delete key will not delete the selected text. If you want this, put the following in your emacs init file:

(delete-selection-mode 1) ; make typing override text selection

visual-line-mode

Press 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.

Typing “Alt+x visual-line-mode” toggles the behavior. Or, use the menu “Options‣Line Wrapping in this Buffer‣Word Wrap (Visual Line Mode)”.

To toggle globally, type “Alt+x global-visual-line-mode”. To set it on or off permanently, use:

(global-visual-line-mode 1) ; 1 for on, 0 for off.

(info "(emacs)Visual Line Mode")

linum-mode

Now you can show line numbers on the margin, a common feature in other editors.

emacs line numbers

Emacs with linum-mode on.

To toggle it in current buffer, type “Alt+x linum-mode”. To toggle globally, type “Alt+x global-linum-mode”. To set it permanetnly, put:

(global-linum-mode 1) ; always show line numbers

Wildcard in Keyword Completion

Minibuffer's Command completion support wildcard char “*”, and also support 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.

Completion with wildcard works in minibuffer prompt whenever it makes sense. For example, when you call switch-to-buffer (C-x b), execute-extended-command (M-x), describe-function (C-h f), etc.

Note: this new completion feature applies in minibuffer only. When you are in a programing mode and pressing M-TAB for completing function names, wildcard does not apply, nor substring matching.

(info "(emacs)Completion")

In emacs 22, you can turn on partial-completion-mode or ido-mode for similar features. For some detail, see emacswiki Source.

View Whitespaces

whitespace-mode is a mode that lets you view whitespace chars such as spaces and tabs. Calling the command toggles it.

This is handy when you need to trim your whitespaces. Once you turn it on, you can call delete-trailing-whitespace, delete-blank-lines, delete-whitespace-rectangle. Or, you can use query-replace (M-%), query-replace-regexp (C-M-%), to replace white spaces. To insert a tab char, press “Ctrl+q Tab”. To type a newline char, type “Ctrl+q Ctrl+j”.

New Font Engine

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. (Keith Packard))

emacs23 font selection dialog

The font selection dialogue in Emacs 23 on Windows. Emacs now uses operating system's fonts.

emacs22 vs emacs23 font

Font rendering in Emacs 22 and Emacs 23. The top is emacs 22 compiled normally with X11 support, running in Mac OS X's X11. The bottom is emacs 23 compiled “--with-ns”, for Mac OS X.

Unicode

Characters are now represented by Unicode encoding internally. Thanks to Kenichi Handa.

You can see a effect of the change by typing “Ctrl+u Ctrl+x =” (or “Alt+x universal-argument Alt+x what-cursor-position”).

Result display of typing “Ctrl+u Ctrl+x =” 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)
Result display of typing “Ctrl+u Ctrl+x =” 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)

Compare the lines “buffer code:” and “file code:” above. In emacs 23, the they are identical. Emacs 23 also includes a char's unicode name.

Emacs's new character engine does not effect daily emacs use much but is critical through out emacs. New in emacs 23 is 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 byte compiled in emacs 23 cannot run in emacs 22. However, emacs 22 byte compiled files still runs in emacs 23. 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.

Emacs autosave files will use utf-8 instead of emacs's emacs-mule encoding. This means, you can view those #autosave# files that has non-ascii chars without seeing gibberish.

The 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. Type “Alt+x ucs-insert”, then type “*star” then Tab, then emacs will list all unicode char names that has a star in it.

(info "(emacs)International")

Emacs Server/Client

Emacs can be run as a server/client. This allows you to start a 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 instances as before.

Thanks to Károly Lőrentey, Dan Nicolescu.

To launch a emacs server, type “emacs --daemon” in shell. Or, within emacs, type “Alt+x server-start”.

To start a emacs client, type “emacsclient” in shell.

You can set your environment variable “EDITOR” to “emacsclient”. Multiple clients can connects to the same server. You can also start more than one emacs server, and have client specify which server to connect to.

(info "(emacs)Emacs Server")

nxml-mode

nxml-mode by James Clark

This is a superb mode for working with XML documents. It validates your XML as you type.

(info "(nxml-mode)Top")

View System Processes

“proced” by Roland Winkler, for managing OS processes, similar to dired is managing files.

Start it by “Alt+x proced”

emacs23 proced

Emacs 23's proced mode, showing running processes.

You can click on the column at the top to sort by that. In the mode, type “Ctrl+h m” (describe-mode) 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, and 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.

Other New Modes

ruby-mode

ruby-mode by Yukihiro Matsumoto & Nobuyoshi Nakada.

doc-view-mode

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.

(info "(emacs)Document View")

Interface To GNU Privacy Guard

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 epa-” then “Tab”.

(info "(epa)Top")

Deleting Files to OS's Trash

Deleting files in emacs can now be set so that they move to the OS's trash.

(setq delete-by-moving-to-trash t) ; deleting files goes to OS's trash can

However, when this is on, your system trash will be filled with emacs temp files, such as those “#autosave#” files, “backup~” files, multiple emacs temp files named like “.emacs.desktop”, “emacs00164”, “server”, etc.

remember mode

“remember” by John Wiegley. Lets you write down notes quickly. Not sure what's the deal here, or what's the diff just writing to a file.

To start, type “M-x 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")

Linux Specific Features

Support D-BUS. This feature allows emacs to provide and receive services from other apps.

Support Xesam spec for desktop search. If you have the proper tools installed, you can invoke search by the command xesam-search.


References

Thanks to all the Emacs developers.

“Emacs 23.1 released” (2009-07-29) by Chong Yidong, on emacs-dev mailing list. http://lists.gnu.org/archive/html/emacs-devel/2009-07/msg01526.html

Official Emacs release notes: http://www.gnu.org/software/emacs/NEWS.23.1

Interview with emacs maintainer Chong Yidong and Stefan Monnier, 2009-08-03: Source.

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs