; TeX output 1989.12.17:2053 x܍3$'܍ ^7H
docHThe?MGReferenceManual >&Release?MG2A 1Sandra?J.Loosemore GbMCopyright?(C)1987,SandraJ.Loosemore/qǍHThis<document,orsectionsofthisdocument,maybefreely HredistributedIprovidedthatthecopyrightnoticeandthefollowingHdisclaimerQ$remainintact:ITheauthorbearsnoresponsibilitiesforHerrors*inthisdocumentorthesoftwareitdescribes; .andshallHnot]beheldliableforanyindirect,$incidental,or]consequentialHdamages. *x܍3$'܍K3$HContents9??1Introduction1]2 _1.1.3Implementations?ofMG̍.
....................3_1.2.3A?NoteonCharacterSetsLɍ.
..................3_1.3.3Notation?andConventionsLɍ.
..................4_1.4.3Getting?Started̍.
.......................5??2Using?Commands'c7_2.1.3Command?Arguments̍.
......................7_2.2.3Prefix?ArgumentsLɍ.
......................7_2.3.3AbortingLɍ.
..........................8_2.4.3Extended?Commands̍.
......................8?3Moving?theCursor\l9?4Text?InsertionCommands 12?5Killing,?Deleting,andMovingText ܢ14?6Searching?andReplacing 16_6.1.3Searching̍.
..........................} 16_6.2.3Replacing̍.
..........................} 17_6.3.3Regular?Expressions̍.
.....................} 18?7WindowsFQ21?8Files?andBufferso23_8.1.3Buffer?Manipulation̍.
.....................} 23_8.2.3Reading?andWritingFiles̍.
..................} 24_8.3.3Backup?FilesLɍ.
........................} 25_8.4.3Changing?theDirectoryLɍ.
...................} 25?9ModesQK26_9.1.3No?TabMode̍.
.........................} 26_9.2.3Overwrite?ModeLɍ.
.......................} 27_9.3.3Auto?Fill̍.
..........................} 27_9.4.3Auto?Indent̍.
.........................} 27_9.5.3Blink̍.
............................} 28 1 x܍3$'܍3$_H9.6.3Dired?ModeLɍ.
.........................} 28??10Miscellaneous'c30 _10.1.3HelpLɍ.
............................} 30_10.2.3Keyboard?Macros̍.
.......................} 30_10.3.3Changing?Case̍.
........................} 31_10.4.3Odds?andEnds̍.
........................} 31?11Customization'c33_11.1.3Key?BindingsLɍ.
........................} 33_11.2.3Startup?Files̍.
........................} 34Fundamental?ModeKeyBindings 꼅36Indexh=38 2 x܍3$'܍F3$HChapter?12 Introduction4 MGξis$asmall,2fast,and$portableEmacs-styletexteditorintendedtobe useddbypeoplewhocan'trunarealEmacsforonereasonoranother---astheirmaineditoronsmallermachineswithlimitedmemoryorfilespace,orasa``quick-start''editoronlargersystems,usefulforcomposingshortmail?messagesandthelike.We'vemadeMG>compatiblewithGNUEmacsbecausethatisthe``big'',full-featurededitorthatmanyofususeregularlyandaremostfamiliarwith.
MGNU.Emacs/isthecreationofRichardM.Stallman,jwhowasalsotheauthorzoftheoriginalEmacseditor.dpHowever, MGPisnotassociatedinanywaywiththeGNU2project,andtheMGauthorsindividuallymayormaynotagree?withtheopinionsexpressedbyRichardStallmanandtheGNUproject.MGMisNlargelypublicdomain.
Youcanuse,modify,andNredistributeMGasyoulike.A+fewmodules,however,arecopyrighted;tspecifically,theregular-expressioncode,theVMStermcaproutines,andtheAmigasupportcode.
Look?atthesourcecodefortheexactcopyrightrestrictions.There *QareseveralothereditorsinexistencewhichcallthemselvesMicroEmacs.<TheoriginalpublicdomainversionwaswrittenbyDaveConroyandbcirculatedasversion1.6.J)Derivedfromthis,;thereisanotherPDversion|byDaveConroynumberedv30;wasignificantlylargerPD|versionbyDanielLawrencewhichisnowuptoversion3.9;atleastoneproprietaryimplementation;
ЀanimplementationfortheAtariSTwithanintegratedcommandshell,4byPrabhakerMateti;eandprobablyothersthatwedon'tknowabout.MG"is7derivedfromthev30MicroEmacs,withkeybindings,commandnames,andogeneralfunctionalitymademorecompatiblewithGNUovEmacs.NLikev30,MG\is][fairlysmallandquiterobust.Wehavegenerallyresistedthetemptationtooverfeaturize.o<Somefeatureswhicharelargeandcomplexareflagged?forconditionalcompilation.ManyM%peoplehavecontributedtheirtimetodeveloping,oimproving,and 3 àx܍3$'܍3$Hporting"MG.MikeMeyer,QMicKaczmarczik,andBobLarsondeserveparticular mention?fortheirefforts.Questions,?suggestions,andoffersofhelpshouldbeaddressedto: )mg-developers@ucbvax.berkeley.edu(ARPA))ucbvax!mg-developersS(UUCP)! 1.1Implementations?ofMG MGruns1onmanydifferentkindsofhardwareundermanydifferentoperatingsystems.
Currently,?theseinclude: -`4.2?and4.3BSDUnix(includingUltrix-32) -`System?VUnix -`VAX/VMS -`Primos -`OS9/68k -`Amiga -`Atari?ST -`MS-DOSThisdocumentdescribesreleaseMG2A.Whenwetalkofdifferentversions ofMGinthismanual,thetermversionisusedtorefertothedifferentsupport1MGprovidesforthevariousmachinesandoperatingsystemsitrunsunder,nottodifferentreleasesofMGitself.EForexample,wemightspeakof?howtheVMSversionofMGdiffersfromtheUnixversion.Asamentionedabove, *hsomeMGacommandsmaynotbeimplementedinallversions;theseNarenotedinthedocumentation.
SomeversionsofMGMalsosupport?features(suchasmousehandling)thatarenotdescribedhere. 1.2A?NoteonCharacterSets MG
0uses
2the128-characterASCIIcharacterset,nandprovidessupportfor8-bitcharacters.nWhethertheparticularversionofMGthatyouareJrunningknowsaboutextendedcharactersetsdependsonwhetheryour 4 (x܍3$'܍3$HterminalAandthehostoperatingsystemknowaboutthem.EMoreover,=since thererisnostandard8-bitcharacterset,thesamecharactercodeswillprobablyogivedifferentglyphsondifferentsystems.;MostversionsofMGuse?theDECmultinationalcharacterset. 1.3Notation?andConventions Inithismanual,commandsandotherthingsthatmustbetypedinliterallyareiindicatedinatypewriterfont,likenext-line.
Placeholderssuchascommand?argumentnamesuseanitalicfont.Thetermscommandandfunctionaresynonymous.kWeoftenspeakofacommandbeingboundtoaparticularkey,*althoughyoumayactuallyhavetotypemorethanonecharactertoformasinglekey.?bMostcommandsareboundto?keyswithcontrolandmetamodifiers.To8typeacontrolcharacter,Fusethecontrolkeyonyourkeyboardlikeashiftdkey:holddownthecontrolkeywhiletypingthecharacter.L.Inthismanual,/we|willindicatecontrolcharacterslikeC-x---here,typingthecharacter?``x''whileholdingdownthecontrolkey.SomeOkeyboardsalsohaveametakeythatworkslikethecontrolkey.(ItImaybelabelledsomethingelse;͠ontheAtariST,forexample,Zthekeymarked'$``Alternate''isthemetakey.)5oIfyourkeyboarddoesn'thaveameta Lkey,X`don'tpanic.
Youcanalsousetheescapekeyasametaprefix;firsttypetheescape,qandthenthecharacter.Metacharacterswillbeindicated?asM-x.Besidesthemetaprefix,twoothercharactersareusedasprefixes::C-xandC-h.eAMfewkeyshavespecialnotation:
DSPCisthespacecharacter,DELis?thedeleteorruboutcharacter,?RETiscarriagereturn,?andESCisytheescapecharacter.mNUListhenullcharacter(ASCII0),kwhichisusually?equivalenttoeitherC-SPCorC-@.Uppercaseandlowercasecharactersaregenerallyequivalentincommandkeystrokes.WhenyourunMGfromashell,*commandlineargumentsareinterpretedasthea5namesoffilesyouwanttovisit,oredit.
Eachfileisreadintoabuffer2inmemory.
XNochangesareactuallymadetothefileuntilyouaskit?tobewrittenouttodisk.WithinMG,thelargetoppartofthescreenservesasawindowintothe?bufferbeingedited.
YBelowthisisthemodeline,whichdisplaysthenameofthebuffer.EFinally,Tattheverybottomofthescreen,thereisa}one-lineminibufferwhichisusedfordisplayingmessagesandansweringquestions.MG'keeps9trackoftwopointersintoeachwindow,Hthepointandthemark.TheScursorappearsatthepointinthecurrentwindow,andweoftenspeakofmovingthecursorratherthanofmovingthepoint.?bThetextbetweenthe 5 .x܍3$'܍3$Hpoint?andthemarkisreferredtoastheregion. Somecommandsdealwithwordsandparagraphs.0Generally,Swhitespaceandpunctuationseparatewords.9Linesthatareemptyorthatcontainonlyspacesortabsseparateparagraphswithoutbeingpartofaparagraph.IAnon-empty?linethatstartswithaspaceortabalsobeginsanewparagraph.ADnumberD]ofcommandsaredefinedastoggles.
Ifnoprefixargumentissupplied,thesecommandstoggleanaction.KTheactionisturnedonifanegativeorzeroargumentissupplied,andturnedonifapositiveargumentis?supplied. 1.4Getting?Started This'$documentisintendedprimarilyasareferencemanual.5oIfyouhaveneverusedanyEmacs-liketexteditorbefore,Sitisstronglysuggestedthatyouruntheon-linetutorialsuppliedwiththeMGVdistribution,?insteadofreading?thismanual.Donotbeputoffbythelargenumberofcommandsdescribedinthismanual!eItispossibletogetbywithonlyahandfulofbasiccommands.Here?aretheonesthatareprobablyusedmostfrequently: C-pREMove?thecursortothepreviouslineC-nREMove?thecursortothenextlineC-bREMove?thecursorbackwardsC-fREMove?thecursorforwardsC-vREScroll?forwardsonescreenfulM-vREScroll?backwardsonescreenfulM-<REGo?tothebeginningofthebufferM->REGo?totheendofthebufferC-aREGo?tothebeginningofthelineC-eREGo?totheendofthelineDELREDelete?thepreviouscharacterC-kREKill?(delete)totheendofline 6 :x܍3$'܍3$HC-yREReinsert?killedtext. C-x?C-cREExit?MGC-x?C-sRESave?thecurrentbuffer 7 Ax܍3$'܍F3$HChapter?22 Using?Commands: 2.1Command?Arguments Some?commandsrequirearguments.
YForexample,ifyouwanttoreadafile into͗abuffer,youmusttypeinthenameofthefile.(Inthedescriptionsofۍcommandsinthismanual,qifargumentsarerequired,theyarelistedfollowing?thecommandname.MG prompts forcommandargumentsintheminibuffer.h1Withintheminibuffer,?thefollowingcharacterscanbeusedforediting:nDEL,?C-hREErase?thelastcharacter.C-x,?C-uREErase?theentireinputline.C-wREErase?tothebeginningofthepreviousword.C-q,?!",
cmsy10nREHQuote?thenextcharactertyped.RETRESignifies?thatyouhavecompletedtypingintheargument.C-gREAbort?thecommandinprogress.m2.2Prefix?ArgumentsAllOcommandsacceptanoptionalnumericprefixargument.9Thisisofteninterpretedtasarepetitioncount.`Forexample,jRthefunctionnext-line,ifigivenaprefixargument,willmovethecursorforwardthatmanylines;withoutanargument,W[itwillmovethecursorforwardoneline.CAsfewcommandsbehavedifferentlyifgivenaprefixargumentthantheydowithout 8 Btx܍3$'܍3$Hone,?andothersignoretheprefixargumententirely. digit-argumentGM-0,?M-1,M-2,M-3,M-4,M-5,M-6,M-7,M-8,M-9negative-argument$|dM--Onewaytospecifyacommandargumentistousetheescapekeyasametaprefix,Ļandthentypeoneormoredigits.Adashmaybeusedforanegative?argument.universal-argument<gC-uAnotherwaytospecifyacommandprefixistotypeC-u./kTypingoneC-uisequivalent;^toaprefixargumentof4,z7typingtwogivesavalueof16,andso#on.UkInaddition,youcantypedigitsfollowingC-utoformanumericprefix?argument. 2.3Aborting keyboard-quit9|XC-gTypingC-gcancelsanycommand.\Itisparticularlyusefulforcancellingacommand?whenMGispromptingforinputintheminibuffer. 2.4Extended?Commands execute-extended-command?command ռM-xCommands hpthatarenotboundtokeyscanbeexecutedthroughexecuteextended-command.Ifaprefixargumentissupplied,itispassedtothecommand?beingexecuted. 9
Gx܍3$'܍F3$HChapter?32 Moving?theCursor4 The2commandsdescribedinthischaptermovethecursor(sometimescalled theDYpointordot)withinthecurrentwindow.
Commandswhichsetthemarkare?includedhereaswell.backward-char9|XC-bMovesXthecursorbackward(left)onecharacter.Ifthecursorisattheleft?margin,itwillbemovedtotheendofthepreviousline.backward-paragraph<gM-[Movestthecursorbackwardstothebeginningofthecurrentparagraph,jRortothebeginningofthepreviousparagraphifthecursorisalreadyatthebeginning?ofaparagraph.backward-word9|XM-bMovesthecursorbackwardstothebeginningofthecurrentword,ortothebeginningofthepreviouswordifthecursorisalreadyatthebeginningofa?word.beginning-of-bufferjM-<Moves?thecursorbackwardstothebeginningofthebuffer.beginning-of-line$|dC-aMovesthecursorbackwardstothebeginningofthecurrentline.kThiscommandhasnoeffectifthecursorisalreadyatthebeginningoftheline.end-of-buffer9|XM->Moves?thecursorforwardstotheendofthebuffer. ~10 Lx܍3$'܍3$ Hend-of-lineCRC-eMovesthecursorforwardstotheendofthecurrentline.?bThiscommandhasno?effectifthecursorisalreadyattheendoftheline.exchange-point-and-mark C-x?C-xSet&themarkatthecurrentcursorposition,andmovethecursortotheoldlocation?ofthemark.forward-char>UC-fMovesthecursorforwardsonecharacter./kIfthecursorisattheendofaline,?itwillbemovedtothefirstcharacteronthenextline.forward-paragraph$|dM-]Moves?thecursorforwardstothenextparagraphdelimiter.forward-word>UM-fMovesthecursorforwardstotheendofthecurrentword,ortotheendofthe?nextwordifthecursorisalreadyattheendofaword.goto-line?line-numberMoves?thecursortothebeginningoflineline-numberinthebuffer.next-lineN|LC-nMovesdXthecursordownoneline.Thecursorremainsinthesamecolumnunless Litwouldbepasttheendoftheline,X`inwhichcaseitismovedtothe?endoftheline.
Attheendofthebuffer,C-nwillcreatenewlines.previous-line9|XC-pMovesthecursoruponeline.?bThecursorremainsinthesamecolumnunlessitbwouldbepasttheendoftheline,inwhichcaseitismovedtotheendof?theline.recenterSIC-lRedrawstheentirescreen,DNscrollingthecurrentwindowifnecessarysothat~thecursorisnearthecenter.<?Withapositiveprefixargumentn,othewindowisscrolledsothatthecursorisnlinesfromthetop./rAϫnegativeprefixargumentputsthecursorthatmanylinesfromthebottomofthewindow.redraw-display ~11 Qx܍3$'܍3$HRedraws?theentirescreen,butneverscrolls. scroll-downCRM-vScrollsthedisplaydown(movingbackwardthroughthebuffer).<Withoutanargument,itiscrollsslightlylessthanonewindowful.
AiDprefixargumentscrolls?thatmanylines.scroll-one-line-downscroll-one-line-upThesefunctionsaresimilartoscroll-downandscroll-up(respectively),butAwheninvokedwithoutanargument,=causethedisplaytoscrollbyonelineonly.o<Thesefunctionsareenabledbydefiningthecompile-timeoptionGOSMACS.scroll-other-window|pM-C-vScrolls?the``other''windowforwardasforscroll-up.scroll-upN|LC-vScrollsthedisplayup(movingforwardthroughthebuffer).Withoutananargument,itiscrollsslightlylessthanonewindowful.
AiDprefixargumentscrolls?thatmanylines.set-mark-command)aNULSet?themarkatthecurrentcursorposition.what-cursor-position
<sC-x?=Prints?someinformationintheminibufferaboutwherethecursoris. ~12
Xx܍3$'܍F3$HChapter?42 Text?InsertionCommands4 The usualwaytoinserttextintoabufferissimplytotypethe characters.SThe hpdefaultbindingforalloftheprintingcharacters(self-insert-command)jRcausesthemtobeinsertedliterallyatthecursorposition.insert?stringInsert?stringintothecurrentbufferatthecursorposition.newlineXFRETInsertalinebreakintothecurrentbufferatthecursorposition,*movingthe?cursorforwardtothebeginningofthenewline.newline-and-indent<gC-jInsertAalinebreakintothecurrentbufferatthecursorposition,=thenaddextrawhitespacesothatthecursorisalignedinthesamecolumnasthe?firstnon-whitespacecharacterinthepreviousline.open-lineN|LC-oInsertsialinebreakintothecurrentbufferatthecurrentposition,butdoes?notmovethecursorforward.quoted-insert9|XC-qThis߽commandactsasaprefixtocancelthenormalinterpretationofthenextDkeystroke.]IfC-qisfollowedbyonetothreeoctaldigits,Gitisinterpreted'$asthecodeofthecharactertoinsert.5oOtherwiseasinglekeyOisreadandthecharactertypedisinsertedintothebufferinsteadofinterpretedasacommand.IThisisusedforinsertingliteralcontrolcharacters?intoabuffer. ~13 ]6x܍3$'܍3$ Hself-insert-commandThisisthedefaultbindingforkeysrepresentingprintablecharacters.Theicharacterisinsertedintothebufferatthecursorposition,andthecursor?movedforward. ~14 bx܍3$'܍F3$HChapter?52 Killing,?Deleting,andMovingText4 Whenޮtextisdeleted,Zitiserasedcompletely.\
Killingtext,ontheother hand,moves?itintoatemporarystorageareacalledthekillbuffer.
YThesavedtextinthekillbufferiserasedwhenanotherblockoftextiskilled.
UntilMthen,}however,youcanretrievetextfromthekillbuffer.This7fcanbeusedtomoveorcopyblocksoftext,@aswellastorestoreaccidentally?killedtext.backward-kill-wordmM-DELKill߽thetextbackwardsfromthecursorpositiontothebeginningofthecurrentt'word.wTypingM-DELsTseveraltimesinsuccessionprependseachkilled?wordtothekillbuffer.copy-region-as-killjM-wCopiesDthetextintheregionintothekillbuffer,6withoutremovingitfrom?thecurrentbuffer.delete-backward-charmDELDeletes?thecharactertotheleftofthecursor.delete-blank-lines
<sC-x?C-oDeletesallblanklinesafterthecurrentline,andifthecurrentlineisblank,?deletesitandallblanklinespreceedingitaswell.delete-charCRC-dDeletes?thecharacterunderneaththecursor.delete-horizontal-space<rM-nHDeletes?allspacesandtabsoneithersideofthecursor. ~15 dx܍3$'܍3$ Hjust-one-space)aM-SPCThis&islikedelete-horizontal-space,gexceptitleavesasinglespaceatthe?cursorposition.kill-lineN|LC-kIf8noprefixargumentisspecified,Fthisfunctionkillstextuptothenextnewline;"or'kifthecursorisattheendofaline,aFthenewlineiskilled.A&prefix'.argumentspecifieshowmanylinestokill.5TypingC-kseveraltimes?insuccessionappendseachlinetothekillbuffer.kill-paragraphThiscommandkillstheentireparagraphcontainingthecursor.9Ifthecursor?ispositionedbetweenparagraphs,thenextparagraphiskilled.kill-regionCRC-wThe?region(alltextbetweenpointandmark)iskilled.kill-wordN|LM-dTextiskilledforwardfromthecursorpositiontothenextendofword.If7fthecursorisattheendoftheword,@thenthenextwordiskilled.Typing?M-dseveraltimesappendsthekilledtexttothekillbuffer.yankh=C-yTextX`iscopiedfromthekillbufferintothecurrentbufferatthecursorposition.
The?cursorismovedtotheendoftheinsertedtext. ~16 ix܍3$'܍F3$HChapter?62 Searching?andReplacing: 6.1Searching TheoordinarysearchcommandinMGovdiffersfromthatinmanyothereditors inYthatitisincremental:itbeginssearchingassoonasyoubegintypingthe?searchstring,insteadofwaitingforyoutotypetheentirestring.Allofthesearchcommandsdescribedinthissectionarecase-insensitive.isearch-backward?pattern yC-risearch-forward?patternvC-sTheseGcommandsperformanincrementalsearchbackwardandforward(respectively)_forpattern. MGwillmovethecursortotheplaceinthebufferithatmatchesasmuchofthepatternasyouhavetypedsofar,kaseach?characterisentered.WithinVtheincrementalsearch,thefollowingcharactersareinterpretedspecially: DELREErase?thelastcharacterinthesearchstring.ESCREStopsearching;Sexitfromincrementalsearchmode,leavingREthe?cursorwherethesearchbroughtit.C-gREIfEmamatchhasbeenfound,FexitsfromincrementalsearchbutREleaves9kthecursorinitsoriginalposition.
lCIfthesearchREhashfailed,thiswilljusterasethecharacterswhichhaveREnotbeenfoundfromtheendofthesearchpattern.InthisREcase,?youmusttypeC-gagaintoabortthesearch. ~17 nix܍3$'܍3$HC-sRESearch?forwardforthenextoccurrenceofthesamepattern. C-rRESearchbackwardforthepreviousoccurrenceofthesame REpattern.C-qRE``Quotes'' thenextcharactertyped,
forcingittobeREinterpreted?asaliteralcharacterinthesearchpattern. InQaddition, normalcommandssuchasC-athatdonothavespecialmeaningswithinincrementalsearchcausethesearchtobeterminated,andthen?areexecutedintheordinaryway.search-againsearch-backward?patternvM-rsearch-forward?pattern
<sM-sThesecommandsperformordinary,3non-incrementalsearches.)Search-againuses?thesamepatternanddirectionastheprevioussearch. 6.2Replacingquery-replace?patternreplacement |M-%TheprimaryreplacecommandinMGisaninteractivequeryreplace.kMGsearchesforwardforoccurrencesofpattern,*andasksyouwhattodoabouteach?one.
Thechoicesare: SPCREReplace?thismatchwithreplacement,andgoontothenext.DELRESkip?tothenextmatchwithoutreplacingthisone..REReplace?thismatch,andthenquit.!REReplace?allremainingoccurrenceswithoutaskingagain.ESCREQuit.By}default, Mkquery-replaceadjuststhecaseoflower-caselettersin thereplacementstringtomatchthatoftheparticularoccurrenceofthepattern;?for?example,replacing``Foo''with``bar''resultsin``Bar''.Uppercaselettersinthereplacementstringarealwaysleftuppercase.\Inaddition,supplying\aprefixargumentwillalsotellquery-replacetoleavethe?caseofthereplacementstringas-is. ~18 t1x܍3$'܍3$HNote?thatquery-replacealwaysperformsacase-insensitivesearch. 6.3Regular?Expressions RegularSexpressionsprovideameansforspecifyingcomplexsearchpatterns, insteadĭofjustaliteralstring.
Thecommandsinthissectionareavailable?onlyifMGiscompiledwiththeREGEXoptiondefined.RegularJexpressionsyntaxusesthefollowingrules.Mostcharactersinaregularexpressionareconsideredtobeordinarycharacters, andwillOmatchthemselvesandnothingelse.9Theexceptionsarethespecialcharacters?listedbelow. .REMatches?anysinglecharacterexceptanewline.*REApsuffixpoperatorthatmatcheszeroormorerepetitionsofREthe?(smallest)precedingregularexpression.+REAsuffix:operatorthatmatchesoneormorerepetitionsofREthe?(smallest)precedingregularexpression.?REA`suffixۈoperatorthatmatcheseitherzerooroneoccurenceREof?the(smallest)precedingregularexpression.[...]REMatches anyonecharacterlistedinthecharactersetREbetween?thesquarebrackets.
Seeexamplesbelow.^REMatches?atthebeginningofaline.$REMatches?attheendofaline.nREHExcept3forthesituationslistedbelow, actsasaprefixREoperatorwhichcausesthecharacterfollowingtobetreatedREas?anordinarycharacter.nH|REAninfixbinaryoroperator.ItappliestothetwolargestREsurrounding?expressions.nH(...nH)REA Sgrouping Oconstruct,
dusuallyusedtospecifyalargerREexpressionR\forpostfixoperatorssuchas*ortolimittheREscope?ofoperandsto\|.nHdigitREMatches
thesametextmatchedbythedigitth\(...\)REconstruct.
TheseDGarenumberedfrom1to9intheorderthat ~19 {rx܍3$'܍3$REHthe?open-parenthesesappear. nH`REMatches?atthebeginningofthebuffer.nH'REMatches?attheendofthebuffer.nHbREMatches?atthebeginningorendofaword.nHBREMatches?anyplaceexceptatthebeginningorendofaword.nH<REMatches?atthebeginningofaword.nH>REMatches?attheendofaword.nHwREMatches?anyword-constituentcharacter.nHWREMatches?anycharacterwhichisnotaword-constituent. Some?examplesmayhelpclarifytherules.fooREMatches?theliteralstringfoo. ;.*REMatches
allstringswhichbeginwithasemicolonand REcontinue?totheendofaline.c[ad]+rREMatches?stringsoftheformcar,cdr,caar,cadr,andsoon.[a-z]REMatches?anylowercaseletter.[^a-z]REMatches?anycharacterexceptlowercaseletters.[0-9+---]REMatches?adigitorsign.nH(foonH|barnH)REMatches?eitherthestringfooorthestringbar. count-matches?patterncount-non-matches?patternThesecommandscountthenumberoflineswhichdoordonot(respectively)match?thespecifiedpattern.delete-matching-lines?patterndelete-non-matching-lines?pattern ~20 fx܍3$'܍3$HThesecommandsdeletealllineswhichdoordonot(respectively)matchthe specified?pattern.query-replace-regexp?patternreplacementThis?istheregularexpressionversionofquery-replace.Thebreplacementstringmaybeaconstant,;oritcanrefertoallorpartXofthestringmatchedbythepattern.\&inthereplacementstringexpands8intotheentiretextbeingreplaced,Fwhile\n(wherenisanumber)replaces?thenthparenthesizedexpressioninpattern.re-search-againre-search-backward?patternre-search-forward?patternThesearetheregularexpressionequivalentsoftheordinarynon-incremental?searchcommands.set-case-fold-searchThiscommandtogglesaninternalvariablethatcontrolswhethertheregularexpressionsearchandreplacecommandspayattentiontocase.<Bydefault,regularjRexpressionsearchesarecase-insensitive.Ordinarysearchesarealways case-insensitiveandarenotaffectedbythesettingofthisvariable. ~21 x܍3$'܍F3$HChapter?72 Windows4 MGPinitiallyzhasonlyonetextwindowdisplayed.dpHowever, youcanhaveas manywindowsaswillfitonthescreen./kEachwindowhasitsownmodelineandmustdisplayatleasttwolinesoftext.?b(NotethataMG's``windows''aredistinctfromthe``windows''handledbyscreenmanagerssuchastheXWindow?System.)Multiplewindowsmaybeusedtodisplaydifferentbuffers.\Youcanalsohavethesamebufferdisplayedinmorethanonewindow,whichisusefulifyouwanttoseeonepartofafileatthesametimeasyouareeditinganother?part.Althoughamanywindowscanbedisplayedatonce, *Qonlyonewindowisactive?atanygiventime.
Thisisthewindowwherethecursorappears.Some commandsrefertothe``other''window.6Thisisthewindowdirectlybbelowthecurrentwindow,;orthetopwindowifyouareinthebottom?window.delete-other-windows
<sC-x?1Makes?thecurrentwindowtheonlywindow.delete-window.^C-x?0Deletes\thecurrentwindow,makingthe``other''windowthecurrentwindow.Thisocommanddoesn'tdoanythingusefulifthereisonlyonewindowbeingdisplayed.enlarge-window4<[C-^MakesDthecurrentwindowlarger.Withoutaprefixargument,6thewindowgrowsoneline;eotherwise,4theprefixargumentspecifieshowmanylinestogrow. ~22 [x܍3$'܍3$Hother-window4<[C-x?oMakes?the``other''windowthecurrentwindow. previous-windowThisrislikeother-window,exceptthatitcyclesthroughthewindowsinreverse\order.mThiscommandisavailableonlyifMG2wascompiledwiththeGOSMACS?optiondefined.shrink-windowMakesAthecurrentwindowsmaller.EWithoutaprefixargument,=thewindowlosesoneline;eotherwise,4theprefixargumentspecifieshowmanylinesgoaway.split-window-vertically ||C-x?2Split?thecurrentwindowintotwowindows,bothusingthesamebuffer. ~23 vx܍3$'܍F3$HChapter?82 Files?andBuffers4 Mostdbuffersareusedtocontainafilebeingedited.L.Itisalsopossible tohavebuffersthatarenotassociatedwithanyfile;j]MG4usestheseforpurposessuchasdisplayinghelptext,2forexample.-VHowever,sincemostcommandsfordealingwithfilesalsodealwithbuffers,wehavegroupedallof?thesecommandstogetherintoonechapter. 8.1Buffer?Manipulation insert-buffer?buffer-nameInsertsOthecontentsofthenamedbufferintothecurrentbufferatthecursor?location.
Thecursormovestotheendoftheinsertedtext.kill-buffer?buffer-name ||C-xkThedXnamedbufferanditscontentsaredeleted.Ifthebufferhasbeenmarked͙asmodified, MGuwillaskyouifyoureallywanttodeleteit.(Notethat,&contrarytoitsname,thiscommanddoesnotsavethebuffercontentsin?thekillbuffer.If?abufferisbeingdisplayedinawindowwhenitisdeleted,MG?willfind?someotherbuffertodisplayinthesamewindow.list-buffers)aC-x?C-bThiscommandwritesinformationaboutthebufferscurrentlyinusetoabuffernamed*BufferList*.\Thisbufferisthendisplayedinthe``other''window;)if0thereisonlyonewindow,thiscommandwillsplitthescreeninto?twowindows.not-modified>UM-~ ~24 +x܍3$'܍3$HThiscommandmakesMGthinkthatthecurrentbufferhasnotbeenmodified, evenXifitreallyhasbeenchanged.
Thisaffectsthebehaviorofthekill-buffer?andthebuffer-savingcommandsdescribedbelow.MGindicatesmodifiedbufferswithtwostarsattheleftendofthemodeline.switch-to-buffer?buffer-name <C-xbTheYcurrentwindowismappedontothenamedbuffer.MIfthereisn'talreadya?bufferwiththatnamearound,MGwillcreateone.switch-to-buffer-other-window?buffer-name |C-x4bThis8commandworkslikeswitch-to-buffer,vexceptthatthe``other''windowisused.DIfthereisonlyonewindow,thiscommandsplitsthescreenintotwo?windowsandmapsthenamedbufferontooneofthem. 8.2Reading?andWritingFiles find-file?file-name|pC-xffind-file-other-window?file-name <C-x4C-fThese commandsareanalagoustoswitch-to-bufferandswitch-to-buffer-other-window,Srespectively.0ThedifferenceisthatthesecommandslookforaDYbufferassociatedwiththenamedfile.
Ifnomatchingbufferisfound,MGwillmcreateanewbufferwithanamederivedfromthefilename,Iandattempt?toreadthefileintothebuffer._Ifthenamedfilecannotbeopened,?thebufferremainsempty.insert-file?file-namevC-xiThis/commandreadsinthecontentsofthenamedfileintothecurrentbuffer?atthecursorposition.
Thecursorremainsinthesameplace.save-buffer.^C-x?C-sIf~thecurrentbufferhasbeenmodified,oitissaved.<?Buffersthatarenotassociated?withfilescannotbewrittenoutwiththiscommand.save-buffers-kill-emacs C-x?C-cThisD]commandisusedtoleaveMGDandreturncontroltotheshellorotherprogramSthatwasusedtostartMG.Iftherearemodifiedbuffers,MGRwillask?youifyouwanttosavethembeforeexiting.save-some-buffersjC-x?sMGgwillaskyouifyouwanttosavemodifiedbuffersthatareassociated ~25 x܍3$'܍3$Hwith?files. write-file?file-name yC-xC-wThecurrentbufferiswrittenoutusingthefilenamesupplied.ThisisDusefulforsavingbuffersthatarenotassociatedwithfiles,6orforwriting?outafilewithadifferentnamethanwhatwasusedtoreaditin. 8.3Backup?Files MGprovides`awaytosaveacopyoftheoriginalversionoffileswhichhavebeenmodifiedandthenwrittenoutagain.IThebackupcopyreflectsthe{stateofthefileasitexistedthefirsttimeitwasreadintoMG.Thename?usedforthebackupfilevaries,dependingontheoperatingsystem.This?featureisdisabledifMGiscompiledwithNOP ff 3BACKUPdefined.make-backup-filesThisocommandisatogglewhichcontrolsthestateofaninternalvariablethat?determineswhetherMGcreatesbackupfiles. 8.4Changing?theDirectory The?commandsinthissectionaredisabledbydefiningNOP ff 3DIR.cd?directory-nameThis&commandchangesMG'snotionofthe``current''directoryorpathname.This?isusedtosupplydefaultsforfunctionsthatreadorwritefiles.ThejRsyntaxfordirectory-nameisobviouslyspecifictotheparticularoperating?systemMGisrunningon.pwdDisplay?whatMGthinksisthecurrentdirectory. ~26 x܍3$'܍F3$HChapter?92 Modes4 Modesareusedtolocallyalterthebindingsofkeysonabuffer-by-buffer basis.IyMGis'normallyinfundamentalmode,andthesearethebindingsthatarelistedwiththecommanddescriptionsinthismanual.9ModesdefineadditionaljRkeymapsthataresearchedforbindingsbeforethefundamentalmodecbindingsareexamined;dseethesectiononkeybindingbelowformoredetails?onhowthisworks.set-default-mode?mode-nameNormally,
8when :?MG 9:visitsafile,itputstheassociatedbufferintofundamentalmode.0Usingtheset-default-modecommand,SyoucanspecifythatMGshoulddefaulttousesomeothermodeonallsubsequentbuffersthatarecreated.(This͗commandisatoggle.Withnoprefixargument,ifthenamedmodeisnotalreadyonthelistofdefaultmodes,thenitwillbeaddedtothe?list;otherwise,itisremovedfromthelist. 9.1No?TabMode Innotabmode,?tabsareexpandedintospacesinsteadofinsertedliterallyinto'.thebuffer.5Literaltabcharactersaredisplayedas^I&(muchlikeothercontrolcharacters).HThesecommandsareavailableifMGiscompiledwith`thesymbolNOTABdefined.$(Thismodeismainlyforuseonsystemssuch?asPRIMOSthatdonottreattabasaseriesofspaces.)no-tab-modeThis?commandisatoggletocontrolwhethernotabmodeisineffect.space-to-tabstopInsert0enoughspacestomovethecursortothenexttabstop.rInnotab ~27 |x܍3$'܍3$Hmode,?thisfunctionisboundtoC-i. 9.2Overwrite?Mode Normally,when"charactersareinsertedintothebuffer,theyarespliced intoAtheexistingtext.EInoverwritemode,=insertingacharactercausesthecharacteralreadyatthecursorpositiontobereplaced.Thisisuseful?foreditingpictures,tables,andthelike.overwrite-modeThisBcommandisatogglewhichcontrolswhetheroverwritemodeisineffect.9.3Auto?Fill Fillmodecausesnewlinestobeaddedautomaticallyatwordbreakswhentext͗isaddedattheendofaline,extendingpasttherightmargin.(Autofill?isusefulforeditingtextanddocumentationfiles.auto-fill-modeThis?commandisatogglewhichcontrolswhetherfillmodeisineffect.insert-with-wrapThisAcommandworkslikeself-insert,=exceptthatitcheckstoseeifthecursorhaspassedtherightmargin.DIfso,itfillsthelinebyinsertinga?linebreakbetweenwords.
ThiscommandisboundtoSPCinfillmode.fill-paragraph4<[M-qFill?theparagraphcontainingthecursor.set-fill-column$|dC-x?fWithoutQaprefixargument, thiscommandsetstherightmarginatthecurrentN@cursorcolumn.Ifaprefixargumentissupplied, itisusedinstead?asthelinewidth. 9.4Auto?Indent IndentamodebindsRETatonewline-and-indent, *hsothateachnewlineisindentedtothesamelevelasthepreceedingline.?bThismodeisusefulforediting?code. ~28 x܍3$'܍3$Hauto-indent-modeThiscommandisatogglewhichcontrolswhetherauto-indentmodeisin effect. 9.5Blink Blink modemakesiteasiertomatchparentheses,
brackets,and otherpairedidelimiters.
Whentheclosingdelimiteristyped,thecursormovesmomentarilytothematchingopeningdelimiter(ifitisonthescreen),*ordisplaysthelinecontainingthematchingdelimiterontheecholine.\Thisis'usefulforeditingLisporCcode,orforpreparinginputfilesfortextprocessors?suchasLaTeXthatusepaireddelimiters.blink-matching-parenThis?commandisatogglewhichcontrolswhetherblinkmodeisineffect.blink-matching-paren-hackThisfunctionbehaveslikeself-insert,exceptthatitfindsthematchingdelimiterwasdescribedabove.dgInblinkmode, thisfunctionisboundto),whichYflashesthematching(.MThisfunctionalsoknowsaboutthepairs{},[],?and<>.
Allothercharactersmatchwiththemselves. 9.6Dired?Mode ``Dired''&isanabbreviationfor``directoryeditor'',ganditprovidesawaytobrowsethroughthecontentsofadirectoryfromwithMG.Diredputsacdirectorylistingintoabuffer;dyoucanusenormaleditingcommandstomoveiaroundthebuffer,andaspecialgroupofcommandstomanipulatethefiles.\
Forޮexample,Ztherearecommandstodeleteandrenamefiles,andtoread?afileintoanMGbuffer.Since?diredmoderebindsmanykeys,atablemaybehelpful: C-ddired-flag-file-deletedSPCnext-linec)dired-copy-filed)dired-flag-file-deletede)dired-find-filef)dired-find-filen)next-lineo)dired-find-file-other-windowp)previous-liner)dired-renamefile ~29 x܍3$'܍3$Hu)dired-unflag x)dired-do-deletionsDELdired-backup-unflag,The?commandsinthissectionaredisabledbydefiningNOP ff 3DIRED.dired?directory-name
<sC-xdCreatesDadiredbufferforthegivendirectoryname,6anddisplaysitintheScurrentwindow.
CThefilesinthedirectoryarelisted,usuallyalongwithYinformationaboutthefilesuchasitssizeandtimestamp.mTheexactformat?oftheinformationissystem-specific.dired-backup-unflagThis hpfunctionremovesthedeletionflagfromthefilelistedontheprevious?lineofthediredbuffer.dired-copy-file?new-nameCopy?thefilelistedonthecurrentlineofthediredbuffer.dired-do-deletionsDeletes?thefilesthathavebeenflaggedfordeletion.dired-find-filedired-find-file-other-windowThesefunctionworkslikefind-fileandfind-file-other-window,exceptthatthe?filenameistakenfromthecurrentlineinthediredbuffer.dired-flag-file-deletedFlagDYthefilelistedonthecurrentlinefordeletion.
Thisisindicatedinthebufferbyputtinga``D''Yattheleftmargin.Nofilesarenotactually?deleteduntilthefunctiondired-do-deletionsisexecuted.dired-other-window?directory-nameThisifunctionworksjustlikedired,exceptthatitputsthediredbufferin?the``other''window.dired-rename-file?new-nameRenamesthefilelistedonthecurrentlineofthediredbuffer.?bNotethatthe?diredbufferisnotupdatedtoreflectthechange.dired-unflagRemove?thedeletionflagforthefileonthecurrentline. ~30 ^x܍3$'܍F3$HChapter?102 Miscellaneous: 10.1?Help Mostofthecommandsinthissectionwriteusefulinformationtothe*help* buffer,?whichisthendisplayedinthe``other''window.These?commandscanbedisabledatcompile-timebydefiningNOP ff 3HELP.apropos?topic.^C-haThis?commandlistsallfunctionswhosenamescontainastringmatchingtopic?inthe*help*buffer.describe-bindingsjC-h?bInformationtaboutthekeybindingsineffectinthecurrentbufferislisted?inthe*help*buffer.describe-key-briefly?key <C-hcInformation?aboutthebindingofkeyisprintedintheminibuffer.help-help?optionmC-hC-hThiscommandlistsallofthehelpoptionsavailableandpromptsforwhichonetorun.QCurrently,|theseincludeonlyatorunapropos,btorundescribe-bindings,?andctorundescribe-key-briefly. 10.2?Keyboard?Macros ADkeyboardD]macroisasavedsetofcommandsfromthekeyboardthatcanbereexecutedDYlateron.
Therecanonlybeonekeyboardmacrodefinedatanyone?time. ~31 `x܍3$'܍3$HThe commandsinthissectionareavailableunlesstheyhavebeen disabled?bydefiningNOP ff 3MACRO.call-last-kbd-macro|pC-x?eExecuteZthesavedkeyboardmacro.MAIprefixargumentcanbeusedtospecifya?repetitioncount.end-kbd-macro.^C-x?)start-kbd-macro$|dC-x?(Thesefunctionsareusedtodefineakeyboardmacro.kAllkeysenteredafter"start-kbd-macroisexecuted,uptoaend-kbd-macro,arerememberedastheyareexecuted.Youcanthenreexecutethesamesequenceofoperationsusing?call-last-kbd-macro. 10.3?Changing?Case MG?providesanumberoffunctionsforchangingthecaseoftext.capitalize-word.^M-cdowncase-regionjC-x?C-ldowncase-word9|XM-lupcase-region$|dC-x?C-uupcase-wordCRM-uAll?ofthesecommandsdotheobvious. 10.4?Odds?andEnds This *Qsectiondescribesmiscellaneouscommandsthatdon'tfitintoanyparticular?category.emacs-versionPrints
\informationabouttheversionofMG
[youarerunningintheminibuffer.meta-key-modeIfStheparticularversionofMGRyouarerunningsupportsametakey,thisfunctioncanbeusedtodeterminewhetherMGactuallypaysattentiontoitorbnot.J)Ifnoprefixargumentissupplied,;theinternalvariablethatcontrolsMtheuseofthemetakeyistoggled;apositivevalueenablesthemeta?key,whileanegativevaluedisablesit. ~32 ! Ax܍3$'܍3$Hprefix-region set-prefix-string?stringPrefix-regionisusedtoprefixeachlineoftheregionwithastring.Thisisusefulforindentingquotedtext,^Emakingblockcomments,andthelike.MTheYfunctionset-prefix-stringcanbeusedtosetthestringusedasthe?prefix.suspend-emacs9|XC-zThiscommandtemporarilysuspendsMGsothatyoucanrunotherprograms,and߽laterresumeediting._:TheexactbehaviordependsonwhichoperatingsystemyyouarerunningMGunder.mTypically,kMGwillyeitherspawnanewshell?asasubprocess,orreturnyoutotheparentprocess.transpose-chars.^C-tThis?commandtransposestheprevioustwocharacters. ~33 "