From FreeBSDwiki
Revision as of 15:41, 9 July 2005 by Smortex (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

emacs, written by Richard M. Stallman, is a text editor on crack. It has many modules -- sort of like plug-ins -- that allow you to do all sorts of stuff while still editing (e.g., checking your email.) (It should be noted, however, that despite its muscularity it still is primarily a text editor, not a word processor.) It is difficult to learn to use for most, but those who do often grow enamored of its versatility.

Other text editors commonly found on BSD systems: vi, joe, ee (aka edit), nano, vim and pico.


Using Emacs


In the normal editing mode, Emacs behaves just like other text editors: the character keys (a, b, c, 1, 2, 3, etc.) insert the corresponding characters, the arrow keys move the editing point, backspace deletes text, and so forth. Other commands are invoked with modified keystrokes, using the control key and/or the meta key/alt key. Every editing command is actually a call to a function in the Emacs Lisp environment. Even a command as simple as typing a to insert the character a involves calling a function -- in this case, self-insert-command.

Some of the basic commands are shown below. The control key is denoted by a capital C, and the meta or alt key by a capital M.

Command Keystroke Description
forward-word M-f Move forward past one word.
undo C-/ Undo last change, and prior changes if pressed repeatedly.
keyboard-quit C-g Abort the current command.
fill-paragraph M-q Wrap text in ("fill") a paragraph.
save-buffer C-x C-s Save the current text into a file.
save-buffers-kill-emacs C-x C-c Offer to save changes, then exit Emacs.

Note that the commands save-buffer and save-buffers-kill-emacs use multiple modified keystrokes. For example, C-x C-c means: while holding down the control key, press x; then, while holding down the control key, press c. This technique, allowing more commands to be bound to the keyboard than with the use of single keystrokes alone, first appeared in Emacs. It has since made its way into modern code editors like Visual Studio.

When Emacs is running a graphical interface, many commands can be invoked from the menubar or toolbar instead of using the keyboard. However, many experienced Emacs users prefer to use the keyboard anyway, because it is faster and more convenient once the necessary keystrokes have been memorized.

Some Emacs commands work by invoking an external program (such as ispell for spell-checking or gcc for program compilation), parsing the program's output, and displaying the result in Emacs.


External links

Personal tools