




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Instructions on how to edit lines and move the cursor in the Emacs text editor. It covers various commands for moving the cursor, deleting text, and inserting new lines. It also explains how to use recursive editing levels and indentation in Lisp mode.
What you will learn
Typology: Study Guides, Projects, Research
1 / 220
This page cannot be seen from the preview
Don't miss anything!
___ASIIE
4 TITEnoulogyr SquareI-
COTRL (^) to. N ICEI NAME AND ADDRESS ,-.. F3..RORTAMLZTP J_,TS
Advanced (^) Research (^) Projects (^) Agency (^) (/ (^) June 1400 Wilson Blvd 1I
0Office) It. SECURITY CLASS. (^) (of lti report,
IS. DISTRIBUTION STATEMENT (^) (of this Report)
17. DISTRIBUTION STATEMENT (^) (of the abstract enteged in Block (^) 20, It different from Repot)
None (^) '
19. KEY WORDS (^) _(Continue on rovers aide If nocmeary and_** (^) Identify by block number)
Display Editor r (^) )CCT.K.. Reference (^) Manual (^) ..,li Primer
20. ABSTRACT (Continue onireverse olds, If neoeeeapy mid Identify by block number) C...- rThis manual documents (^) the use and simple customization (^) of the display editor LU EMACS with the ITS (^) operating system. The reader is not (^) expected to be a programmer. Even (^) simple customizations do not require (^) programming skill, but the user (^) who is not interested in customizing can (^) ignore the scattered customization (^) hints. This is primarily a (^) reference manual, but can also be used (^) A primer.
DDI'Af317 (^) EDITION OF I NOV (^65) IS ONSOLETE (^) UNCLASSIFIED (^) J SECURITY CLASSIFICATION (^) OF THIS PAGE (W11hon Dere Kniered)
DISCLAIMER NOTICE
THIS DOCUMENT IS BEST QUALITY
PRACTICABLE. THE COPY FURNISHED
TO DTIC CONTAINED A SIGNIFICANT
NUMBER OF PAGES WHICH DO NOT
REPRODUCE LEGIBLY.
[A
21.1. 21.2. (^) II low low to to (^) TeilMake i'MACS a Tags^ Youile forWan,^ a^ Program to Use TAGS^101102 f
P'reface
P~reface
equ~ire programmig skill. but the uscr %%ho is not interested (^) in custoiiing call ignore thle scattcrcd cIustillid'atio1 hints.
U'his (^) is primad ly I recfeience mantii but call also be used as a primer. However, I recommend that tile newveonier first use the on-line. icarti-by-doing tutorial TF ACHEI NI ACS. by typing :IiACI I EMACS~cr> v.hik' in I IACIR N.* With it, you (^) learn FIMACS by using FMACS oni a specially designed file %liiLh decibes L 0tII Mands, tells vou wlieuiit) try thiemiad theii explains (lhe results you sce. 'Ibfis givcs aI more vivid iatlrodaLtioll than11 a printed mnalual.
Onilit scading. ou neved not make any attempt ito memome chapters~ I and 2, which desribe the flulit lm~l c' 'it cll ni )l the Ilaitana il id tIile g~el aet-. appea iance (^) of die FiMACS display screen. It is en ough to be ia.re of What questions ace anlswel ed in these chapters. so you canl relir b~ack wheni youl later bccomne
Ill find thle docunlientafion onl a pat icular command, look ill the (^) index if you know what the command is. IfIvon know (^) vaguel3 what the command does, look in (lie command index. The conunand index contains a line or talc) about each comimnd, and aI cross-reference to the sccti-m of thle manual which describes thle command it-, mtore detail. Related commands are grouped together. 11licre is aliso) a glossary, with a cross reacrence for each tei an.
The mlanlual is ;-vailable in three formns: the puli~held form, thie I III' forml, and thle I NFO forml. The
unsophisticaled harid copy devices such as terminals and line printers 'ibe INFO forain is Imi on-line perasal with the INF:O progiani. All three frms are substantiatlly the sline. Thlere are also two versions of tlie text: mte fit' us~e with I''S. and onie for use with T'wenex. DEC's "TOPS-20" system. (^) Bloth versions irc available in all Ithree forms.
I'NICS savilalefor-(list (^) rihutimn for use on Tenex and lwenex systetms (it does not nanl onI Iotionis-lO, Am h ovrinol iiot be easy). Mail usa 2400 foot (^) mag tape if you want it. It does not cost aiything
niust send back aty (^) inprocmctas you mtake ito IMACS. itaclading any libraries you write, and that you mnust not redistribuate tile system except exactly (^) as you got it, comtplete. (You canl also distribute your
I 2 IiMACS^ Manuial^ flr^ VITS^ Users
Yours in-hack :ng.
NIIT Artificial Intelligence L ab 545 Tch Sqiiarc.-n 913 Canmbridge, MIA 02139 (617) 253-
might wish to learni^ how.^ Sce^ the^ file^ INIFO;CONV^ >,for^ advicco(ilIcarning^ TECO.^ 'Ibis^ manual^ does^ not even try^ to^ explain^ how^ to^ writc^ TECO^ programs,^ but^ it^ does^ contain^ some^ notes^ which^ arc^ useful^ primarily^ to the extension writer.
T--
'The Organization of the Screen 5
1.The Organization of the Screen
i-MACS divides the .ercen into seeral areas. each of which contains itsown sorts of infornation. The bigest area. of^ course,^ is^ the^ one^ in^ which you^ usually^ see^ the^ text^ you^ are^ editing.^ 'Ile^ tenninal's^ cursor tLsu~dl) appears in the middle of the text, showing 'he position (f "point". thc location at which editing takes place. While (lie cursor appcars to point al a character, point should be thought of as beiween to characters: it points b'firie the charactcr that the cursor appears on top of. Terninals have only one cursor. and when oUtut iSiil progress it must appear where the typing is bcing done. Ibis does not mcan that point is moving. Itis onli that FNIACS has no wa. to show you the location of point except u hell^ tie^ erninal^ is^ idle.
"lhc C-X ct ullllll;liultells jou precisely %thatis in ih text. if it isnot clear frmn ii:c dipla%. (Ify p arc a beginner. don't worry if'.ou don't understand this paragralh). It prints the row and coluin ol he hx.ation of the ctursor onl the screen. and the numeric code for the charactcr after the cursor. See section IIA Iqillingi. page 47.
,llic toi lines of the screen are usually availahle for text but are sometimes pre-empted by an "error mesage". which says that sonic comnmand you giae was illegal or used improperly, or^ b)^ typeout^ from^ a command (such as. a fisting of a file directory). "lhe error message or typeout appears there for your ifrmation. but it is not part of the file you are editing, and it gos away if you -ype any command. Ifyou Want to make it go away iummiediately but not do anything else. you can type a Space. (Usuamlly a Space inserts itself. but when there is an errorn messge or typeout on the ,cren it does nothing but get rid of that.) The terininars ctror always appears at the end of the error mtesage or typeoit. but this does not mean that point has mnoted. The cursor moves back to tlhe location (if point after the error nts.a.e or typeout goes ziway.
A few lines at the botton of the screen compose what is called "the echo area". "hlihoing" means printing out the commands that you type. EIMACS commands are usually not echoed at all, but if you pause for more than a second in the middle^ of a^ nmulti-character^ command^ then^ the^ whole^ command^ (including^ what^ you have typed so far) Fs echoed. Ibis behavior is designed to give confidint users optimum response. while giving nervous users information on u h.t they arc doing.
IMACS also uses the echo area for reading and displaying the arguments for some commands. such as E searches. ad for printing hifirmation in rspomse It)ccrtai in Iads.
lhe lint above he echo area is known as the "nmiodc line". It is the line that usually starts with "I-MACS
may not bc imerprtcd intie stantlard way. "bic mode line is %cry iniportfanL and .Xyou are surprised by how lIM.\CS reacs to youir comiands you should look there for colightenmenL
I'he Organization ol the Screen 7
If "(RO)' (for "read only") appears after the filcnamlc. it mecans that if you visit anothier file ill thle same buffier thcn changes you hiavc miade to this file will bc lost unilcss you have explicitly asked to sa've them. See section 13.1 [Visiting], page 55, for niorc information. If therc is no "(RO)" and YOU Visit anlOOMe ile in the samec butffbr, EMACS will offer to save your changes First, if there arc any changcs.
T'he star at the end of the niode line means thiat there are chianges in thie buffer whiich have not been saved inthe file. If, Ithe file has nlot been chaniged sinlce it was read in or saved, there is no star.
"pos" tells you whlether there is additional text ab~ove the top of the screen, or below the b~ottom. If your File is smiall andl it is all onl the screen, --p~os-- is omnitted. Othierwise, it is --TlOP-- if you are looking at the begin n11ing of' thie ile. --130OT-- i f you are look ing atl the end of the File, or' --nnl%-- where Ill is tile Percentage of thie file aboN e the top of the screen.
Somct-nIes you will see -MORIF- instead of --imni%--. 'Ilhis happens when typeout fro coiniand is too long tfiontesienImeans that if you type a Space the next sci cenflul of in forinauion will be p~rited. If you are not interested, typing anything but at Space Will cauise thle rest 01'thle output ito be discarded. Tlyping atRuLboul will discat d thle onutput and do noth i ig else. 'I ypi ng any othier cininand will (discard the rest oif the otput and lalso do thle commiland. Wheni the output is discarded, "FH I IlI)" is printed after ticle
So mutchi foi- whiat the miode line says at top level. When the miode linc doesn't start Wilit "EMACS" and
not be un(Ieistood in thle uIsuail Way. 'Ihis is because you am'e inside a subsystem, such ats INFO (See section 6.1 [Subsystems), page 25.), or in a recursive editing level, suchI as Edit Options (See^ section^ 6. [Recursive Fditingj, page 26.). TIhe miode line tells you what commnand you are inside.
If you ar'e accustomecd to othie' display editors, you mnay be surprise() that iM ACS does not always display thle pagPe numnber and line numnbet' of^ point^ in^ the^ inode^ line.^ 'l'his^ is^ because^ tli'.^ text^ is^ stored^ iii^ a^ way^ which makes it (Iifficult to comipute this information. D isplaying themn all the timec would be too slow to be borne. When you want to know the page and line numnber' of point,^ you^ inus~t^ ask^ flor^ thle^ inibrinatiol^ Withi^ thle^ M-X What Page commnand. Sesection 18 jl1'ages], page 79. I lowevet', once you are adjusted to JEMACS, you will r'arely hiave any reason to be concerned Withi page nunlem's or line numibers..
5 __ ____ ____ ____~ 4
mg
8 I-MACS-MantladI^
for fl'S-Users
Aw
-- -A
10 VIMACS^ Manual^ tor^ ITS^ Users
distinction between ASCII Control and EMACS Control, except to realize that EMACS uses some "Control" characters which arc not on your keyboard.
In addition to the 9-bit command character set,^ there^ is^ one extra^ character^ called^ Help.^ It^ cannot^ be combined with Control or Meta. Its use is to ask for documentation, at any time. Like the the 9-bit characters, the I leip character has its own key on an ideal keyboard, but must be represented by something else on other keyboards. The circumlocution we use is Control-_ H (two characters). 'Ilic code use; internally for I^ lelp^ is4!10^ (octal). We have given some command characters special names which we always capitalize. "Return" or "<crY" stands for the carriage return character, code 015 (all charactcr codcs are in octal). Note that C-R mcans thc character Conttol-R. never Rcturn. "Rubout" is the character with code 177, labeled "l)ciete" on some kc boards. "Ahniode"^ isthe^ character^ with^ code^ 033,^ sometimes^ labeled^ ".scape".^ Other^ command char'cters with special names ac Tab (code 011). Iackspace (code 010). L.inefeed (code 012). Space (code 0140). I:xcl ("!". code 0,11). Comma (code 054), and Period (code 056). Control is represented in the numcric code for a character by 200. and Meta by 400; thus, hleta-iPeriod is code 456 in^ the^ 9-bit^ character^ set.
2.2. Prefix Characters
A non-ideal keyboard can only send certain Control characters, and may completely lack the ability to send Meta characters. 'lo use these commands on such keyboards, you need to use two-character circumlocuitioais starting with a "bit prefix" character which turns on the Control or Meta bit it, the second characicr. The Altmode character turns on the Meta bit, so Altmode X can be used to type a Meta-X. and Alunode Control-O can be used to type a C-M-O. Altnode is known as "the Metizer". Other bit prelix ch:aracters arc C-- for Control, and C-C for Control and Meta together. Thus, C-- < is a way of typing a Control-<, and C-C < can lC used to type C-M-<. Because C-^ isawkward to type on most keyboards, we ha c tried to minimize the number of cormnands For which you will need it.
There is another prefix character, Control-X which is used as the beginning of a large set of two-characier commands known as "C-X commands". C-X is not a bit prefix character, C-X A is not a circumlocution for any single characterand it mutst be typed ats two characters oil anly terminal.
~~2.3. Cotmmands, Fuctions, and Variabfles
Most o' ihe #i'MA(.'S commnlands documented herein are nicmher of this 9-hit character set. Others arc pairs of characters from that set. I lowever, I.MACS doesn't really delic commands directly. Instead, IMACS delines "fiunctiors", which have long names such as "R Down Real I.ine", and then the functions are connected to "commands" such as C-N through a dispatch table. When we say that C-'. moves the cursor
Character (^) Set and Command Input Conventions (^1)
dlown a line we ;ire glossing over a distinction %%hich is iniluportant for (^) ordinary use. but essential for customizationl: it is [lie function -R Down Real LIn.m which knows hlow to mlove (^) down at line. and C-N moves
oihe the cxtcnsion-writcr thc informnation lie necds, we statc the namic (^) of thc function which really does the "ork in parentheses after mentioning thle command name. For example: (^) "C-N (-R lDown Real in.e) moves tile cutior down ;, line". In)tile FMACS (^) wall chart, the function names arc used as a formi of vcry brief documentation for the command characters. See section 5.2 [Nunctions], (^) page 21.
The "R " whirh appears at (^) thle front oftheli functio~n name is simply part of the name. Bly convention, aj Cei maini class of, Iunct ions ham e nam11es whlich stall t with (^) "Rt"
WVhile %e are h ujcto( u~ri nbit'sWihyt (^) htl otb fgindoi' a
VillableMumle%aiabeisit Fo".A mineuse to emeber t vltic FNACS ontin variablesble .%hcharethicso (^) thiat you can change themn if you want to cuistomize. The %;triable's value is examined by %otne (^) c01mi 1,aud, and changing the valuec makes thc command behave differently. Until you are intereslcd in
inforril! on on .variables, amnd (^) thenl the information onl individual variables will make sense. See section 22. IVamiab!,s1, page 114.
2.4. Notational C'onventions for ASCII Ch1,1aces
Cont(;ol cllaracicrs, in files, your IiMAC-,S buo ich. or *UlCO programs, arc ut dinary ASCII (^) chiaractet ' and
representcd ats t IF. *1 he special 9-bit character set applies only to typing FIMACS commands.
single .* aracter, but i'CO t-ode must deal wvith thle realities. A return or atlinefeed which is not part of it CR!iscaled Stry".IiACS (^) tusualiy trca.,s mhem as part of thie line and displays themn as TM and -ti.
Other A.CII charactzrs with special names include tab (control-I, 01l), backspace (controi-l-l, 010), uimifeel ;lm~od~(031).spae(unt '~ J,012. (~l0. ad i 1 abnt I77.Imb anld c')mtrol-I are different. as 9-bit it uatm,11d Libm (cr5. hNoIwhi mnlm ed Ito '\S( II Ilhey become thie saanw. Our consention (^) is that Ilallics (II'
?A. Rubout isLflsplay~d as 1,i:ccluse (^) Iby stretching thie meaning of' "control" it canl be interpreted as ASCII
IV T Rmv
Basic Editing Commands (^) 1
3. Basic Editing Commiands
3.1. Inserting 'ext
Tlo insett printing characters into (tic text you are editing, just type them. Normally (when FIMACS is at
nlme fbi mard too. It' thc cursor is in between af 100 and a BA R, typing XX produces and disolays l{OONX HA with file Cursor before thie "BI". 'luis miethod of insertion works fior prinfhing characteis anol space. but other Characters act as editing comnmandls and do not insert themselves. Iftyou need to insert it
to the Contool lbit. See section 2 fCharacteisl, page 9.
I()correct text youl have just inset ted, you can use Ruhouit. Rulout deletes th chcli-ter bibe thiecursor (nlot thle onle that the cuIlsor is oil top of or- tifder, that is thle chat acter afleir thie cursor). 'llhe cursor and all chara-,ctet s flter-itiimove backwairds. YIotican rutl) oit a liebounidariy by typimig tbont when thectirs(,. is at thle beginniing ofa linle. -o enlda linle and start typing (^) at new one, typc Return (-R CRI.F). (^) You canl also type Retinin to break anl exidting linle into two. A Rubout after atReturn will unldo it. Return really inserts two characters, at carriage
which you can think ohas afline-separator character.
If you add too many characters to onec line, without breaking it with atRclurn, the line will grow to occupyt two (or- more) lines onl the screen, with a " at thie extremec right inargin of all but thle last of thenil. 'I'lie "I" says that the^ following^ screen^ line^ is^ not^ really^ a^ (distinictfine^ inl^ the^ file,^ but^ just^ the^ "continuiation"^ of^ a^ line
3.2. Movitng 'IThe Cursor
To (10 iumoic thai1m insert Charactet s. youl have^ to^ know^ how^ to^ imove^ the^ cursor.^ I^ keie^ are^ afre.w^ of^ theA -. tomtttttalIfs fill doing t~at.
C-A Moves to [lime hleginiulitg of'the line.
jC-1:^ CIAf^ MovesMoves^ toForward^ thie^ end over,^ or^ the one^ line.V character.
14 1-.MACS Mani'al for ITS Users
C-Il Moves backward over one character.
middle of the next. From the last line of text. it creates a new line.
C-I. Clears the screen and reprints everything. C-U C-I. reprints just the line that the cursor is on. C-T Transposes t, mracters (the ones before and after the cursor). M-< Moves to tl( of your text. M-> Motes to the e, ofyour text.
C-K Kill to the end of the line. on already know about tie Ruotit command whichldeletes the character before the cursor. Another collnllind. Control-I). deletes the character after the ctrsor. causing tie rest of the text on tie line to shift left.
To erase a larger amount of text, use the Control-K command, which kills a line at a time. lfControl-K is done at the beginning or middle of a line. it kills all the text up to the end oil the line. IfControl-K is done at the end ofa line, it joins that line and the next line.
See :ccti)I 9.1 Killingi, page 35. for more flexible ways of killing text.
:' 3.4. Files
changes, and then "save" tie file by typing C-X C-S. 1his makes the changes penanent and actually
w changes tile Me FOO.^ Until^ then,^ ie changes^ are^ only^ inside^ your^ IMACS,^ and^ tile^ file^ FOO^ is^ not^ really changed. If the file FOO doesn't exist. and yon want to create it. visit it as if it did exist. When you tsave your -