pavement

Emacs

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
 
m (Add Vim in the editor list)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[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 is difficult to learn to use for most, but those who do often grow enamored of it's versatility.
+
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: [[vi]], [[joe]], [[ee]] (aka [[edit]]), [[nano]] and [[pico]].
+
Other text editors commonly found on BSD systems: [[vi]], [[joe]], [[ee]] (aka [[edit]]), [[nano]], [[vim]] and [[pico]].
 +
 
 +
== Using Emacs ==
 +
=== Commands ===
 +
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 [[modifier key|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 <code>a</code> to insert the character ''a'' involves calling a function -- in this case, <code>self-insert-command</code>.
 +
 
 +
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''.
 +
{|border="1" cellpadding="5" cellspacing="0" align="center"
 +
| '''Command'''
 +
| '''Keystroke'''
 +
| '''Description'''
 +
|-
 +
|<code>forward-word</code>
 +
|<code>M-f</code>
 +
|Move forward past one word.
 +
|-
 +
|<code>undo</code>
 +
|<code>C-/</code>
 +
|Undo last change, and prior changes if pressed repeatedly.
 +
|-
 +
|<code>keyboard-quit</code>
 +
|<code>C-g</code>
 +
|Abort the current command.
 +
|-
 +
|<code>fill-paragraph</code>
 +
|<code>M-q</code>
 +
|[[Word wrap|Wrap]] text in ("fill") a paragraph.
 +
|-
 +
|<code>save-buffer</code>
 +
|<code>C-x C-s</code>
 +
|Save the current text into a file.
 +
|-
 +
|<code>save-buffers-kill-emacs</code>
 +
|<code>C-x C-c</code>
 +
|Offer to save changes, then exit Emacs.
 +
|}
 +
Note that the commands <code>save-buffer</code> and <code>save-buffers-kill-emacs</code> use ''multiple'' modified keystrokes. For example, <code>C-x C-c</code> 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 [[Microsoft_Visual_Studio|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 [[GNU Compiler Collection|gcc]] for program compilation), parsing the program's output, and displaying the result in Emacs.
 +
 
 +
==References==
 +
*[[Richard Stallman|Stallman, Richard M.]] (1981). ''EMACS: The Extensible, Customizable, Self-Documenting Display Editor''. Cambridge Massachusetts: MIT. MIT Artificial Intelligence Laboratory publication AIM-519A. [ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-519A.pdf PDF] [http://www.gnu.org/software/emacs/emacs-paper.html HTML]
 +
* Stallman, Richard M. (2002). ''GNU Emacs Manual. 15th edition''. GNU Press ISBN 1-882114-85-X.
 +
*[[Robert J. Chassell|Chassell, Robert J.]] (2004). ''An Introduction to Programming in Emacs Lisp''. GNU Press ISBN 1-882114-56-6.
 +
 
 +
==External links==
 +
*[http://en.wikipedia.org/wiki/Emacs Wikipedia.org's Emacs article]
 +
*[http://www.gnu.org/software/emacs/emacs.html The GNU Emacs homepage]
 +
*[http://www.xemacs.org/ The XEmacs homepage]
 +
*[http://www.emacswiki.org/ Emacs users' wiki]
 +
*[http://www.multicians.org/mepap.html ''Multics Emacs: The History, Design and Implementation'']
 +
*[http://www.livingtorah.org/~csebold/emacs/why.phtml ''Why I Became An Emacs User'']
 +
*[http://www.finseth.com/~fin/emacs.html List of Emacs implementations]
 +
*[http://www.finseth.com/craft ''The Craft of Text Editing or Emacs for the Modern World'']
 +
*[http://www.jwz.org/doc/emacs-timeline.html An Emacs timeline]
 +
*[http://www.ntu.edu.sg/home5/PG04878518/EmacsName.html The name for Emacs (Humour)]
 +
*[http://www.lisp.org/humor/ai-koans.html Another name-related humor page]
  
 
[[Category : Ports and Packages]]
 
[[Category : Ports and Packages]]
 
[[Category : System Commands]]
 
[[Category : System Commands]]

Latest revision as of 16:41, 9 July 2005

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.

Contents

[edit] Using Emacs

[edit] Commands

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.

[edit] References

[edit] External links

Personal tools