DOC PREVIEW
Berkeley COMPSCI 61B - Highlights of GNU Emacs

This preview shows page 1-2-3-4-5-6 out of 18 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

UNIVERSITY OF CALIFORNIADepartment of Electrical Engineeringand Computer SciencesComputer Science DivisionCS61B P. N. HilfingerSpring 1998Highlights of GNU EmacsThis document describes the major features of GNU Emacs (called “Emacs” hereafter), a cus-tomizable, self-documenting text editor. There are versions available for all our UNIX systems, aswell as Windows 95 and Windows NT. In the interests of truth, beauty, and justice—and to undo, insome small part, the damage Berkeley has done by foisting vi on an already-unhappy world—Emacswill be the official CS61B text editor this semester. I have spoken.Emacs carries with it on-line documentation of most of its commands, along with a tutorial forfirst-time users. Section 5 describes how to use these facilities. Because this documentation isavailable, I have not made attempted to present a complete Emacs reference manual here.To run Emacs, simply enter the commmand emacs to the shell. If you are on a Sun, it is best tobe running under X, so as to get full advantage of the window system. Within Emacs, as describedbelow, you can edit any number of files simultaneously, run UNIX shells, and compile, execute, anddebug programs. As a result, it should seldom be necessary to leave Emacs before you are ready tologout.1 Basic ConceptsAt any given time, Emacs maintains one or more buffers containing text. Each buffer may, but neednot, be associated with a file. A buffer may be associated with a UNIX process, in which case thebuffer generally contains input and output produced by that process (see, for example, sections 6and 7). Within each buffer, there is a position called the point, where most of the action takes place.Emacs displays one or more windows into its buffers, each showing some portion of the text ofsome buffer. A buffer’s text is retained even when no window displays it; it can be displayed atany time by giving it a window. Each window has its own point (as just described); when only onewindowdisplays a buffer, its point is the same as the buffer’s point. Two windows can simultaneouslydisplay text (not necessarily the same text) from the same buffer with a differentpoint in each window,although it is most often useful to use multiple windows to display multiple files. At the bottom ofeach window, Emacs displays a mode line, which generally identifies the buffer being displayed and(if applicable) the file associated with it. At any given time, the cursor, which generally marks thepoint of text insertion, is in one of the windows (called the current window) at that window’s point.34P. N. HilfingerAt the bottom of Emacs’ display is a single echo area, displaying the contents of the minibuffer.This is a one-line buffer in which one types commands. It is, for many purposes, an ordinary Emacsbuffer; standard Emacs text-editing commands for moving left or right and for inserting or deletingcharacters generally work in it. To issue a command by name, one types M-x (“meta-x”; this notationis described below) followed by the name of the command and RET (the return key); the echoarea displays the command as it is typed. It is only necessary to type as much of the commandname as suffices to identify it uniquely. For example, to run the command for looking at a UNIXmanual entry—for which the full command is M-x manual-entry—it suffices to type M-x man,followed by a RET.All Emacs commands have names, and you can issue them with M-x. You’ll invoke mostcommands, however, by using control characters and escape sequences to which these commands arebound. Almost every character typed to Emacs actually executes a command. By default, typing anyof the printable characters executes a command that inserts that character at the cursor. Many of thecontrol characters are bound to commonly-used commands (see the quick-reference guide at the endfor a summary of particularly important ones). At any time, it is possible to bind an arbitrary key orsequence of keys to an arbitrary command, thus customizing Emacs to your own tastes. Hence, alldescriptions of key bindings in this document are actually descriptions of standard or default bindings.In referringto non-graphickeys (control characters and the like), we’ll use the followingnotations.ESC denotes the escape character.DEL denotes the delete character. On HP workstations, the ‘Backspace’ key has the same effect.SPC denotes the space character.RET denotes the result of pressing the ‘Return’ key. (Confusingly, the result of typing this into afile is not a return character (ASCII code 13), but rather a linefeed character (ASCII code 10).Nevertheless, Emacs distinguishes the two keys.)LFD denotes the result of typing the linefeed key.TAB denotes the tab (also C-i) key.C-x denotes the result of control-shifting a character x.M- denotes the result of meta-shifting a character (on our HP workstations when running theX window system, either ‘Alt’ key serves as a meta-shift key; it is held down while typing x).Alternatively, one may type M- as the two-character sequence ESC followed by .C-M- denotes the result of simultaneously control- and meta-shifting x (on HP workstations whenrunningX,holddowntheAltandControlkeyssimultaneously with typing ). Alternatively,one may type ESC C- .The binding of keys to commands depends on the buffer that currently contains the cursor. Thisallows different buffers to respond to characters in different ways. In this document, we will referto the set of key bindings in effect within a given buffer as the (major) mode of that buffer (theHighlights of GNU Emacs5term “mode” is actually somewhat ill-defined in Emacs). There are certain standard modes that aredescribed in section 3.7.Certain commands take arguments, and take these arguments from a variety of sources. Anycommand may be given a numeric argument. To enter the number comprising the digits0 1as a numeric argument (0may also be a minus sign), type either ‘M-0 1’ or ‘C-u0 1’before the command. When using C-u, the digits may be omitted, in which case ‘4’ is assumed. Themost common use for numeric arguments is as repetition counts. Thus, M-4 C-n moves down fourlines and M-72 * inserts a line of 72 asterisks in the file. Other commands give other interpretations,as described below. In describing commands, we will use the notation ARG to refer to the value ofthe numeric argument, if present.When commands prompt for arguments, Emacs will often allow provide a completion


View Full Document

Berkeley COMPSCI 61B - Highlights of GNU Emacs

Documents in this Course
Lab

Lab

4 pages

Matrix

Matrix

3 pages

Numbers

Numbers

14 pages

Lectures

Lectures

12 pages

Project 1

Project 1

24 pages

Exam

Exam

8 pages

Load more
Download Highlights of GNU Emacs
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Highlights of GNU Emacs and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Highlights of GNU Emacs 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?