Emacs: Difference between revisions
Clarification: Emacs are unrelated to eMacs |
Marudubshinki (talk | contribs) m robot interwiki standardization |
||
Line 1: | Line 1: | ||
{{ |
{{mergeto|Emacs}} |
||
{{featured article}} |
|||
{{Emacs}} |
|||
{{Infobox_Software2 |
|||
:''This article is about the [[text editor]]. For the unrelated [[Apple Computer|Apple]] [[Apple Macintosh|Macintosh]] [[computer]] model, see [[eMac]].'' |
|||
|logo = [[Image:Emacs_logo.png|24px|Emacs logo]] |
|||
|name = GNU Emacs |
|||
|screenshot =[[Image:Emacs-GTK.png|200px|]] |
|||
|caption = The GNU Emacs interface, running in a graphical environment. |
|||
|developer = [[GNU Project]] |
|||
|operating_system = [[Cross-platform]] |
|||
|genre = [[Text editor]] |
|||
|license = [[GNU General Public License|GPL]] |
|||
|website = [http://www.gnu.org/software/emacs/ www.gnu.org/software/emacs/] |
|||
}} |
|||
{{Emacs}} |
|||
'''GNU Emacs''' is one of the two most popular versions of the [[Emacs]] text editor. The GNU Emacs manual describes it as "the extensible, customizable, self-documenting, real-time display editor." |
|||
'''Emacs''' refers to a class of [[text editor]]s, possessing an extensive set of features, that are popular with [[computer programmer]]s and other technically proficient computer users. The original EMACS, a set of '''''E'''ditor '''MAC'''ro'''S''''' for the [[Text Editor and Corrector|TECO]] editor, was written in 1975 by [[Richard Stallman]], initially put together with [[Guy L. Steele, Jr.|Guy Steele]]. It was inspired by the ideas of TECMAC and TMACS, a pair of TECO-macro editors written by Guy Steele, [[Dave Moon]], [[Richard Greenblatt (programmer)|Richard Greenblatt]], [[Charles Frankston]], and others. Many versions of Emacs have appeared over the years, but nowadays there are two that are commonly used: [[GNU Emacs]], started by [[Richard Stallman]] in 1984 and still maintained by him, and [[XEmacs]], a [[Fork (software development)|fork]] of GNU Emacs which was started in 1991 and has remained mostly compatible. Both use a powerful extension language, [[Emacs Lisp]], that allows them to handle tasks ranging from [[computer programming|writing]] and [[compiler|compiling]] [[computer program]]s to [[web browser|browsing the web]]. |
|||
Since so much of the user interface of GNU Emacs and [[XEmacs]] is the same, a combined introduction is available in [[Emacs]]. |
|||
In [[Unix]] culture, Emacs is one of the two main contenders in the traditional [[editor war]]s, the other being [[vi]]. |
|||
== |
==Distribution== |
||
GNU Emacs is [[free software]], distributed under the terms of the [[GNU General Public License|GNU GPL]]. |
|||
Emacs began life at the [[MIT AI Lab]] during the 1970s. Before its introduction, the default editor on the [[Incompatible Timesharing System]] (ITS), the [[operating system]] on the AI Lab's [[PDP-6]] and [[PDP-10]] computers, was a [[line editor]] known as [[Text Editor and Corrector|TECO]]. Unlike modern text editors, TECO treated typing, editing, and document display as separate modes, like the later vi would. Typing characters into TECO did not place those characters directly into a document; one had to write a series of instructions in the TECO command language telling it to enter the required characters, during which time the edited text was not displayed on the screen. This behavior is similar to the program [[ed (UNIX)|ed]], which is still in use. |
|||
The source code and binaries are available via [[File Transfer Protocol|FTP]] from the GNU project website (see below). They are also widely available from other sites on the [[Internet]]. Vendors of [[Unix]] systems, both free and proprietary, frequently provide Emacs bundled with the [[operating system]]. |
|||
Richard Stallman visited the [[Stanford AI Lab]] in 1974 or 1972 and saw the lab's "E" editor. |
|||
The editor had an intuitive [[WYSIWYG]] behavior as is used almost universally by modern text editors. Impressed by this feature, Stallman returned to MIT where Carl Mikkelsen, one of the [[Hacker|hackers]] at the AI Lab, had added a display-editing mode called "Control-R" to [[Text Editor and Corrector|TECO]], allowing the screen display to be updated each time the user entered a keystroke. Stallman reimplemented this mode to run efficiently, then added a [[Macro|macro]] feature to the TECO display-editing mode, allowing the user to redefine any keystroke to run a TECO program. |
|||
GNU Emacs runs on a large number of platforms, including [[Linux|GNU/Linux]], [[FreeBSD]], most other variants of [[Unix]], [[Mac OS 8]]/[[Mac OS 9|OS 9]], [[Mac OS X]], and [[Microsoft Windows]]. |
|||
The new version of TECO was instantly popular at the AI Lab, and soon there accumulated a large collection of custom macros, whose names often ended in "MAC" or "MACS", which stood for "macros". Two years later, [[Guy L. Steele, Jr.|Guy Steele]] took on the project of unifying the overly-diverse keyboard command sets into a single set. After one night of joint hacking by Steele and Stallman, the latter finished the implementation, which included facilities for extending and documenting the new macro set. The resulting system was called EMACS, which stood for "Editing MACroS". According to Stallman, he picked the name Emacs "because <nowiki><E></nowiki> was not in use as an abbreviation on ITS at the time." It has also been pointed out that "[[Emack & Bolio's]]" was the name of a popular [[Ice cream|ice cream]] store in [[Boston, Massachusetts|Boston]], within walking distance of MIT. A text-formatting program used on ITS was later named BOLIO by [[Dave Moon]], who frequented that store. However, Stallman did not like that ice cream, and did not even know of it when choosing the name "Emacs"; this ignorance is the basis of a [[Hacker koan]], [[Hacker koan#Emacs and Bolio|''Emacs and Bolio'']]). |
|||
==Development== |
|||
Stallman realized the danger of too much customization and de-facto forking and set certain conditions for usage. He later wrote: |
|||
GNU Emacs is part of the [[GNU|GNU project]], and is under active development. Several, but not all, of the developers are affiliated with the [[Free Software Foundation]] (FSF). |
|||
:''"EMACS was distributed on a basis of communal sharing, which means all improvements must be given back to me to be incorporated and distributed."'' |
|||
[[As of 2004]], the latest release of GNU Emacs is version 21.4. Development takes place in a single CVS trunk, which is at version 22.0.50. The current maintainer is [[Richard Stallman]]. |
|||
The original Emacs, like TECO, ran only on the PDP-10. Many Emacs-like editors were written in the following years for other computer systems, including SINE (Sine is not EMACS), EINE ("EINE Is Not EMACS") and ZWEI ("ZWEI Was EINE Initially", for the [[Lisp machine]]), which were written by Michael McMahon and Daniel Weinreb. (Those names mean "one" and "two" in German, respectively.) In 1978, [[Bernard Greenberg]] wrote [[Multics]] Emacs at [[Honeywell]]'s Cambridge Information Systems Lab. Multics Emacs was written in [[Maclisp]], a dialect of the [[Lisp programming language]]. User-supplied extensions were also written in Lisp. The choice of Lisp provided more extensibility than ever before, and has been followed by most subsequent emacsen. |
|||
Until [[1999]], GNU Emacs development was relatively closed, to the point where it was used as an example of the "Cathedral" development style in ''[[The Cathedral and the Bazaar]]''. The project has since adopted a public development mailing list and anonymous [[Concurrent Versions System|CVS]] access. As with all GNU projects, it remains policy to accept significant code contributions only if the [[copyright]] holder assigns the code's copyright to the FSF, although one exception was made to this policy for the [[MULE]] (MULtilingual Extension, which handles [[Unicode]] and more advanced methods of dealing with other languages' scripts) code [http://mail.gnu.org/archive/html/bug-gnu-emacs/2000-09/msg00065.html] since the copyright holder is the Japanese government and copyright assignment was not possible. This does not apply to extremely minor code contributions or bug fixes. There is no strict definition of minor, but as a guideline less than 10 lines of code is considered minor. This policy is intended to facilitate [[copyleft]] enforcement, so that the FSF can defend the software in a court case if one arises. This requirement by the GNU Emacs maintainers is assumed to affect contributions. Some people claim that it even affects performance, e.g. the inability of GNU Emacs to handle large files in an efficient manner could be blamed on the mentioned requirement repelling any serious developer. However, according to Stallman, it is more important for the program to be "free" than good in any other aspect. Enforcement provides legal confidence in the GNU Emacs [[free software license]]—the [[GNU General Public License]]—and in the free software itself—an intellectual work with many copyrights and contributors. |
|||
Although EMACS was built on TECO, its behavior was different enough to be considered a text editor in its own right. It quickly became the standard editing program on ITS. It was also [[Porting|ported]] from ITS to the [[TOPS-20|Tenex]] and [[TOPS-20]] operating systems by Michael McMahon, but not Unix, initially. The first Emacs-like editor to run on [[Unix]] was [[Gosling Emacs]], written in 1981 by [[James Gosling]] (who later invented the [[Java programming language]]). It was written in [[C programming language|C]] and, notably, used a language with Lisp-like syntax known as [[Mocklisp]] as an extension language. In 1984 it was [[Proprietary software|proprietary software]]. |
|||
[[Image:Emacs-GTK.png|thumb|right|300px|The [[GNU Emacs]] interface, running in a graphical environment.]] |
|||
In 1984, Stallman began working on [[GNU Emacs]] to produce a [[free software]] alternative to Gosling Emacs; initially it was based on Gosling Emacs, but Stallman replaced the Mocklisp interpreter at its heart with a true Lisp interpreter, which entailed replacing nearly all of the code. It became the first program released by the nascent [[GNU|GNU project]]. GNU Emacs is written in C and provides [[Emacs Lisp]] (itself implemented in C) as an extension language. The first widely-distributed version of GNU Emacs was 15.34, which appeared in 1985. (Versions 2 through 12 never existed. Earlier versions of GNU Emacs had been numbered "1.x.x", but sometime after version 1.12 the decision was made to drop the "1", as it was thought the major number would never change. Version 13, the first public release, was made on March 20, 1985.) |
|||
Like Gosling Emacs, GNU Emacs ran on Unix; however, GNU Emacs had more features, in particular a full-featured Lisp as extension language. As a result, it soon replaced Gosling Emacs as the ''de facto'' Emacs editor on Unix. |
|||
Beginning in 1991, Lucid Emacs was developed by [[Jamie Zawinski]] and others at Lucid Inc., based on an early alpha version of GNU Emacs 19. The codebases soon diverged, and the separate development teams gave up trying to merge them back into a single program. This was one of the most famous early [[Fork (software development)|forks]] of a [[free software]] program. Lucid Emacs has since been renamed [[XEmacs]]; it and GNU Emacs remain the two most popular varieties in use today. |
|||
Some people make a distinction between the capitalized word ''Emacs'', which is used to refer to editors derived from versions created by Richard Stallman (particularly GNU Emacs and XEmacs), and the lower-case word ''emacs'', which is used to refer to the large number of independent emacs reimplementations. The word ''emacs'' is often pluralized as ''emacsen'' by analogy with ''oxen'' — for example, [[Debian]]'s basic Emacs package is named <CODE>emacsen-common</CODE>. The only plural given by the ''Collins English Dictionary'' is emacsen. [http://groups.google.com/group/comp.emacs/msg/23791b9653685c08] |
|||
GNU Emacs was initially targeted at computers with a 32-bit flat address space, and at least 1 [[Mebibyte|MiB]] of RAM, at a time where such computers were considered high end. This left an opening for smaller reimplementations. Some noteworthy ones are listed here: |
|||
*[[MicroEMACS]], a very portable implementation originally written by Dave Conroy and further developed by Daniel Lawrence, which exists in many variations. The editor used by [[Linus Torvalds]]. |
|||
*[[Mg (editor)|MG]], originally called MicroGNUEmacs, an offshoot of MicroEMACS intended to more closely resemble GNU Emacs. Now installed by default on [[OpenBSD]]. |
|||
* JOVE (Jonathan's Own Version of Emacs), a non-programmable Emacs implementation for [[UNIX-like]] systems by Jonathan Payne. |
|||
*[[Freemacs]], a [[DOS]] version with a stack based extension language, all within the original 64 [[Kibibyte|KiB]] flat memory limit. |
|||
==Features== |
|||
The remainder of this article discusses GNU Emacs and XEmacs, the only incarnations of Emacs that are widely used today. The term "Emacs" will be used to refer to both programs, as they have very similar features; XEmacs started as a fork of GNU Emacs, and subsequent versions have remained more or less compatible with GNU Emacs. |
|||
In spite of—or perhaps because of—its venerable background, Emacs is one of the most powerful and versatile text editors in existence. It should be noted that it is primarily a ''text'' editor, not a [[Word processor|word processor]]; its huge feature set is geared toward helping the user to manipulate pieces of text, rather than manipulating the [[Typeface|font]] of the characters or printing documents (though Emacs can do these as well). Emacs brings a host of features to bear on the deceptively simple-seeming task of text editing, ranging from commands to manipulate [[Word (linguistics)|word]]s and [[paragraph]]s (deleting them, moving them, moving through them, and so forth), to [[syntax highlighting]] for making [[source code]] easier to read, to executing "keyboard macros" for performing arbitrary batches of editing commands defined by the user. |
|||
The rich variety of features found in Emacs is a result of its unusual design. Almost all of the functionality in the editor, ranging from basic editing operations such as the insertion of characters into a document to the configuration of the user interface, is controlled by a dialect of the [[Lisp programming language]] known as [[Emacs Lisp]]. In this Lisp environment, [[Variable|variables]] and even entire [[subroutine|functions]] can be modified on the fly, without having to recompile or even restart the editor. As a result, the behavior of Emacs can be modified almost without limit, either directly by the user, or (more commonly) by loading bodies of Emacs Lisp code known variously as "libraries", "packages", or "extensions". |
|||
Emacs contains a large number of Emacs Lisp libraries, and more "third-party" libraries can be found on the [[Internet]]. Many libraries implement computer programming aids, reflecting Emacs' popularity among programmers. Emacs can be used as an [[Integrated_development_environment|Integrated Development Environment]] (IDE), allowing programmers to edit, [[Compiler|compile]], and [[Debugging|debug]] their code within a single interface. Other libraries perform more unusual functions. A few examples are listed below: |
|||
*Calc, a powerful numerical [[calculator]] |
|||
*Calendar-mode, for keeping appointment calendars and diaries |
|||
*Doctor, an implementation of [[ELIZA]] that performs basic [[Carl Rogers|Rogerian]] [[psychotherapy]] |
|||
*[[Dunnet (game)|Dunnet]], a [[Interactive fiction|text adventure]] |
|||
*[[Ediff]], for working with [[diff]] files interactively. |
|||
*[[Emerge]], for comparing files and combining them |
|||
*[[Emacs/W3]], a [[web browser]] |
|||
*[[ERC (software)|ERC]], an [[Internet Relay Chat|IRC]] client |
|||
*[[Gnus]], a full-featured [[News client|newsreader]] and [[email client]] |
|||
*[[MULE]], MultiLingual extensions to Emacs, allowing editing text written in multiple languages, somewhat analogous to [[Unicode]] |
|||
*[[Texinfo|Info]], an online help-browser |
|||
*[[Emacs-wiki]], LISP based wiki software for Emacs |
|||
*[[Planner (PIM for Emacs)]], A Personal Information Manager ([[PIM]]) for Emacs |
|||
*[[Tetris]] |
|||
*[[Pong]] |
|||
The downside to Emacs' Lisp-based design is a performance overhead resulting from loading and [[interpreter (computing)|interpreting]] the Lisp code. On the systems in which Emacs was first implemented, Emacs was often noticeably slower than rival text editors. Several joke acronyms allude to this: ''Eight Megabytes And Constantly Swapping'' (from the days when eight [[megabyte]]s was a lot of memory), ''Emacs Makes A Computer Slow'', and ''Eventually [[Malloc]]s All Computer Storage''. However, modern computers are fast enough that Emacs is seldom felt to be slow. In fact, Emacs starts up more quickly than most modern word processors. Other joke acronyms describe the user interface: ''Escape Meta Alt Control Shift''. |
|||
===Platforms=== |
|||
Emacs is one of the most [[porting|ported]] non-trivial computer programs in the world. It runs on a wide variety of [[operating system]]s, including most [[Unix]]-like systems ([[Linux|GNU/Linux]], the various [[Berkeley Software Distribution|BSDs]], [[Solaris Operating Environment|Solaris]], [[AIX operating system|AIX]], [[IRIX]], [[Mac OS X]], etc.), [[MS-DOS]], [[Microsoft Windows]] and [[OpenVMS]]. |
|||
Emacs runs on both [[text terminal]]s and [[graphical user interface]] (GUI) environments. On [[Unix]]-like operating systems, Emacs uses the [[X Window System]] to produce its GUI, either directly or using a "widget toolkit" such as [[Motif (widget toolkit)|Motif]], [[LessTif]], or [[GTK+]]. Emacs can also use the native graphical systems of Mac OS X (using the [[Carbon (API)|Carbon]] interface) and [[Microsoft Windows]]. The graphical interface provides [[menubar]]s, [[toolbar]]s, [[scrollbar]]s, and [[context menu]]s. |
|||
===Editing modes=== |
|||
Emacs adapts its behavior to the type of text it is editing by entering editing modes called "major modes". Major modes are defined for ordinary text files, [[source code]] for many [[programming language]]s, [[HTML]] documents, [[TeX]] and [[LaTeX]] documents, and many other types of text. Each major mode tweaks certain Emacs Lisp variables to make Emacs behave more conveniently for the particular type of text. In particular, they usually implement [[syntax highlighting]], using different fonts or colors to display [[keyword]]s, [[comment]]s, and so forth. Major modes also provide special editing commands; for example, major modes for programming languages usually define commands to jump to the beginning and the end of a function. |
|||
The behavior of Emacs can be further customized using "minor modes". While only one major mode can be associated with a buffer at a time, multiple minor modes can be simultaneously active. For example, the major mode for the C programming language defines a different minor mode for each of the popular [[indent style]]s. |
|||
===Customization=== |
|||
Many users of Emacs customize the editor to suit their needs. There are three primary ways to customize Emacs. The first is the ''customize'' extension, which allows the user to set common customization variables, such as the colour scheme, using a graphical interface. This is intended for Emacs beginners who do not want to work with Emacs Lisp code. |
|||
The second is to collect keystrokes into [[macro#Keyboard_macros|macros]] and replay them to automate complex, repetitive tasks. This is often done on an ad-hoc basis and each macro discarded after use, although macros can be saved and invoked at need. |
|||
The third method for customizing Emacs is using Emacs Lisp. Usually, user-supplied Emacs Lisp code is stored in a file called <code>.emacs</code>, which is loaded when Emacs starts up. The <code>.emacs</code> file is often used to set variables and [[Binding (computer science)|key bindings]] different from the default setting, and to define new commands that the user finds convenient. Many advanced users have <code>.emacs</code> files hundreds of lines long, with idiosyncratic customizations that cause Emacs to diverge wildly from the default behavior. |
|||
If a body of Emacs Lisp code is generally useful, it is often packaged as a library and distributed to other users. Many such third-party libraries can be found on the Internet; for example, there is a library called [[Wikipedia:Wikipedia-mode.el|wikipedia-mode]] for editing [[Wikipedia:How to edit a page#The wiki markup|Wikipedia articles]]. There is even a [[Usenet]] [[newsgroup]], [news://gnu.emacs.sources gnu.emacs.sources], which is used for posting new libraries. Some third-party libraries eventually make their way into Emacs, thus becoming a "standard" library. |
|||
===Documentation=== |
|||
The first Emacs included a powerful ''help'' library that can display the documentation for every single command, variable, and internal function. (It may have originated this technique.) <!-- can anyone find out for sure? -- rms --> Because of this, Emacs was described as "self-documenting". (This term does not mean that Emacs writes its own documentation, but rather that it presents its own documentation to the user.) This feature makes Emacs' documentation very accessible. For example, the user can find out about the command bound to a particular keystroke simply by entering <code>C-h k</code> (which runs the command <code>describe-key</code>), followed by the keystroke. Each function included a documentation string, specifically to be used for showing to the |
|||
user on request. The practice of giving functions documentation strings subsequently spread to various programming |
|||
languages such as [[Lisp programming language|Lisp]] and [[Java language|Java]]. |
|||
The Emacs ''help'' system is useful not only for beginners, but also for advanced users writing Emacs Lisp code. If the documentation for a function or variable is not enough, the ''help'' system can be used to browse the Emacs Lisp source code for both built-in libraries and installed third-party libraries. It is therefore very convenient to program in Emacs Lisp using Emacs itself. |
|||
Apart from the built-in documentation, Emacs has an unusually long, detailed and well-written [[manual]]. An electronic copy of the ''GNU Emacs Manual'', written by Richard Stallman, is included with GNU Emacs and can be viewed with the built-in [[Texinfo|Info]] browser. XEmacs has a similar manual, which forked from the GNU Emacs Manual at the same time as the XEmacs software. Two other manuals, the ''Emacs Lisp Reference Manual'' by Bill Lewis, Richard Stallman, and Dan Laliberte, and ''Programming in Emacs Lisp'' by Robert Chassell, are also included. Apart from the electronic versions, all three manuals are also available in book form, published by the [[Free Software Foundation]]. |
|||
Emacs also has a built-in [[tutorial]]. When Emacs is started with no file to edit, it displays instructions for performing simple editing commands and invoking the tutorial. |
|||
===Internationalization=== |
|||
Emacs supports the editing of text written in many [[Language|human languages]]. There is support for many alphabets, scripts, writing systems, and cultural conventions. Emacs provides spell checking for many languages by calling external programs such as [[ispell]]. Many [[Character encoding|encoding systems]], including [[UTF-8]], are supported. XEmacs version 21.5 has partial [[Unicode]] support. Emacs 21.4 has similar support; Emacs 22 will be better. All of these efforts use an Emacs-specific encoding internally, necessitating conversion upon load and save. [[UTF-8]] will become the Emacs-internal encoding in some later version of XEmacs 21.5, and likely in Emacs 23. |
|||
However, the Emacs user interface is in English, and has not been translated into any other language, with the exception of the beginners' tutorial. |
|||
For visually impaired and blind users, there is a subsystem called ''[[Emacspeak]]'' which allows the editor to be used through audio feedback only. |
|||
==License== |
|||
The source code, including both the C and Emacs Lisp components, is freely available for examination, modification, and redistribution, under the terms of the [[GNU General Public License]] (GPL). Older versions of the GNU Emacs documentation were released under an ad-hoc license which required the inclusion of certain text in any modified copy. In the GNU Emacs user's manual, for example, this included how to obtain GNU Emacs and Richard Stallman's political essay "[[GNU Manifesto|The GNU Manifesto]]". The XEmacs manuals, which were inherited from older GNU Emacs manuals when the fork occurred, have the same license. The newer versions of the GNU Emacs documentation, meanwhile, uses the [[GNU Free Documentation License]] and makes use of "invariant sections" to require the inclusion of the same documents, additionally requiring that the manuals proclaim themselves as ''GNU Manuals''. |
|||
==Using Emacs== |
|||
===Commands=== |
|||
From the Unix shell, a file can be opened for editing by typing "emacs [filename]". If the filename you entered does not exist a file will be created with that name. For example "emacs xorg.conf" will edit the xorg.conf file in the current directory, if it exists. However, Emacs documentation recommends starting Emacs without a file name, to avoid the bad habit of starting a separate Emacs for each file you edit. Visiting all files in a single Emacs process is the way to get the full benefit of 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 [[modifier key|modified keystrokes]], pressing the [[control key]] and/or the [[meta key]]/[[alt key]] in conjunction with a regular 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 [Ctrl] is denoted by a capital ''C'', and the meta or alt [Alt] key by a capital ''M'''''. |
|||
{| class="wikitable" |
|||
! Command |
|||
! Keystroke |
|||
! Description |
|||
|- |
|||
|<code>forward-word</code> |
|||
|<code>M-f</code> |
|||
|Move forward past one word. |
|||
|- |
|||
|<code>search-word</code> |
|||
|<code>C-s</code> |
|||
|Search a word in the buffer. |
|||
|- |
|||
|<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>find-file</code> |
|||
|<code>C-x C-f</code> |
|||
|Visit a file (you specify the name) in its own editor buffer. |
|||
|- |
|||
|<code>save-buffer</code> |
|||
|<code>C-x C-s</code> |
|||
|Save the current editor buffer in its visited file. |
|||
|- |
|||
|<code>save-with-newname</code> |
|||
|<code>C-x C-w</code> |
|||
|Save the current editor buffer as a file with the name you specify. |
|||
|- |
|||
|<code>save-buffers-kill-emacs</code> |
|||
|<code>C-x C-c</code> |
|||
|Offer to save changes, then exit Emacs. |
|||
|- |
|||
|<code>set-marker</code> |
|||
|<code>C-[space]</code> |
|||
|Set a marker from where you want to cut or copy. |
|||
|- |
|||
|<code>cut</code> |
|||
|<code>C-w</code> |
|||
|Cut all text between the marker and the cursor. |
|||
|- |
|||
|<code>copy</code> |
|||
|<code>M-w</code> |
|||
|Copy all text between the marker and the cursor. |
|||
|- |
|||
|<code>paste</code> |
|||
|<code>C-y</code> |
|||
|Paste text from the emacs clipboard |
|||
|} |
|||
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, was popularized by Emacs, which got it from TECMAC, one of the TECO macro collections that immediately preceded 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 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. |
|||
===The minibuffer=== |
|||
The ''minibuffer'', normally the bottommost line, is where Emacs requests information. |
|||
Text to target in a search, the name of a file to read or save, and similar information |
|||
is entered in the minibuffer. When applicable, [[tab completion]] is usually available. |
|||
===File management and display=== |
|||
Emacs keeps text in objects called ''buffers''. The user can create new buffers and dismiss unwanted ones, and several buffers can exist at the same time. Most buffers contain text loaded from [[Binary and text files|text files]], which the user can edit and save back to disk. Buffers are also used to store temporary text, such as the documentation strings displayed by the ''help'' library. |
|||
In both text terminal and graphical modes, Emacs is able to split the editing area into separate sections (referred to since 1975 as "windows", which can be confusing on systems that have another concept of "windows" as well), so that more than one buffer can be displayed at a time. This has many uses. For example, one section can be used to display the [[source code]] of a program, while another displays the results from compiling the program. In graphical environments, Emacs can also launch multiple [[window (computing)|graphical-environment windows]], known as "frames" in the context of Emacs. |
|||
===Emacs Pinky=== |
|||
Because of Emacs' dependence on the modifier keys and their being pushed with the [[Little finger|pinky finger]], heavy Emacs users have experienced pain in their pinky fingers (see [[repetitive strain injury]]). This has been dubbed the "Emacs Pinky", and [[vi]] advocates often cite it as a reason to switch to vi. To alleviate this situation, many Emacs users transpose the left control key and the left caps-lock key or define both as control keys. There are also [[Computer keyboard|keyboards]] available which reduce the strain by moving the modifier keys altogether so that they are in a position to be easily pushed by the [[thumb]]. |
|||
==See also== |
|||
{{portalpar|Free software}} |
|||
*[[List of text editors]] |
|||
*[[Comparison of text editors]] |
|||
*[[Wikipedia:Text editor support#GNU Emacs|Editing Wikipedia articles with Emacs]] |
|||
*[[Emacs-wiki]] |
|||
*[[GNU TeXmacs]] |
|||
*[[List of Unix programs]] |
|||
==References== |
==References== |
||
*Stallman, Richard M. (2002). ''GNU Emacs Manual''. 15th edition Boston, Massachusetts: Free Software Foundation. ISBN 1-882114-85-X. |
|||
<div class="references-small"> |
|||
*Cameron, Debra; Elliott, James; Loy, Marc. (December 2004). ''Learning GNU Emacs'', 3rd edition. O'Reilly & Associates. ISBN 0596006489. |
|||
* {{cite book |
|||
*Glickstein, Bob. (April 1997). ''Writing GNU Emacs Extensions''. O'Reilly & Associates. ISBN 1-56592-261-1. |
|||
| last = Ciccarelli |
|||
| first = Eugene |
|||
| authorlink = Eugene Ciccarelli |
|||
| year = 1978 |
|||
| title = An Introduction to the Emacs Editor |
|||
| location = Cambridge, Massachusetts |
|||
| publisher = MIT Artificial Intelligence Laboratory |
|||
| id = AIM-447 |
|||
}} |
|||
* {{cite book |
|||
| last = Stallman |
|||
| first = Richard M. |
|||
| authorlink = Richard Stallman |
|||
| year = 1979, updated 1981 |
|||
| title = EMACS: The Extensible, Customizable, Self-Documenting Display Editor |
|||
| location = Cambridge Massachusetts |
|||
| publisher = MIT Artificial Intelligence Laboratory |
|||
| id = AIM-519A |
|||
}} [ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-519A.pdf PDF] [http://www.gnu.org/software/emacs/emacs-paper.html HTML] |
|||
* {{cite book |
|||
| last = Stallman |
|||
| first = Richard M |
|||
| year = 2002 |
|||
| title = GNU Emacs Manual |
|||
| edition = 15th edition |
|||
| publisher = GNU Press |
|||
| id = ISBN 1-882114-85-X |
|||
}} |
|||
* {{cite book |
|||
| last = Chassel |
|||
| first = Robert J. |
|||
| authorlink = Robert J. Chassell |
|||
| year = 2004 |
|||
| title = An Introduction to Programming in Emacs Lisp |
|||
| publisher = GNU Press |
|||
| id = ISBN 1-882114-56-6 |
|||
}} |
|||
* {{cite book |
|||
| last = Williams |
|||
| first = Sam |
|||
| year = 2002 |
|||
| title = Free as in Freedom |
|||
| publisher = O'Reilly & Associates |
|||
| id = ISBN 0-596-00287-4 |
|||
}} |
|||
</div> |
|||
==External links== |
==External links== |
||
{{portalpar|Free software}} |
|||
{{wikiquote}} |
|||
*[http://www.gnu.org/software/emacs/emacs.html The GNU Emacs homepage] |
*[http://www.gnu.org/software/emacs/emacs.html The GNU Emacs homepage] including |
||
**[http://www.gnu.org/software/emacs/manual/ ''GNU Emacs Manual''. 15th ed. (Emacs 21.3). GNU Press, 2002] – Online version ([[HTML]] from [[texinfo]]), published under the [[GNU Free Documentation Licence|GFDL]] |
|||
*[http://www.franz.com/emacs Emacs installer for Windows] |
|||
**[http://www.gnu.org/software/emacs/emacs-lisp-intro/ ''An Introduction to Programming in Emacs Lisp'']. 2nd ed. By R. Chassell |
|||
*[http://www.emacswiki.org/ Emacs users' wiki] |
|||
**[http://www.gnu.org/software/emacs/emacs-faq.text GNU Emacs FAQ] |
|||
*[http://www.nabble.com/Emacs-f1569.html Emacs Forum] hosted by [http://www.nabble.com Nabble] archiving Emacs [http://www.gnu.org/software/emacs/#HelpMailing mailing lists] into a searchable forum. |
|||
*[http://www. |
**[http://www.gnu.org/software/emacs/windows/ntemacs.html GNU Emacs FAQ For Windows 95/98/ME/NT/XP and 2000] |
||
*[http://www.emacswiki.org/ EmacsWiki] – community site dedicated to documenting and discussing Emacs and XEmacs |
|||
<!-- *[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:GNU project software]] |
|||
[[Category:Linux text editors]] |
[[Category:Linux text editors]] |
||
[[Category:Mac OS text editors]] |
[[Category:Mac OS text editors]] |
||
Line 272: | Line 52: | ||
[[Category:Windows text editors]] |
[[Category:Windows text editors]] |
||
[[Category:File comparison tools]] |
[[Category:File comparison tools]] |
||
[[Category:Free text editors]] |
|||
[[Category:GNU project software|Emacs]] |
|||
[[Category:Emacs]] |
[[Category:Emacs]] |
||
[[Category: |
[[Category:Integrated development environments]] |
||
[[ar:إيماكس]] |
|||
[[bs:Emacs]] |
|||
[[cs:Emacs]] |
[[cs:Emacs]] |
||
[[de:Emacs]] |
[[de:Emacs]] |
||
[[es:Emacs]] |
[[es:Emacs]] |
||
[[et:Emacs]] |
|||
[[eo:Emacs]] |
[[eo:Emacs]] |
||
[[eu:GNU Emacs]] |
|||
[[fr:GNU Emacs]] |
[[fr:GNU Emacs]] |
||
[[gl:Emacs]] |
|||
[[ko:Emacs]] |
[[ko:Emacs]] |
||
[[id:Emacs]] |
|||
[[ia:Emacs]] |
[[ia:Emacs]] |
||
[[it:Emacs]] |
[[it:Emacs]] |
||
Line 294: | Line 70: | ||
[[pl:Emacs]] |
[[pl:Emacs]] |
||
[[pt:Emacs]] |
[[pt:Emacs]] |
||
[[ |
[[sv:GNU Emacs]] |
||
[[ |
[[uk:GNU Emacs]] |
||
[[fi:Emacs]] |
|||
[[sv:Emacs]] |
|||
[[vi:Emacs]] |
|||
[[tr:Emacs]] |
|||
[[zh:Emacs]] |
[[zh:Emacs]] |
||
[[uk:Emacs]] |
Revision as of 22:23, 11 July 2006
Emacs logo | |
File:Emacs-GTK.png The GNU Emacs interface, running in a graphical environment. | |
Developer(s) | GNU Project |
---|---|
Operating system | Cross-platform |
Type | Text editor |
License | GPL |
Website | www.gnu.org/software/emacs/ |
GNU Emacs is one of the two most popular versions of the Emacs text editor. The GNU Emacs manual describes it as "the extensible, customizable, self-documenting, real-time display editor."
Since so much of the user interface of GNU Emacs and XEmacs is the same, a combined introduction is available in Emacs.
Distribution
GNU Emacs is free software, distributed under the terms of the GNU GPL.
The source code and binaries are available via FTP from the GNU project website (see below). They are also widely available from other sites on the Internet. Vendors of Unix systems, both free and proprietary, frequently provide Emacs bundled with the operating system.
GNU Emacs runs on a large number of platforms, including GNU/Linux, FreeBSD, most other variants of Unix, Mac OS 8/OS 9, Mac OS X, and Microsoft Windows.
Development
GNU Emacs is part of the GNU project, and is under active development. Several, but not all, of the developers are affiliated with the Free Software Foundation (FSF).
As of 2004, the latest release of GNU Emacs is version 21.4. Development takes place in a single CVS trunk, which is at version 22.0.50. The current maintainer is Richard Stallman.
Until 1999, GNU Emacs development was relatively closed, to the point where it was used as an example of the "Cathedral" development style in The Cathedral and the Bazaar. The project has since adopted a public development mailing list and anonymous CVS access. As with all GNU projects, it remains policy to accept significant code contributions only if the copyright holder assigns the code's copyright to the FSF, although one exception was made to this policy for the MULE (MULtilingual Extension, which handles Unicode and more advanced methods of dealing with other languages' scripts) code [1] since the copyright holder is the Japanese government and copyright assignment was not possible. This does not apply to extremely minor code contributions or bug fixes. There is no strict definition of minor, but as a guideline less than 10 lines of code is considered minor. This policy is intended to facilitate copyleft enforcement, so that the FSF can defend the software in a court case if one arises. This requirement by the GNU Emacs maintainers is assumed to affect contributions. Some people claim that it even affects performance, e.g. the inability of GNU Emacs to handle large files in an efficient manner could be blamed on the mentioned requirement repelling any serious developer. However, according to Stallman, it is more important for the program to be "free" than good in any other aspect. Enforcement provides legal confidence in the GNU Emacs free software license—the GNU General Public License—and in the free software itself—an intellectual work with many copyrights and contributors.
References
- Stallman, Richard M. (2002). GNU Emacs Manual. 15th edition Boston, Massachusetts: Free Software Foundation. ISBN 1-882114-85-X.
- Cameron, Debra; Elliott, James; Loy, Marc. (December 2004). Learning GNU Emacs, 3rd edition. O'Reilly & Associates. ISBN 0596006489.
- Glickstein, Bob. (April 1997). Writing GNU Emacs Extensions. O'Reilly & Associates. ISBN 1-56592-261-1.
External links
- The GNU Emacs homepage including
- GNU Emacs Manual. 15th ed. (Emacs 21.3). GNU Press, 2002 – Online version (HTML from texinfo), published under the GFDL
- An Introduction to Programming in Emacs Lisp. 2nd ed. By R. Chassell
- GNU Emacs FAQ
- GNU Emacs FAQ For Windows 95/98/ME/NT/XP and 2000
- EmacsWiki – community site dedicated to documenting and discussing Emacs and XEmacs