emacs-1 293 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711
  1. This is /home/cyd/emacs/doc/emacs/../../info/emacs, produced by
  2. makeinfo version 4.13 from /home/cyd/emacs/doc/emacs/emacs.texi.
  3. This is the `GNU Emacs Manual', updated for Emacs version 24.2.
  4. Copyright (C) 1985-1987, 1993-2012 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this
  6. document under the terms of the GNU Free Documentation License,
  7. Version 1.3 or any later version published by the Free Software
  8. Foundation; with the Invariant Sections being "The GNU Manifesto,"
  9. "Distribution" and "GNU GENERAL PUBLIC LICENSE," with the
  10. Front-Cover texts being "A GNU Manual," and with the Back-Cover
  11. Texts as in (a) below. A copy of the license is included in the
  12. section entitled "GNU Free Documentation License."
  13. (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
  14. modify this GNU manual. Buying copies from the FSF supports it in
  15. developing GNU and promoting software freedom."
  16. INFO-DIR-SECTION Emacs
  17. START-INFO-DIR-ENTRY
  18. * Emacs: (emacs). The extensible self-documenting text editor.
  19. END-INFO-DIR-ENTRY
  20. 
  21. File: emacs, Node: Top, Next: Distrib, Prev: (dir), Up: (dir)
  22. The Emacs Editor
  23. ****************
  24. Emacs is the extensible, customizable, self-documenting real-time
  25. display editor. This Info file describes how to edit with Emacs and
  26. some of the ways to customize it; it corresponds to GNU Emacs version
  27. 24.2.
  28. If you are reading this in Emacs, type `h' to read a basic
  29. introduction to the Info documentation system.
  30. For information on extending Emacs, see *note Emacs Lisp: (elisp)Top.
  31. This is the `GNU Emacs Manual', updated for Emacs version 24.2.
  32. Copyright (C) 1985-1987, 1993-2012 Free Software Foundation, Inc.
  33. Permission is granted to copy, distribute and/or modify this
  34. document under the terms of the GNU Free Documentation License,
  35. Version 1.3 or any later version published by the Free Software
  36. Foundation; with the Invariant Sections being "The GNU Manifesto,"
  37. "Distribution" and "GNU GENERAL PUBLIC LICENSE," with the
  38. Front-Cover texts being "A GNU Manual," and with the Back-Cover
  39. Texts as in (a) below. A copy of the license is included in the
  40. section entitled "GNU Free Documentation License."
  41. (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
  42. modify this GNU manual. Buying copies from the FSF supports it in
  43. developing GNU and promoting software freedom."
  44. * Menu:
  45. * Distrib:: How to get the latest Emacs distribution.
  46. * Intro:: An introduction to Emacs concepts.
  47. * Glossary:: Terms used in this manual.
  48. Indexes (each index contains a large menu)
  49. * Key Index:: An item for each standard Emacs key sequence.
  50. * Option Index:: An item for every command-line option.
  51. * Command Index:: An item for each command name.
  52. * Variable Index:: An item for each documented variable.
  53. * Concept Index:: An item for each concept.
  54. * Acknowledgments:: Major contributors to GNU Emacs.
  55. Important General Concepts
  56. * Screen:: How to interpret what you see on the screen.
  57. * User Input:: Kinds of input events (characters, buttons,
  58. function keys).
  59. * Keys:: Key sequences: what you type to request one
  60. editing action.
  61. * Commands:: Named functions run by key sequences to do editing.
  62. * Entering Emacs:: Starting Emacs from the shell.
  63. * Exiting:: Stopping or killing Emacs.
  64. Fundamental Editing Commands
  65. * Basic:: The most basic editing commands.
  66. * Minibuffer:: Entering arguments that are prompted for.
  67. * M-x:: Invoking commands by their names.
  68. * Help:: Commands for asking Emacs about its commands.
  69. Important Text-Changing Commands
  70. * Mark:: The mark: how to delimit a "region" of text.
  71. * Killing:: Killing (cutting) and yanking (copying) text.
  72. * Registers:: Saving a text string or a location in the buffer.
  73. * Display:: Controlling what text is displayed.
  74. * Search:: Finding or replacing occurrences of a string.
  75. * Fixit:: Commands especially useful for fixing typos.
  76. * Keyboard Macros:: Recording a sequence of keystrokes to be replayed.
  77. Major Structures of Emacs
  78. * Files:: All about handling files.
  79. * Buffers:: Multiple buffers; editing several files at once.
  80. * Windows:: Viewing multiple pieces of text in one frame.
  81. * Frames:: Using multiple "windows" on your display.
  82. * International:: Using non-ASCII character sets.
  83. Advanced Features
  84. * Modes:: Major and minor modes alter Emacs's basic behavior.
  85. * Indentation:: Editing the white space at the beginnings of lines.
  86. * Text:: Commands and modes for editing human languages.
  87. * Programs:: Commands and modes for editing programs.
  88. * Building:: Compiling, running and debugging programs.
  89. * Maintaining:: Features for maintaining large programs.
  90. * Abbrevs:: Defining text abbreviations to reduce typing.
  91. * Dired:: Directory and file manager.
  92. * Calendar/Diary:: Calendar and diary facilities.
  93. * Sending Mail:: Sending mail in Emacs.
  94. * Rmail:: Reading mail in Emacs.
  95. * Gnus:: A flexible mail and news reader.
  96. * Document View:: Viewing PDF, PS and DVI files.
  97. * Shell:: Executing shell commands from Emacs.
  98. * Emacs Server:: Using Emacs as an editing server.
  99. * Printing:: Printing hardcopies of buffers or regions.
  100. * Sorting:: Sorting lines, paragraphs or pages within Emacs.
  101. * Picture Mode:: Editing pictures made up of text characters.
  102. * Editing Binary Files:: Editing binary files with Hexl mode.
  103. * Saving Emacs Sessions:: Saving Emacs state from one session to the next.
  104. * Recursive Edit:: Performing edits while "within another command".
  105. * Emulation:: Emulating some other editors with Emacs.
  106. * Hyperlinking:: Following links in buffers.
  107. * Amusements:: Various games and hacks.
  108. * Packages:: Installing additional features.
  109. * Customization:: Modifying the behavior of Emacs.
  110. Recovery from Problems
  111. * Quitting:: Quitting and aborting.
  112. * Lossage:: What to do if Emacs is hung or malfunctioning.
  113. * Bugs:: How and when to report a bug.
  114. * Contributing:: How to contribute improvements to Emacs.
  115. * Service:: How to get help for your own Emacs needs.
  116. Appendices
  117. * Copying:: The GNU General Public License gives you permission
  118. to redistribute GNU Emacs on certain terms;
  119. it also explains that there is no warranty.
  120. * GNU Free Documentation License:: The license for this documentation.
  121. * Emacs Invocation:: Hairy startup options.
  122. * X Resources:: X resources for customizing Emacs.
  123. * Antinews:: Information about Emacs version 23.
  124. * Mac OS / GNUstep:: Using Emacs under Mac OS and GNUstep.
  125. * Microsoft Windows:: Using Emacs on Microsoft Windows and MS-DOS.
  126. * Manifesto:: What's GNU? Gnu's Not Unix!
  127. --- The Detailed Node Listing ---
  128. ---------------------------------
  129. Here are some other nodes which are really subnodes of the ones
  130. already listed, mentioned here so you can get to them in one step:
  131. The Organization of the Screen
  132. * Point:: The place in the text where editing commands operate.
  133. * Echo Area:: Short messages appear at the bottom of the screen.
  134. * Mode Line:: Interpreting the mode line.
  135. * Menu Bar:: How to use the menu bar.
  136. Basic Editing Commands
  137. * Inserting Text:: Inserting text by simply typing it.
  138. * Moving Point:: Moving the cursor to the place where you want to
  139. change something.
  140. * Erasing:: Deleting and killing text.
  141. * Basic Undo:: Undoing recent changes in the text.
  142. * Basic Files:: Visiting, creating, and saving files.
  143. * Basic Help:: Asking what a character does.
  144. * Blank Lines:: Making and deleting blank lines.
  145. * Continuation Lines:: How Emacs displays lines too wide for the screen.
  146. * Position Info:: What line, row, or column is point on?
  147. * Arguments:: Numeric arguments for repeating a command N times.
  148. * Repeating:: Repeating the previous command quickly.
  149. The Minibuffer
  150. * Minibuffer File:: Entering file names with the minibuffer.
  151. * Minibuffer Edit:: How to edit in the minibuffer.
  152. * Completion:: An abbreviation facility for minibuffer input.
  153. * Minibuffer History:: Reusing recent minibuffer arguments.
  154. * Repetition:: Re-executing commands that used the minibuffer.
  155. * Passwords:: Entering passwords in the echo area.
  156. Completion
  157. * Completion Example:: Examples of using completion.
  158. * Completion Commands:: A list of completion commands.
  159. * Completion Exit:: Completion and minibuffer text submission.
  160. * Completion Styles:: How completion matches are chosen.
  161. * Completion Options:: Options for completion.
  162. Help
  163. * Help Summary:: Brief list of all Help commands.
  164. * Key Help:: Asking what a key does in Emacs.
  165. * Name Help:: Asking about a command, variable or function name.
  166. * Apropos:: Asking what pertains to a given topic.
  167. * Help Mode:: Special features of Help mode and Help buffers.
  168. * Package Keywords:: Finding Lisp libraries by keywords (topics).
  169. * Language Help:: Help relating to international language support.
  170. * Misc Help:: Other help commands.
  171. * Help Files:: Commands to display auxiliary help files.
  172. * Help Echo:: Help on active text and tooltips ("balloon help").
  173. The Mark and the Region
  174. * Setting Mark:: Commands to set the mark.
  175. * Marking Objects:: Commands to put region around textual units.
  176. * Using Region:: Summary of ways to operate on contents of the region.
  177. * Mark Ring:: Previous mark positions saved so you can go back there.
  178. * Global Mark Ring:: Previous mark positions in various buffers.
  179. * Shift Selection:: Using shifted cursor motion keys.
  180. * Disabled Transient Mark:: Leaving regions unhighlighted by default.
  181. Killing and Moving Text
  182. * Deletion and Killing:: Commands that remove text.
  183. * Yanking:: Commands that insert text.
  184. * Cut and Paste:: Clipboard and selections on graphical displays.
  185. * Accumulating Text:: Other methods to add text to the buffer.
  186. * Rectangles:: Operating on text in rectangular areas.
  187. * CUA Bindings:: Using C-x/C-c/C-v to kill and yank.
  188. Deletion and Killing
  189. * Deletion:: Commands for deleting small amounts of text and
  190. blank areas.
  191. * Killing by Lines:: How to kill entire lines of text at one time.
  192. * Other Kill Commands:: Commands to kill large regions of text and
  193. syntactic units such as words and sentences.
  194. * Kill Options:: Options that affect killing.
  195. Yanking
  196. * Kill Ring:: Where killed text is stored.
  197. * Earlier Kills:: Yanking something killed some time ago.
  198. * Appending Kills:: Several kills in a row all yank together.
  199. "Cut and Paste" Operations on Graphical Displays
  200. * Clipboard:: How Emacs uses the system clipboard.
  201. * Primary Selection:: The temporarily selected text selection.
  202. * Secondary Selection:: Cutting without altering point and mark.
  203. Registers
  204. * Position Registers:: Saving positions in registers.
  205. * Text Registers:: Saving text in registers.
  206. * Rectangle Registers:: Saving rectangles in registers.
  207. * Configuration Registers:: Saving window configurations in registers.
  208. * Number Registers:: Numbers in registers.
  209. * File Registers:: File names in registers.
  210. * Bookmarks:: Bookmarks are like registers, but persistent.
  211. Controlling the Display
  212. * Scrolling:: Commands to move text up and down in a window.
  213. * Recentering:: A scroll command that centers the current line.
  214. * Auto Scrolling:: Redisplay scrolls text automatically when needed.
  215. * Horizontal Scrolling:: Moving text left and right in a window.
  216. * Narrowing:: Restricting display and editing to a portion
  217. of the buffer.
  218. * View Mode:: Viewing read-only buffers.
  219. * Follow Mode:: Follow mode lets two windows scroll as one.
  220. * Faces:: How to change the display style using faces.
  221. * Colors:: Specifying colors for faces.
  222. * Standard Faces:: The main predefined faces.
  223. * Text Scale:: Increasing or decreasing text size in a buffer.
  224. * Font Lock:: Minor mode for syntactic highlighting using faces.
  225. * Highlight Interactively:: Tell Emacs what text to highlight.
  226. * Fringes:: Enabling or disabling window fringes.
  227. * Displaying Boundaries:: Displaying top and bottom of the buffer.
  228. * Useless Whitespace:: Showing possibly spurious trailing whitespace.
  229. * Selective Display:: Hiding lines with lots of indentation.
  230. * Optional Mode Line:: Optional mode line display features.
  231. * Text Display:: How text characters are normally displayed.
  232. * Cursor Display:: Features for displaying the cursor.
  233. * Line Truncation:: Truncating lines to fit the screen width instead
  234. of continuing them to multiple screen lines.
  235. * Visual Line Mode:: Word wrap and screen line-based editing.
  236. * Display Custom:: Information on variables for customizing display.
  237. Searching and Replacement
  238. * Incremental Search:: Search happens as you type the string.
  239. * Nonincremental Search:: Specify entire string and then search.
  240. * Word Search:: Search for sequence of words.
  241. * Regexp Search:: Search for match for a regexp.
  242. * Regexps:: Syntax of regular expressions.
  243. * Regexp Backslash:: Regular expression constructs starting with `\'.
  244. * Regexp Example:: A complex regular expression explained.
  245. * Search Case:: To ignore case while searching, or not.
  246. * Replace:: Search, and replace some or all matches.
  247. * Other Repeating Search:: Operating on all matches for some regexp.
  248. Incremental Search
  249. * Basic Isearch:: Basic incremental search commands.
  250. * Repeat Isearch:: Searching for the same string again.
  251. * Error in Isearch:: When your string is not found.
  252. * Special Isearch:: Special input in incremental search.
  253. * Isearch Yank:: Commands that grab text into the search string
  254. or else edit the search string.
  255. * Isearch Scroll:: Scrolling during an incremental search.
  256. * Isearch Minibuffer:: Incremental search of the minibuffer history.
  257. Replacement Commands
  258. * Unconditional Replace:: Replacing all matches for a string.
  259. * Regexp Replace:: Replacing all matches for a regexp.
  260. * Replacement and Case:: How replacements preserve case of letters.
  261. * Query Replace:: How to use querying.
  262. Commands for Fixing Typos
  263. * Undo:: The Undo commands.
  264. * Transpose:: Exchanging two characters, words, lines, lists...
  265. * Fixing Case:: Correcting case of last word entered.
  266. * Spelling:: Apply spelling checker to a word, or a whole file.
  267. Keyboard Macros
  268. * Basic Keyboard Macro:: Defining and running keyboard macros.
  269. * Keyboard Macro Ring:: Where previous keyboard macros are saved.
  270. * Keyboard Macro Counter:: Inserting incrementing numbers in macros.
  271. * Keyboard Macro Query:: Making keyboard macros do different things each
  272. time.
  273. * Save Keyboard Macro:: Giving keyboard macros names; saving them in
  274. files.
  275. * Edit Keyboard Macro:: Editing keyboard macros.
  276. * Keyboard Macro Step-Edit:: Interactively executing and editing a keyboard
  277. macro.
  278. File Handling
  279. * File Names:: How to type and edit file-name arguments.
  280. * Visiting:: Visiting a file prepares Emacs to edit the file.
  281. * Saving:: Saving makes your changes permanent.
  282. * Reverting:: Reverting cancels all the changes not saved.
  283. * Autorevert:: Auto Reverting non-file buffers.
  284. * Auto Save:: Auto Save periodically protects against loss of data.
  285. * File Aliases:: Handling multiple names for one file.
  286. * Directories:: Creating, deleting, and listing file directories.
  287. * Comparing Files:: Finding where two files differ.
  288. * Diff Mode:: Mode for editing file differences.
  289. * Misc File Ops:: Other things you can do on files.
  290. * Compressed Files:: Accessing compressed files.
  291. * File Archives:: Operating on tar, zip, jar etc. archive files.
  292. * Remote Files:: Accessing files on other machines.
  293. * Quoted File Names:: Quoting special characters in file names.
  294. * File Name Cache:: Completion against a list of files you often use.
  295. * File Conveniences:: Convenience Features for Finding Files.
  296. * Filesets:: Handling sets of files.
  297. Saving Files
  298. * Save Commands:: Commands for saving files.
  299. * Backup:: How Emacs saves the old version of your file.
  300. * Customize Save:: Customizing the saving of files.
  301. * Interlocking:: How Emacs protects against simultaneous editing
  302. of one file by two users.
  303. * File Shadowing:: Copying files to "shadows" automatically.
  304. * Time Stamps:: Emacs can update time stamps on saved files.
  305. Backup Files
  306. * Backup Names:: How backup files are named.
  307. * Backup Deletion:: Emacs deletes excess numbered backups.
  308. * Backup Copying:: Backups can be made by copying or renaming.
  309. Auto Reverting Non-File Buffers
  310. * Auto Reverting the Buffer Menu:: Auto Revert of the Buffer Menu.
  311. * Auto Reverting Dired:: Auto Revert of Dired buffers.
  312. * Supporting additional buffers:: How to add more Auto Revert support.
  313. Auto-Saving: Protection Against Disasters
  314. * Auto Save Files:: The file where auto-saved changes are
  315. actually made until you save the file.
  316. * Auto Save Control:: Controlling when and how often to auto-save.
  317. * Recover:: Recovering text from auto-save files.
  318. Using Multiple Buffers
  319. * Select Buffer:: Creating a new buffer or reselecting an old one.
  320. * List Buffers:: Getting a list of buffers that exist.
  321. * Misc Buffer:: Renaming; changing read-onlyness; copying text.
  322. * Kill Buffer:: Killing buffers you no longer need.
  323. * Several Buffers:: How to go through the list of all buffers
  324. and operate variously on several of them.
  325. * Indirect Buffers:: An indirect buffer shares the text of another buffer.
  326. * Buffer Convenience:: Convenience and customization features for
  327. buffer handling.
  328. Convenience Features and Customization of Buffer Handling
  329. * Uniquify:: Making buffer names unique with directory parts.
  330. * Iswitchb:: Switching between buffers with substrings.
  331. * Buffer Menus:: Configurable buffer menu.
  332. Multiple Windows
  333. * Basic Window:: Introduction to Emacs windows.
  334. * Split Window:: New windows are made by splitting existing windows.
  335. * Other Window:: Moving to another window or doing something to it.
  336. * Pop Up Window:: Finding a file or buffer in another window.
  337. * Change Window:: Deleting windows and changing their sizes.
  338. * Displaying Buffers:: How Emacs picks a window for displaying a buffer.
  339. * Window Convenience:: Convenience functions for window handling.
  340. Displaying a Buffer in a Window
  341. * Window Choice:: How `display-buffer' works.
  342. Frames and Graphical Displays
  343. * Mouse Commands:: Moving, cutting, and pasting, with the mouse.
  344. * Word and Line Mouse:: Mouse commands for selecting whole words or lines.
  345. * Mouse References:: Using the mouse to select an item from a list.
  346. * Menu Mouse Clicks:: Mouse clicks that bring up menus.
  347. * Mode Line Mouse:: Mouse clicks on the mode line.
  348. * Creating Frames:: Creating additional Emacs frames with various contents.
  349. * Frame Commands:: Iconifying, deleting, and switching frames.
  350. * Fonts:: Changing the frame font.
  351. * Speedbar:: How to make and use a speedbar frame.
  352. * Multiple Displays:: How one Emacs instance can talk to several displays.
  353. * Frame Parameters:: Changing the colors and other modes of frames.
  354. * Scroll Bars:: How to enable and disable scroll bars; how to use them.
  355. * Drag and Drop:: Using drag and drop to open files and insert text.
  356. * Menu Bars:: Enabling and disabling the menu bar.
  357. * Tool Bars:: Enabling and disabling the tool bar.
  358. * Dialog Boxes:: Controlling use of dialog boxes.
  359. * Tooltips:: Displaying information at the current mouse position.
  360. * Mouse Avoidance:: Preventing the mouse pointer from obscuring text.
  361. * Non-Window Terminals:: Multiple frames on terminals that show only one.
  362. * Text-Only Mouse:: Using the mouse in text terminals.
  363. International Character Set Support
  364. * International Chars:: Basic concepts of multibyte characters.
  365. * Disabling Multibyte:: Controlling whether to use multibyte characters.
  366. * Language Environments:: Setting things up for the language you use.
  367. * Input Methods:: Entering text characters not on your keyboard.
  368. * Select Input Method:: Specifying your choice of input methods.
  369. * Coding Systems:: Character set conversion when you read and
  370. write files, and so on.
  371. * Recognize Coding:: How Emacs figures out which conversion to use.
  372. * Specify Coding:: Specifying a file's coding system explicitly.
  373. * Output Coding:: Choosing coding systems for output.
  374. * Text Coding:: Choosing conversion to use for file text.
  375. * Communication Coding:: Coding systems for interprocess communication.
  376. * File Name Coding:: Coding systems for file _names_.
  377. * Terminal Coding:: Specifying coding systems for converting
  378. terminal input and output.
  379. * Fontsets:: Fontsets are collections of fonts
  380. that cover the whole spectrum of characters.
  381. * Defining Fontsets:: Defining a new fontset.
  382. * Modifying Fontsets:: Modifying an existing fontset.
  383. * Undisplayable Characters::When characters don't display.
  384. * Unibyte Mode:: You can pick one European character set
  385. to use without multibyte characters.
  386. * Charsets:: How Emacs groups its internal character codes.
  387. * Bidirectional Editing:: Support for right-to-left scripts.
  388. Major and Minor Modes
  389. * Major Modes:: Text mode vs. Lisp mode vs. C mode...
  390. * Minor Modes:: Each minor mode is a feature you can turn on
  391. independently of any others.
  392. * Choosing Modes:: How modes are chosen when visiting files.
  393. Indentation
  394. * Indentation Commands:: More commands for performing indentation.
  395. * Tab Stops:: Stop points for indentation in Text modes.
  396. * Just Spaces:: Using only space characters for indentation.
  397. * Indent Convenience:: Optional indentation features.
  398. Commands for Human Languages
  399. * Words:: Moving over and killing words.
  400. * Sentences:: Moving over and killing sentences.
  401. * Paragraphs:: Moving over paragraphs.
  402. * Pages:: Moving over pages.
  403. * Filling:: Filling or justifying text.
  404. * Case:: Changing the case of text.
  405. * Text Mode:: The major modes for editing text files.
  406. * Outline Mode:: Editing outlines.
  407. * Org Mode:: The Emacs organizer.
  408. * TeX Mode:: Editing TeX and LaTeX files.
  409. * HTML Mode:: Editing HTML and SGML files.
  410. * Nroff Mode:: Editing input to the nroff formatter.
  411. * Enriched Text:: Editing text "enriched" with fonts, colors, etc.
  412. * Text Based Tables:: Commands for editing text-based tables.
  413. * Two-Column:: Splitting text columns into separate windows.
  414. Filling Text
  415. * Auto Fill:: Auto Fill mode breaks long lines automatically.
  416. * Fill Commands:: Commands to refill paragraphs and center lines.
  417. * Fill Prefix:: Filling paragraphs that are indented
  418. or in a comment, etc.
  419. * Adaptive Fill:: How Emacs can determine the fill prefix automatically.
  420. Outline Mode
  421. * Outline Format:: What the text of an outline looks like.
  422. * Outline Motion:: Special commands for moving through outlines.
  423. * Outline Visibility:: Commands to control what is visible.
  424. * Outline Views:: Outlines and multiple views.
  425. * Foldout:: Folding means zooming in on outlines.
  426. Org Mode
  427. * Org Organizer:: Managing TODO lists and agendas.
  428. * Org Authoring:: Exporting Org buffers to various formats.
  429. TeX Mode
  430. * TeX Editing:: Special commands for editing in TeX mode.
  431. * LaTeX Editing:: Additional commands for LaTeX input files.
  432. * TeX Print:: Commands for printing part of a file with TeX.
  433. * TeX Misc:: Customization of TeX mode, and related features.
  434. Enriched Text
  435. * Enriched Mode:: Entering and exiting Enriched mode.
  436. * Hard and Soft Newlines:: There are two different kinds of newlines.
  437. * Editing Format Info:: How to edit text properties.
  438. * Enriched Faces:: Bold, italic, underline, etc.
  439. * Enriched Indentation:: Changing the left and right margins.
  440. * Enriched Justification:: Centering, setting text flush with the
  441. left or right margin, etc.
  442. * Enriched Properties:: The "special" text properties submenu.
  443. Editing Text-based Tables
  444. * Table Definition:: What is a text based table.
  445. * Table Creation:: How to create a table.
  446. * Table Recognition:: How to activate and deactivate tables.
  447. * Cell Commands:: Cell-oriented commands in a table.
  448. * Cell Justification:: Justifying cell contents.
  449. * Table Rows and Columns:: Inserting and deleting rows and columns.
  450. * Table Conversion:: Converting between plain text and tables.
  451. * Table Misc:: Table miscellany.
  452. Editing Programs
  453. * Program Modes:: Major modes for editing programs.
  454. * Defuns:: Commands to operate on major top-level parts
  455. of a program.
  456. * Program Indent:: Adjusting indentation to show the nesting.
  457. * Parentheses:: Commands that operate on parentheses.
  458. * Comments:: Inserting, killing, and aligning comments.
  459. * Documentation:: Getting documentation of functions you plan to call.
  460. * Hideshow:: Displaying blocks selectively.
  461. * Symbol Completion:: Completion on symbol names of your program or language.
  462. * Glasses:: Making identifiersLikeThis more readable.
  463. * Semantic:: Suite of editing tools based on source code parsing.
  464. * Misc for Programs:: Other Emacs features useful for editing programs.
  465. * C Modes:: Special commands of C, C++, Objective-C,
  466. Java, IDL, Pike and AWK modes.
  467. * Asm Mode:: Asm mode and its special features.
  468. * Fortran:: Fortran mode and its special features.
  469. Top-Level Definitions, or Defuns
  470. * Left Margin Paren:: An open-paren or similar opening delimiter
  471. starts a defun if it is at the left margin.
  472. * Moving by Defuns:: Commands to move over or mark a major definition.
  473. * Imenu:: Making buffer indexes as menus.
  474. * Which Function:: Which Function mode shows which function you are in.
  475. Indentation for Programs
  476. * Basic Indent:: Indenting a single line.
  477. * Multi-line Indent:: Commands to reindent many lines at once.
  478. * Lisp Indent:: Specifying how each Lisp function should be indented.
  479. * C Indent:: Extra features for indenting C and related modes.
  480. * Custom C Indent:: Controlling indentation style for C and related modes.
  481. Commands for Editing with Parentheses
  482. * Expressions:: Expressions with balanced parentheses.
  483. * Moving by Parens:: Commands for moving up, down and across
  484. in the structure of parentheses.
  485. * Matching:: Insertion of a close-delimiter flashes matching open.
  486. Manipulating Comments
  487. * Comment Commands:: Inserting, killing, and aligning comments.
  488. * Multi-Line Comments:: Commands for adding and editing multi-line comments.
  489. * Options for Comments::Customizing the comment features.
  490. Documentation Lookup
  491. * Info Lookup:: Looking up library functions and commands in Info files.
  492. * Man Page:: Looking up man pages of library functions and commands.
  493. * Lisp Doc:: Looking up Emacs Lisp functions, etc.
  494. C and Related Modes
  495. * Motion in C:: Commands to move by C statements, etc.
  496. * Electric C:: Colon and other chars can automatically reindent.
  497. * Hungry Delete:: A more powerful DEL command.
  498. * Other C Commands:: Filling comments, viewing expansion of macros,
  499. and other neat features.
  500. Fortran Mode
  501. * Fortran Motion:: Moving point by statements or subprograms.
  502. * Fortran Indent:: Indentation commands for Fortran.
  503. * Fortran Comments:: Inserting and aligning comments.
  504. * Fortran Autofill:: Auto fill support for Fortran.
  505. * Fortran Columns:: Measuring columns for valid Fortran.
  506. * Fortran Abbrev:: Built-in abbrevs for Fortran keywords.
  507. Fortran Indentation
  508. * ForIndent Commands:: Commands for indenting and filling Fortran.
  509. * ForIndent Cont:: How continuation lines indent.
  510. * ForIndent Num:: How line numbers auto-indent.
  511. * ForIndent Conv:: Conventions you must obey to avoid trouble.
  512. * ForIndent Vars:: Variables controlling Fortran indent style.
  513. Compiling and Testing Programs
  514. * Compilation:: Compiling programs in languages other
  515. than Lisp (C, Pascal, etc.).
  516. * Compilation Mode:: The mode for visiting compiler errors.
  517. * Compilation Shell:: Customizing your shell properly
  518. for use in the compilation buffer.
  519. * Grep Searching:: Searching with grep.
  520. * Flymake:: Finding syntax errors on the fly.
  521. * Debuggers:: Running symbolic debuggers for non-Lisp programs.
  522. * Executing Lisp:: Various modes for editing Lisp programs,
  523. with different facilities for running
  524. the Lisp programs.
  525. * Lisp Libraries:: How Lisp programs are loaded into Emacs.
  526. * Lisp Eval:: Executing a single Lisp expression in Emacs.
  527. * Lisp Interaction:: Executing Lisp in an Emacs buffer.
  528. * External Lisp:: Communicating through Emacs with a separate Lisp.
  529. Running Debuggers Under Emacs
  530. * Starting GUD:: How to start a debugger subprocess.
  531. * Debugger Operation:: Connection between the debugger and source buffers.
  532. * Commands of GUD:: Key bindings for common commands.
  533. * GUD Customization:: Defining your own commands for GUD.
  534. * GDB Graphical Interface:: An enhanced mode that uses GDB features to
  535. implement a graphical debugging environment.
  536. GDB Graphical Interface
  537. * GDB User Interface Layout:: Control the number of displayed buffers.
  538. * Source Buffers:: Use the mouse in the fringe/margin to
  539. control your program.
  540. * Breakpoints Buffer:: A breakpoint control panel.
  541. * Threads Buffer:: Displays your threads.
  542. * Stack Buffer:: Select a frame from the call stack.
  543. * Other GDB Buffers:: Other buffers for controlling the GDB state.
  544. * Watch Expressions:: Monitor variable values in the speedbar.
  545. * Multithreaded Debugging:: Debugging programs with several threads.
  546. Maintaining Large Programs
  547. * Version Control:: Using version control systems.
  548. * Change Log:: Maintaining a change history for your program.
  549. * Tags:: Go directly to any function in your program in one
  550. command. Tags remembers which file it is in.
  551. * EDE:: An integrated development environment for Emacs.
  552. * Emerge:: A convenient way of merging two versions of a program.
  553. Version Control
  554. * Introduction to VC:: How version control works in general.
  555. * VC Mode Line:: How the mode line shows version control status.
  556. * Basic VC Editing:: How to edit a file under version control.
  557. * Log Buffer:: Features available in log entry buffers.
  558. * Registering:: Putting a file under version control.
  559. * Old Revisions:: Examining and comparing old versions.
  560. * VC Change Log:: Viewing the VC Change Log.
  561. * VC Undo:: Canceling changes before or after committing.
  562. * VC Directory Mode:: Listing files managed by version control.
  563. * Branches:: Multiple lines of development.
  564. * Miscellaneous VC:: Various other commands and features of VC.
  565. * Customizing VC:: Variables that change VC's behavior.
  566. Introduction to Version Control
  567. * Why Version Control?:: Understanding the problems it addresses.
  568. * Version Control Systems:: Supported version control back-end systems.
  569. * VCS Concepts:: Words and concepts related to version control.
  570. * VCS Merging:: How file conflicts are handled.
  571. * VCS Changesets:: How changes are grouped.
  572. * VCS Repositories:: Where version control repositories are stored.
  573. * Types of Log File:: The VCS log in contrast to the ChangeLog.
  574. Basic Editing under Version Control
  575. * VC With A Merging VCS:: Without locking: default mode for CVS.
  576. * VC With A Locking VCS:: RCS in its default mode, SCCS, and optionally CVS.
  577. * Advanced C-x v v:: Advanced features available with a prefix argument.
  578. VC Directory Mode
  579. * VC Directory Buffer:: What the buffer looks like and means.
  580. * VC Directory Commands:: Commands to use in a VC directory buffer.
  581. Version Control Branches
  582. * Switching Branches:: How to get to another existing branch.
  583. * VC Pull:: Updating the contents of a branch.
  584. * Merging:: Transferring changes between branches.
  585. * Creating Branches:: How to start a new branch.
  586. Miscellaneous Commands and Features of VC
  587. * Change Logs and VC:: Generating a change log file from log entries.
  588. * VC Delete/Rename:: Deleting and renaming version-controlled files.
  589. * Revision Tags:: Symbolic names for revisions.
  590. * Version Headers:: Inserting version control headers into working files.
  591. Customizing VC
  592. * General VC Options:: Options that apply to multiple back ends.
  593. * RCS and SCCS:: Options for RCS and SCCS.
  594. * CVS Options:: Options for CVS.
  595. Change Logs
  596. * Change Log Commands:: Commands for editing change log files.
  597. * Format of ChangeLog:: What the change log file looks like.
  598. Tags Tables
  599. * Tag Syntax:: Tag syntax for various types of code and text files.
  600. * Create Tags Table:: Creating a tags table with `etags'.
  601. * Etags Regexps:: Create arbitrary tags using regular expressions.
  602. * Select Tags Table:: How to visit a tags table.
  603. * Find Tag:: Commands to find the definition of a specific tag.
  604. * Tags Search:: Using a tags table for searching and replacing.
  605. * List Tags:: Using tags for completion, and listing them.
  606. Merging Files with Emerge
  607. * Overview of Emerge:: How to start Emerge. Basic concepts.
  608. * Submodes of Emerge:: Fast mode vs. Edit mode.
  609. Skip Prefers mode and Auto Advance mode.
  610. * State of Difference:: You do the merge by specifying state A or B
  611. for each difference.
  612. * Merge Commands:: Commands for selecting a difference,
  613. changing states of differences, etc.
  614. * Exiting Emerge:: What to do when you've finished the merge.
  615. * Combining in Emerge:: How to keep both alternatives for a difference.
  616. * Fine Points of Emerge:: Miscellaneous issues.
  617. Abbrevs
  618. * Abbrev Concepts:: Fundamentals of defined abbrevs.
  619. * Defining Abbrevs:: Defining an abbrev, so it will expand when typed.
  620. * Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
  621. * Editing Abbrevs:: Viewing or editing the entire list of defined abbrevs.
  622. * Saving Abbrevs:: Saving the entire list of abbrevs for another session.
  623. * Dynamic Abbrevs:: Abbreviations for words already in the buffer.
  624. * Dabbrev Customization:: What is a word, for dynamic abbrevs. Case handling.
  625. Editing Pictures
  626. * Basic Picture:: Basic concepts and simple commands of Picture Mode.
  627. * Insert in Picture:: Controlling direction of cursor motion
  628. after "self-inserting" characters.
  629. * Tabs in Picture:: Various features for tab stops and indentation.
  630. * Rectangles in Picture:: Clearing and superimposing rectangles.
  631. Dired, the Directory Editor
  632. * Dired Enter:: How to invoke Dired.
  633. * Dired Navigation:: Special motion commands in the Dired buffer.
  634. * Dired Deletion:: Deleting files with Dired.
  635. * Flagging Many Files:: Flagging files based on their names.
  636. * Dired Visiting:: Other file operations through Dired.
  637. * Marks vs Flags:: Flagging for deletion vs marking.
  638. * Operating on Files:: How to copy, rename, print, compress, etc.
  639. either one file or several files.
  640. * Shell Commands in Dired:: Running a shell command on the marked files.
  641. * Transforming File Names:: Using patterns to rename multiple files.
  642. * Comparison in Dired:: Running `diff' by way of Dired.
  643. * Subdirectories in Dired:: Adding subdirectories to the Dired buffer.
  644. * Subdir Switches:: Subdirectory switches in Dired.
  645. * Subdirectory Motion:: Moving across subdirectories, and up and down.
  646. * Hiding Subdirectories:: Making subdirectories visible or invisible.
  647. * Dired Updating:: Discarding lines for files of no interest.
  648. * Dired and Find:: Using `find' to choose the files for Dired.
  649. * Wdired:: Operating on files by editing the Dired buffer.
  650. * Image-Dired:: Viewing image thumbnails in Dired.
  651. * Misc Dired Features:: Various other features.
  652. The Calendar and the Diary
  653. * Calendar Motion:: Moving through the calendar; selecting a date.
  654. * Scroll Calendar:: Bringing earlier or later months onto the screen.
  655. * Counting Days:: How many days are there between two dates?
  656. * General Calendar:: Exiting or recomputing the calendar.
  657. * Writing Calendar Files:: Writing calendars to files of various formats.
  658. * Holidays:: Displaying dates of holidays.
  659. * Sunrise/Sunset:: Displaying local times of sunrise and sunset.
  660. * Lunar Phases:: Displaying phases of the moon.
  661. * Other Calendars:: Converting dates to other calendar systems.
  662. * Diary:: Displaying events from your diary.
  663. * Appointments:: Reminders when it's time to do something.
  664. * Importing Diary:: Converting diary events to/from other formats.
  665. * Daylight Saving:: How to specify when daylight saving time is active.
  666. * Time Intervals:: Keeping track of time intervals.
  667. * Advanced Calendar/Diary Usage:: Advanced Calendar/Diary customization.
  668. Movement in the Calendar
  669. * Calendar Unit Motion:: Moving by days, weeks, months, and years.
  670. * Move to Beginning or End:: Moving to start/end of weeks, months, and years.
  671. * Specified Dates:: Moving to the current date or another
  672. specific date.
  673. Conversion To and From Other Calendars
  674. * Calendar Systems:: The calendars Emacs understands
  675. (aside from Gregorian).
  676. * To Other Calendar:: Converting the selected date to various calendars.
  677. * From Other Calendar:: Moving to a date specified in another calendar.
  678. * Mayan Calendar:: Moving to a date specified in a Mayan calendar.
  679. The Diary
  680. * Displaying the Diary:: Viewing diary entries and associated calendar dates.
  681. * Format of Diary File:: Entering events in your diary.
  682. * Date Formats:: Various ways you can specify dates.
  683. * Adding to Diary:: Commands to create diary entries.
  684. * Special Diary Entries:: Anniversaries, blocks of dates, cyclic entries, etc.
  685. Customizing the Calendar and Diary
  686. * Calendar Customizing:: Calendar layout and hooks.
  687. * Holiday Customizing:: Defining your own holidays.
  688. * Date Display Format:: Changing the format.
  689. * Time Display Format:: Changing the format.
  690. * Diary Customizing:: Defaults you can set.
  691. * Non-Gregorian Diary:: Diary entries based on other calendars.
  692. * Diary Display:: A choice of ways to display the diary.
  693. * Fancy Diary Display:: Sorting diary entries, using included diary files.
  694. * Sexp Diary Entries:: More flexible diary entries.
  695. Sending Mail
  696. * Mail Format:: Format of a mail message.
  697. * Mail Headers:: Details of some standard mail header fields.
  698. * Mail Aliases:: Abbreviating and grouping mail addresses.
  699. * Mail Commands:: Special commands for editing mail being composed.
  700. * Mail Signature:: Adding a signature to every message.
  701. * Mail Amusements:: Distracting the NSA; adding fortune messages.
  702. * Mail Methods:: Using alternative mail-composition methods.
  703. Mail Commands
  704. * Mail Sending:: Commands to send the message.
  705. * Header Editing:: Commands to move to header fields and edit them.
  706. * Citing Mail:: Quoting a message you are replying to.
  707. * Mail Misc:: Attachments, spell checking, etc.
  708. Reading Mail with Rmail
  709. * Rmail Basics:: Basic concepts of Rmail, and simple use.
  710. * Rmail Scrolling:: Scrolling through a message.
  711. * Rmail Motion:: Moving to another message.
  712. * Rmail Deletion:: Deleting and expunging messages.
  713. * Rmail Inbox:: How mail gets into the Rmail file.
  714. * Rmail Files:: Using multiple Rmail files.
  715. * Rmail Output:: Copying message out to files.
  716. * Rmail Labels:: Classifying messages by labeling them.
  717. * Rmail Attributes:: Certain standard labels, called attributes.
  718. * Rmail Reply:: Sending replies to messages you are viewing.
  719. * Rmail Summary:: Summaries show brief info on many messages.
  720. * Rmail Sorting:: Sorting messages in Rmail.
  721. * Rmail Display:: How Rmail displays a message; customization.
  722. * Rmail Coding:: How Rmail handles decoding character sets.
  723. * Rmail Editing:: Editing message text and headers in Rmail.
  724. * Rmail Digest:: Extracting the messages from a digest message.
  725. * Rmail Rot13:: Reading messages encoded in the rot13 code.
  726. * Movemail:: More details of fetching new mail.
  727. * Remote Mailboxes:: Retrieving mail from remote mailboxes.
  728. * Other Mailbox Formats:: Retrieving mail from local mailboxes in
  729. various formats.
  730. Rmail Summaries
  731. * Rmail Make Summary:: Making various sorts of summaries.
  732. * Rmail Summary Edit:: Manipulating messages from the summary.
  733. Gnus
  734. * Buffers of Gnus:: The group, summary, and article buffers.
  735. * Gnus Startup:: What you should know about starting Gnus.
  736. * Gnus Group Buffer:: A short description of Gnus group commands.
  737. * Gnus Summary Buffer:: A short description of Gnus summary commands.
  738. Document Viewing
  739. * DocView Navigation:: Navigating DocView buffers.
  740. * DocView Searching:: Searching inside documents.
  741. * DocView Slicing:: Specifying which part of a page is displayed.
  742. * DocView Conversion:: Influencing and triggering conversion.
  743. Running Shell Commands from Emacs
  744. * Single Shell:: How to run one shell command and return.
  745. * Interactive Shell:: Permanent shell taking input via Emacs.
  746. * Shell Mode:: Special Emacs commands used with permanent shell.
  747. * Shell Prompts:: Two ways to recognize shell prompts.
  748. * Shell History:: Repeating previous commands in a shell buffer.
  749. * Directory Tracking:: Keeping track when the subshell changes directory.
  750. * Shell Options:: Options for customizing Shell mode.
  751. * Terminal emulator:: An Emacs window as a terminal emulator.
  752. * Term Mode:: Special Emacs commands used in Term mode.
  753. * Remote Host:: Connecting to another computer.
  754. * Serial Terminal:: Connecting to a serial port.
  755. Shell Command History
  756. * Shell Ring:: Fetching commands from the history list.
  757. * Shell History Copying::Moving to a command and then copying it.
  758. * History References:: Expanding `!'-style history references.
  759. Using Emacs as a Server
  760. * Invoking emacsclient:: Connecting to the Emacs server.
  761. * emacsclient Options:: Emacs client startup options.
  762. Printing Hard Copies
  763. * PostScript:: Printing buffers or regions as PostScript.
  764. * PostScript Variables:: Customizing the PostScript printing commands.
  765. * Printing Package:: An optional advanced printing interface.
  766. Hyperlinking and Navigation Features
  767. * Browse-URL:: Following URLs.
  768. * Goto Address mode:: Activating URLs.
  769. * FFAP:: Finding files etc. at point.
  770. Emacs Lisp Packages
  771. * Package Menu:: Buffer for viewing and managing packages.
  772. * Package Installation:: Options for package installation.
  773. * Package Files:: Where packages are installed.
  774. Customization
  775. * Easy Customization:: Convenient way to browse and change settings.
  776. * Variables:: Many Emacs commands examine Emacs variables
  777. to decide what to do; by setting variables,
  778. you can control their functioning.
  779. * Key Bindings:: The keymaps say what command each key runs.
  780. By changing them, you can "redefine" keys.
  781. * Init File:: How to write common customizations in the
  782. initialization file.
  783. Easy Customization Interface
  784. * Customization Groups:: How settings are classified.
  785. * Browsing Custom:: Browsing and searching for settings.
  786. * Changing a Variable:: How to edit an option's value and set the option.
  787. * Saving Customizations:: Saving customizations for future Emacs sessions.
  788. * Face Customization:: How to edit the attributes of a face.
  789. * Specific Customization:: Customizing specific settings or groups.
  790. * Custom Themes:: Collections of customization settings.
  791. * Creating Custom Themes:: How to create a new custom theme.
  792. Variables
  793. * Examining:: Examining or setting one variable's value.
  794. * Hooks:: Hook variables let you specify programs for parts
  795. of Emacs to run on particular occasions.
  796. * Locals:: Per-buffer values of variables.
  797. * File Variables:: How files can specify variable values.
  798. * Directory Variables:: How variable values can be specified by directory.
  799. Local Variables in Files
  800. * Specifying File Variables:: Specifying file local variables.
  801. * Safe File Variables:: Making sure file local variables are safe.
  802. Customizing Key Bindings
  803. * Keymaps:: Generalities. The global keymap.
  804. * Prefix Keymaps:: Keymaps for prefix keys.
  805. * Local Keymaps:: Major and minor modes have their own keymaps.
  806. * Minibuffer Maps:: The minibuffer uses its own local keymaps.
  807. * Rebinding:: How to redefine one key's meaning conveniently.
  808. * Init Rebinding:: Rebinding keys with your initialization file.
  809. * Modifier Keys:: Using modifier keys in key bindings.
  810. * Function Keys:: Rebinding terminal function keys.
  811. * Named ASCII Chars:: Distinguishing <TAB> from C-i, and so on.
  812. * Mouse Buttons:: Rebinding mouse buttons in Emacs.
  813. * Disabling:: Disabling a command means confirmation is required
  814. before it can be executed. This is done to protect
  815. beginners from surprises.
  816. The Emacs Initialization File
  817. * Init Syntax:: Syntax of constants in Emacs Lisp.
  818. * Init Examples:: How to do some things with an init file.
  819. * Terminal Init:: Each terminal type can have an init file.
  820. * Find Init:: How Emacs finds the init file.
  821. * Init Non-ASCII:: Using non-ASCII characters in an init file.
  822. Dealing with Emacs Trouble
  823. * DEL Does Not Delete:: What to do if <DEL> doesn't delete.
  824. * Stuck Recursive:: `[...]' in mode line around the parentheses.
  825. * Screen Garbled:: Garbage on the screen.
  826. * Text Garbled:: Garbage in the text.
  827. * Memory Full:: How to cope when you run out of memory.
  828. * After a Crash:: Recovering editing in an Emacs session that crashed.
  829. * Emergency Escape:: What to do if Emacs stops responding.
  830. Reporting Bugs
  831. * Known Problems:: How to read about known problems and bugs.
  832. * Bug Criteria:: Have you really found a bug?
  833. * Understanding Bug Reporting:: How to report a bug effectively.
  834. * Checklist:: Steps to follow for a good bug report.
  835. * Sending Patches:: How to send a patch for GNU Emacs.
  836. Command Line Arguments for Emacs Invocation
  837. * Action Arguments:: Arguments to visit files, load libraries,
  838. and call functions.
  839. * Initial Options:: Arguments that take effect while starting Emacs.
  840. * Command Example:: Examples of using command line arguments.
  841. * Environment:: Environment variables that Emacs uses.
  842. * Display X:: Changing the default display and using remote login.
  843. * Font X:: Choosing a font for text, under X.
  844. * Colors X:: Choosing display colors.
  845. * Window Size X:: Start-up window size, under X.
  846. * Borders X:: Internal and external borders, under X.
  847. * Title X:: Specifying the initial frame's title.
  848. * Icons X:: Choosing what sort of icon to use, under X.
  849. * Misc X:: Other display options.
  850. Environment Variables
  851. * General Variables:: Environment variables that all versions of Emacs use.
  852. * Misc Variables:: Certain system-specific variables.
  853. * MS-Windows Registry:: An alternative to the environment on MS-Windows.
  854. X Options and Resources
  855. * Resources:: Using X resources with Emacs (in general).
  856. * Table of Resources:: Table of specific X resources that affect Emacs.
  857. * Lucid Resources:: X resources for Lucid menus.
  858. * LessTif Resources:: X resources for LessTif and Motif menus.
  859. * GTK resources:: Resources for GTK widgets.
  860. GTK resources
  861. * GTK Resource Basics:: Basic usage of GTK+ resources.
  862. * GTK Widget Names:: How GTK+ widgets are named.
  863. * GTK Names in Emacs:: GTK widgets used by Emacs.
  864. * GTK styles:: What can be customized in a GTK widget.
  865. Emacs and Mac OS / GNUstep
  866. * Mac / GNUstep Basics:: Basic Emacs usage under GNUstep or Mac OS.
  867. * Mac / GNUstep Customization:: Customizations under GNUstep or Mac OS.
  868. * Mac / GNUstep Events:: How window system events are handled.
  869. * GNUstep Support:: Details on status of GNUstep support.
  870. Emacs and Microsoft Windows/MS-DOS
  871. * Windows Startup:: How to start Emacs on Windows.
  872. * Text and Binary:: Text files use CRLF to terminate lines.
  873. * Windows Files:: File-name conventions on Windows.
  874. * ls in Lisp:: Emulation of `ls' for Dired.
  875. * Windows HOME:: Where Emacs looks for your `.emacs' and
  876. where it starts up.
  877. * Windows Keyboard:: Windows-specific keyboard features.
  878. * Windows Mouse:: Windows-specific mouse features.
  879. * Windows Processes:: Running subprocesses on Windows.
  880. * Windows Printing:: How to specify the printer on MS-Windows.
  881. * Windows Fonts:: Specifying fonts on MS-Windows.
  882. * Windows Misc:: Miscellaneous Windows features.
  883. * MS-DOS:: Using Emacs on MS-DOS.
  884. Emacs and MS-DOS
  885. * MS-DOS Keyboard:: Keyboard conventions on MS-DOS.
  886. * MS-DOS Mouse:: Mouse conventions on MS-DOS.
  887. * MS-DOS Display:: Fonts, frames and display size on MS-DOS.
  888. * MS-DOS File Names:: File name conventions on MS-DOS.
  889. * MS-DOS Printing:: Printing specifics on MS-DOS.
  890. * MS-DOS and MULE:: Support for internationalization on MS-DOS.
  891. * MS-DOS Processes:: Running subprocesses on MS-DOS.
  892. 
  893. File: emacs, Node: Distrib, Next: Intro, Prev: Top, Up: Top
  894. Distribution
  895. ************
  896. GNU Emacs is "free software"; this means that everyone is free to use
  897. it and free to redistribute it under certain conditions. GNU Emacs is
  898. not in the public domain; it is copyrighted and there are restrictions
  899. on its distribution, but these restrictions are designed to permit
  900. everything that a good cooperating citizen would want to do. What is
  901. not allowed is to try to prevent others from further sharing any
  902. version of GNU Emacs that they might get from you. The precise
  903. conditions are found in the GNU General Public License that comes with
  904. Emacs and also appears in this manual(1). *Note Copying::.
  905. One way to get a copy of GNU Emacs is from someone else who has it.
  906. You need not ask for our permission to do so, or tell any one else;
  907. just copy it. If you have access to the Internet, you can get the
  908. latest distribution version of GNU Emacs by anonymous FTP; see
  909. `http://www.gnu.org/software/emacs' on our website for more information.
  910. You may also receive GNU Emacs when you buy a computer. Computer
  911. manufacturers are free to distribute copies on the same terms that
  912. apply to everyone else. These terms require them to give you the full
  913. sources, including whatever changes they may have made, and to permit
  914. you to redistribute the GNU Emacs received from them under the usual
  915. terms of the General Public License. In other words, the program must
  916. be free for you when you get it, not just free for the manufacturer.
  917. If you find GNU Emacs useful, please *send a donation* to the Free
  918. Software Foundation to support our work. Donations to the Free
  919. Software Foundation are tax deductible in the US. If you use GNU Emacs
  920. at your workplace, please suggest that the company make a donation.
  921. For more information on how you can help, see
  922. `http://www.gnu.org/help/help.html'.
  923. We also sell hardcopy versions of this manual and `An Introduction
  924. to Programming in Emacs Lisp', by Robert J. Chassell. You can visit
  925. our online store at `http://shop.fsf.org/'. The income from sales goes
  926. to support the foundation's purpose: the development of new free
  927. software, and improvements to our existing programs including GNU Emacs.
  928. If you need to contact the Free Software Foundation, see
  929. `http://www.fsf.org/about/contact/', or write to
  930. Free Software Foundation
  931. 51 Franklin Street, Fifth Floor
  932. Boston, MA 02110-1301
  933. USA
  934. ---------- Footnotes ----------
  935. (1) This manual is itself covered by the GNU Free Documentation
  936. License. This license is similar in spirit to the General Public
  937. License, but is more suitable for documentation. *Note GNU Free
  938. Documentation License::.
  939. 
  940. File: emacs, Node: Intro, Next: Glossary, Prev: Distrib, Up: Top
  941. Introduction
  942. ************
  943. You are reading about GNU Emacs, the GNU incarnation of the advanced,
  944. self-documenting, customizable, extensible editor Emacs. (The `G' in
  945. `GNU' is not silent.)
  946. We call Emacs "advanced" because it can do much more than simple
  947. insertion and deletion of text. It can control subprocesses, indent
  948. programs automatically, show multiple files at once, and more. Emacs
  949. editing commands operate in terms of characters, words, lines,
  950. sentences, paragraphs, and pages, as well as expressions and comments
  951. in various programming languages.
  952. "Self-documenting" means that at any time you can use special
  953. commands, known as "help commands", to find out what your options are,
  954. or to find out what any command does, or to find all the commands that
  955. pertain to a given topic. *Note Help::.
  956. "Customizable" means that you can easily alter the behavior of Emacs
  957. commands in simple ways. For instance, if you use a programming
  958. language in which comments start with `<**' and end with `**>', you can
  959. tell the Emacs comment manipulation commands to use those strings
  960. (*note Comments::). To take another example, you can rebind the basic
  961. cursor motion commands (up, down, left and right) to any keys on the
  962. keyboard that you find comfortable. *Note Customization::.
  963. "Extensible" means that you can go beyond simple customization and
  964. create entirely new commands. New commands are simply programs written
  965. in the Lisp language, which are run by Emacs's own Lisp interpreter.
  966. Existing commands can even be redefined in the middle of an editing
  967. session, without having to restart Emacs. Most of the editing commands
  968. in Emacs are written in Lisp; the few exceptions could have been
  969. written in Lisp but use C instead for efficiency. Writing an extension
  970. is programming, but non-programmers can use it afterwards. *Note Emacs
  971. Lisp Intro: (eintr)Top, if you want to learn Emacs Lisp programming.
  972. 
  973. File: emacs, Node: Screen, Next: User Input, Prev: Acknowledgments, Up: Top
  974. 1 The Organization of the Screen
  975. ********************************
  976. On a graphical display, such as on GNU/Linux using the X Window System,
  977. Emacs occupies a "graphical window". On a text terminal, Emacs
  978. occupies the entire terminal screen. We will use the term "frame" to
  979. mean a graphical window or terminal screen occupied by Emacs. Emacs
  980. behaves very similarly on both kinds of frames. It normally starts out
  981. with just one frame, but you can create additional frames if you wish
  982. (*note Frames::).
  983. Each frame consists of several distinct regions. At the top of the
  984. frame is a "menu bar", which allows you to access commands via a series
  985. of menus. On a graphical display, directly below the menu bar is a
  986. "tool bar", a row of icons that perform editing commands if you click
  987. on them. At the very bottom of the frame is an "echo area", where
  988. informative messages are displayed and where you enter information when
  989. Emacs asks for it.
  990. The main area of the frame, below the tool bar (if one exists) and
  991. above the echo area, is called "the window". Henceforth in this
  992. manual, we will use the word "window" in this sense. Graphical display
  993. systems commonly use the word "window" with a different meaning; but,
  994. as stated above, we refer to those "graphical windows" as "frames".
  995. An Emacs window is where the "buffer"--the text you are editing--is
  996. displayed. On a graphical display, the window possesses a "scroll bar"
  997. on one side, which can be used to scroll through the buffer. The last
  998. line of the window is a "mode line". This displays various information
  999. about what is going on in the buffer, such as whether there are unsaved
  1000. changes, the editing modes that are in use, the current line number,
  1001. and so forth.
  1002. When you start Emacs, there is normally only one window in the
  1003. frame. However, you can subdivide this window horizontally or
  1004. vertically to create multiple windows, each of which can independently
  1005. display a buffer (*note Windows::).
  1006. At any time, one window is the "selected window". On a graphical
  1007. display, the selected window shows a more prominent cursor (usually
  1008. solid and blinking); other windows show a less prominent cursor
  1009. (usually a hollow box). On a text terminal, there is only one cursor,
  1010. which is shown in the selected window. The buffer displayed in the
  1011. selected window is called the "current buffer", and it is where editing
  1012. happens. Most Emacs commands implicitly apply to the current buffer;
  1013. the text displayed in unselected windows is mostly visible for
  1014. reference. If you use multiple frames on a graphical display,
  1015. selecting a particular frame selects a window in that frame.
  1016. * Menu:
  1017. * Point:: The place in the text where editing commands operate.
  1018. * Echo Area:: Short messages appear at the bottom of the screen.
  1019. * Mode Line:: Interpreting the mode line.
  1020. * Menu Bar:: How to use the menu bar.
  1021. 
  1022. File: emacs, Node: Point, Next: Echo Area, Up: Screen
  1023. 1.1 Point
  1024. =========
  1025. The cursor in the selected window shows the location where most editing
  1026. commands take effect, which is called "point"(1). Many Emacs commands
  1027. move point to different places in the buffer; for example, you can
  1028. place point by clicking mouse button 1 (normally the left button) at
  1029. the desired location.
  1030. By default, the cursor in the selected window is drawn as a solid
  1031. block and appears to be _on_ a character, but you should think of point
  1032. as _between_ two characters; it is situated _before_ the character
  1033. under the cursor. For example, if your text looks like `frob' with the
  1034. cursor over the `b', then point is between the `o' and the `b'. If you
  1035. insert the character `!' at that position, the result is `fro!b', with
  1036. point between the `!' and the `b'. Thus, the cursor remains over the
  1037. `b', as before.
  1038. If you are editing several files in Emacs, each in its own buffer,
  1039. each buffer has its own value of point. A buffer that is not currently
  1040. displayed remembers its value of point if you later display it again.
  1041. Furthermore, if a buffer is displayed in multiple windows, each of
  1042. those windows has its own value of point.
  1043. *Note Cursor Display::, for options that control how Emacs displays
  1044. the cursor.
  1045. ---------- Footnotes ----------
  1046. (1) The term "point" comes from the character `.', which was the
  1047. command in TECO (the language in which the original Emacs was written)
  1048. for accessing the editing position.
  1049. 
  1050. File: emacs, Node: Echo Area, Next: Mode Line, Prev: Point, Up: Screen
  1051. 1.2 The Echo Area
  1052. =================
  1053. The line at the very bottom of the frame is the "echo area". It is
  1054. used to display small amounts of text for various purposes.
  1055. The echo area is so-named because one of the things it is used for
  1056. is "echoing", which means displaying the characters of a
  1057. multi-character command as you type. Single-character commands are not
  1058. echoed. Multi-character commands (*note Keys::) are echoed if you
  1059. pause for more than a second in the middle of a command. Emacs then
  1060. echoes all the characters of the command so far, to prompt you for the
  1061. rest. Once echoing has started, the rest of the command echoes
  1062. immediately as you type it. This behavior is designed to give
  1063. confident users fast response, while giving hesitant users maximum
  1064. feedback.
  1065. The echo area is also used to display an "error message" when a
  1066. command cannot do its job. Error messages may be accompanied by
  1067. beeping or by flashing the screen.
  1068. Some commands display informative messages in the echo area to tell
  1069. you what the command has done, or to provide you with some specific
  1070. information. These "informative" messages, unlike error messages, are
  1071. not accompanied with a beep or flash. For example, `C-x =' (hold down
  1072. <CTRL> and type `x', then let go of <CTRL> and type `=') displays a
  1073. message describing the character at point, its position in the buffer,
  1074. and its current column in the window. Commands that take a long time
  1075. often display messages ending in `...' while they are working
  1076. (sometimes also indicating how much progress has been made, as a
  1077. percentage), and add `done' when they are finished.
  1078. Informative echo area messages are saved in a special buffer named
  1079. `*Messages*'. (We have not explained buffers yet; see *note Buffers::,
  1080. for more information about them.) If you miss a message that appeared
  1081. briefly on the screen, you can switch to the `*Messages*' buffer to see
  1082. it again. The `*Messages*' buffer is limited to a certain number of
  1083. lines, specified by the variable `message-log-max'. (We have not
  1084. explained variables either; see *note Variables::, for more information
  1085. about them.) Beyond this limit, one line is deleted from the beginning
  1086. whenever a new message line is added at the end.
  1087. *Note Display Custom::, for options that control how Emacs uses the
  1088. echo area.
  1089. The echo area is also used to display the "minibuffer", a special
  1090. window where you can input arguments to commands, such as the name of a
  1091. file to be edited. When the minibuffer is in use, the text displayed
  1092. in the echo area begins with a "prompt string", and the active cursor
  1093. appears within the minibuffer, which is temporarily considered the
  1094. selected window. You can always get out of the minibuffer by typing
  1095. `C-g'. *Note Minibuffer::.
  1096. 
  1097. File: emacs, Node: Mode Line, Next: Menu Bar, Prev: Echo Area, Up: Screen
  1098. 1.3 The Mode Line
  1099. =================
  1100. At the bottom of each window is a "mode line", which describes what is
  1101. going on in the current buffer. When there is only one window, the
  1102. mode line appears right above the echo area; it is the next-to-last
  1103. line in the frame. On a graphical display, the mode line is drawn with
  1104. a 3D box appearance. Emacs also usually draws the mode line of the
  1105. selected window with a different color than that of unselected windows,
  1106. in order to make it stand out.
  1107. The text displayed in the mode line has the following format:
  1108. CS:CH-FR BUF POS LINE (MAJOR MINOR)
  1109. On a text terminal, this text is followed by a series of dashes
  1110. extending to the right edge of the window. These dashes are omitted on
  1111. a graphical display.
  1112. The CS string and the colon character after it describe the
  1113. character set and newline convention used for the current buffer.
  1114. Normally, Emacs automatically handles these settings for you, but it is
  1115. sometimes useful to have this information.
  1116. CS describes the character set of the text in the buffer (*note
  1117. Coding Systems::). If it is a dash (`-'), that indicates no special
  1118. character set handling (with the possible exception of end-of-line
  1119. conventions, described in the next paragraph). `=' means no conversion
  1120. whatsoever, and is usually used for files containing non-textual data.
  1121. Other characters represent various "coding systems"--for example, `1'
  1122. represents ISO Latin-1.
  1123. On a text terminal, CS is preceded by two additional characters that
  1124. describe the coding systems for keyboard input and terminal output.
  1125. Furthermore, if you are using an input method, CS is preceded by a
  1126. string that identifies the input method (*note Input Methods::).
  1127. The character after CS is usually a colon. If a different string is
  1128. displayed, that indicates a nontrivial end-of-line convention for
  1129. encoding a file. Usually, lines of text are separated by "newline
  1130. characters" in a file, but two other conventions are sometimes used.
  1131. The MS-DOS convention uses a "carriage-return" character followed by a
  1132. "linefeed" character; when editing such files, the colon changes to
  1133. either a backslash (`\') or `(DOS)', depending on the operating system.
  1134. Another convention, employed by older Macintosh systems, uses a
  1135. "carriage-return" character instead of a newline; when editing such
  1136. files, the colon changes to either a forward slash (`/') or `(Mac)'.
  1137. On some systems, Emacs displays `(Unix)' instead of the colon for files
  1138. that use newline as the line separator.
  1139. The next element on the mode line is the string indicated by CH.
  1140. This shows two dashes (`--') if the buffer displayed in the window has
  1141. the same contents as the corresponding file on the disk; i.e., if the
  1142. buffer is "unmodified". If the buffer is modified, it shows two stars
  1143. (`**'). For a read-only buffer, it shows `%*' if the buffer is
  1144. modified, and `%%' otherwise.
  1145. The character after CH is normally a dash (`-'). However, if the
  1146. default-directory for the current buffer is on a remote machine, `@' is
  1147. displayed instead (*note File Names::).
  1148. FR gives the selected frame name (*note Frames::). It appears only
  1149. on text terminals. The initial frame's name is `F1'.
  1150. BUF is the name of the buffer displayed in the window. Usually,
  1151. this is the same as the name of a file you are editing. *Note
  1152. Buffers::.
  1153. POS tells you whether there is additional text above the top of the
  1154. window, or below the bottom. If your buffer is small and all of it is
  1155. visible in the window, POS is `All'. Otherwise, it is `Top' if you are
  1156. looking at the beginning of the buffer, `Bot' if you are looking at the
  1157. end of the buffer, or `NN%', where NN is the percentage of the buffer
  1158. above the top of the window. With Size Indication mode, you can
  1159. display the size of the buffer as well. *Note Optional Mode Line::.
  1160. LINE is the character `L' followed by the line number at point.
  1161. (You can display the current column number too, by turning on Column
  1162. Number mode. *Note Optional Mode Line::.)
  1163. MAJOR is the name of the "major mode" used in the buffer. A major
  1164. mode is a principal editing mode for the buffer, such as Text mode,
  1165. Lisp mode, C mode, and so forth. *Note Major Modes::. Some major
  1166. modes display additional information after the major mode name. For
  1167. example, Compilation buffers and Shell buffers display the status of
  1168. the subprocess.
  1169. MINOR is a list of some of the enabled "minor modes", which are
  1170. optional editing modes that provide additional features on top of the
  1171. major mode. *Note Minor Modes::.
  1172. Some features are listed together with the minor modes whenever they
  1173. are turned on, even though they are not really minor modes. `Narrow'
  1174. means that the buffer being displayed has editing restricted to only a
  1175. portion of its text (*note Narrowing::). `Def' means that a keyboard
  1176. macro is currently being defined (*note Keyboard Macros::).
  1177. In addition, if Emacs is inside a recursive editing level, square
  1178. brackets (`[...]') appear around the parentheses that surround the
  1179. modes. If Emacs is in one recursive editing level within another,
  1180. double square brackets appear, and so on. Since recursive editing
  1181. levels affect Emacs globally, such square brackets appear in the mode
  1182. line of every window. *Note Recursive Edit::.
  1183. You can change the appearance of the mode line as well as the format
  1184. of its contents. *Note Optional Mode Line::. In addition, the mode
  1185. line is mouse-sensitive; clicking on different parts of the mode line
  1186. performs various commands. *Note Mode Line Mouse::.
  1187. 
  1188. File: emacs, Node: Menu Bar, Prev: Mode Line, Up: Screen
  1189. 1.4 The Menu Bar
  1190. ================
  1191. Each Emacs frame normally has a "menu bar" at the top which you can use
  1192. to perform common operations. There's no need to list them here, as
  1193. you can more easily see them yourself.
  1194. On a graphical display, you can use the mouse to choose a command
  1195. from the menu bar. An arrow on the right edge of a menu item means it
  1196. leads to a subsidiary menu, or "submenu". A `...' at the end of a menu
  1197. item means that the command will prompt you for further input before it
  1198. actually does anything.
  1199. Some of the commands in the menu bar have ordinary key bindings as
  1200. well; if so, a key binding is shown in parentheses after the item
  1201. itself. To view the full command name and documentation for a menu
  1202. item, type `C-h k', and then select the menu bar with the mouse in the
  1203. usual way (*note Key Help::).
  1204. Instead of using the mouse, you can also invoke the first menu bar
  1205. item by pressing <F10> (to run the command `menu-bar-open'). You can
  1206. then navigate the menus with the arrow keys. To activate a selected
  1207. menu item, press <RET>; to cancel menu navigation, press <ESC>.
  1208. On a text terminal, you can use the menu bar by typing `M-`' or
  1209. <F10> (these run the command `tmm-menubar'). This lets you select a
  1210. menu item with the keyboard. A provisional choice appears in the echo
  1211. area. You can use the up and down arrow keys to move through the menu
  1212. to different items, and then you can type <RET> to select the item.
  1213. Each menu item is also designated by a letter or digit (usually the
  1214. initial of some word in the item's name). This letter or digit is
  1215. separated from the item name by `=>'. You can type the item's letter
  1216. or digit to select the item.
  1217. 
  1218. File: emacs, Node: User Input, Next: Keys, Prev: Screen, Up: Top
  1219. 2 Kinds of User Input
  1220. *********************
  1221. GNU Emacs is primarily designed for use with the keyboard. While it is
  1222. possible to use the mouse to issue editing commands through the menu
  1223. bar and tool bar, that is not as efficient as using the keyboard.
  1224. Therefore, this manual mainly documents how to edit with the keyboard.
  1225. Keyboard input into Emacs is based on a heavily-extended version of
  1226. ASCII. Simple characters, like `a', `B', `3', `=', and the space
  1227. character (denoted as <SPC>), are entered by typing the corresponding
  1228. key. "Control characters", such as <RET>, <TAB>, <DEL>, <ESC>, <F1>,
  1229. <Home>, and <left>, are also entered this way, as are certain
  1230. characters found on non-English keyboards (*note International::).
  1231. Emacs also recognizes control characters that are entered using
  1232. "modifier keys". Two commonly-used modifier keys are <Control>
  1233. (usually labeled <Ctrl>), and <Meta> (usually labeled <Alt>)(1). For
  1234. example, `Control-a' is entered by holding down the <Ctrl> key while
  1235. pressing `a'; we will refer to this as `C-a' for short. Similarly
  1236. `Meta-a', or `M-a' for short, is entered by holding down the <Alt> key
  1237. and pressing `a'. Modifier keys can also be applied to
  1238. non-alphanumerical characters, e.g. `C-<F1>' or `M-<left>'.
  1239. You can also type Meta characters using two-character sequences
  1240. starting with <ESC>. Thus, you can enter `M-a' by typing `<ESC> a'.
  1241. You can enter `C-M-a' by typing `<ESC> C-a'. Unlike <Meta>, <ESC> is
  1242. entered as a separate character. You don't hold down <ESC> while
  1243. typing the next character; instead, press <ESC> and release it, then
  1244. enter the next character. This feature is useful on certain text
  1245. terminals where the <Meta> key does not function reliably.
  1246. On graphical displays, the window manager might block some keyboard
  1247. inputs, including `M-<TAB>', `M-<SPC>', `C-M-d' and `C-M-l'. If you
  1248. have this problem, you can either customize your window manager to not
  1249. block those keys, or "rebind" the affected Emacs commands (*note
  1250. Customization::).
  1251. Simple characters and control characters, as well as certain
  1252. non-keyboard inputs such as mouse clicks, are collectively referred to
  1253. as "input events". For details about how Emacs internally handles
  1254. input events, see *note Input Events: (elisp)Input Events.
  1255. ---------- Footnotes ----------
  1256. (1) We refer to <Alt> as <Meta> for historical reasons.
  1257. 
  1258. File: emacs, Node: Keys, Next: Commands, Prev: User Input, Up: Top
  1259. 3 Keys
  1260. ******
  1261. Some Emacs commands are invoked by just one input event; for example,
  1262. `C-f' moves forward one character in the buffer. Other commands take
  1263. two or more input events to invoke, such as `C-x C-f' and `C-x 4 C-f'.
  1264. A "key sequence", or "key" for short, is a sequence of one or more
  1265. input events that is meaningful as a unit. If a key sequence invokes a
  1266. command, we call it a "complete key"; for example, `C-f', `C-x C-f' and
  1267. `C-x 4 C-f' are all complete keys. If a key sequence isn't long enough
  1268. to invoke a command, we call it a "prefix key"; from the preceding
  1269. example, we see that `C-x' and `C-x 4' are prefix keys. Every key
  1270. sequence is either a complete key or a prefix key.
  1271. A prefix key combines with the following input event to make a
  1272. longer key sequence. For example, `C-x' is a prefix key, so typing
  1273. `C-x' alone does not invoke a command; instead, Emacs waits for further
  1274. input (if you pause for longer than a second, it echoes the `C-x' key
  1275. to prompt for that input; *note Echo Area::). `C-x' combines with the
  1276. next input event to make a two-event key sequence, which could itself
  1277. be a prefix key (such as `C-x 4'), or a complete key (such as `C-x
  1278. C-f'). There is no limit to the length of key sequences, but in
  1279. practice they are seldom longer than three or four input events.
  1280. You can't add input events onto a complete key. For example,
  1281. because `C-f' is a complete key, the two-event sequence `C-f C-k' is
  1282. two key sequences, not one.
  1283. By default, the prefix keys in Emacs are `C-c', `C-h', `C-x', `C-x
  1284. <RET>', `C-x @', `C-x a', `C-x n', `C-x r', `C-x v', `C-x 4', `C-x 5',
  1285. `C-x 6', <ESC>, `M-g', and `M-o'. (<F1> and <F2> are aliases for `C-h'
  1286. and `C-x 6'.) This list is not cast in stone; if you customize Emacs,
  1287. you can make new prefix keys. You could even eliminate some of the
  1288. standard ones, though this is not recommended for most users; for
  1289. example, if you remove the prefix definition of `C-x 4', then `C-x 4
  1290. C-f' becomes an invalid key sequence. *Note Key Bindings::.
  1291. Typing the help character (`C-h' or <F1>) after a prefix key
  1292. displays a list of the commands starting with that prefix. The sole
  1293. exception to this rule is <ESC>: `<ESC> C-h' is equivalent to `C-M-h',
  1294. which does something else entirely. You can, however, use <F1> to
  1295. display a list of commands starting with <ESC>.
  1296. 
  1297. File: emacs, Node: Commands, Next: Entering Emacs, Prev: Keys, Up: Top
  1298. 4 Keys and Commands
  1299. *******************
  1300. This manual is full of passages that tell you what particular keys do.
  1301. But Emacs does not assign meanings to keys directly. Instead, Emacs
  1302. assigns meanings to named "commands", and then gives keys their
  1303. meanings by "binding" them to commands.
  1304. Every command has a name chosen by a programmer. The name is
  1305. usually made of a few English words separated by dashes; for example,
  1306. `next-line' or `forward-word'. Internally, each command is a special
  1307. type of Lisp "function", and the actions associated with the command
  1308. are performed by running the function. *Note What Is a Function:
  1309. (elisp)What Is a Function.
  1310. The bindings between keys and commands are recorded in tables called
  1311. "keymaps". *Note Keymaps::.
  1312. When we say that "`C-n' moves down vertically one line" we are
  1313. glossing over a subtle distinction that is irrelevant in ordinary use,
  1314. but vital for Emacs customization. The command `next-line' does a
  1315. vertical move downward. `C-n' has this effect _because_ it is bound to
  1316. `next-line'. If you rebind `C-n' to the command `forward-word', `C-n'
  1317. will move forward one word instead.
  1318. In this manual, we will often speak of keys like `C-n' as commands,
  1319. even though strictly speaking the key is bound to a command. Usually
  1320. we state the name of the command which really does the work in
  1321. parentheses after mentioning the key that runs it. For example, we
  1322. will say that "The command `C-n' (`next-line') moves point vertically
  1323. down", meaning that the command `next-line' moves vertically down, and
  1324. the key `C-n' is normally bound to it.
  1325. Since we are discussing customization, we should tell you about
  1326. "variables". Often the description of a command will say, "To change
  1327. this, set the variable `mumble-foo'." A variable is a name used to
  1328. store a value. Most of the variables documented in this manual are
  1329. meant for customization: some command or other part of Emacs examines
  1330. the variable and behaves differently according to the value that you
  1331. set. You can ignore the information about variables until you are
  1332. interested in customizing them. Then read the basic information on
  1333. variables (*note Variables::) and the information about specific
  1334. variables will make sense.
  1335. 
  1336. File: emacs, Node: Entering Emacs, Next: Exiting, Prev: Commands, Up: Top
  1337. 5 Entering Emacs
  1338. ****************
  1339. The usual way to invoke Emacs is with the shell command `emacs'. From
  1340. a terminal window running in the X Window System, you can run Emacs in
  1341. the background with `emacs &'; this way, Emacs won't tie up the
  1342. terminal window, so you can use it to run other shell commands.
  1343. When Emacs starts up, the initial frame displays a special buffer
  1344. named `*GNU Emacs*'. This "startup screen" contains information about
  1345. Emacs and "links" to common tasks that are useful for beginning users.
  1346. For instance, activating the `Emacs Tutorial' link opens the Emacs
  1347. tutorial; this does the same thing as the command `C-h t'
  1348. (`help-with-tutorial'). To activate a link, either move point onto it
  1349. and type `<RET>', or click on it with `mouse-1' (the left mouse button).
  1350. Using a command line argument, you can tell Emacs to visit one or
  1351. more files as soon as it starts up. For example, `emacs foo.txt'
  1352. starts Emacs with a buffer displaying the contents of the file
  1353. `foo.txt'. This feature exists mainly for compatibility with other
  1354. editors, which are designed to be launched from the shell for short
  1355. editing sessions. If you call Emacs this way, the initial frame is
  1356. split into two windows--one showing the specified file, and the other
  1357. showing the startup screen. *Note Windows::.
  1358. Generally, it is unnecessary and wasteful to start Emacs afresh each
  1359. time you want to edit a file. The recommended way to use Emacs is to
  1360. start it just once, just after you log in, and do all your editing in
  1361. the same Emacs session. *Note Files::, for information on visiting
  1362. more than one file. If you use Emacs this way, the Emacs session
  1363. accumulates valuable context, such as the kill ring, registers, undo
  1364. history, and mark ring data, which together make editing more
  1365. convenient. These features are described later in the manual.
  1366. To edit a file from another program while Emacs is running, you can
  1367. use the `emacsclient' helper program to open a file in the existing
  1368. Emacs session. *Note Emacs Server::.
  1369. Emacs accepts other command line arguments that tell it to load
  1370. certain Lisp files, where to put the initial frame, and so forth.
  1371. *Note Emacs Invocation::.
  1372. If the variable `inhibit-startup-screen' is non-`nil', Emacs does
  1373. not display the startup screen. In that case, if one or more files
  1374. were specified on the command line, Emacs simply displays those files;
  1375. otherwise, it displays a buffer named `*scratch*', which can be used to
  1376. evaluate Emacs Lisp expressions interactively. *Note Lisp
  1377. Interaction::. You can set the variable `inhibit-startup-screen' using
  1378. the Customize facility (*note Easy Customization::), or by editing your
  1379. initialization file (*note Init File::).(1)
  1380. You can also force Emacs to display a file or directory at startup
  1381. by setting the variable `initial-buffer-choice' to a non-`nil' value.
  1382. (In that case, even if you specify one or more files on the command
  1383. line, Emacs opens but does not display them.) The value of
  1384. `initial-buffer-choice' should be the name of the desired file or
  1385. directory.
  1386. ---------- Footnotes ----------
  1387. (1) Setting `inhibit-startup-screen' in `site-start.el' doesn't
  1388. work, because the startup screen is set up before reading
  1389. `site-start.el'. *Note Init File::, for information about
  1390. `site-start.el'.
  1391. 
  1392. File: emacs, Node: Exiting, Next: Basic, Prev: Entering Emacs, Up: Top
  1393. 6 Exiting Emacs
  1394. ***************
  1395. `C-x C-c'
  1396. Kill Emacs (`save-buffers-kill-terminal').
  1397. `C-z'
  1398. On a text terminal, suspend Emacs; on a graphical display,
  1399. "minimize" the selected frame (`suspend-emacs').
  1400. "Killing" Emacs means terminating the Emacs program. To do this,
  1401. type `C-x C-c' (`save-buffers-kill-terminal'). A two-character key
  1402. sequence is used to make it harder to type by accident. If there are
  1403. any modified file-visiting buffers when you type `C-x C-c', Emacs first
  1404. offers to save these buffers. If you do not save them all, it asks for
  1405. confirmation again, since the unsaved changes will be lost. Emacs also
  1406. asks for confirmation if any subprocesses are still running, since
  1407. killing Emacs will also kill the subprocesses (*note Shell::).
  1408. `C-x C-c' behaves specially if you are using Emacs as a server. If
  1409. you type it from a "client frame", it closes the client connection.
  1410. *Note Emacs Server::.
  1411. Emacs can, optionally, record certain session information when you
  1412. kill it, such as the files you were visiting at the time. This
  1413. information is then available the next time you start Emacs. *Note
  1414. Saving Emacs Sessions::.
  1415. If the value of the variable `confirm-kill-emacs' is non-`nil', `C-x
  1416. C-c' assumes that its value is a predicate function, and calls that
  1417. function. If the result of the function call is non-`nil', the session
  1418. is killed, otherwise Emacs continues to run. One convenient function
  1419. to use as the value of `confirm-kill-emacs' is the function
  1420. `yes-or-no-p'. The default value of `confirm-kill-emacs' is `nil'.
  1421. To kill Emacs without being prompted about saving, type `M-x
  1422. kill-emacs'.
  1423. `C-z' runs the command `suspend-frame'. On a graphical display,
  1424. this command "minimizes" (or "iconifies") the selected Emacs frame,
  1425. hiding it in a way that lets you bring it back later (exactly how this
  1426. hiding occurs depends on the window system). On a text terminal, the
  1427. `C-z' command "suspends" Emacs, stopping the program temporarily and
  1428. returning control to the parent process (usually a shell); in most
  1429. shells, you can resume Emacs after suspending it with the shell command
  1430. `%emacs'.
  1431. Text terminals usually listen for certain special characters whose
  1432. meaning is to kill or suspend the program you are running. This
  1433. terminal feature is turned off while you are in Emacs. The meanings of
  1434. `C-z' and `C-x C-c' as keys in Emacs were inspired by the use of `C-z'
  1435. and `C-c' on several operating systems as the characters for stopping
  1436. or killing a program, but that is their only relationship with the
  1437. operating system. You can customize these keys to run any commands of
  1438. your choice (*note Keymaps::).
  1439. 
  1440. File: emacs, Node: Basic, Next: Minibuffer, Prev: Exiting, Up: Top
  1441. 7 Basic Editing Commands
  1442. ************************
  1443. Here we explain the basics of how to enter text, make corrections, and
  1444. save the text in a file. If this material is new to you, we suggest
  1445. you first run the Emacs learn-by-doing tutorial, by typing `C-h t'
  1446. (`help-with-tutorial').
  1447. * Menu:
  1448. * Inserting Text:: Inserting text by simply typing it.
  1449. * Moving Point:: Moving the cursor to the place where you want to
  1450. change something.
  1451. * Erasing:: Deleting and killing text.
  1452. * Basic Undo:: Undoing recent changes in the text.
  1453. * Files: Basic Files. Visiting, creating, and saving files.
  1454. * Help: Basic Help. Asking what a character does.
  1455. * Blank Lines:: Making and deleting blank lines.
  1456. * Continuation Lines:: How Emacs displays lines too wide for the screen.
  1457. * Position Info:: What line, row, or column is point on?
  1458. * Arguments:: Numeric arguments for repeating a command N times.
  1459. * Repeating:: Repeating the previous command quickly.
  1460. 
  1461. File: emacs, Node: Inserting Text, Next: Moving Point, Up: Basic
  1462. 7.1 Inserting Text
  1463. ==================
  1464. You can insert an ordinary "graphic character" (e.g., `a', `B', `3',
  1465. and `=') by typing the associated key. This adds the character to the
  1466. buffer at point. Insertion moves point forward, so that point remains
  1467. just after the inserted text. *Note Point::.
  1468. To end a line and start a new one, type <RET> (`newline'). (The
  1469. <RET> key may be labeled <Return> or <Enter> on your keyboard, but we
  1470. refer to it as <RET> in this manual.) This command inserts a newline
  1471. character into the buffer. If point is at the end of the line, the
  1472. effect is to create a new blank line after it; if point is in the
  1473. middle of a line, the line is split at that position.
  1474. As we explain later in this manual, you can change the way Emacs
  1475. handles text insertion by turning on "minor modes". For instance, the
  1476. minor mode called Auto Fill mode splits lines automatically when they
  1477. get too long (*note Filling::). The minor mode called Overwrite mode
  1478. causes inserted characters to replace (overwrite) existing text,
  1479. instead of shoving it to the right. *Note Minor Modes::.
  1480. Only graphic characters can be inserted by typing the associated
  1481. key; other keys act as editing commands and do not insert themselves.
  1482. For instance, `DEL' runs the command `delete-backward-char' by default
  1483. (some modes bind it to a different command); it does not insert a
  1484. literal `DEL' character (ASCII character code 127).
  1485. To insert a non-graphic character, or a character that your keyboard
  1486. does not support, first "quote" it by typing `C-q' (`quoted-insert').
  1487. There are two ways to use `C-q':
  1488. * `C-q' followed by any non-graphic character (even `C-g') inserts
  1489. that character. For instance, `C-q <DEL>' inserts a literal `DEL'
  1490. character.
  1491. * `C-q' followed by a sequence of octal digits inserts the character
  1492. with the specified octal character code. You can use any number of
  1493. octal digits; any non-digit terminates the sequence. If the
  1494. terminating character is <RET>, that <RET> serves only to
  1495. terminate the sequence. Any other non-digit terminates the
  1496. sequence and then acts as normal input--thus, `C-q 1 0 1 B' inserts
  1497. `AB'.
  1498. The use of octal sequences is disabled in ordinary non-binary
  1499. Overwrite mode, to give you a convenient way to insert a digit
  1500. instead of overwriting with it.
  1501. To use decimal or hexadecimal instead of octal, set the variable
  1502. `read-quoted-char-radix' to 10 or 16. If the radix is 16, the letters
  1503. `a' to `f' serve as part of a character code, just like digits. Case
  1504. is ignored.
  1505. Instead of `C-q', you can use the command `C-x 8 <RET>'
  1506. (`ucs-insert'). This prompts for the Unicode name or code-point of a
  1507. character, using the minibuffer. If you enter a name, the command
  1508. provides completion (*note Completion::). If you enter a code-point,
  1509. it should be a hexadecimal number (which is the convention for
  1510. Unicode). The command then inserts the corresponding character into
  1511. the buffer. For example, both of the following insert the infinity
  1512. sign (Unicode code-point `U+221E'):
  1513. C-x 8 <RET> infinity <RET>
  1514. C-x 8 <RET> 221e <RET>
  1515. A numeric argument to either `C-q' or `C-x 8 <RET>' specifies how
  1516. many copies of the character to insert (*note Arguments::).
  1517. 
  1518. File: emacs, Node: Moving Point, Next: Erasing, Prev: Inserting Text, Up: Basic
  1519. 7.2 Changing the Location of Point
  1520. ==================================
  1521. To do more than insert characters, you have to know how to move point
  1522. (*note Point::). The keyboard commands `C-f', `C-b', `C-n', and `C-p'
  1523. move point to the right, left, down, and up, respectively. You can
  1524. also move point using the "arrow keys" present on most keyboards:
  1525. `<right>', `<left>', `<down>', and `<up>'; however, many Emacs users
  1526. find that it is slower to use the arrow keys than the control keys,
  1527. because you need to move your hand to the area of the keyboard where
  1528. those keys are located.
  1529. You can also click the left mouse button to move point to the
  1530. position clicked. Emacs also provides a variety of additional keyboard
  1531. commands that move point in more sophisticated ways.
  1532. `C-f'
  1533. Move forward one character (`forward-char').
  1534. `<right>'
  1535. This command (`right-char') behaves like `C-f', with one
  1536. exception: when editing right-to-left scripts such as Arabic, it
  1537. instead moves _backward_ if the current paragraph is a
  1538. right-to-left paragraph. *Note Bidirectional Editing::.
  1539. `C-b'
  1540. Move backward one character (`backward-char').
  1541. `<left>'
  1542. This command (`left-char') behaves like `C-b', except it moves
  1543. _forward_ if the current paragraph is right-to-left. *Note
  1544. Bidirectional Editing::.
  1545. `C-n'
  1546. `<down>'
  1547. Move down one screen line (`next-line'). This command attempts to
  1548. keep the horizontal position unchanged, so if you start in the
  1549. middle of one line, you move to the middle of the next.
  1550. `C-p'
  1551. `<up>'
  1552. Move up one screen line (`previous-line'). This command preserves
  1553. position within the line, like `C-n'.
  1554. `C-a'
  1555. `<Home>'
  1556. Move to the beginning of the line (`move-beginning-of-line').
  1557. `C-e'
  1558. `<End>'
  1559. Move to the end of the line (`move-end-of-line').
  1560. `M-f'
  1561. Move forward one word (`forward-word').
  1562. `C-<right>'
  1563. `M-<right>'
  1564. This command (`right-word') behaves like `M-f', except it moves
  1565. _backward_ by one word if the current paragraph is right-to-left.
  1566. *Note Bidirectional Editing::.
  1567. `M-b'
  1568. Move backward one word (`backward-word').
  1569. `C-<left>'
  1570. `M-<left>'
  1571. This command (`left-word') behaves like `M-f', except it moves
  1572. _forward_ by one word if the current paragraph is right-to-left.
  1573. *Note Bidirectional Editing::.
  1574. `M-r'
  1575. Without moving the text on the screen, reposition point on the left
  1576. margin of the center-most text line of the window; on subsequent
  1577. consecutive invocations, move point to the left margin of the
  1578. top-most line, the bottom-most line, and so forth, in cyclic order
  1579. (`move-to-window-line-top-bottom').
  1580. A numeric argument says which screen line to place point on,
  1581. counting downward from the top of the window (zero means the top
  1582. line). A negative argument counts lines up from the bottom (-1
  1583. means the bottom line). *Note Arguments::, for more information
  1584. on numeric arguments.
  1585. `M-<'
  1586. Move to the top of the buffer (`beginning-of-buffer'). With
  1587. numeric argument N, move to N/10 of the way from the top.
  1588. `M->'
  1589. Move to the end of the buffer (`end-of-buffer').
  1590. `C-v'
  1591. `<PageDown>'
  1592. `<next>'
  1593. Scroll the display one screen forward, and move point onscreen if
  1594. necessary (`scroll-up-command'). *Note Scrolling::.
  1595. `M-v'
  1596. `<PageUp>'
  1597. `<prior>'
  1598. Scroll one screen backward, and move point onscreen if necessary
  1599. (`scroll-down-command'). *Note Scrolling::.
  1600. `M-x goto-char'
  1601. Read a number N and move point to buffer position N. Position 1
  1602. is the beginning of the buffer.
  1603. `M-g M-g'
  1604. `M-g g'
  1605. Read a number N and move point to the beginning of line number N
  1606. (`goto-line'). Line 1 is the beginning of the buffer. If point
  1607. is on or just after a number in the buffer, that is the default
  1608. for N. Just type <RET> in the minibuffer to use it. You can also
  1609. specify N by giving `M-g M-g' a numeric prefix argument. *Note
  1610. Select Buffer::, for the behavior of `M-g M-g' when you give it a
  1611. plain prefix argument.
  1612. `C-x C-n'
  1613. Use the current column of point as the "semipermanent goal column"
  1614. for `C-n' and `C-p' (`set-goal-column'). When a semipermanent
  1615. goal column is in effect, those commands always try to move to
  1616. this column, or as close as possible to it, after moving
  1617. vertically. The goal column remains in effect until canceled.
  1618. `C-u C-x C-n'
  1619. Cancel the goal column. Henceforth, `C-n' and `C-p' try to
  1620. preserve the horizontal position, as usual.
  1621. When a line of text in the buffer is longer than the width of the
  1622. window, Emacs usually displays it on two or more "screen lines". For
  1623. convenience, `C-n' and `C-p' move point by screen lines, as do the
  1624. equivalent keys `<down>' and `<up>'. You can force these commands to
  1625. move according to "logical lines" (i.e., according to the text lines in
  1626. the buffer) by setting the variable `line-move-visual' to `nil'; if a
  1627. logical line occupies multiple screen lines, the cursor then skips over
  1628. the additional screen lines. For details, see *note Continuation
  1629. Lines::. *Note Variables::, for how to set variables such as
  1630. `line-move-visual'.
  1631. Unlike `C-n' and `C-p', most of the Emacs commands that work on
  1632. lines work on _logical_ lines. For instance, `C-a'
  1633. (`move-beginning-of-line') and `C-e' (`move-end-of-line') respectively
  1634. move to the beginning and end of the logical line. Whenever we
  1635. encounter commands that work on screen lines, such as `C-n' and `C-p',
  1636. we will point these out.
  1637. When `line-move-visual' is `nil', you can also set the variable
  1638. `track-eol' to a non-`nil' value. Then `C-n' and `C-p', when starting
  1639. at the end of the logical line, move to the end of the next logical
  1640. line. Normally, `track-eol' is `nil'.
  1641. `C-n' normally stops at the end of the buffer when you use it on the
  1642. last line in the buffer. However, if you set the variable
  1643. `next-line-add-newlines' to a non-`nil' value, `C-n' on the last line
  1644. of a buffer creates an additional line at the end and moves down into
  1645. it.
  1646. 
  1647. File: emacs, Node: Erasing, Next: Basic Undo, Prev: Moving Point, Up: Basic
  1648. 7.3 Erasing Text
  1649. ================
  1650. `<DEL>'
  1651. `<Backspace>'
  1652. Delete the character before point, or the region if it is active
  1653. (`delete-backward-char').
  1654. `<Delete>'
  1655. Delete the character after point, or the region if it is active
  1656. (`delete-forward-char').
  1657. `C-d'
  1658. Delete the character after point (`delete-char').
  1659. `C-k'
  1660. Kill to the end of the line (`kill-line').
  1661. `M-d'
  1662. Kill forward to the end of the next word (`kill-word').
  1663. `M-<DEL>'
  1664. Kill back to the beginning of the previous word
  1665. (`backward-kill-word').
  1666. The `<DEL>' (`delete-backward-char') command removes the character
  1667. before point, moving the cursor and the characters after it backwards.
  1668. If point was at the beginning of a line, this deletes the preceding
  1669. newline, joining this line to the previous one.
  1670. If, however, the region is active, `<DEL>' instead deletes the text
  1671. in the region. *Note Mark::, for a description of the region.
  1672. On most keyboards, <DEL> is labeled <Backspace>, but we refer to it
  1673. as <DEL> in this manual. (Do not confuse <DEL> with the <Delete> key;
  1674. we will discuss <Delete> momentarily.) On some text terminals, Emacs
  1675. may not recognize the <DEL> key properly. *Note DEL Does Not Delete::,
  1676. if you encounter this problem.
  1677. The <delete> (`delete-forward-char') command deletes in the
  1678. "opposite direction": it deletes the character after point, i.e. the
  1679. character under the cursor. If point was at the end of a line, this
  1680. joins the following line onto this one. Like `<DEL>', it deletes the
  1681. text in the region if the region is active (*note Mark::).
  1682. `C-d' (`delete-char') deletes the character after point, similar to
  1683. <delete>, but regardless of whether the region is active.
  1684. *Note Deletion::, for more detailed information about the above
  1685. deletion commands.
  1686. `C-k' (`kill-line') erases (kills) a line at a time. If you type
  1687. `C-k' at the beginning or middle of a line, it kills all the text up to
  1688. the end of the line. If you type `C-k' at the end of a line, it joins
  1689. that line with the following line.
  1690. *Note Killing::, for more information about `C-k' and related
  1691. commands.
  1692. 
  1693. File: emacs, Node: Basic Undo, Next: Basic Files, Prev: Erasing, Up: Basic
  1694. 7.4 Undoing Changes
  1695. ===================
  1696. `C-/'
  1697. Undo one entry of the undo records--usually, one command worth
  1698. (`undo').
  1699. `C-x u'
  1700. `C-_'
  1701. The same.
  1702. Emacs records a list of changes made in the buffer text, so you can
  1703. undo recent changes. This is done using the `undo' command, which is
  1704. bound to `C-/' (as well as `C-x u' and `C-_'). Normally, this command
  1705. undoes the last change, moving point back to where it was before the
  1706. change. The undo command applies only to changes in the buffer; you
  1707. can't use it to undo cursor motion.
  1708. Although each editing command usually makes a separate entry in the
  1709. undo records, very simple commands may be grouped together. Sometimes,
  1710. an entry may cover just part of a complex command.
  1711. If you repeat `C-/' (or its aliases), each repetition undoes
  1712. another, earlier change, back to the limit of the undo information
  1713. available. If all recorded changes have already been undone, the undo
  1714. command displays an error message and does nothing.
  1715. To learn more about the `undo' command, see *note Undo::.
  1716. 
  1717. File: emacs, Node: Basic Files, Next: Basic Help, Prev: Basic Undo, Up: Basic
  1718. 7.5 Files
  1719. =========
  1720. Text that you insert in an Emacs buffer lasts only as long as the Emacs
  1721. session. To keep any text permanently, you must put it in a "file".
  1722. Suppose there is a file named `test.emacs' in your home directory.
  1723. To begin editing this file in Emacs, type
  1724. C-x C-f test.emacs <RET>
  1725. Here the file name is given as an "argument" to the command `C-x C-f'
  1726. (`find-file'). That command uses the "minibuffer" to read the
  1727. argument, and you type <RET> to terminate the argument (*note
  1728. Minibuffer::).
  1729. Emacs obeys this command by "visiting" the file: it creates a
  1730. buffer, copies the contents of the file into the buffer, and then
  1731. displays the buffer for editing. If you alter the text, you can "save"
  1732. the new text in the file by typing `C-x C-s' (`save-buffer'). This
  1733. copies the altered buffer contents back into the file `test.emacs',
  1734. making them permanent. Until you save, the changed text exists only
  1735. inside Emacs, and the file `test.emacs' is unaltered.
  1736. To create a file, just visit it with `C-x C-f' as if it already
  1737. existed. This creates an empty buffer, in which you can insert the
  1738. text you want to put in the file. Emacs actually creates the file the
  1739. first time you save this buffer with `C-x C-s'.
  1740. To learn more about using files in Emacs, see *note Files::.
  1741. 
  1742. File: emacs, Node: Basic Help, Next: Blank Lines, Prev: Basic Files, Up: Basic
  1743. 7.6 Help
  1744. ========
  1745. If you forget what a key does, you can find out by typing `C-h k'
  1746. (`describe-key'), followed by the key of interest; for example, `C-h k
  1747. C-n' tells you what `C-n' does.
  1748. The prefix key `C-h' stands for "help". The key <F1> serves as an
  1749. alias for `C-h'. Apart from `C-h k', there are many other help
  1750. commands providing different kinds of help.
  1751. *Note Help::, for details.
  1752. 
  1753. File: emacs, Node: Blank Lines, Next: Continuation Lines, Prev: Basic Help, Up: Basic
  1754. 7.7 Blank Lines
  1755. ===============
  1756. Here are special commands and techniques for inserting and deleting
  1757. blank lines.
  1758. `C-o'
  1759. Insert a blank line after the cursor (`open-line').
  1760. `C-x C-o'
  1761. Delete all but one of many consecutive blank lines
  1762. (`delete-blank-lines').
  1763. We have seen how `<RET>' (`newline') starts a new line of text.
  1764. However, it may be easier to see what you are doing if you first make a
  1765. blank line and then insert the desired text into it. This is easy to
  1766. do using the key `C-o' (`open-line'), which inserts a newline after
  1767. point but leaves point in front of the newline. After `C-o', type the
  1768. text for the new line.
  1769. You can make several blank lines by typing `C-o' several times, or
  1770. by giving it a numeric argument specifying how many blank lines to make.
  1771. *Note Arguments::, for how. If you have a fill prefix, the `C-o'
  1772. command inserts the fill prefix on the new line, if typed at the
  1773. beginning of a line. *Note Fill Prefix::.
  1774. The easy way to get rid of extra blank lines is with the command
  1775. `C-x C-o' (`delete-blank-lines'). If point lies within a run of
  1776. several blank lines, `C-x C-o' deletes all but one of them. If point
  1777. is on a single blank line, `C-x C-o' deletes it. If point is on a
  1778. nonblank line, `C-x C-o' deletes all following blank lines, if any
  1779. exists.
  1780. 
  1781. File: emacs, Node: Continuation Lines, Next: Position Info, Prev: Blank Lines, Up: Basic
  1782. 7.8 Continuation Lines
  1783. ======================
  1784. Sometimes, a line of text in the buffer--a "logical line"--is too long
  1785. to fit in the window, and Emacs displays it as two or more "screen
  1786. lines". This is called "line wrapping" or "continuation", and the long
  1787. logical line is called a "continued line". On a graphical display,
  1788. Emacs indicates line wrapping with small bent arrows in the left and
  1789. right window fringes. On a text terminal, Emacs indicates line
  1790. wrapping by displaying a `\' character at the right margin.
  1791. Most commands that act on lines act on logical lines, not screen
  1792. lines. For instance, `C-k' kills a logical line. As described
  1793. earlier, `C-n' (`next-line') and `C-p' (`previous-line') are special
  1794. exceptions: they move point down and up, respectively, by one screen
  1795. line (*note Moving Point::).
  1796. Emacs can optionally "truncate" long logical lines instead of
  1797. continuing them. This means that every logical line occupies a single
  1798. screen line; if it is longer than the width of the window, the rest of
  1799. the line is not displayed. On a graphical display, a truncated line is
  1800. indicated by a small straight arrow in the right fringe; on a text
  1801. terminal, it is indicated by a `$' character in the right margin.
  1802. *Note Line Truncation::.
  1803. By default, continued lines are wrapped at the right window edge.
  1804. Since the wrapping may occur in the middle of a word, continued lines
  1805. can be difficult to read. The usual solution is to break your lines
  1806. before they get too long, by inserting newlines. If you prefer, you
  1807. can make Emacs insert a newline automatically when a line gets too
  1808. long, by using Auto Fill mode. *Note Filling::.
  1809. Sometimes, you may need to edit files containing many long logical
  1810. lines, and it may not be practical to break them all up by adding
  1811. newlines. In that case, you can use Visual Line mode, which enables
  1812. "word wrapping": instead of wrapping long lines exactly at the right
  1813. window edge, Emacs wraps them at the word boundaries (i.e., space or
  1814. tab characters) nearest to the right window edge. Visual Line mode
  1815. also redefines editing commands such as `C-a', `C-n', and `C-k' to
  1816. operate on screen lines rather than logical lines. *Note Visual Line
  1817. Mode::.
  1818. 
  1819. File: emacs, Node: Position Info, Next: Arguments, Prev: Continuation Lines, Up: Basic
  1820. 7.9 Cursor Position Information
  1821. ===============================
  1822. Here are commands to get information about the size and position of
  1823. parts of the buffer, and to count words and lines.
  1824. `M-x what-line'
  1825. Display the line number of point.
  1826. `M-x line-number-mode'
  1827. `M-x column-number-mode'
  1828. Toggle automatic display of the current line number or column
  1829. number. *Note Optional Mode Line::.
  1830. `M-='
  1831. Display the number of lines, words, and characters that are
  1832. present in the region (`count-words-region'). *Note Mark::, for
  1833. information about the region.
  1834. `M-x count-words'
  1835. Display the number of lines, words, and characters that are
  1836. present in the buffer. If the region is active (*note Mark::),
  1837. display the numbers for the region instead.
  1838. `C-x ='
  1839. Display the character code of character after point, character
  1840. position of point, and column of point (`what-cursor-position').
  1841. `M-x hl-line-mode'
  1842. Enable or disable highlighting of the current line. *Note Cursor
  1843. Display::.
  1844. `M-x size-indication-mode'
  1845. Toggle automatic display of the size of the buffer. *Note
  1846. Optional Mode Line::.
  1847. `M-x what-line' displays the current line number in the echo area.
  1848. This command is usually redundant, because the current line number is
  1849. shown in the mode line (*note Mode Line::). However, if you narrow the
  1850. buffer, the mode line shows the line number relative to the accessible
  1851. portion (*note Narrowing::). By contrast, `what-line' displays both
  1852. the line number relative to the narrowed region and the line number
  1853. relative to the whole buffer.
  1854. `M-=' (`count-words-region') displays a message reporting the number
  1855. of lines, words, and characters in the region. `M-x count-words'
  1856. displays a similar message for the entire buffer, or for the region if
  1857. the region is "active". *Note Mark::, for an explanation of the region.
  1858. The command `C-x =' (`what-cursor-position') shows information about
  1859. the current cursor position and the buffer contents at that position.
  1860. It displays a line in the echo area that looks like this:
  1861. Char: c (99, #o143, #x63) point=28062 of 36168 (78%) column=53
  1862. After `Char:', this shows the character in the buffer at point. The
  1863. text inside the parenthesis shows the corresponding decimal, octal and
  1864. hex character codes; for more information about how `C-x =' displays
  1865. character information, see *note International Chars::. After `point='
  1866. is the position of point as a character count (the first character in
  1867. the buffer is position 1, the second character is position 2, and so
  1868. on). The number after that is the total number of characters in the
  1869. buffer, and the number in parenthesis expresses the position as a
  1870. percentage of the total. After `column=' is the horizontal position of
  1871. point, in columns counting from the left edge of the window.
  1872. If the buffer has been narrowed, making some of the text at the
  1873. beginning and the end temporarily inaccessible, `C-x =' displays
  1874. additional text describing the currently accessible range. For
  1875. example, it might display this:
  1876. Char: C (67, #o103, #x43) point=252 of 889 (28%) <231-599> column=0
  1877. where the two extra numbers give the smallest and largest character
  1878. position that point is allowed to assume. The characters between those
  1879. two positions are the accessible ones. *Note Narrowing::.
  1880. 
  1881. File: emacs, Node: Arguments, Next: Repeating, Prev: Position Info, Up: Basic
  1882. 7.10 Numeric Arguments
  1883. ======================
  1884. In the terminology of mathematics and computing, "argument" means "data
  1885. provided to a function or operation". You can give any Emacs command a
  1886. "numeric argument" (also called a "prefix argument"). Some commands
  1887. interpret the argument as a repetition count. For example, giving
  1888. `C-f' an argument of ten causes it to move point forward by ten
  1889. characters instead of one. With these commands, no argument is
  1890. equivalent to an argument of one, and negative arguments cause them to
  1891. move or act in the opposite direction.
  1892. The easiest way to specify a numeric argument is to type a digit
  1893. and/or a minus sign while holding down the <META> key. For example,
  1894. M-5 C-n
  1895. moves down five lines. The keys `M-1', `M-2', and so on, as well as
  1896. `M--', are bound to commands (`digit-argument' and `negative-argument')
  1897. that set up an argument for the next command. `Meta--' without digits
  1898. normally means -1.
  1899. If you enter more than one digit, you need not hold down the <META>
  1900. key for the second and subsequent digits. Thus, to move down fifty
  1901. lines, type
  1902. M-5 0 C-n
  1903. Note that this _does not_ insert five copies of `0' and move down one
  1904. line, as you might expect--the `0' is treated as part of the prefix
  1905. argument.
  1906. (What if you do want to insert five copies of `0'? Type `M-5 C-u
  1907. 0'. Here, `C-u' "terminates" the prefix argument, so that the next
  1908. keystroke begins the command that you want to execute. Note that this
  1909. meaning of `C-u' applies only to this case. For the usual role of
  1910. `C-u', see below.)
  1911. Instead of typing `M-1', `M-2', and so on, another way to specify a
  1912. numeric argument is to type `C-u' (`universal-argument') followed by
  1913. some digits, or (for a negative argument) a minus sign followed by
  1914. digits. A minus sign without digits normally means -1.
  1915. `C-u' alone has the special meaning of "four times": it multiplies
  1916. the argument for the next command by four. `C-u C-u' multiplies it by
  1917. sixteen. Thus, `C-u C-u C-f' moves forward sixteen characters. Other
  1918. useful combinations are `C-u C-n', `C-u C-u C-n' (move down a good
  1919. fraction of a screen), `C-u C-u C-o' (make "a lot" of blank lines), and
  1920. `C-u C-k' (kill four lines).
  1921. You can use a numeric argument before a self-inserting character to
  1922. insert multiple copies of it. This is straightforward when the
  1923. character is not a digit; for example, `C-u 6 4 a' inserts 64 copies of
  1924. the character `a'. But this does not work for inserting digits; `C-u 6
  1925. 4 1' specifies an argument of 641. You can separate the argument from
  1926. the digit to insert with another `C-u'; for example, `C-u 6 4 C-u 1'
  1927. does insert 64 copies of the character `1'.
  1928. Some commands care whether there is an argument, but ignore its
  1929. value. For example, the command `M-q' (`fill-paragraph') fills text;
  1930. with an argument, it justifies the text as well. (*Note Filling::, for
  1931. more information on `M-q'.) For these commands, it is enough to the
  1932. argument with a single `C-u'.
  1933. Some commands use the value of the argument as a repeat count, but
  1934. do something special when there is no argument. For example, the
  1935. command `C-k' (`kill-line') with argument N kills N lines, including
  1936. their terminating newlines. But `C-k' with no argument is special: it
  1937. kills the text up to the next newline, or, if point is right at the end
  1938. of the line, it kills the newline itself. Thus, two `C-k' commands
  1939. with no arguments can kill a nonblank line, just like `C-k' with an
  1940. argument of one. (*Note Killing::, for more information on `C-k'.)
  1941. A few commands treat a plain `C-u' differently from an ordinary
  1942. argument. A few others may treat an argument of just a minus sign
  1943. differently from an argument of -1. These unusual cases are described
  1944. when they come up; they exist to make an individual command more
  1945. convenient, and they are documented in that command's documentation
  1946. string.
  1947. We use the term "prefix argument" as well as "numeric argument", to
  1948. emphasize that you type these argument before the command, and to
  1949. distinguish them from minibuffer arguments that come after the command.
  1950. 
  1951. File: emacs, Node: Repeating, Prev: Arguments, Up: Basic
  1952. 7.11 Repeating a Command
  1953. ========================
  1954. Many simple commands, such as those invoked with a single key or with
  1955. `M-x COMMAND-NAME <RET>', can be repeated by invoking them with a
  1956. numeric argument that serves as a repeat count (*note Arguments::).
  1957. However, if the command you want to repeat prompts for input, or uses a
  1958. numeric argument in another way, that method won't work.
  1959. The command `C-x z' (`repeat') provides another way to repeat an
  1960. Emacs command many times. This command repeats the previous Emacs
  1961. command, whatever that was. Repeating a command uses the same arguments
  1962. that were used before; it does not read new arguments each time.
  1963. To repeat the command more than once, type additional `z''s: each
  1964. `z' repeats the command one more time. Repetition ends when you type a
  1965. character other than `z', or press a mouse button.
  1966. For example, suppose you type `C-u 2 0 C-d' to delete 20 characters.
  1967. You can repeat that command (including its argument) three additional
  1968. times, to delete a total of 80 characters, by typing `C-x z z z'. The
  1969. first `C-x z' repeats the command once, and each subsequent `z' repeats
  1970. it once again.
  1971. 
  1972. File: emacs, Node: Minibuffer, Next: M-x, Prev: Basic, Up: Top
  1973. 8 The Minibuffer
  1974. ****************
  1975. The "minibuffer" is where Emacs commands read complicated arguments,
  1976. such as file names, buffer names, Emacs command names, or Lisp
  1977. expressions. We call it the "minibuffer" because it's a
  1978. special-purpose buffer with a small amount of screen space. You can
  1979. use the usual Emacs editing commands in the minibuffer to edit the
  1980. argument text.
  1981. When the minibuffer is in use, it appears in the echo area, with a
  1982. cursor. The minibuffer starts with a "prompt" in a distinct color,
  1983. usually ending with a colon. The prompt states what kind of input is
  1984. expected, and how it will be used.
  1985. The simplest way to enter a minibuffer argument is to type the text,
  1986. then <RET> to submit the argument and exit the minibuffer. You can
  1987. cancel the minibuffer, and the command that wants the argument, by
  1988. typing `C-g'.
  1989. Sometimes, a "default argument" appears in the prompt, inside
  1990. parentheses before the colon. This default will be used as the
  1991. argument if you just type <RET>. For example, commands that read
  1992. buffer names usually show a buffer name as the default; you can type
  1993. <RET> to operate on that default buffer.
  1994. Since the minibuffer appears in the echo area, it can conflict with
  1995. other uses of the echo area. If an error message or an informative
  1996. message is emitted while the minibuffer is active, the message hides
  1997. the minibuffer for a few seconds, or until you type something; then the
  1998. minibuffer comes back. While the minibuffer is in use, keystrokes do
  1999. not echo.
  2000. * Menu:
  2001. * Minibuffer File:: Entering file names with the minibuffer.
  2002. * Minibuffer Edit:: How to edit in the minibuffer.
  2003. * Completion:: An abbreviation facility for minibuffer input.
  2004. * Minibuffer History:: Reusing recent minibuffer arguments.
  2005. * Repetition:: Re-executing commands that used the minibuffer.
  2006. * Passwords:: Entering passwords in the echo area.
  2007. 
  2008. File: emacs, Node: Minibuffer File, Next: Minibuffer Edit, Up: Minibuffer
  2009. 8.1 Minibuffers for File Names
  2010. ==============================
  2011. Commands such as `C-x C-f' (`find-file') use the minibuffer to read a
  2012. file name argument (*note Basic Files::). When the minibuffer is used
  2013. to read a file name, it typically starts out with some initial text
  2014. ending in a slash. This is the "default directory". For example, it
  2015. may start out like this:
  2016. Find file: /u2/emacs/src/
  2017. Here, `Find file: ' is the prompt and `/u2/emacs/src/' is the default
  2018. directory. If you now type `buffer.c' as input, that specifies the
  2019. file `/u2/emacs/src/buffer.c'. *Note File Names::, for information
  2020. about the default directory.
  2021. You can specify the parent directory with `..': `/a/b/../foo.el' is
  2022. equivalent to `/a/foo.el'. Alternatively, you can use `M-<DEL>' to
  2023. kill directory names backwards (*note Words::).
  2024. To specify a file in a completely different directory, you can kill
  2025. the entire default with `C-a C-k' (*note Minibuffer Edit::).
  2026. Alternatively, you can ignore the default, and enter an absolute file
  2027. name starting with a slash or a tilde after the default directory. For
  2028. example, you can specify `/etc/termcap' as follows:
  2029. Find file: /u2/emacs/src//etc/termcap
  2030. Emacs interprets a double slash as "ignore everything before the second
  2031. slash in the pair". In the example above, `/u2/emacs/src/' is ignored,
  2032. so the argument you supplied is `/etc/termcap'. The ignored part of
  2033. the file name is dimmed if the terminal allows it. (To disable this
  2034. dimming, turn off File Name Shadow mode with the command `M-x
  2035. file-name-shadow-mode'.)
  2036. Emacs interprets `~/' as your home directory. Thus, `~/foo/bar.txt'
  2037. specifies a file named `bar.txt', inside a directory named `foo', which
  2038. is in turn located in your home directory. In addition, `~USER-ID/'
  2039. means the home directory of a user whose login name is USER-ID. Any
  2040. leading directory name in front of the `~' is ignored: thus,
  2041. `/u2/emacs/~/foo/bar.txt' is equivalent to `~/foo/bar.txt'.
  2042. On MS-Windows and MS-DOS systems, where a user doesn't always have a
  2043. home directory, Emacs uses several alternatives. For MS-Windows, see
  2044. *note Windows HOME::; for MS-DOS, see *note MS-DOS File Names::. On
  2045. these systems, the `~USER-ID/' construct is supported only for the
  2046. current user, i.e., only if USER-ID is the current user's login name.
  2047. To prevent Emacs from inserting the default directory when reading
  2048. file names, change the variable `insert-default-directory' to `nil'.
  2049. In that case, the minibuffer starts out empty. Nonetheless, relative
  2050. file name arguments are still interpreted based on the same default
  2051. directory.
  2052. You can also enter remote file names in the minibuffer. *Note
  2053. Remote Files::.
  2054. 
  2055. File: emacs, Node: Minibuffer Edit, Next: Completion, Prev: Minibuffer File, Up: Minibuffer
  2056. 8.2 Editing in the Minibuffer
  2057. =============================
  2058. The minibuffer is an Emacs buffer, albeit a peculiar one, and the usual
  2059. Emacs commands are available for editing the argument text. (The
  2060. prompt, however, is "read-only", and cannot be changed.)
  2061. Since <RET> in the minibuffer submits the argument, you can't use it
  2062. to insert a newline. You can do that with `C-q C-j', which inserts a
  2063. `C-j' control character, which is formally equivalent to a newline
  2064. character (*note Inserting Text::). Alternatively, you can use the
  2065. `C-o' (`open-line') command (*note Blank Lines::).
  2066. Inside a minibuffer, the keys <TAB>, <SPC>, and `?' are often bound
  2067. to "completion commands", which allow you to easily fill in the desired
  2068. text without typing all of it. *Note Completion::. As with <RET>, you
  2069. can use `C-q' to insert a <TAB>, <SPC>, or `?' character.
  2070. For convenience, `C-a' (`move-beginning-of-line') in a minibuffer
  2071. moves point to the beginning of the argument text, not the beginning of
  2072. the prompt. For example, this allows you to erase the entire argument
  2073. with `C-a C-k'.
  2074. When the minibuffer is active, the echo area is treated much like an
  2075. ordinary Emacs window. For instance, you can switch to another window
  2076. (with `C-x o'), edit text there, then return to the minibuffer window
  2077. to finish the argument. You can even kill text in another window,
  2078. return to the minibuffer window, and yank the text into the argument.
  2079. There are some restrictions on the minibuffer window, however: for
  2080. instance, you cannot split it. *Note Windows::.
  2081. Normally, the minibuffer window occupies a single screen line.
  2082. However, if you add two or more lines' worth of text into the
  2083. minibuffer, it expands automatically to accommodate the text. The
  2084. variable `resize-mini-windows' controls the resizing of the minibuffer.
  2085. The default value is `grow-only', which means the behavior we have just
  2086. described. If the value is `t', the minibuffer window will also shrink
  2087. automatically if you remove some lines of text from the minibuffer,
  2088. down to a minimum of one screen line. If the value is `nil', the
  2089. minibuffer window never changes size automatically, but you can use the
  2090. usual window-resizing commands on it (*note Windows::).
  2091. The variable `max-mini-window-height' controls the maximum height
  2092. for resizing the minibuffer window. A floating-point number specifies
  2093. a fraction of the frame's height; an integer specifies the maximum
  2094. number of lines; `nil' means do not resize the minibuffer window
  2095. automatically. The default value is 0.25.
  2096. The `C-M-v' command in the minibuffer scrolls the help text from
  2097. commands that display help text of any sort in another window. You can
  2098. also scroll the help text with `M-<prior>' and `M-<next>' (or,
  2099. equivalently, `M-<PageUp>' and `M-<PageDown>'). This is especially
  2100. useful with long lists of possible completions. *Note Other Window::.
  2101. Emacs normally disallows most commands that use the minibuffer while
  2102. the minibuffer is active. To allow such commands in the minibuffer,
  2103. set the variable `enable-recursive-minibuffers' to `t'.
  2104. When not active, the minibuffer is in `minibuffer-inactive-mode',
  2105. and clicking `Mouse-1' there shows the `*Messages*' buffer. If you use
  2106. a dedicated frame for minibuffers, Emacs also recognizes certain keys
  2107. there, for example `n' to make a new frame.
  2108. 
  2109. File: emacs, Node: Completion, Next: Minibuffer History, Prev: Minibuffer Edit, Up: Minibuffer
  2110. 8.3 Completion
  2111. ==============
  2112. You can often use a feature called "completion" to help enter
  2113. arguments. This means that after you type part of the argument, Emacs
  2114. can fill in the rest, or some of it, based on what was typed so far.
  2115. When completion is available, certain keys (usually <TAB>, <RET>,
  2116. and <SPC>) are rebound in the minibuffer to special completion commands
  2117. (*note Completion Commands::). These commands attempt to complete the
  2118. text in the minibuffer, based on a set of "completion alternatives"
  2119. provided by the command that requested the argument. You can usually
  2120. type `?' to see a list of completion alternatives.
  2121. Although completion is usually done in the minibuffer, the feature
  2122. is sometimes available in ordinary buffers too. *Note Symbol
  2123. Completion::.
  2124. * Menu:
  2125. * Completion Example:: Examples of using completion.
  2126. * Completion Commands:: A list of completion commands.
  2127. * Completion Exit:: Completion and minibuffer text submission.
  2128. * Completion Styles:: How completion matches are chosen.
  2129. * Completion Options:: Options for completion.
  2130. 
  2131. File: emacs, Node: Completion Example, Next: Completion Commands, Up: Completion
  2132. 8.3.1 Completion Example
  2133. ------------------------
  2134. A simple example may help here. `M-x' uses the minibuffer to read the
  2135. name of a command, so completion works by matching the minibuffer text
  2136. against the names of existing Emacs commands. Suppose you wish to run
  2137. the command `auto-fill-mode'. You can do that by typing `M-x
  2138. auto-fill-mode <RET>', but it is easier to use completion.
  2139. If you type `M-x a u <TAB>', the <TAB> looks for completion
  2140. alternatives (in this case, command names) that start with `au'. There
  2141. are several, including `auto-fill-mode' and `autoconf-mode', but they
  2142. all begin with `auto', so the `au' in the minibuffer completes to
  2143. `auto'. (More commands may be defined in your Emacs session. For
  2144. example, if a command called `authorize-me' was defined, Emacs could
  2145. only complete as far as `aut'.)
  2146. If you type <TAB> again immediately, it cannot determine the next
  2147. character; it could be `-', `a', or `c'. So it does not add any
  2148. characters; instead, <TAB> displays a list of all possible completions
  2149. in another window.
  2150. Next, type `-f'. The minibuffer now contains `auto-f', and the only
  2151. command name that starts with this is `auto-fill-mode'. If you now
  2152. type <TAB>, completion fills in the rest of the argument
  2153. `auto-fill-mode' into the minibuffer.
  2154. Hence, typing just `a u <TAB> - f <TAB>' allows you to enter
  2155. `auto-fill-mode'.
  2156. 
  2157. File: emacs, Node: Completion Commands, Next: Completion Exit, Prev: Completion Example, Up: Completion
  2158. 8.3.2 Completion Commands
  2159. -------------------------
  2160. Here is a list of the completion commands defined in the minibuffer
  2161. when completion is allowed.
  2162. `<TAB>'
  2163. Complete the text in the minibuffer as much as possible; if unable
  2164. to complete, display a list of possible completions
  2165. (`minibuffer-complete').
  2166. `<SPC>'
  2167. Complete up to one word from the minibuffer text before point
  2168. (`minibuffer-complete-word'). This command is not available for
  2169. arguments that often include spaces, such as file names.
  2170. `<RET>'
  2171. Submit the text in the minibuffer as the argument, possibly
  2172. completing first (`minibuffer-complete-and-exit'). *Note
  2173. Completion Exit::.
  2174. `?'
  2175. Display a list of completions (`minibuffer-completion-help').
  2176. <TAB> (`minibuffer-complete') is the most fundamental completion
  2177. command. It searches for all possible completions that match the
  2178. existing minibuffer text, and attempts to complete as much as it can.
  2179. *Note Completion Styles::, for how completion alternatives are chosen.
  2180. <SPC> (`minibuffer-complete-word') completes like <TAB>, but only up
  2181. to the next hyphen or space. If you have `auto-f' in the minibuffer
  2182. and type <SPC>, it finds that the completion is `auto-fill-mode', but
  2183. it only inserts `ill-', giving `auto-fill-'. Another <SPC> at this
  2184. point completes all the way to `auto-fill-mode'.
  2185. If <TAB> or <SPC> is unable to complete, it displays a list of
  2186. matching completion alternatives (if there are any) in another window.
  2187. You can display the same list with `?' (`minibuffer-completion-help').
  2188. The following commands can be used with the completion list:
  2189. `Mouse-1'
  2190. `Mouse-2'
  2191. Clicking mouse button 1 or 2 on a completion alternative chooses it
  2192. (`mouse-choose-completion').
  2193. `M-v'
  2194. `<PageUp>'
  2195. `<prior>'
  2196. Typing `M-v', while in the minibuffer, selects the window showing
  2197. the completion list (`switch-to-completions'). This paves the way
  2198. for using the commands below. <PageUp> or <prior> does the same.
  2199. You can also select the window in other ways (*note Windows::).
  2200. `<RET>'
  2201. While in the completion list buffer, this chooses the completion at
  2202. point (`choose-completion').
  2203. `<Right>'
  2204. While in the completion list buffer, this moves point to the
  2205. following completion alternative (`next-completion').
  2206. `<Left>'
  2207. While in the completion list buffer, this moves point to the
  2208. previous completion alternative (`previous-completion').
  2209. 
  2210. File: emacs, Node: Completion Exit, Next: Completion Styles, Prev: Completion Commands, Up: Completion
  2211. 8.3.3 Completion Exit
  2212. ---------------------
  2213. When a command reads an argument using the minibuffer with completion,
  2214. it also controls what happens when you type <RET>
  2215. (`minibuffer-complete-and-exit') to submit the argument. There are
  2216. four types of behavior:
  2217. * "Strict completion" accepts only exact completion matches. Typing
  2218. <RET> exits the minibuffer only if the minibuffer text is an exact
  2219. match, or completes to one. Otherwise, Emacs refuses to exit the
  2220. minibuffer; instead it tries to complete, and if no completion can
  2221. be done it momentarily displays `[No match]' after the minibuffer
  2222. text. (You can still leave the minibuffer by typing `C-g' to
  2223. cancel the command.)
  2224. An example of a command that uses this behavior is `M-x', since it
  2225. is meaningless for it to accept a non-existent command name.
  2226. * "Cautious completion" is like strict completion, except <RET>
  2227. exits only if the text is already an exact match. If the text
  2228. completes to an exact match, <RET> performs that completion but
  2229. does not exit yet; you must type a second <RET> to exit.
  2230. Cautious completion is used for reading file names for files that
  2231. must already exist, for example.
  2232. * "Permissive completion" allows any input; the completion
  2233. candidates are just suggestions. Typing <RET> does not complete,
  2234. it just submits the argument as you have entered it.
  2235. * "Permissive completion with confirmation" is like permissive
  2236. completion, with an exception: if you typed <TAB> and this
  2237. completed the text up to some intermediate state (i.e., one that
  2238. is not yet an exact completion match), typing <RET> right
  2239. afterward does not submit the argument. Instead, Emacs asks for
  2240. confirmation by momentarily displaying `[Confirm]' after the text;
  2241. type <RET> again to confirm and submit the text. This catches a
  2242. common mistake, in which one types <RET> before realizing that
  2243. <TAB> did not complete as far as desired.
  2244. You can tweak the confirmation behavior by customizing the variable
  2245. `confirm-nonexistent-file-or-buffer'. The default value,
  2246. `after-completion', gives the behavior we have just described. If
  2247. you change it to `nil', Emacs does not ask for confirmation,
  2248. falling back on permissive completion. If you change it to any
  2249. other non-`nil' value, Emacs asks for confirmation whether or not
  2250. the preceding command was <TAB>.
  2251. This behavior is used by most commands that read file names, like
  2252. `C-x C-f', and commands that read buffer names, like `C-x b'.
  2253. 
  2254. File: emacs, Node: Completion Styles, Next: Completion Options, Prev: Completion Exit, Up: Completion
  2255. 8.3.4 How Completion Alternatives Are Chosen
  2256. --------------------------------------------
  2257. Completion commands work by narrowing a large list of possible
  2258. completion alternatives to a smaller subset that "matches" what you
  2259. have typed in the minibuffer. In *note Completion Example::, we gave a
  2260. simple example of such matching. The procedure of determining what
  2261. constitutes a "match" is quite intricate. Emacs attempts to offer
  2262. plausible completions under most circumstances.
  2263. Emacs performs completion using one or more "completion
  2264. styles"--sets of criteria for matching minibuffer text to completion
  2265. alternatives. During completion, Emacs tries each completion style in
  2266. turn. If a style yields one or more matches, that is used as the list
  2267. of completion alternatives. If a style produces no matches, Emacs
  2268. falls back on the next style.
  2269. The list variable `completion-styles' specifies the completion
  2270. styles to use. Each list element is the name of a completion style (a
  2271. Lisp symbol). The default completion styles are (in order):
  2272. `basic'
  2273. A matching completion alternative must have the same beginning as
  2274. the text in the minibuffer before point. Furthermore, if there is
  2275. any text in the minibuffer after point, the rest of the completion
  2276. alternative must contain that text as a substring.
  2277. `partial-completion'
  2278. This aggressive completion style divides the minibuffer text into
  2279. words separated by hyphens or spaces, and completes each word
  2280. separately. (For example, when completing command names, `em-l-m'
  2281. completes to `emacs-lisp-mode'.)
  2282. Furthermore, a `*' in the minibuffer text is treated as a
  2283. "wildcard"--it matches any character at the corresponding position
  2284. in the completion alternative.
  2285. `emacs22'
  2286. This completion style is similar to `basic', except that it
  2287. ignores the text in the minibuffer after point. It is so-named
  2288. because it corresponds to the completion behavior in Emacs 22.
  2289. The following additional completion styles are also defined, and you
  2290. can add them to `completion-styles' if you wish (*note Customization::):
  2291. `substring'
  2292. A matching completion alternative must contain the text in the
  2293. minibuffer before point, and the text in the minibuffer after
  2294. point, as substrings (in that same order).
  2295. Thus, if the text in the minibuffer is `foobar', with point
  2296. between `foo' and `bar', that matches `AfooBbarC', where A, B, and
  2297. C can be any string including the empty string.
  2298. `initials'
  2299. This very aggressive completion style attempts to complete acronyms
  2300. and initialisms. For example, when completing command names, it
  2301. matches `lch' to `list-command-history'.
  2302. There is also a very simple completion style called `emacs21'. In this
  2303. style, if the text in the minibuffer is `foobar', only matches starting
  2304. with `foobar' are considered.
  2305. You can use different completion styles in different situations, by
  2306. setting the variable `completion-category-overrides'. For example, the
  2307. default setting says to use only `basic' and `substring' completion for
  2308. buffer names.
  2309. 
  2310. File: emacs, Node: Completion Options, Prev: Completion Styles, Up: Completion
  2311. 8.3.5 Completion Options
  2312. ------------------------
  2313. Case is significant when completing case-sensitive arguments, such as
  2314. command names. For example, when completing command names, `AU' does
  2315. not complete to `auto-fill-mode'. Case differences are ignored when
  2316. completing arguments in which case does not matter.
  2317. When completing file names, case differences are ignored if the
  2318. variable `read-file-name-completion-ignore-case' is non-`nil'. The
  2319. default value is `nil' on systems that have case-sensitive file-names,
  2320. such as GNU/Linux; it is non-`nil' on systems that have
  2321. case-insensitive file-names, such as Microsoft Windows. When
  2322. completing buffer names, case differences are ignored if the variable
  2323. `read-buffer-completion-ignore-case' is non-`nil'; the default is `nil'.
  2324. When completing file names, Emacs usually omits certain alternatives
  2325. that are considered unlikely to be chosen, as determined by the list
  2326. variable `completion-ignored-extensions'. Each element in the list
  2327. should be a string; any file name ending in such a string is ignored as
  2328. a completion alternative. Any element ending in a slash (`/')
  2329. represents a subdirectory name. The standard value of
  2330. `completion-ignored-extensions' has several elements including `".o"',
  2331. `".elc"', and `"~"'. For example, if a directory contains `foo.c' and
  2332. `foo.elc', `foo' completes to `foo.c'. However, if _all_ possible
  2333. completions end in "ignored" strings, they are not ignored: in the
  2334. previous example, `foo.e' completes to `foo.elc'. Emacs disregards
  2335. `completion-ignored-extensions' when showing completion alternatives in
  2336. the completion list.
  2337. If `completion-auto-help' is set to `nil', the completion commands
  2338. never display the completion list buffer; you must type `?' to display
  2339. the list. If the value is `lazy', Emacs only shows the completion list
  2340. buffer on the second attempt to complete. In other words, if there is
  2341. nothing to complete, the first <TAB> echoes `Next char not unique'; the
  2342. second <TAB> shows the completion list buffer.
  2343. If `completion-cycle-threshold' is non-`nil', completion commands
  2344. can "cycle" through completion alternatives. Normally, if there is
  2345. more than one completion alternative for the text in the minibuffer, a
  2346. completion command completes up to the longest common substring. If
  2347. you change `completion-cycle-threshold' to `t', the completion command
  2348. instead completes to the first of those completion alternatives; each
  2349. subsequent invocation of the completion command replaces that with the
  2350. next completion alternative, in a cyclic manner. If you give
  2351. `completion-cycle-threshold' a numeric value N, completion commands
  2352. switch to this cycling behavior only when there are fewer than N
  2353. alternatives.
  2354. Icomplete mode presents a constantly-updated display that tells you
  2355. what completions are available for the text you've entered so far. The
  2356. command to enable or disable this minor mode is `M-x icomplete-mode'.
  2357. 
  2358. File: emacs, Node: Minibuffer History, Next: Repetition, Prev: Completion, Up: Minibuffer
  2359. 8.4 Minibuffer History
  2360. ======================
  2361. Every argument that you enter with the minibuffer is saved in a
  2362. "minibuffer history list" so you can easily use it again later. You
  2363. can use the following arguments to quickly fetch an earlier argument
  2364. into the minibuffer:
  2365. `M-p'
  2366. `<Up>'
  2367. Move to the previous item in the minibuffer history, an earlier
  2368. argument (`previous-history-element').
  2369. `M-n'
  2370. `<Down>'
  2371. Move to the next item in the minibuffer history
  2372. (`next-history-element').
  2373. `M-r REGEXP <RET>'
  2374. Move to an earlier item in the minibuffer history that matches
  2375. REGEXP (`previous-matching-history-element').
  2376. `M-s REGEXP <RET>'
  2377. Move to a later item in the minibuffer history that matches REGEXP
  2378. (`next-matching-history-element').
  2379. While in the minibuffer, `M-p' or <Up> (`previous-history-element')
  2380. moves through the minibuffer history list, one item at a time. Each
  2381. `M-p' fetches an earlier item from the history list into the
  2382. minibuffer, replacing its existing contents. Typing `M-n' or <Down>
  2383. (`next-history-element') moves through the minibuffer history list in
  2384. the opposite direction, fetching later entries into the minibuffer.
  2385. If you type `M-n' in the minibuffer when there are no later entries
  2386. in the minibuffer history (e.g., if you haven't previously typed
  2387. `M-p'), Emacs tries fetching from a list of default arguments: values
  2388. that you are likely to enter. You can think of this as moving through
  2389. the "future history" list.
  2390. If you edit the text inserted by the `M-p' or <M-n> minibuffer
  2391. history commands, this does not change its entry in the history list.
  2392. However, the edited argument does go at the end of the history list
  2393. when you submit it.
  2394. You can use `M-r' (`previous-matching-history-element') to search
  2395. through older elements in the history list, and `M-s'
  2396. (`next-matching-history-element') to search through newer entries.
  2397. Each of these commands asks for a "regular expression" as an argument,
  2398. and fetches the first matching entry into the minibuffer. *Note
  2399. Regexps::, for an explanation of regular expressions. A numeric prefix
  2400. argument N means to fetch the Nth matching entry. These commands are
  2401. unusual, in that they use the minibuffer to read the regular expression
  2402. argument, even though they are invoked from the minibuffer. An
  2403. upper-case letter in the regular expression makes the search
  2404. case-sensitive (*note Search Case::).
  2405. You can also search through the history using an incremental search.
  2406. *Note Isearch Minibuffer::.
  2407. Emacs keeps separate history lists for several different kinds of
  2408. arguments. For example, there is a list for file names, used by all
  2409. the commands that read file names. Other history lists include buffer
  2410. names, command names (used by `M-x'), and command arguments (used by
  2411. commands like `query-replace').
  2412. The variable `history-length' specifies the maximum length of a
  2413. minibuffer history list; adding a new element deletes the oldest
  2414. element if the list gets too long. If the value is `t', there is no
  2415. maximum length.
  2416. The variable `history-delete-duplicates' specifies whether to delete
  2417. duplicates in history. If it is non-`nil', adding a new element
  2418. deletes from the list all other elements that are equal to it. The
  2419. default is `nil'.
  2420. 
  2421. File: emacs, Node: Repetition, Next: Passwords, Prev: Minibuffer History, Up: Minibuffer
  2422. 8.5 Repeating Minibuffer Commands
  2423. =================================
  2424. Every command that uses the minibuffer once is recorded on a special
  2425. history list, the "command history", together with the values of its
  2426. arguments, so that you can repeat the entire command. In particular,
  2427. every use of `M-x' is recorded there, since `M-x' uses the minibuffer
  2428. to read the command name.
  2429. `C-x <ESC> <ESC>'
  2430. Re-execute a recent minibuffer command from the command history
  2431. (`repeat-complex-command').
  2432. `M-x list-command-history'
  2433. Display the entire command history, showing all the commands `C-x
  2434. <ESC> <ESC>' can repeat, most recent first.
  2435. `C-x <ESC> <ESC>' re-executes a recent command that used the
  2436. minibuffer. With no argument, it repeats the last such command. A
  2437. numeric argument specifies which command to repeat; 1 means the last
  2438. one, 2 the previous, and so on.
  2439. `C-x <ESC> <ESC>' works by turning the previous command into a Lisp
  2440. expression and then entering a minibuffer initialized with the text for
  2441. that expression. Even if you don't know Lisp, it will probably be
  2442. obvious which command is displayed for repetition. If you type just
  2443. <RET>, that repeats the command unchanged. You can also change the
  2444. command by editing the Lisp expression before you execute it. The
  2445. repeated command is added to the front of the command history unless it
  2446. is identical to the most recent item.
  2447. Once inside the minibuffer for `C-x <ESC> <ESC>', you can use the
  2448. usual minibuffer history commands (*note Minibuffer History::) to move
  2449. through the history list. After finding the desired previous command,
  2450. you can edit its expression as usual and then repeat it by typing <RET>.
  2451. Incremental search does not, strictly speaking, use the minibuffer.
  2452. Therefore, although it behaves like a complex command, it normally does
  2453. not appear in the history list for `C-x <ESC> <ESC>'. You can make
  2454. incremental search commands appear in the history by setting
  2455. `isearch-resume-in-command-history' to a non-`nil' value. *Note
  2456. Incremental Search::.
  2457. The list of previous minibuffer-using commands is stored as a Lisp
  2458. list in the variable `command-history'. Each element is a Lisp
  2459. expression that describes one command and its arguments. Lisp programs
  2460. can re-execute a command by calling `eval' with the `command-history'
  2461. element.
  2462. 
  2463. File: emacs, Node: Passwords, Prev: Repetition, Up: Minibuffer
  2464. 8.6 Entering passwords
  2465. ======================
  2466. Sometimes, you may need to enter a password into Emacs. For instance,
  2467. when you tell Emacs to visit a file on another machine via a network
  2468. protocol such as FTP, you often need to supply a password to gain
  2469. access to the machine (*note Remote Files::).
  2470. Entering a password is similar to using a minibuffer. Emacs
  2471. displays a prompt in the echo area (such as `Password: '); after you
  2472. type the required password, press <RET> to submit it. To prevent
  2473. others from seeing your password, every character you type is displayed
  2474. as a dot (`.') instead of its usual form.
  2475. Most of the features and commands associated with the minibuffer can
  2476. _not_ be used when entering a password. There is no history or
  2477. completion, and you cannot change windows or perform any other action
  2478. with Emacs until you have submitted the password.
  2479. While you are typing the password, you may press <DEL> to delete
  2480. backwards, removing the last character entered. <C-u> deletes
  2481. everything you have typed so far. `C-g' quits the password prompt
  2482. (*note Quitting::). `C-y' inserts the current kill into the password
  2483. (*note Killing::). You may type either <RET> or <ESC> to submit the
  2484. password. Any other self-inserting character key inserts the
  2485. associated character into the password, and all other input is ignored.
  2486. 
  2487. File: emacs, Node: M-x, Next: Help, Prev: Minibuffer, Up: Top
  2488. 9 Running Commands by Name
  2489. **************************
  2490. Every Emacs command has a name that you can use to run it. For
  2491. convenience, many commands also have key bindings. You can run those
  2492. commands by typing the keys, or run them by name. Most Emacs commands
  2493. have no key bindings, so the only way to run them is by name. (*Note
  2494. Key Bindings::, for how to set up key bindings.)
  2495. By convention, a command name consists of one or more words,
  2496. separated by hyphens; for example, `auto-fill-mode' or `manual-entry'.
  2497. Command names mostly use complete English words to make them easier to
  2498. remember.
  2499. To run a command by name, start with `M-x', type the command name,
  2500. then terminate it with <RET>. `M-x' uses the minibuffer to read the
  2501. command name. The string `M-x' appears at the beginning of the
  2502. minibuffer as a "prompt" to remind you to enter a command name to be
  2503. run. <RET> exits the minibuffer and runs the command. *Note
  2504. Minibuffer::, for more information on the minibuffer.
  2505. You can use completion to enter the command name. For example, to
  2506. invoke the command `forward-char', you can type
  2507. M-x forward-char <RET>
  2508. or
  2509. M-x forw <TAB> c <RET>
  2510. Note that `forward-char' is the same command that you invoke with the
  2511. key `C-f'. The existence of a key binding does not stop you from
  2512. running the command by name.
  2513. To cancel the `M-x' and not run a command, type `C-g' instead of
  2514. entering the command name. This takes you back to command level.
  2515. To pass a numeric argument to the command you are invoking with
  2516. `M-x', specify the numeric argument before `M-x'. The argument value
  2517. appears in the prompt while the command name is being read, and finally
  2518. `M-x' passes the argument to that command.
  2519. When the command you run with `M-x' has a key binding, Emacs
  2520. mentions this in the echo area after running the command. For example,
  2521. if you type `M-x forward-word', the message says that you can run the
  2522. same command by typing `M-f'. You can turn off these messages by
  2523. setting the variable `suggest-key-bindings' to `nil'.
  2524. In this manual, when we speak of running a command by name, we often
  2525. omit the <RET> that terminates the name. Thus we might say `M-x
  2526. auto-fill-mode' rather than `M-x auto-fill-mode <RET>'. We mention the
  2527. <RET> only for emphasis, such as when the command is followed by
  2528. arguments.
  2529. `M-x' works by running the command `execute-extended-command', which
  2530. is responsible for reading the name of another command and invoking it.
  2531. 
  2532. File: emacs, Node: Help, Next: Mark, Prev: M-x, Up: Top
  2533. 10 Help
  2534. *******
  2535. Emacs provides a wide variety of help commands, all accessible through
  2536. the prefix key `C-h' (or, equivalently, the function key <F1>). These
  2537. help commands are described in the following sections. You can also
  2538. type `C-h C-h' to view a list of help commands (`help-for-help'). You
  2539. can scroll the list with <SPC> and <DEL>, then type the help command
  2540. you want. To cancel, type `C-g'.
  2541. Many help commands display their information in a special "help
  2542. buffer". In this buffer, you can type <SPC> and <DEL> to scroll and
  2543. type <RET> to follow hyperlinks. *Note Help Mode::.
  2544. If you are looking for a certain feature, but don't know what it is
  2545. called or where to look, we recommend three methods. First, try an
  2546. apropos command, then try searching the manual index, then look in the
  2547. FAQ and the package keywords.
  2548. `C-h a TOPICS <RET>'
  2549. This searches for commands whose names match the argument TOPICS.
  2550. The argument can be a keyword, a list of keywords, or a regular
  2551. expression (*note Regexps::). *Note Apropos::.
  2552. `C-h i d m emacs <RET> i TOPIC <RET>'
  2553. This searches for TOPIC in the indices of the Emacs Info manual,
  2554. displaying the first match found. Press `,' to see subsequent
  2555. matches. You can use a regular expression as TOPIC.
  2556. `C-h i d m emacs <RET> s TOPIC <RET>'
  2557. Similar, but searches the _text_ of the manual rather than the
  2558. indices.
  2559. `C-h C-f'
  2560. This displays the Emacs FAQ, using Info.
  2561. `C-h p'
  2562. This displays the available Emacs packages based on keywords.
  2563. *Note Package Keywords::.
  2564. `C-h' or <F1> means "help" in various other contexts as well. For
  2565. instance, you can type them after a prefix key to view a list of the
  2566. keys that can follow the prefix key. (A few prefix keys don't support
  2567. `C-h' in this way, because they define other meanings for it, but they
  2568. all support <F1> for help.)
  2569. * Menu:
  2570. * Help Summary:: Brief list of all Help commands.
  2571. * Key Help:: Asking what a key does in Emacs.
  2572. * Name Help:: Asking about a command, variable or function name.
  2573. * Apropos:: Asking what pertains to a given topic.
  2574. * Help Mode:: Special features of Help mode and Help buffers.
  2575. * Package Keywords:: Finding Lisp libraries by keywords (topics).
  2576. * Language Help:: Help relating to international language support.
  2577. * Misc Help:: Other help commands.
  2578. * Help Files:: Commands to display auxiliary help files.
  2579. * Help Echo:: Help on active text and tooltips ("balloon help").
  2580. 
  2581. File: emacs, Node: Help Summary, Next: Key Help, Up: Help
  2582. 10.1 Help Summary
  2583. =================
  2584. Here is a summary of help commands for accessing the built-in
  2585. documentation. Most of these are described in more detail in the
  2586. following sections.
  2587. `C-h a TOPICS <RET>'
  2588. Display a list of commands whose names match TOPICS
  2589. (`apropos-command').
  2590. `C-h b'
  2591. Display all active key bindings; minor mode bindings first, then
  2592. those of the major mode, then global bindings
  2593. (`describe-bindings').
  2594. `C-h c KEY'
  2595. Show the name of the command that the key sequence KEY is bound to
  2596. (`describe-key-briefly'). Here `c' stands for "character". For
  2597. more extensive information on KEY, use `C-h k'.
  2598. `C-h d TOPICS <RET>'
  2599. Display the commands and variables whose documentation matches
  2600. TOPICS (`apropos-documentation').
  2601. `C-h e'
  2602. Display the `*Messages*' buffer (`view-echo-area-messages').
  2603. `C-h f FUNCTION <RET>'
  2604. Display documentation on the Lisp function named FUNCTION
  2605. (`describe-function'). Since commands are Lisp functions, this
  2606. works for commands too.
  2607. `C-h h'
  2608. Display the `HELLO' file, which shows examples of various character
  2609. sets.
  2610. `C-h i'
  2611. Run Info, the GNU documentation browser (`info'). The Emacs
  2612. manual is available in Info.
  2613. `C-h k KEY'
  2614. Display the name and documentation of the command that KEY runs
  2615. (`describe-key').
  2616. `C-h l'
  2617. Display a description of your last 300 keystrokes (`view-lossage').
  2618. `C-h m'
  2619. Display documentation of the current major mode (`describe-mode').
  2620. `C-h n'
  2621. Display news of recent Emacs changes (`view-emacs-news').
  2622. `C-h p'
  2623. Find packages by topic keyword (`finder-by-keyword'). This lists
  2624. packages using a package menu buffer. *Note Packages::.
  2625. `C-h P PACKAGE <RET>'
  2626. Display documentation about the package named PACKAGE
  2627. (`describe-package').
  2628. `C-h r'
  2629. Display the Emacs manual in Info (`info-emacs-manual').
  2630. `C-h s'
  2631. Display the contents of the current "syntax table"
  2632. (`describe-syntax'). The syntax table says which characters are
  2633. opening delimiters, which are parts of words, and so on. *Note
  2634. Syntax Tables: (elisp)Syntax Tables, for details.
  2635. `C-h t'
  2636. Enter the Emacs interactive tutorial (`help-with-tutorial').
  2637. `C-h v VAR <RET>'
  2638. Display the documentation of the Lisp variable VAR
  2639. (`describe-variable').
  2640. `C-h w COMMAND <RET>'
  2641. Show which keys run the command named COMMAND (`where-is').
  2642. `C-h C CODING <RET>'
  2643. Describe the coding system CODING (`describe-coding-system').
  2644. `C-h C <RET>'
  2645. Describe the coding systems currently in use.
  2646. `C-h F COMMAND <RET>'
  2647. Enter Info and go to the node that documents the Emacs command
  2648. COMMAND (`Info-goto-emacs-command-node').
  2649. `C-h I METHOD <RET>'
  2650. Describe the input method METHOD (`describe-input-method').
  2651. `C-h K KEY'
  2652. Enter Info and go to the node that documents the key sequence KEY
  2653. (`Info-goto-emacs-key-command-node').
  2654. `C-h L LANGUAGE-ENV <RET>'
  2655. Display information on the character sets, coding systems, and
  2656. input methods used in language environment LANGUAGE-ENV
  2657. (`describe-language-environment').
  2658. `C-h S SYMBOL <RET>'
  2659. Display the Info documentation on symbol SYMBOL according to the
  2660. programming language you are editing (`info-lookup-symbol').
  2661. `C-h .'
  2662. Display the help message for a special text area, if point is in
  2663. one (`display-local-help'). (These include, for example, links in
  2664. `*Help*' buffers.)
  2665. 
  2666. File: emacs, Node: Key Help, Next: Name Help, Prev: Help Summary, Up: Help
  2667. 10.2 Documentation for a Key
  2668. ============================
  2669. The help commands to get information about a key sequence are `C-h c'
  2670. (`describe-key-briefly') and `C-h k' (`describe-key').
  2671. `C-h c KEY' displays in the echo area the name of the command that
  2672. KEY is bound to. For example, `C-h c C-f' displays `forward-char'.
  2673. `C-h k KEY' is similar but gives more information: it displays a
  2674. help buffer containing the command's "documentation string", which
  2675. describes exactly what the command does.
  2676. `C-h K KEY' displays the section of the Emacs manual that describes
  2677. the command corresponding to KEY.
  2678. `C-h c', `C-h k' and `C-h K' work for any sort of key sequences,
  2679. including function keys, menus, and mouse events. For instance, after
  2680. `C-h k' you can select a menu item from the menu bar, to view the
  2681. documentation string of the command it runs.
  2682. `C-h w COMMAND <RET>' lists the keys that are bound to COMMAND. It
  2683. displays the list in the echo area. If it says the command is not on
  2684. any key, that means you must use `M-x' to run it. `C-h w' runs the
  2685. command `where-is'.
  2686. 
  2687. File: emacs, Node: Name Help, Next: Apropos, Prev: Key Help, Up: Help
  2688. 10.3 Help by Command or Variable Name
  2689. =====================================
  2690. `C-h f FUNCTION <RET>' (`describe-function') displays the documentation
  2691. of Lisp function FUNCTION, in a window. Since commands are Lisp
  2692. functions, you can use this method to view the documentation of any
  2693. command whose name you know. For example,
  2694. C-h f auto-fill-mode <RET>
  2695. displays the documentation of `auto-fill-mode'. This is the only way
  2696. to get the documentation of a command that is not bound to any key (one
  2697. which you would normally run using `M-x').
  2698. `C-h f' is also useful for Lisp functions that you use in a Lisp
  2699. program. For example, if you have just written the expression
  2700. `(make-vector len)' and want to check that you are using `make-vector'
  2701. properly, type `C-h f make-vector <RET>'. Because `C-h f' allows all
  2702. function names, not just command names, you may find that some of your
  2703. favorite completion abbreviations that work in `M-x' don't work in `C-h
  2704. f'. An abbreviation that is unique among command names may not be
  2705. unique among all function names.
  2706. If you type `C-h f <RET>', it describes the function called by the
  2707. innermost Lisp expression in the buffer around point, _provided_ that
  2708. function name is a valid, defined Lisp function. (That name appears as
  2709. the default while you enter the argument.) For example, if point is
  2710. located following the text `(make-vector (car x)', the innermost list
  2711. containing point is the one that starts with `(make-vector', so `C-h f
  2712. <RET>' will describe the function `make-vector'.
  2713. `C-h f' is also useful just to verify that you spelled a function
  2714. name correctly. If the minibuffer prompt for `C-h f' shows the
  2715. function name from the buffer as the default, it means that name is
  2716. defined as a Lisp function. Type `C-g' to cancel the `C-h f' command
  2717. if you don't really want to view the documentation.
  2718. `C-h v' (`describe-variable') is like `C-h f' but describes Lisp
  2719. variables instead of Lisp functions. Its default is the Lisp symbol
  2720. around or before point, if that is the name of a defined Lisp variable.
  2721. *Note Variables::.
  2722. Help buffers that describe Emacs variables and functions normally
  2723. have hyperlinks to the corresponding source code, if you have the
  2724. source files installed (*note Hyperlinking::).
  2725. To find a command's documentation in a manual, use `C-h F'
  2726. (`Info-goto-emacs-command-node'). This knows about various manuals,
  2727. not just the Emacs manual, and finds the right one.
  2728. 
  2729. File: emacs, Node: Apropos, Next: Help Mode, Prev: Name Help, Up: Help
  2730. 10.4 Apropos
  2731. ============
  2732. The "apropos" commands answer questions like, "What are the commands
  2733. for working with files?" More precisely, you specify an "apropos
  2734. pattern", which means either a word, a list of words, or a regular
  2735. expression.
  2736. Each of the following apropos commands reads an apropos pattern in
  2737. the minibuffer, searches for items that match the pattern, and displays
  2738. the results in a different window.
  2739. `C-h a'
  2740. Search for commands (`apropos-command'). With a prefix argument,
  2741. search for noninteractive functions too.
  2742. `M-x apropos'
  2743. Search for functions and variables. Both interactive functions
  2744. (commands) and noninteractive functions can be found by this.
  2745. `M-x apropos-variable'
  2746. Search for user-customizable variables. With a prefix argument,
  2747. search for non-customizable variables too.
  2748. `M-x apropos-value'
  2749. Search for variables whose values match the specified pattern.
  2750. With a prefix argument, search also for functions with definitions
  2751. matching the pattern, and Lisp symbols with properties matching
  2752. the pattern.
  2753. `C-h d'
  2754. Search for functions and variables whose documentation strings
  2755. match the specified pattern (`apropos-documentation').
  2756. The simplest kind of apropos pattern is one word. Anything
  2757. containing that word matches the pattern. Thus, to find commands that
  2758. work on files, type `C-h a file <RET>'. This displays a list of all
  2759. command names that contain `file', including `copy-file', `find-file',
  2760. and so on. Each command name comes with a brief description and a list
  2761. of keys you can currently invoke it with. In our example, it would say
  2762. that you can invoke `find-file' by typing `C-x C-f'.
  2763. For more information about a function definition, variable or symbol
  2764. property listed in an apropos buffer, you can click on it with
  2765. `Mouse-1' or `Mouse-2', or move there and type <RET>.
  2766. When you specify more than one word in the apropos pattern, a name
  2767. must contain at least two of the words in order to match. Thus, if you
  2768. are looking for commands to kill a chunk of text before point, you
  2769. could try `C-h a kill back backward behind before <RET>'. The real
  2770. command name `kill-backward' will match that; if there were a command
  2771. `kill-text-before', it would also match, since it contains two of the
  2772. specified words.
  2773. For even greater flexibility, you can specify a regular expression
  2774. (*note Regexps::). An apropos pattern is interpreted as a regular
  2775. expression if it contains any of the regular expression special
  2776. characters, `^$*+?.\['.
  2777. Following the conventions for naming Emacs commands, here are some
  2778. words that you'll find useful in apropos patterns. By using them in
  2779. `C-h a', you will also get a feel for the naming conventions.
  2780. char, line, word, sentence, paragraph, region, page, sexp, list,
  2781. defun, rect, buffer, frame, window, face, file, dir, register,
  2782. mode, beginning, end, forward, backward, next, previous, up, down,
  2783. search, goto, kill, delete, mark, insert, yank, fill, indent,
  2784. case, change, set, what, list, find, view, describe, default.
  2785. If the variable `apropos-do-all' is non-`nil', the apropos commands
  2786. always behave as if they had been given a prefix argument.
  2787. By default, all apropos commands except `apropos-documentation' list
  2788. their results in alphabetical order. If the variable
  2789. `apropos-sort-by-scores' is non-`nil', these commands instead try to
  2790. guess the relevance of each result, and display the most relevant ones
  2791. first. The `apropos-documentation' command lists its results in order
  2792. of relevance by default; to list them in alphabetical order, change the
  2793. variable `apropos-documentation-sort-by-scores' to `nil'.
  2794. 
  2795. File: emacs, Node: Help Mode, Next: Package Keywords, Prev: Apropos, Up: Help
  2796. 10.5 Help Mode Commands
  2797. =======================
  2798. Help buffers provide the same commands as View mode (*note View
  2799. Mode::); for instance, <SPC> scrolls forward, and <DEL> scrolls
  2800. backward. A few special commands are also provided:
  2801. `<RET>'
  2802. Follow a cross reference at point (`help-follow').
  2803. `<TAB>'
  2804. Move point forward to the next hyperlink (`forward-button').
  2805. `S-<TAB>'
  2806. Move point back to the previous hyperlink (`backward-button').
  2807. `Mouse-1'
  2808. `Mouse-2'
  2809. Follow a hyperlink that you click on.
  2810. `C-c C-c'
  2811. Show all documentation about the symbol at point
  2812. (`help-follow-symbol').
  2813. `C-c C-b'
  2814. Go back to the previous help topic (`help-go-back').
  2815. When a function name, variable name, or face name (*note Faces::)
  2816. appears in the documentation in the help buffer, it is normally an
  2817. underlined "hyperlink". To view the associated documentation, move
  2818. point there and type <RET> (`help-follow'), or click on the hyperlink
  2819. with `Mouse-1' or `Mouse-2'. Doing so replaces the contents of the
  2820. help buffer; to retrace your steps, type `C-c C-b' (`help-go-back').
  2821. A help buffer can also contain hyperlinks to Info manuals, source
  2822. code definitions, and URLs (web pages). The first two are opened in
  2823. Emacs, and the third using a web browser via the `browse-url' command
  2824. (*note Browse-URL::).
  2825. In a help buffer, <TAB> (`forward-button') moves point forward to
  2826. the next hyperlink, while `S-<TAB>' (`backward-button') point back to
  2827. the previous hyperlink. These commands act cyclically; for instance,
  2828. typing <TAB> at the last hyperlink moves back to the first hyperlink.
  2829. To view all documentation about any symbol in the text, move point
  2830. to there and type `C-c C-c' (`help-follow-symbol'). This shows all
  2831. available documentation about the symbol--as a variable, function
  2832. and/or face.
  2833. 
  2834. File: emacs, Node: Package Keywords, Next: Language Help, Prev: Help Mode, Up: Help
  2835. 10.6 Keyword Search for Packages
  2836. ================================
  2837. Most optional features in Emacs are grouped into "packages". Emacs
  2838. contains several hundred built-in packages, and more can be installed
  2839. over the network (*note Packages::).
  2840. To make it easier to find packages related to a topic, most packages
  2841. are associated with one or more "keywords" based on what they do. Type
  2842. `C-h p' (`finder-by-keyword') to bring up a list of package keywords,
  2843. together with a description of what the keywords mean. To view a list
  2844. of packages for a given keyword, type <RET> on that line; this displays
  2845. the list of packages in a Package Menu buffer (*note Package Menu::).
  2846. `C-h P' (`describe-package') prompts for the name of a package, and
  2847. displays a help buffer describing the attributes of the package and the
  2848. features that it implements.
  2849. 
  2850. File: emacs, Node: Language Help, Next: Misc Help, Prev: Package Keywords, Up: Help
  2851. 10.7 Help for International Language Support
  2852. ============================================
  2853. For information on a specific language environment (*note Language
  2854. Environments::), type `C-h L' (`describe-language-environment'). This
  2855. displays a help buffer describing the languages supported by the
  2856. language environment, and listing the associated character sets, coding
  2857. systems, and input methods, as well as some sample text for that
  2858. language environment.
  2859. The command `C-h h' (`view-hello-file') displays the file
  2860. `etc/HELLO', which demonstrates various character sets by showing how
  2861. to say "hello" in many languages.
  2862. The command `C-h I' (`describe-input-method') describes an input
  2863. method--either a specified input method, or by default the input method
  2864. currently in use. *Note Input Methods::.
  2865. The command `C-h C' (`describe-coding-system') describes coding
  2866. systems--either a specified coding system, or the ones currently in
  2867. use. *Note Coding Systems::.
  2868. 
  2869. File: emacs, Node: Misc Help, Next: Help Files, Prev: Language Help, Up: Help
  2870. 10.8 Other Help Commands
  2871. ========================
  2872. `C-h i' (`info') runs the Info program, which browses structured
  2873. documentation files. The entire Emacs manual is available within Info,
  2874. along with many other manuals for the GNU system. Type `h' after
  2875. entering Info to run a tutorial on using Info.
  2876. With a numeric argument N, `C-h i' selects the Info buffer
  2877. `*info*<N>'. This is useful if you want to browse multiple Info
  2878. manuals simultaneously. If you specify just `C-u' as the prefix
  2879. argument, `C-h i' prompts for the name of a documentation file, so you
  2880. can browse a file which doesn't have an entry in the top-level Info
  2881. menu.
  2882. The help commands `C-h F FUNCTION <RET>' and `C-h K KEY', described
  2883. above, enter Info and go straight to the documentation of FUNCTION or
  2884. KEY.
  2885. When editing a program, if you have an Info version of the manual
  2886. for the programming language, you can use `C-h S'
  2887. (`info-lookup-symbol') to find an entry for a symbol (keyword, function
  2888. or variable) in the proper manual. The details of how this command
  2889. works depend on the major mode.
  2890. If something surprising happens, and you are not sure what you typed,
  2891. use `C-h l' (`view-lossage'). `C-h l' displays your last 300 input
  2892. keystrokes. If you see commands that you don't know, you can use `C-h
  2893. c' to find out what they do.
  2894. To review recent echo area messages, use `C-h e'
  2895. (`view-echo-area-messages'). This displays the buffer `*Messages*',
  2896. where those messages are kept.
  2897. Each Emacs major mode typically redefines a few keys and makes other
  2898. changes in how editing works. `C-h m' (`describe-mode') displays
  2899. documentation on the current major mode, which normally describes the
  2900. commands and features that are changed in this mode.
  2901. `C-h b' (`describe-bindings') and `C-h s' (`describe-syntax') show
  2902. other information about the current environment within Emacs. `C-h b'
  2903. displays a list of all the key bindings now in effect: first the local
  2904. bindings of the current minor modes, then the local bindings defined by
  2905. the current major mode, and finally the global bindings (*note Key
  2906. Bindings::). `C-h s' displays the contents of the syntax table, with
  2907. explanations of each character's syntax (*note Syntax Tables:
  2908. (elisp)Syntax Tables.).
  2909. You can get a list of subcommands for a particular prefix key by
  2910. typing `C-h' (`describe-prefix-bindings') after the prefix key. (There
  2911. are a few prefix keys for which this does not work--those that provide
  2912. their own bindings for `C-h'. One of these is <ESC>, because `<ESC>
  2913. C-h' is actually `C-M-h', which marks a defun.)
  2914. 
  2915. File: emacs, Node: Help Files, Next: Help Echo, Prev: Misc Help, Up: Help
  2916. 10.9 Help Files
  2917. ===============
  2918. Apart from the built-in documentation and manuals, Emacs contains
  2919. several other files describing topics like copying conditions, release
  2920. notes, instructions for debugging and reporting bugs, and so forth.
  2921. You can use the following commands to view these files. Apart from
  2922. `C-h g', they all have the form `C-h C-CHAR'.
  2923. `C-h C-c'
  2924. Display the rules under which you can copy and redistribute Emacs
  2925. (`describe-copying').
  2926. `C-h C-d'
  2927. Display help for debugging Emacs (`view-emacs-debugging').
  2928. `C-h C-e'
  2929. Display information about where to get external packages
  2930. (`view-external-packages').
  2931. `C-h C-f'
  2932. Display the Emacs frequently-answered-questions list
  2933. (`view-emacs-FAQ').
  2934. `C-h g'
  2935. Display information about the GNU Project (`describe-gnu-project').
  2936. `C-h C-m'
  2937. Display information about ordering printed copies of Emacs manuals
  2938. (`view-order-manuals').
  2939. `C-h C-n'
  2940. Display the "news" file, which lists the new features in this
  2941. version of Emacs (`view-emacs-news').
  2942. `C-h C-o'
  2943. Display how to order or download the latest version of Emacs and
  2944. other GNU software (`describe-distribution').
  2945. `C-h C-p'
  2946. Display the list of known Emacs problems, sometimes with suggested
  2947. workarounds (`view-emacs-problems').
  2948. `C-h C-t'
  2949. Display the Emacs to-do list (`view-emacs-todo').
  2950. `C-h C-w'
  2951. Display the full details on the complete absence of warranty for
  2952. GNU Emacs (`describe-no-warranty').
  2953. 
  2954. File: emacs, Node: Help Echo, Prev: Help Files, Up: Help
  2955. 10.10 Help on Active Text and Tooltips
  2956. ======================================
  2957. In Emacs, stretches of "active text" (text that does something special
  2958. in response to mouse clicks or <RET>) often have associated help text.
  2959. This includes hyperlinks in Emacs buffers, as well as parts of the mode
  2960. line. On graphical displays, as well as some text terminals which
  2961. support mouse tracking, moving the mouse over the active text displays
  2962. the help text as a "tooltip". *Note Tooltips::.
  2963. On terminals that don't support mouse-tracking, you can display the
  2964. help text for active buffer text at point by typing `C-h .'
  2965. (`display-local-help'). This shows the help text in the echo area. To
  2966. display help text automatically whenever it is available at point, set
  2967. the variable `help-at-pt-display-when-idle' to `t'.
  2968. 
  2969. File: emacs, Node: Mark, Next: Killing, Prev: Help, Up: Top
  2970. 11 The Mark and the Region
  2971. **************************
  2972. Many Emacs commands operate on an arbitrary contiguous part of the
  2973. current buffer. To specify the text for such a command to operate on,
  2974. you set "the mark" at one end of it, and move point to the other end.
  2975. The text between point and the mark is called "the region". The region
  2976. always extends between point and the mark, no matter which one comes
  2977. earlier in the text; each time you move point, the region changes.
  2978. Setting the mark at a position in the text also "activates" it.
  2979. When the mark is active, we say also that the region is active; Emacs
  2980. indicates its extent by highlighting the text within it, using the
  2981. `region' face (*note Face Customization::).
  2982. After certain non-motion commands, including any command that
  2983. changes the text in the buffer, Emacs automatically "deactivates" the
  2984. mark; this turns off the highlighting. You can also explicitly
  2985. deactivate the mark at any time, by typing `C-g' (*note Quitting::).
  2986. The above default behavior is known as Transient Mark mode.
  2987. Disabling Transient Mark mode switches Emacs to an alternative
  2988. behavior, in which the region is usually not highlighted. *Note
  2989. Disabled Transient Mark::.
  2990. Setting the mark in one buffer has no effect on the marks in other
  2991. buffers. When you return to a buffer with an active mark, the mark is
  2992. at the same place as before. When multiple windows show the same
  2993. buffer, they can have different values of point, and thus different
  2994. regions, but they all share one common mark position. *Note Windows::.
  2995. Ordinarily, only the selected window highlights its region; however, if
  2996. the variable `highlight-nonselected-windows' is non-`nil', each window
  2997. highlights its own region.
  2998. * Menu:
  2999. * Setting Mark:: Commands to set the mark.
  3000. * Marking Objects:: Commands to put region around textual units.
  3001. * Using Region:: Summary of ways to operate on contents of the region.
  3002. * Mark Ring:: Previous mark positions saved so you can go back there.
  3003. * Global Mark Ring:: Previous mark positions in various buffers.
  3004. * Shift Selection:: Using shifted cursor motion keys.
  3005. * Disabled Transient Mark:: Leaving regions unhighlighted by default.
  3006. 
  3007. File: emacs, Node: Setting Mark, Next: Marking Objects, Up: Mark
  3008. 11.1 Setting the Mark
  3009. =====================
  3010. Here are some commands for setting the mark:
  3011. `C-<SPC>'
  3012. Set the mark at point, and activate it (`set-mark-command').
  3013. `C-@'
  3014. The same.
  3015. `C-x C-x'
  3016. Set the mark at point, and activate it; then move point where the
  3017. mark used to be (`exchange-point-and-mark').
  3018. `Drag-Mouse-1'
  3019. Set point and the mark around the text you drag across.
  3020. `Mouse-3'
  3021. Set the mark at point, then move point to where you click
  3022. (`mouse-save-then-kill').
  3023. ``Shifted cursor motion keys''
  3024. Set the mark at point if the mark is inactive, then move point.
  3025. *Note Shift Selection::.
  3026. The most common way to set the mark is with `C-<SPC>'
  3027. (`set-mark-command')(1). This sets the mark where point is, and
  3028. activates it. You can then move point away, leaving the mark behind.
  3029. For example, suppose you wish to convert part of the buffer to upper
  3030. case. To accomplish this, go to one end of the desired text, type
  3031. `C-<SPC>', and move point until the desired portion of text is
  3032. highlighted. Now type `C-x C-u' (`upcase-region'). This converts the
  3033. text in the region to upper case, and then deactivates the mark.
  3034. Whenever the mark is active, you can deactivate it by typing `C-g'
  3035. (*note Quitting::). Most commands that operate on the region also
  3036. automatically deactivate the mark, like `C-x C-u' in the above example.
  3037. Instead of setting the mark in order to operate on a region, you can
  3038. also use it to "remember" a position in the buffer (by typing `C-<SPC>
  3039. C-<SPC>'), and later jump back there (by typing `C-u C-<SPC>'). *Note
  3040. Mark Ring::, for details.
  3041. The command `C-x C-x' (`exchange-point-and-mark') exchanges the
  3042. positions of point and the mark. `C-x C-x' is useful when you are
  3043. satisfied with the position of point but want to move the other end of
  3044. the region (where the mark is). Using `C-x C-x' a second time, if
  3045. necessary, puts the mark at the new position with point back at its
  3046. original position. Normally, if the mark is inactive, this command
  3047. first reactivates the mark wherever it was last set, to ensure that the
  3048. region is left highlighted. However, if you call it with a prefix
  3049. argument, it leaves the mark inactive and the region unhighlighted; you
  3050. can use this to jump to the mark in a manner similar to `C-u C-<SPC>'.
  3051. You can also set the mark with the mouse. If you press the left
  3052. mouse button (`down-mouse-1') and drag the mouse across a range of
  3053. text, this sets the mark where you first pressed the mouse button and
  3054. puts point where you release it. Alternatively, clicking the right
  3055. mouse button (`mouse-3') sets the mark at point and then moves point to
  3056. where you clicked. *Note Mouse Commands::, for a more detailed
  3057. description of these mouse commands.
  3058. Finally, you can set the mark by holding down the shift key while
  3059. typing certain cursor motion commands (such as `S-<right>', `S-C-f',
  3060. `S-C-n', etc.) This is called "shift-selection". It sets the mark at
  3061. point before moving point, but only if there is no active mark set via
  3062. shift-selection. The mark set by mouse commands and by shift-selection
  3063. behaves slightly differently from the usual mark: any subsequent
  3064. unshifted cursor motion command deactivates it automatically. For
  3065. details, *Note Shift Selection::.
  3066. Many commands that insert text, such as `C-y' (`yank'), set the mark
  3067. at the other end of the inserted text, without activating it. This
  3068. lets you easily return to that position (*note Mark Ring::). You can
  3069. tell that a command does this when it shows `Mark set' in the echo area.
  3070. Under X, every time the active region changes, Emacs saves the text
  3071. in the region to the "primary selection". This lets you insert that
  3072. text into other X applications with `mouse-2' clicks. *Note Primary
  3073. Selection::.
  3074. ---------- Footnotes ----------
  3075. (1) There is no `C-<SPC>' character in ASCII; usually, typing
  3076. `C-<SPC>' on a text terminal gives the character `C-@'. This key is
  3077. also bound to `set-mark-command', so unless you are unlucky enough to
  3078. have a text terminal that behaves differently, you might as well think
  3079. of `C-@' as `C-<SPC>'.
  3080. 
  3081. File: emacs, Node: Marking Objects, Next: Using Region, Prev: Setting Mark, Up: Mark
  3082. 11.2 Commands to Mark Textual Objects
  3083. =====================================
  3084. Here are commands for placing point and the mark around a textual
  3085. object such as a word, list, paragraph or page:
  3086. `M-@'
  3087. Set mark after end of next word (`mark-word'). This does not move
  3088. point.
  3089. `C-M-@'
  3090. Set mark after end of following balanced expression (`mark-sexp').
  3091. This does not move point.
  3092. `M-h'
  3093. Move point to the beginning of the current paragraph, and set mark
  3094. at the end (`mark-paragraph').
  3095. `C-M-h'
  3096. Move point to the beginning of the current defun, and set mark at
  3097. the end (`mark-defun').
  3098. `C-x C-p'
  3099. Move point to the beginning of the current page, and set mark at
  3100. the end (`mark-page').
  3101. `C-x h'
  3102. Move point to the beginning of the buffer, and set mark at the end
  3103. (`mark-whole-buffer').
  3104. `M-@' (`mark-word') sets the mark at the end of the next word (*note
  3105. Words::, for information about words). Repeated invocations of this
  3106. command extend the region by advancing the mark one word at a time. As
  3107. an exception, if the mark is active and located before point, `M-@'
  3108. moves the mark backwards from its current position one word at a time.
  3109. This command also accepts a numeric argument N, which tells it to
  3110. advance the mark by N words. A negative argument moves the mark back
  3111. by N words.
  3112. Similarly, `C-M-@' (`mark-sexp') puts the mark at the end of the
  3113. next balanced expression (*note Expressions::). Repeated invocations
  3114. extend the region to subsequent expressions, while positive or negative
  3115. numeric arguments move the mark forward or backward by the specified
  3116. number of expressions.
  3117. The other commands in the above list set both point and mark, so as
  3118. to delimit an object in the buffer. `M-h' (`mark-paragraph') marks
  3119. paragraphs (*note Paragraphs::), `C-M-h' (`mark-defun') marks top-level
  3120. definitions (*note Moving by Defuns::), and `C-x C-p' (`mark-page')
  3121. marks pages (*note Pages::). Repeated invocations again play the same
  3122. role, extending the region to consecutive objects; similarly, numeric
  3123. arguments specify how many objects to move the mark by.
  3124. `C-x h' (`mark-whole-buffer') sets up the entire buffer as the
  3125. region, by putting point at the beginning and the mark at the end.
  3126. 
  3127. File: emacs, Node: Using Region, Next: Mark Ring, Prev: Marking Objects, Up: Mark
  3128. 11.3 Operating on the Region
  3129. ============================
  3130. Once you have a region, here are some of the ways you can operate on it:
  3131. * Kill it with `C-w' (*note Killing::).
  3132. * Copy it to the kill ring with `M-w' (*note Yanking::).
  3133. * Convert case with `C-x C-l' or `C-x C-u' (*note Case::).
  3134. * Undo changes within it using `C-u C-/' (*note Undo::).
  3135. * Replace text within it using `M-%' (*note Query Replace::).
  3136. * Indent it with `C-x <TAB>' or `C-M-\' (*note Indentation::).
  3137. * Fill it as text with `M-x fill-region' (*note Filling::).
  3138. * Check the spelling of words within it with `M-$' (*note
  3139. Spelling::).
  3140. * Evaluate it as Lisp code with `M-x eval-region' (*note Lisp
  3141. Eval::).
  3142. * Save it in a register with `C-x r s' (*note Registers::).
  3143. * Save it in a buffer or a file (*note Accumulating Text::).
  3144. Some commands have a default behavior when the mark is inactive, but
  3145. operate on the region if the mark is active. For example, `M-$'
  3146. (`ispell-word') normally checks the spelling of the word at point, but
  3147. it checks the text in the region if the mark is active (*note
  3148. Spelling::). Normally, such commands use their default behavior if the
  3149. region is empty (i.e., if mark and point are at the same position). If
  3150. you want them to operate on the empty region, change the variable
  3151. `use-empty-active-region' to `t'.
  3152. As described in *note Erasing::, the <DEL> (`backward-delete-char')
  3153. and <delete> (`delete-forward-char') commands also act this way. If
  3154. the mark is active, they delete the text in the region. (As an
  3155. exception, if you supply a numeric argument N, where N is not one, these
  3156. commands delete N characters regardless of whether the mark is active).
  3157. If you change the variable `delete-active-region' to `nil', then these
  3158. commands don't act differently when the mark is active. If you change
  3159. the value to `kill', these commands "kill" the region instead of
  3160. deleting it (*note Killing::).
  3161. Other commands always operate on the region, and have no default
  3162. behavior. Such commands usually have the word `region' in their names,
  3163. like `C-w' (`kill-region') and `C-x C-u' (`upcase-region'). If the
  3164. mark is inactive, they operate on the "inactive region"--that is, on
  3165. the text between point and the position at which the mark was last set
  3166. (*note Mark Ring::). To disable this behavior, change the variable
  3167. `mark-even-if-inactive' to `nil'. Then these commands will instead
  3168. signal an error if the mark is inactive.
  3169. By default, text insertion occurs normally even if the mark is
  3170. active--for example, typing `a' inserts the character `a', then
  3171. deactivates the mark. If you enable Delete Selection mode, a minor
  3172. mode, then inserting text while the mark is active causes the text in
  3173. the region to be deleted first. To toggle Delete Selection mode on or
  3174. off, type `M-x delete-selection-mode'.
  3175. 
  3176. File: emacs, Node: Mark Ring, Next: Global Mark Ring, Prev: Using Region, Up: Mark
  3177. 11.4 The Mark Ring
  3178. ==================
  3179. Each buffer remembers previous locations of the mark, in the "mark
  3180. ring". Commands that set the mark also push the old mark onto this
  3181. ring. One of the uses of the mark ring is to remember spots that you
  3182. may want to go back to.
  3183. `C-<SPC> C-<SPC>'
  3184. Set the mark, pushing it onto the mark ring, without activating it.
  3185. `C-u C-<SPC>'
  3186. Move point to where the mark was, and restore the mark from the
  3187. ring of former marks.
  3188. The command `C-<SPC> C-<SPC>' is handy when you want to use the mark
  3189. to remember a position to which you may wish to return. It pushes the
  3190. current point onto the mark ring, without activating the mark (which
  3191. would cause Emacs to highlight the region). This is actually two
  3192. consecutive invocations of `C-<SPC>' (`set-mark-command'); the first
  3193. `C-<SPC>' sets the mark, and the second `C-<SPC>' deactivates it.
  3194. (When Transient Mark mode is off, `C-<SPC> C-<SPC>' instead activates
  3195. Transient Mark mode temporarily; *note Disabled Transient Mark::.)
  3196. To return to a marked position, use `set-mark-command' with a prefix
  3197. argument: `C-u C-<SPC>'. This moves point to where the mark was, and
  3198. deactivates the mark if it was active. Each subsequent `C-u C-<SPC>'
  3199. jumps to a prior position stored in the mark ring. The positions you
  3200. move through in this way are not lost; they go to the end of the ring.
  3201. If you set `set-mark-command-repeat-pop' to non-`nil', then
  3202. immediately after you type `C-u C-<SPC>', you can type `C-<SPC>'
  3203. instead of `C-u C-<SPC>' to cycle through the mark ring. By default,
  3204. `set-mark-command-repeat-pop' is `nil'.
  3205. Each buffer has its own mark ring. All editing commands use the
  3206. current buffer's mark ring. In particular, `C-u C-<SPC>' always stays
  3207. in the same buffer.
  3208. The variable `mark-ring-max' specifies the maximum number of entries
  3209. to keep in the mark ring. This defaults to 16 entries. If that many
  3210. entries exist and another one is pushed, the earliest one in the list
  3211. is discarded. Repeating `C-u C-<SPC>' cycles through the positions
  3212. currently in the ring.
  3213. If you want to move back to the same place over and over, the mark
  3214. ring may not be convenient enough. If so, you can record the position
  3215. in a register for later retrieval (*note Saving Positions in Registers:
  3216. Position Registers.).
  3217. 
  3218. File: emacs, Node: Global Mark Ring, Next: Shift Selection, Prev: Mark Ring, Up: Mark
  3219. 11.5 The Global Mark Ring
  3220. =========================
  3221. In addition to the ordinary mark ring that belongs to each buffer,
  3222. Emacs has a single "global mark ring". Each time you set a mark, this
  3223. is recorded in the global mark ring in addition to the current buffer's
  3224. own mark ring, if you have switched buffers since the previous mark
  3225. setting. Hence, the global mark ring records a sequence of buffers
  3226. that you have been in, and, for each buffer, a place where you set the
  3227. mark. The length of the global mark ring is controlled by
  3228. `global-mark-ring-max', and is 16 by default.
  3229. The command `C-x C-<SPC>' (`pop-global-mark') jumps to the buffer
  3230. and position of the latest entry in the global ring. It also rotates
  3231. the ring, so that successive uses of `C-x C-<SPC>' take you to earlier
  3232. buffers and mark positions.
  3233. 
  3234. File: emacs, Node: Shift Selection, Next: Disabled Transient Mark, Prev: Global Mark Ring, Up: Mark
  3235. 11.6 Shift Selection
  3236. ====================
  3237. If you hold down the shift key while typing a cursor motion command,
  3238. this sets the mark before moving point, so that the region extends from
  3239. the original position of point to its new position. This feature is
  3240. referred to as "shift-selection". It is similar to the way text is
  3241. selected in other editors.
  3242. The mark set via shift-selection behaves a little differently from
  3243. what we have described above. Firstly, in addition to the usual ways
  3244. of deactivating the mark (such as changing the buffer text or typing
  3245. `C-g'), the mark is deactivated by any _unshifted_ cursor motion
  3246. command. Secondly, any subsequent _shifted_ cursor motion command
  3247. avoids setting the mark anew. Therefore, a series of shifted cursor
  3248. motion commands will continuously adjust the region.
  3249. Shift-selection only works if the shifted cursor motion key is not
  3250. already bound to a separate command (*note Customization::). For
  3251. example, if you bind `S-C-f' to another command, typing `S-C-f' runs
  3252. that command instead of performing a shift-selected version of `C-f'
  3253. (`forward-char').
  3254. A mark set via mouse commands behaves the same as a mark set via
  3255. shift-selection (*note Setting Mark::). For example, if you specify a
  3256. region by dragging the mouse, you can continue to extend the region
  3257. using shifted cursor motion commands. In either case, any unshifted
  3258. cursor motion command deactivates the mark.
  3259. To turn off shift-selection, set `shift-select-mode' to `nil'.
  3260. Doing so does not disable setting the mark via mouse commands.
  3261. 
  3262. File: emacs, Node: Disabled Transient Mark, Prev: Shift Selection, Up: Mark
  3263. 11.7 Disabling Transient Mark Mode
  3264. ==================================
  3265. The default behavior of the mark and region, in which setting the mark
  3266. activates it and highlights the region, is called Transient Mark mode.
  3267. This is a minor mode that is enabled by default. It can be toggled
  3268. with `M-x transient-mark-mode', or with the `Active Region
  3269. Highlighting' menu item in the `Options' menu. Turning it off switches
  3270. Emacs to an alternative mode of operation:
  3271. * Setting the mark, with commands like `C-<SPC>' or `C-x C-x', does
  3272. not highlight the region. Therefore, you can't tell by looking
  3273. where the mark is located; you have to remember.
  3274. The usual solution to this problem is to set the mark and then use
  3275. it soon, before you forget where it is. You can also check where
  3276. the mark is by using `C-x C-x', which exchanges the positions of
  3277. the point and the mark (*note Setting Mark::).
  3278. * Many commands that move point long distances, like `M-<' and
  3279. `C-s', first set the mark where point was.
  3280. * Some commands, which ordinarily act on the region when the mark is
  3281. active, no longer do so. For example, normally `M-%'
  3282. (`query-replace') performs replacements within the region, if the
  3283. mark is active. When Transient Mark mode is off, it always
  3284. operates from point to the end of the buffer. Commands that act
  3285. this way are identified in their own documentation.
  3286. While Transient Mark mode is off, you can activate it temporarily
  3287. using `C-<SPC> C-<SPC>' or `C-u C-x C-x'.
  3288. `C-<SPC> C-<SPC>'
  3289. Set the mark at point (like plain `C-<SPC>') and enable Transient
  3290. Mark mode just once, until the mark is deactivated. (This is not
  3291. really a separate command; you are using the `C-<SPC>' command
  3292. twice.)
  3293. `C-u C-x C-x'
  3294. Activate the mark and enable Transient Mark mode temporarily, until
  3295. the mark is next deactivated. (This is the `C-x C-x' command,
  3296. `exchange-point-and-mark', with a prefix argument.)
  3297. These commands set or activate the mark, and enable Transient Mark
  3298. mode only until the mark is deactivated. One reason you may want to
  3299. use them is that some commands operate on the entire buffer instead of
  3300. the region when Transient Mark mode is off. Enabling Transient Mark
  3301. mode momentarily gives you a way to use these commands on the region.
  3302. When you specify a region with the mouse (*note Setting Mark::), or
  3303. with shift-selection (*note Shift Selection::), this likewise activates
  3304. Transient Mark mode temporarily and highlights the region.
  3305. 
  3306. File: emacs, Node: Killing, Next: Registers, Prev: Mark, Up: Top
  3307. 12 Killing and Moving Text
  3308. **************************
  3309. In Emacs, "killing" means erasing text and copying it into the "kill
  3310. ring". "Yanking" means bringing text from the kill ring back into the
  3311. buffer. (Some applications use the terms "cutting" and "pasting" for
  3312. similar operations.) The kill ring is so-named because it can be
  3313. visualized as a set of blocks of text arranged in a ring, which you can
  3314. access in cyclic order. *Note Kill Ring::.
  3315. Killing and yanking are the most common way to move or copy text
  3316. within Emacs. It is very versatile, because there are commands for
  3317. killing many different types of syntactic units.
  3318. * Menu:
  3319. * Deletion and Killing:: Commands that remove text.
  3320. * Yanking:: Commands that insert text.
  3321. * Cut and Paste:: Clipboard and selections on graphical displays.
  3322. * Accumulating Text:: Other methods to add text to the buffer.
  3323. * Rectangles:: Operating on text in rectangular areas.
  3324. * CUA Bindings:: Using C-x/C-c/C-v to kill and yank.
  3325. 
  3326. File: emacs, Node: Deletion and Killing, Next: Yanking, Up: Killing
  3327. 12.1 Deletion and Killing
  3328. =========================
  3329. Most commands which erase text from the buffer save it in the kill
  3330. ring. These are known as "kill" commands, and their names normally
  3331. contain the word `kill' (e.g. `kill-line'). The kill ring stores
  3332. several recent kills, not just the last one, so killing is a very safe
  3333. operation: you don't have to worry much about losing text that you
  3334. previously killed. The kill ring is shared by all buffers, so text
  3335. that is killed in one buffer can be yanked into another buffer.
  3336. When you use `C-/' (`undo') to undo a kill command (*note Undo::),
  3337. that brings the killed text back into the buffer, but does not remove
  3338. it from the kill ring.
  3339. On graphical displays, killing text also copies it to the system
  3340. clipboard. *Note Cut and Paste::.
  3341. Commands that erase text but do not save it in the kill ring are
  3342. known as "delete" commands; their names usually contain the word
  3343. `delete'. These include `C-d' (`delete-char') and <DEL>
  3344. (`delete-backward-char'), which delete only one character at a time,
  3345. and those commands that delete only spaces or newlines. Commands that
  3346. can erase significant amounts of nontrivial data generally do a kill
  3347. operation instead.
  3348. You can also use the mouse to kill and yank. *Note Cut and Paste::.
  3349. * Menu:
  3350. * Deletion:: Commands for deleting small amounts of text and
  3351. blank areas.
  3352. * Killing by Lines:: How to kill entire lines of text at one time.
  3353. * Other Kill Commands:: Commands to kill large regions of text and
  3354. syntactic units such as words and sentences.
  3355. * Kill Options:: Options that affect killing.
  3356. 
  3357. File: emacs, Node: Deletion, Next: Killing by Lines, Up: Deletion and Killing
  3358. 12.1.1 Deletion
  3359. ---------------
  3360. Deletion means erasing text and not saving it in the kill ring. For
  3361. the most part, the Emacs commands that delete text are those that erase
  3362. just one character or only whitespace.
  3363. `<DEL>'
  3364. `<Backspace>'
  3365. Delete the previous character, or the text in the region if it is
  3366. active (`delete-backward-char').
  3367. `<Delete>'
  3368. Delete the next character, or the text in the region if it is
  3369. active (`delete-forward-char').
  3370. `C-d'
  3371. Delete the next character (`delete-char').
  3372. `M-\'
  3373. Delete spaces and tabs around point (`delete-horizontal-space').
  3374. `M-<SPC>'
  3375. Delete spaces and tabs around point, leaving one space
  3376. (`just-one-space').
  3377. `C-x C-o'
  3378. Delete blank lines around the current line (`delete-blank-lines').
  3379. `M-^'
  3380. Join two lines by deleting the intervening newline, along with any
  3381. indentation following it (`delete-indentation').
  3382. We have already described the basic deletion commands <DEL>
  3383. (`delete-backward-char'), <delete> (`delete-forward-char'), and `C-d'
  3384. (`delete-char'). *Note Erasing::. With a numeric argument, they
  3385. delete the specified number of characters. If the numeric argument is
  3386. omitted or one, they delete all the text in the region if it is active
  3387. (*note Using Region::).
  3388. The other delete commands are those that delete only whitespace
  3389. characters: spaces, tabs and newlines. `M-\'
  3390. (`delete-horizontal-space') deletes all the spaces and tab characters
  3391. before and after point. With a prefix argument, this only deletes
  3392. spaces and tab characters before point. `M-<SPC>' (`just-one-space')
  3393. does likewise but leaves a single space before point, regardless of the
  3394. number of spaces that existed previously (even if there were none
  3395. before). With a numeric argument N, it leaves N spaces before point if
  3396. N is positive; if N is negative, it deletes newlines in addition to
  3397. spaces and tabs, leaving a single space before point.
  3398. `C-x C-o' (`delete-blank-lines') deletes all blank lines after the
  3399. current line. If the current line is blank, it deletes all blank lines
  3400. preceding the current line as well (leaving one blank line, the current
  3401. line). On a solitary blank line, it deletes that line.
  3402. `M-^' (`delete-indentation') joins the current line and the previous
  3403. line, by deleting a newline and all surrounding spaces, usually leaving
  3404. a single space. *Note M-^: Indentation.
  3405. 
  3406. File: emacs, Node: Killing by Lines, Next: Other Kill Commands, Prev: Deletion, Up: Deletion and Killing
  3407. 12.1.2 Killing by Lines
  3408. -----------------------
  3409. `C-k'
  3410. Kill rest of line or one or more lines (`kill-line').
  3411. `C-S-backspace'
  3412. Kill an entire line at once (`kill-whole-line')
  3413. The simplest kill command is `C-k' (`kill-line'). If used at the
  3414. end of a line, it kills the line-ending newline character, merging the
  3415. next line into the current one (thus, a blank line is entirely
  3416. removed). Otherwise, `C-k' kills all the text from point up to the end
  3417. of the line; if point was originally at the beginning of the line, this
  3418. leaves the line blank.
  3419. Spaces and tabs at the end of the line are ignored when deciding
  3420. which case applies. As long as point is after the last visible
  3421. character in the line, you can be sure that `C-k' will kill the
  3422. newline. To kill an entire non-blank line, go to the beginning and
  3423. type `C-k' twice.
  3424. In this context, "line" means a logical text line, not a screen line
  3425. (*note Continuation Lines::).
  3426. When `C-k' is given a positive argument N, it kills N lines and the
  3427. newlines that follow them (text on the current line before point is not
  3428. killed). With a negative argument -N, it kills N lines preceding the
  3429. current line, together with the text on the current line before point.
  3430. `C-k' with an argument of zero kills the text before point on the
  3431. current line.
  3432. If the variable `kill-whole-line' is non-`nil', `C-k' at the very
  3433. beginning of a line kills the entire line including the following
  3434. newline. This variable is normally `nil'.
  3435. `C-S-backspace' (`kill-whole-line') kills a whole line including its
  3436. newline, regardless of the position of point within the line. Note
  3437. that many text terminals will prevent you from typing the key sequence
  3438. `C-S-backspace'.
  3439. 
  3440. File: emacs, Node: Other Kill Commands, Next: Kill Options, Prev: Killing by Lines, Up: Deletion and Killing
  3441. 12.1.3 Other Kill Commands
  3442. --------------------------
  3443. `C-w'
  3444. Kill the region (`kill-region').
  3445. `M-w'
  3446. Copy the region into the kill ring (`kill-ring-save').
  3447. `M-d'
  3448. Kill the next word (`kill-word'). *Note Words::.
  3449. `M-<DEL>'
  3450. Kill one word backwards (`backward-kill-word').
  3451. `C-x <DEL>'
  3452. Kill back to beginning of sentence (`backward-kill-sentence').
  3453. *Note Sentences::.
  3454. `M-k'
  3455. Kill to the end of the sentence (`kill-sentence').
  3456. `C-M-k'
  3457. Kill the following balanced expression (`kill-sexp'). *Note
  3458. Expressions::.
  3459. `M-z CHAR'
  3460. Kill through the next occurrence of CHAR (`zap-to-char').
  3461. One of the commonly-used kill commands is `C-w' (`kill-region'),
  3462. which kills the text in the region (*note Mark::). Similarly, `M-w'
  3463. (`kill-ring-save') copies the text in the region into the kill ring
  3464. without removing it from the buffer. If the mark is inactive when you
  3465. type `C-w' or `M-w', the command acts on the text between point and
  3466. where you last set the mark (*note Using Region::).
  3467. Emacs also provides commands to kill specific syntactic units:
  3468. words, with `M-<DEL>' and `M-d' (*note Words::); balanced expressions,
  3469. with `C-M-k' (*note Expressions::); and sentences, with `C-x <DEL>' and
  3470. `M-k' (*note Sentences::).
  3471. The command `M-z' (`zap-to-char') combines killing with searching:
  3472. it reads a character and kills from point up to (and including) the
  3473. next occurrence of that character in the buffer. A numeric argument
  3474. acts as a repeat count; a negative argument means to search backward
  3475. and kill text before point.
  3476. 
  3477. File: emacs, Node: Kill Options, Prev: Other Kill Commands, Up: Deletion and Killing
  3478. 12.1.4 Options for Killing
  3479. --------------------------
  3480. Some specialized buffers contain "read-only text", which cannot be
  3481. modified and therefore cannot be killed. The kill commands work
  3482. specially in a read-only buffer: they move over text and copy it to the
  3483. kill ring, without actually deleting it from the buffer. Normally,
  3484. they also beep and display an error message when this happens. But if
  3485. you set the variable `kill-read-only-ok' to a non-`nil' value, they
  3486. just print a message in the echo area to explain why the text has not
  3487. been erased.
  3488. If you change the variable `kill-do-not-save-duplicates' to a
  3489. non-`nil' value, identical subsequent kills yield a single kill-ring
  3490. entry, without duplication.
  3491. 
  3492. File: emacs, Node: Yanking, Next: Cut and Paste, Prev: Deletion and Killing, Up: Killing
  3493. 12.2 Yanking
  3494. ============
  3495. "Yanking" means reinserting text previously killed. The usual way to
  3496. move or copy text is to kill it and then yank it elsewhere.
  3497. `C-y'
  3498. Yank the last kill into the buffer, at point (`yank').
  3499. `M-y'
  3500. Replace the text just yanked with an earlier batch of killed text
  3501. (`yank-pop'). *Note Earlier Kills::.
  3502. `C-M-w'
  3503. Cause the following command, if it is a kill command, to append to
  3504. the previous kill (`append-next-kill'). *Note Appending Kills::.
  3505. The basic yanking command is `C-y' (`yank'). It inserts the most
  3506. recent kill, leaving the cursor at the end of the inserted text. It
  3507. also sets the mark at the beginning of the inserted text, without
  3508. activating the mark; this lets you jump easily to that position, if you
  3509. wish, with `C-u C-<SPC>' (*note Mark Ring::).
  3510. With a plain prefix argument (`C-u C-y'), the command instead leaves
  3511. the cursor in front of the inserted text, and sets the mark at the end.
  3512. Using any other prefix argument specifies an earlier kill; e.g. `C-u 4
  3513. C-y' reinserts the fourth most recent kill. *Note Earlier Kills::.
  3514. On graphical displays, `C-y' first checks if another application has
  3515. placed any text in the system clipboard more recently than the last
  3516. Emacs kill. If so, it inserts the text in the clipboard instead.
  3517. Thus, Emacs effectively treats "cut" or "copy" clipboard operations
  3518. performed in other applications like Emacs kills, except that they are
  3519. not recorded in the kill ring. *Note Cut and Paste::, for details.
  3520. * Menu:
  3521. * Kill Ring:: Where killed text is stored.
  3522. * Earlier Kills:: Yanking something killed some time ago.
  3523. * Appending Kills:: Several kills in a row all yank together.
  3524. 
  3525. File: emacs, Node: Kill Ring, Next: Earlier Kills, Up: Yanking
  3526. 12.2.1 The Kill Ring
  3527. --------------------
  3528. The "kill ring" is a list of blocks of text that were previously
  3529. killed. There is only one kill ring, shared by all buffers, so you can
  3530. kill text in one buffer and yank it in another buffer. This is the
  3531. usual way to move text from one buffer to another. (There are several
  3532. other methods: for instance, you could store the text in a register;
  3533. see *note Registers::. *Note Accumulating Text::, for some other ways
  3534. to move text around.)
  3535. The maximum number of entries in the kill ring is controlled by the
  3536. variable `kill-ring-max'. The default is 60. If you make a new kill
  3537. when this limit has been reached, Emacs makes room by deleting the
  3538. oldest entry in the kill ring.
  3539. The actual contents of the kill ring are stored in a variable named
  3540. `kill-ring'; you can view the entire contents of the kill ring with
  3541. `C-h v kill-ring'.
  3542. 
  3543. File: emacs, Node: Earlier Kills, Next: Appending Kills, Prev: Kill Ring, Up: Yanking
  3544. 12.2.2 Yanking Earlier Kills
  3545. ----------------------------
  3546. As explained in *note Yanking::, you can use a numeric argument to
  3547. `C-y' to yank text that is no longer the most recent kill. This is
  3548. useful if you remember which kill ring entry you want. If you don't,
  3549. you can use the `M-y' (`yank-pop') command to cycle through the
  3550. possibilities.
  3551. If the previous command was a yank command, `M-y' takes the text
  3552. that was yanked and replaces it with the text from an earlier kill.
  3553. So, to recover the text of the next-to-the-last kill, first use `C-y'
  3554. to yank the last kill, and then use `M-y' to replace it with the
  3555. previous kill. `M-y' is allowed only after a `C-y' or another `M-y'.
  3556. You can understand `M-y' in terms of a "last yank" pointer which
  3557. points at an entry in the kill ring. Each time you kill, the "last
  3558. yank" pointer moves to the newly made entry at the front of the ring.
  3559. `C-y' yanks the entry which the "last yank" pointer points to. `M-y'
  3560. moves the "last yank" pointer to a different entry, and the text in the
  3561. buffer changes to match. Enough `M-y' commands can move the pointer to
  3562. any entry in the ring, so you can get any entry into the buffer.
  3563. Eventually the pointer reaches the end of the ring; the next `M-y'
  3564. loops back around to the first entry again.
  3565. `M-y' moves the "last yank" pointer around the ring, but it does not
  3566. change the order of the entries in the ring, which always runs from the
  3567. most recent kill at the front to the oldest one still remembered.
  3568. `M-y' can take a numeric argument, which tells it how many entries
  3569. to advance the "last yank" pointer by. A negative argument moves the
  3570. pointer toward the front of the ring; from the front of the ring, it
  3571. moves "around" to the last entry and continues forward from there.
  3572. Once the text you are looking for is brought into the buffer, you can
  3573. stop doing `M-y' commands and it will stay there. It's just a copy of
  3574. the kill ring entry, so editing it in the buffer does not change what's
  3575. in the ring. As long as no new killing is done, the "last yank"
  3576. pointer remains at the same place in the kill ring, so repeating `C-y'
  3577. will yank another copy of the same previous kill.
  3578. When you call `C-y' with a numeric argument, that also sets the
  3579. "last yank" pointer to the entry that it yanks.
  3580. 
  3581. File: emacs, Node: Appending Kills, Prev: Earlier Kills, Up: Yanking
  3582. 12.2.3 Appending Kills
  3583. ----------------------
  3584. Normally, each kill command pushes a new entry onto the kill ring.
  3585. However, two or more kill commands in a row combine their text into a
  3586. single entry, so that a single `C-y' yanks all the text as a unit, just
  3587. as it was before it was killed.
  3588. Thus, if you want to yank text as a unit, you need not kill all of it
  3589. with one command; you can keep killing line after line, or word after
  3590. word, until you have killed it all, and you can still get it all back at
  3591. once.
  3592. Commands that kill forward from point add onto the end of the
  3593. previous killed text. Commands that kill backward from point add text
  3594. onto the beginning. This way, any sequence of mixed forward and
  3595. backward kill commands puts all the killed text into one entry without
  3596. rearrangement. Numeric arguments do not break the sequence of
  3597. appending kills. For example, suppose the buffer contains this text:
  3598. This is a line -!-of sample text.
  3599. with point shown by -!-. If you type `M-d M-<DEL> M-d M-<DEL>',
  3600. killing alternately forward and backward, you end up with `a line of
  3601. sample' as one entry in the kill ring, and `This is text.' in the
  3602. buffer. (Note the double space between `is' and `text', which you can
  3603. clean up with `M-<SPC>' or `M-q'.)
  3604. Another way to kill the same text is to move back two words with
  3605. `M-b M-b', then kill all four words forward with `C-u M-d'. This
  3606. produces exactly the same results in the buffer and in the kill ring.
  3607. `M-f M-f C-u M-<DEL>' kills the same text, all going backward; once
  3608. again, the result is the same. The text in the kill ring entry always
  3609. has the same order that it had in the buffer before you killed it.
  3610. If a kill command is separated from the last kill command by other
  3611. commands (not just numeric arguments), it starts a new entry on the kill
  3612. ring. But you can force it to append by first typing the command
  3613. `C-M-w' (`append-next-kill') right before it. The `C-M-w' tells the
  3614. following command, if it is a kill command, to append the text it kills
  3615. to the last killed text, instead of starting a new entry. With
  3616. `C-M-w', you can kill several separated pieces of text and accumulate
  3617. them to be yanked back in one place.
  3618. A kill command following `M-w' (`kill-ring-save') does not append to
  3619. the text that `M-w' copied into the kill ring.
  3620. 
  3621. File: emacs, Node: Cut and Paste, Next: Accumulating Text, Prev: Yanking, Up: Killing
  3622. 12.3 "Cut and Paste" Operations on Graphical Displays
  3623. =====================================================
  3624. In most graphical desktop environments, you can transfer data (usually
  3625. text) between different applications using a system facility called the
  3626. "clipboard". On X, two other similar facilities are available: the
  3627. primary selection and the secondary selection. When Emacs is run on a
  3628. graphical display, its kill and yank commands integrate with these
  3629. facilities, so that you can easily transfer text between Emacs and
  3630. other graphical applications.
  3631. By default, Emacs uses UTF-8 as the coding system for inter-program
  3632. text transfers. If you find that the pasted text is not what you
  3633. expected, you can specify another coding system by typing `C-x <RET> x'
  3634. or `C-x <RET> X'. You can also request a different data type by
  3635. customizing `x-select-request-type'. *Note Communication Coding::.
  3636. * Menu:
  3637. * Clipboard:: How Emacs uses the system clipboard.
  3638. * Primary Selection:: The temporarily selected text selection.
  3639. * Secondary Selection:: Cutting without altering point and mark.
  3640. 
  3641. File: emacs, Node: Clipboard, Next: Primary Selection, Up: Cut and Paste
  3642. 12.3.1 Using the Clipboard
  3643. --------------------------
  3644. The "clipboard" is the facility that most graphical applications use
  3645. for "cutting and pasting". When the clipboard exists, the kill and
  3646. yank commands in Emacs make use of it.
  3647. When you kill some text with a command such as `C-w'
  3648. (`kill-region'), or copy it to the kill ring with a command such as
  3649. `M-w' (`kill-ring-save'), that text is also put in the clipboard.
  3650. When an Emacs kill command puts text in the clipboard, the existing
  3651. clipboard contents are normally lost. Optionally, you can change
  3652. `save-interprogram-paste-before-kill' to `t'. Then Emacs will first
  3653. save the clipboard to its kill ring, preventing you from losing the old
  3654. clipboard data--at the risk of high memory consumption if that data
  3655. turns out to be large.
  3656. Yank commands, such as `C-y' (`yank'), also use the clipboard. If
  3657. another application "owns" the clipboard--i.e., if you cut or copied
  3658. text there more recently than your last kill command in Emacs--then
  3659. Emacs yanks from the clipboard instead of the kill ring.
  3660. Normally, rotating the kill ring with `M-y' (`yank-pop') does not
  3661. alter the clipboard. However, if you change
  3662. `yank-pop-change-selection' to `t', then `M-y' saves the new yank to
  3663. the clipboard.
  3664. To prevent kill and yank commands from accessing the clipboard,
  3665. change the variable `x-select-enable-clipboard' to `nil'.
  3666. Many X desktop environments support a feature called the "clipboard
  3667. manager". If you exit Emacs while it is the current "owner" of the
  3668. clipboard data, and there is a clipboard manager running, Emacs
  3669. transfers the clipboard data to the clipboard manager so that it is not
  3670. lost. In some circumstances, this may cause a delay when exiting
  3671. Emacs; if you wish to prevent Emacs from transferring data to the
  3672. clipboard manager, change the variable
  3673. `x-select-enable-clipboard-manager' to `nil'.
  3674. Prior to Emacs 24, the kill and yank commands used the primary
  3675. selection (*note Primary Selection::), not the clipboard. If you
  3676. prefer this behavior, change `x-select-enable-clipboard' to `nil',
  3677. `x-select-enable-primary' to `t', and `mouse-drag-copy-region' to `t'.
  3678. In this case, you can use the following commands to act explicitly on
  3679. the clipboard: `clipboard-kill-region' kills the region and saves it to
  3680. the clipboard; `clipboard-kill-ring-save' copies the region to the kill
  3681. ring and saves it to the clipboard; and `clipboard-yank' yanks the
  3682. contents of the clipboard at point.
  3683. 
  3684. File: emacs, Node: Primary Selection, Next: Secondary Selection, Prev: Clipboard, Up: Cut and Paste
  3685. 12.3.2 Cut and Paste with Other Window Applications
  3686. ---------------------------------------------------
  3687. Under the X Window System, there exists a "primary selection"
  3688. containing the last stretch of text selected in an X application
  3689. (usually by dragging the mouse). Typically, this text can be inserted
  3690. into other X applications by `mouse-2' clicks. The primary selection
  3691. is separate from the clipboard. Its contents are more "fragile"; they
  3692. are overwritten each time you select text with the mouse, whereas the
  3693. clipboard is only overwritten by explicit "cut" or "copy" commands.
  3694. Under X, whenever the region is active (*note Mark::), the text in
  3695. the region is saved in the primary selection. This applies regardless
  3696. of whether the region was made by dragging or clicking the mouse (*note
  3697. Mouse Commands::), or by keyboard commands (e.g. by typing `C-<SPC>'
  3698. and moving point; *note Setting Mark::).
  3699. If you change the variable `select-active-regions' to `only', Emacs
  3700. saves only temporarily active regions to the primary selection, i.e.
  3701. those made with the mouse or with shift selection (*note Shift
  3702. Selection::). If you change `select-active-regions' to `nil', Emacs
  3703. avoids saving active regions to the primary selection entirely.
  3704. To insert the primary selection into an Emacs buffer, click
  3705. `mouse-2' (`mouse-yank-primary') where you want to insert it. *Note
  3706. Mouse Commands::.
  3707. MS-Windows provides no primary selection, but Emacs emulates it
  3708. within a single Emacs session by storing the selected text internally.
  3709. Therefore, all the features and commands related to the primary
  3710. selection work on Windows as they do on X, for cutting and pasting
  3711. within the same session, but not across Emacs sessions or with other
  3712. applications.
  3713. 
  3714. File: emacs, Node: Secondary Selection, Prev: Primary Selection, Up: Cut and Paste
  3715. 12.3.3 Secondary Selection
  3716. --------------------------
  3717. In addition to the primary selection, the X Window System provides a
  3718. second similar facility known as the "secondary selection". Nowadays,
  3719. few X applications make use of the secondary selection, but you can
  3720. access it using the following Emacs commands:
  3721. `M-Drag-Mouse-1'
  3722. Set the secondary selection, with one end at the place where you
  3723. press down the button, and the other end at the place where you
  3724. release it (`mouse-set-secondary'). The selected text is
  3725. highlighted, using the `secondary-selection' face, as you drag.
  3726. The window scrolls automatically if you drag the mouse off the top
  3727. or bottom of the window, just like `mouse-set-region' (*note Mouse
  3728. Commands::).
  3729. This command does not alter the kill ring.
  3730. `M-Mouse-1'
  3731. Set one endpoint for the "secondary selection"
  3732. (`mouse-start-secondary').
  3733. `M-Mouse-3'
  3734. Set the secondary selection, with one end at the position clicked
  3735. and the other at the position specified with `M-Mouse-1'
  3736. (`mouse-secondary-save-then-kill'). This also puts the selected
  3737. text in the kill ring. A second `M-Mouse-3' at the same place
  3738. kills the secondary selection just made.
  3739. `M-Mouse-2'
  3740. Insert the secondary selection where you click, placing point at
  3741. the end of the yanked text (`mouse-yank-secondary').
  3742. Double or triple clicking of `M-Mouse-1' operates on words and
  3743. lines, much like `Mouse-1'.
  3744. If `mouse-yank-at-point' is non-`nil', `M-Mouse-2' yanks at point.
  3745. Then it does not matter precisely where you click, or even which of the
  3746. frame's windows you click on. *Note Mouse Commands::.
  3747. 
  3748. File: emacs, Node: Accumulating Text, Next: Rectangles, Prev: Cut and Paste, Up: Killing
  3749. 12.4 Accumulating Text
  3750. ======================
  3751. Usually we copy or move text by killing it and yanking it, but there
  3752. are other convenient methods for copying one block of text in many
  3753. places, or for copying many scattered blocks of text into one place.
  3754. Here we describe the commands to accumulate scattered pieces of text
  3755. into a buffer or into a file.
  3756. `M-x append-to-buffer'
  3757. Append region to the contents of a specified buffer.
  3758. `M-x prepend-to-buffer'
  3759. Prepend region to the contents of a specified buffer.
  3760. `M-x copy-to-buffer'
  3761. Copy region into a specified buffer, deleting that buffer's old
  3762. contents.
  3763. `M-x insert-buffer'
  3764. Insert the contents of a specified buffer into current buffer at
  3765. point.
  3766. `M-x append-to-file'
  3767. Append region to the contents of a specified file, at the end.
  3768. To accumulate text into a buffer, use `M-x append-to-buffer'. This
  3769. reads a buffer name, then inserts a copy of the region into the buffer
  3770. specified. If you specify a nonexistent buffer, `append-to-buffer'
  3771. creates the buffer. The text is inserted wherever point is in that
  3772. buffer. If you have been using the buffer for editing, the copied text
  3773. goes into the middle of the text of the buffer, starting from wherever
  3774. point happens to be at that moment.
  3775. Point in that buffer is left at the end of the copied text, so
  3776. successive uses of `append-to-buffer' accumulate the text in the
  3777. specified buffer in the same order as they were copied. Strictly
  3778. speaking, `append-to-buffer' does not always append to the text already
  3779. in the buffer--it appends only if point in that buffer is at the end.
  3780. However, if `append-to-buffer' is the only command you use to alter a
  3781. buffer, then point is always at the end.
  3782. `M-x prepend-to-buffer' is just like `append-to-buffer' except that
  3783. point in the other buffer is left before the copied text, so successive
  3784. prependings add text in reverse order. `M-x copy-to-buffer' is
  3785. similar, except that any existing text in the other buffer is deleted,
  3786. so the buffer is left containing just the text newly copied into it.
  3787. The command `M-x insert-buffer' can be used to retrieve the
  3788. accumulated text from another buffer. This prompts for the name of a
  3789. buffer, and inserts a copy of all the text in that buffer into the
  3790. current buffer at point, leaving point at the beginning of the inserted
  3791. text. It also adds the position of the end of the inserted text to the
  3792. mark ring, without activating the mark. *Note Buffers::, for
  3793. background information on buffers.
  3794. Instead of accumulating text in a buffer, you can append text
  3795. directly into a file with `M-x append-to-file'. This prompts for a
  3796. filename, and adds the text of the region to the end of the specified
  3797. file. The file is changed immediately on disk.
  3798. You should use `append-to-file' only with files that are _not_ being
  3799. visited in Emacs. Using it on a file that you are editing in Emacs
  3800. would change the file behind Emacs's back, which can lead to losing
  3801. some of your editing.
  3802. Another way to move text around is to store it in a register. *Note
  3803. Registers::.
  3804. 
  3805. File: emacs, Node: Rectangles, Next: CUA Bindings, Prev: Accumulating Text, Up: Killing
  3806. 12.5 Rectangles
  3807. ===============
  3808. "Rectangle" commands operate on rectangular areas of the text: all the
  3809. characters between a certain pair of columns, in a certain range of
  3810. lines. Emacs has commands to kill rectangles, yank killed rectangles,
  3811. clear them out, fill them with blanks or text, or delete them.
  3812. Rectangle commands are useful with text in multicolumn formats, and for
  3813. changing text into or out of such formats.
  3814. To specify a rectangle for a command to work on, set the mark at one
  3815. corner and point at the opposite corner. The rectangle thus specified
  3816. is called the "region-rectangle". If point and the mark are in the
  3817. same column, the region-rectangle is empty. If they are in the same
  3818. line, the region-rectangle is one line high.
  3819. The region-rectangle is controlled in much the same way as the
  3820. region is controlled. But remember that a given combination of point
  3821. and mark values can be interpreted either as a region or as a
  3822. rectangle, depending on the command that uses them.
  3823. `C-x r k'
  3824. Kill the text of the region-rectangle, saving its contents as the
  3825. "last killed rectangle" (`kill-rectangle').
  3826. `C-x r d'
  3827. Delete the text of the region-rectangle (`delete-rectangle').
  3828. `C-x r y'
  3829. Yank the last killed rectangle with its upper left corner at point
  3830. (`yank-rectangle').
  3831. `C-x r o'
  3832. Insert blank space to fill the space of the region-rectangle
  3833. (`open-rectangle'). This pushes the previous contents of the
  3834. region-rectangle to the right.
  3835. `C-x r N'
  3836. Insert line numbers along the left edge of the region-rectangle
  3837. (`rectangle-number-lines'). This pushes the previous contents of
  3838. the region-rectangle to the right.
  3839. `C-x r c'
  3840. Clear the region-rectangle by replacing all of its contents with
  3841. spaces (`clear-rectangle').
  3842. `M-x delete-whitespace-rectangle'
  3843. Delete whitespace in each of the lines on the specified rectangle,
  3844. starting from the left edge column of the rectangle.
  3845. `C-x r t STRING <RET>'
  3846. Replace rectangle contents with STRING on each line
  3847. (`string-rectangle').
  3848. `M-x string-insert-rectangle <RET> STRING <RET>'
  3849. Insert STRING on each line of the rectangle.
  3850. The rectangle operations fall into two classes: commands to erase or
  3851. insert rectangles, and commands to make blank rectangles.
  3852. There are two ways to erase the text in a rectangle: `C-x r d'
  3853. (`delete-rectangle') to delete the text outright, or `C-x r k'
  3854. (`kill-rectangle') to remove the text and save it as the "last killed
  3855. rectangle". In both cases, erasing the region-rectangle is like
  3856. erasing the specified text on each line of the rectangle; if there is
  3857. any following text on the line, it moves backwards to fill the gap.
  3858. "Killing" a rectangle is not killing in the usual sense; the
  3859. rectangle is not stored in the kill ring, but in a special place that
  3860. only records the most recent rectangle killed. This is because yanking
  3861. a rectangle is so different from yanking linear text that different
  3862. yank commands have to be used. Yank-popping is not defined for
  3863. rectangles.
  3864. To yank the last killed rectangle, type `C-x r y'
  3865. (`yank-rectangle'). The rectangle's first line is inserted at point,
  3866. the rectangle's second line is inserted at the same horizontal position
  3867. one line vertically below, and so on. The number of lines affected is
  3868. determined by the height of the saved rectangle.
  3869. For example, you can convert two single-column lists into a
  3870. double-column list by killing one of the single-column lists as a
  3871. rectangle, and then yanking it beside the other list.
  3872. You can also copy rectangles into and out of registers with `C-x r r
  3873. R' and `C-x r i R'. *Note Rectangle Registers::.
  3874. There are two commands you can use for making blank rectangles: `C-x
  3875. r c' (`clear-rectangle') blanks out existing text in the
  3876. region-rectangle, and `C-x r o' (`open-rectangle') inserts a blank
  3877. rectangle.
  3878. `M-x delete-whitespace-rectangle' deletes horizontal whitespace
  3879. starting from a particular column. This applies to each of the lines
  3880. in the rectangle, and the column is specified by the left edge of the
  3881. rectangle. The right edge of the rectangle does not make any
  3882. difference to this command.
  3883. The command `C-x r N' (`rectangle-number-lines') inserts line
  3884. numbers along the left edge of the region-rectangle. Normally, the
  3885. numbering begins from 1 (for the first line of the rectangle). With a
  3886. prefix argument, the command prompts for a number to begin from, and
  3887. for a format string with which to print the numbers (*note Formatting
  3888. Strings: (elisp)Formatting Strings.).
  3889. The command `C-x r t' (`string-rectangle') replaces the contents of
  3890. a region-rectangle with a string on each line. The string's width need
  3891. not be the same as the width of the rectangle. If the string's width
  3892. is less, the text after the rectangle shifts left; if the string is
  3893. wider than the rectangle, the text after the rectangle shifts right.
  3894. The command `M-x string-insert-rectangle' is similar to
  3895. `string-rectangle', but inserts the string on each line, shifting the
  3896. original text to the right.
  3897. 
  3898. File: emacs, Node: CUA Bindings, Prev: Rectangles, Up: Killing
  3899. 12.6 CUA Bindings
  3900. =================
  3901. The command `M-x cua-mode' sets up key bindings that are compatible
  3902. with the Common User Access (CUA) system used in many other
  3903. applications.
  3904. When CUA mode is enabled, the keys `C-x', `C-c', `C-v', and `C-z'
  3905. invoke commands that cut (kill), copy, paste (yank), and undo
  3906. respectively. The `C-x' and `C-c' keys perform cut and copy only if
  3907. the region is active. Otherwise, they still act as prefix keys, so
  3908. that standard Emacs commands like `C-x C-c' still work. Note that this
  3909. means the variable `mark-even-if-inactive' has no effect for `C-x' and
  3910. `C-c' (*note Using Region::).
  3911. To enter an Emacs command like `C-x C-f' while the mark is active,
  3912. use one of the following methods: either hold `Shift' together with the
  3913. prefix key, e.g. `S-C-x C-f', or quickly type the prefix key twice,
  3914. e.g. `C-x C-x C-f'.
  3915. To disable the overriding of standard Emacs binding by CUA mode,
  3916. while retaining the other features of CUA mode described below, set the
  3917. variable `cua-enable-cua-keys' to `nil'.
  3918. In CUA mode, typed text replaces the active region as in
  3919. Delete-Selection mode (*note Mouse Commands::).
  3920. CUA mode provides enhanced rectangle support with visible rectangle
  3921. highlighting. Use `C-RET' to start a rectangle, extend it using the
  3922. movement commands, and cut or copy it using `C-x' or `C-c'. `RET'
  3923. moves the cursor to the next (clockwise) corner of the rectangle, so
  3924. you can easily expand it in any direction. Normal text you type is
  3925. inserted to the left or right of each line in the rectangle (on the
  3926. same side as the cursor).
  3927. With CUA you can easily copy text and rectangles into and out of
  3928. registers by providing a one-digit numeric prefix to the kill, copy,
  3929. and yank commands, e.g. `C-1 C-c' copies the region into register `1',
  3930. and `C-2 C-v' yanks the contents of register `2'.
  3931. CUA mode also has a global mark feature which allows easy moving and
  3932. copying of text between buffers. Use `C-S-SPC' to toggle the global
  3933. mark on and off. When the global mark is on, all text that you kill or
  3934. copy is automatically inserted at the global mark, and text you type is
  3935. inserted at the global mark rather than at the current position.
  3936. For example, to copy words from various buffers into a word list in
  3937. a given buffer, set the global mark in the target buffer, then navigate
  3938. to each of the words you want in the list, mark it (e.g. with `S-M-f'),
  3939. copy it to the list with `C-c' or `M-w', and insert a newline after the
  3940. word in the target list by pressing <RET>.
  3941. 
  3942. File: emacs, Node: Registers, Next: Display, Prev: Killing, Up: Top
  3943. 13 Registers
  3944. ************
  3945. Emacs "registers" are compartments where you can save text, rectangles,
  3946. positions, and other things for later use. Once you save text or a
  3947. rectangle in a register, you can copy it into the buffer once, or many
  3948. times; once you save a position in a register, you can jump back to
  3949. that position once, or many times.
  3950. Each register has a name that consists of a single character, which
  3951. we will denote by R; R can be a letter (such as `a') or a number (such
  3952. as `1'); case matters, so register `a' is not the same as register `A'.
  3953. A register can store a position, a piece of text, a rectangle, a
  3954. number, a window configuration, or a file name, but only one thing at
  3955. any given time. Whatever you store in a register remains there until
  3956. you store something else in that register. To see what register R
  3957. contains, use `M-x view-register':
  3958. `M-x view-register <RET> R'
  3959. Display a description of what register R contains.
  3960. "Bookmarks" record files and positions in them, so you can return to
  3961. those positions when you look at the file again. Bookmarks are similar
  3962. in spirit to registers, so they are also documented in this chapter.
  3963. * Menu:
  3964. * Position Registers:: Saving positions in registers.
  3965. * Text Registers:: Saving text in registers.
  3966. * Rectangle Registers:: Saving rectangles in registers.
  3967. * Configuration Registers:: Saving window configurations in registers.
  3968. * Number Registers:: Numbers in registers.
  3969. * File Registers:: File names in registers.
  3970. * Bookmarks:: Bookmarks are like registers, but persistent.
  3971. 
  3972. File: emacs, Node: Position Registers, Next: Text Registers, Up: Registers
  3973. 13.1 Saving Positions in Registers
  3974. ==================================
  3975. `C-x r <SPC> R'
  3976. Record the position of point and the current buffer in register R
  3977. (`point-to-register').
  3978. `C-x r j R'
  3979. Jump to the position and buffer saved in register R
  3980. (`jump-to-register').
  3981. Typing `C-x r <SPC>' (`point-to-register'), followed by a character
  3982. `R', saves both the position of point and the current buffer in
  3983. register R. The register retains this information until you store
  3984. something else in it.
  3985. The command `C-x r j R' switches to the buffer recorded in register
  3986. R, and moves point to the recorded position. The contents of the
  3987. register are not changed, so you can jump to the saved position any
  3988. number of times.
  3989. If you use `C-x r j' to go to a saved position, but the buffer it
  3990. was saved from has been killed, `C-x r j' tries to create the buffer
  3991. again by visiting the same file. Of course, this works only for buffers
  3992. that were visiting files.
  3993. 
  3994. File: emacs, Node: Text Registers, Next: Rectangle Registers, Prev: Position Registers, Up: Registers
  3995. 13.2 Saving Text in Registers
  3996. =============================
  3997. When you want to insert a copy of the same piece of text several times,
  3998. it may be inconvenient to yank it from the kill ring, since each
  3999. subsequent kill moves that entry further down the ring. An alternative
  4000. is to store the text in a register and later retrieve it.
  4001. `C-x r s R'
  4002. Copy region into register R (`copy-to-register').
  4003. `C-x r i R'
  4004. Insert text from register R (`insert-register').
  4005. `M-x append-to-register <RET> R'
  4006. Append region to text in register R.
  4007. `M-x prepend-to-register <RET> R'
  4008. Prepend region to text in register R.
  4009. `C-x r s R' stores a copy of the text of the region into the
  4010. register named R. If the mark is inactive, Emacs first reactivates the
  4011. mark where it was last set. The mark is deactivated at the end of this
  4012. command. *Note Mark::. `C-u C-x r s R', the same command with a
  4013. prefix argument, copies the text into register R and deletes the text
  4014. from the buffer as well; you can think of this as "moving" the region
  4015. text into the register.
  4016. `M-x append-to-register <RET> R' appends the copy of the text in the
  4017. region to the text already stored in the register named R. If invoked
  4018. with a prefix argument, it deletes the region after appending it to the
  4019. register. The command `prepend-to-register' is similar, except that it
  4020. _prepends_ the region text to the text in the register instead of
  4021. _appending_ it.
  4022. `C-x r i R' inserts in the buffer the text from register R.
  4023. Normally it leaves point before the text and sets the mark after,
  4024. without activating it. With a numeric argument, it instead puts point
  4025. after the text and the mark before.
  4026. 
  4027. File: emacs, Node: Rectangle Registers, Next: Configuration Registers, Prev: Text Registers, Up: Registers
  4028. 13.3 Saving Rectangles in Registers
  4029. ===================================
  4030. A register can contain a rectangle instead of linear text. *Note
  4031. Rectangles::, for basic information on how to specify a rectangle in
  4032. the buffer.
  4033. `C-x r r R'
  4034. Copy the region-rectangle into register R
  4035. (`copy-rectangle-to-register'). With numeric argument, delete it
  4036. as well.
  4037. `C-x r i R'
  4038. Insert the rectangle stored in register R (if it contains a
  4039. rectangle) (`insert-register').
  4040. The `C-x r i R' (`insert-register') command, previously documented
  4041. in *note Text Registers::, inserts a rectangle rather than a text
  4042. string, if the register contains a rectangle.
  4043. 
  4044. File: emacs, Node: Configuration Registers, Next: Number Registers, Prev: Rectangle Registers, Up: Registers
  4045. 13.4 Saving Window Configurations in Registers
  4046. ==============================================
  4047. You can save the window configuration of the selected frame in a
  4048. register, or even the configuration of all windows in all frames, and
  4049. restore the configuration later. *Note Windows::, for information
  4050. about window configurations.
  4051. `C-x r w R'
  4052. Save the state of the selected frame's windows in register R
  4053. (`window-configuration-to-register').
  4054. `C-x r f R'
  4055. Save the state of all frames, including all their windows, in
  4056. register R (`frame-configuration-to-register').
  4057. Use `C-x r j R' to restore a window or frame configuration. This is
  4058. the same command used to restore a cursor position. When you restore a
  4059. frame configuration, any existing frames not included in the
  4060. configuration become invisible. If you wish to delete these frames
  4061. instead, use `C-u C-x r j R'.
  4062. 
  4063. File: emacs, Node: Number Registers, Next: File Registers, Prev: Configuration Registers, Up: Registers
  4064. 13.5 Keeping Numbers in Registers
  4065. =================================
  4066. There are commands to store a number in a register, to insert the
  4067. number in the buffer in decimal, and to increment it. These commands
  4068. can be useful in keyboard macros (*note Keyboard Macros::).
  4069. `C-u NUMBER C-x r n R'
  4070. Store NUMBER into register R (`number-to-register').
  4071. `C-u NUMBER C-x r + R'
  4072. Increment the number in register R by NUMBER
  4073. (`increment-register').
  4074. `C-x r i R'
  4075. Insert the number from register R into the buffer.
  4076. `C-x r i' is the same command used to insert any other sort of
  4077. register contents into the buffer. `C-x r +' with no numeric argument
  4078. increments the register value by 1; `C-x r n' with no numeric argument
  4079. stores zero in the register.
  4080. 
  4081. File: emacs, Node: File Registers, Next: Bookmarks, Prev: Number Registers, Up: Registers
  4082. 13.6 Keeping File Names in Registers
  4083. ====================================
  4084. If you visit certain file names frequently, you can visit them more
  4085. conveniently if you put their names in registers. Here's the Lisp code
  4086. used to put a file name in a register:
  4087. (set-register ?R '(file . NAME))
  4088. For example,
  4089. (set-register ?z '(file . "/gd/gnu/emacs/19.0/src/ChangeLog"))
  4090. puts the file name shown in register `z'.
  4091. To visit the file whose name is in register R, type `C-x r j R'.
  4092. (This is the same command used to jump to a position or restore a frame
  4093. configuration.)
  4094. 
  4095. File: emacs, Node: Bookmarks, Prev: File Registers, Up: Registers
  4096. 13.7 Bookmarks
  4097. ==============
  4098. "Bookmarks" are somewhat like registers in that they record positions
  4099. you can jump to. Unlike registers, they have long names, and they
  4100. persist automatically from one Emacs session to the next. The
  4101. prototypical use of bookmarks is to record "where you were reading" in
  4102. various files.
  4103. `C-x r m <RET>'
  4104. Set the bookmark for the visited file, at point.
  4105. `C-x r m BOOKMARK <RET>'
  4106. Set the bookmark named BOOKMARK at point (`bookmark-set').
  4107. `C-x r b BOOKMARK <RET>'
  4108. Jump to the bookmark named BOOKMARK (`bookmark-jump').
  4109. `C-x r l'
  4110. List all bookmarks (`list-bookmarks').
  4111. `M-x bookmark-save'
  4112. Save all the current bookmark values in the default bookmark file.
  4113. The prototypical use for bookmarks is to record one current position
  4114. in each of several files. So the command `C-x r m', which sets a
  4115. bookmark, uses the visited file name as the default for the bookmark
  4116. name. If you name each bookmark after the file it points to, then you
  4117. can conveniently revisit any of those files with `C-x r b', and move to
  4118. the position of the bookmark at the same time.
  4119. To display a list of all your bookmarks in a separate buffer, type
  4120. `C-x r l' (`list-bookmarks'). If you switch to that buffer, you can
  4121. use it to edit your bookmark definitions or annotate the bookmarks.
  4122. Type `C-h m' in the bookmark buffer for more information about its
  4123. special editing commands.
  4124. When you kill Emacs, Emacs saves your bookmarks, if you have changed
  4125. any bookmark values. You can also save the bookmarks at any time with
  4126. the `M-x bookmark-save' command. Bookmarks are saved to the file
  4127. `~/.emacs.d/bookmarks' (for compatibility with older versions of Emacs,
  4128. if you have a file named `~/.emacs.bmk', that is used instead). The
  4129. bookmark commands load your default bookmark file automatically. This
  4130. saving and loading is how bookmarks persist from one Emacs session to
  4131. the next.
  4132. If you set the variable `bookmark-save-flag' to 1, each command that
  4133. sets a bookmark will also save your bookmarks; this way, you don't lose
  4134. any bookmark values even if Emacs crashes. The value, if a number,
  4135. says how many bookmark modifications should go by between saving. If
  4136. you set this variable to `nil', Emacs only saves bookmarks if you
  4137. explicitly use `M-x bookmark-save'.
  4138. Bookmark position values are saved with surrounding context, so that
  4139. `bookmark-jump' can find the proper position even if the file is
  4140. modified slightly. The variable `bookmark-search-size' says how many
  4141. characters of context to record on each side of the bookmark's position.
  4142. Here are some additional commands for working with bookmarks:
  4143. `M-x bookmark-load <RET> FILENAME <RET>'
  4144. Load a file named FILENAME that contains a list of bookmark
  4145. values. You can use this command, as well as `bookmark-write', to
  4146. work with other files of bookmark values in addition to your
  4147. default bookmark file.
  4148. `M-x bookmark-write <RET> FILENAME <RET>'
  4149. Save all the current bookmark values in the file FILENAME.
  4150. `M-x bookmark-delete <RET> BOOKMARK <RET>'
  4151. Delete the bookmark named BOOKMARK.
  4152. `M-x bookmark-insert-location <RET> BOOKMARK <RET>'
  4153. Insert in the buffer the name of the file that bookmark BOOKMARK
  4154. points to.
  4155. `M-x bookmark-insert <RET> BOOKMARK <RET>'
  4156. Insert in the buffer the _contents_ of the file that bookmark
  4157. BOOKMARK points to.
  4158. 
  4159. File: emacs, Node: Display, Next: Search, Prev: Registers, Up: Top
  4160. 14 Controlling the Display
  4161. **************************
  4162. Since only part of a large buffer fits in the window, Emacs has to show
  4163. only a part of it. This chapter describes commands and variables that
  4164. let you specify which part of the text you want to see, and how the
  4165. text is displayed.
  4166. * Menu:
  4167. * Scrolling:: Commands to move text up and down in a window.
  4168. * Recentering:: A scroll command that centers the current line.
  4169. * Auto Scrolling:: Redisplay scrolls text automatically when needed.
  4170. * Horizontal Scrolling:: Moving text left and right in a window.
  4171. * Narrowing:: Restricting display and editing to a portion
  4172. of the buffer.
  4173. * View Mode:: Viewing read-only buffers.
  4174. * Follow Mode:: Follow mode lets two windows scroll as one.
  4175. * Faces:: How to change the display style using faces.
  4176. * Colors:: Specifying colors for faces.
  4177. * Standard Faces:: The main predefined faces.
  4178. * Text Scale:: Increasing or decreasing text size in a buffer.
  4179. * Font Lock:: Minor mode for syntactic highlighting using faces.
  4180. * Highlight Interactively:: Tell Emacs what text to highlight.
  4181. * Fringes:: Enabling or disabling window fringes.
  4182. * Displaying Boundaries:: Displaying top and bottom of the buffer.
  4183. * Useless Whitespace:: Showing possibly spurious trailing whitespace.
  4184. * Selective Display:: Hiding lines with lots of indentation.
  4185. * Optional Mode Line:: Optional mode line display features.
  4186. * Text Display:: How text characters are normally displayed.
  4187. * Cursor Display:: Features for displaying the cursor.
  4188. * Line Truncation:: Truncating lines to fit the screen width instead
  4189. of continuing them to multiple screen lines.
  4190. * Visual Line Mode:: Word wrap and screen line-based editing.
  4191. * Display Custom:: Information on variables for customizing display.
  4192. 
  4193. File: emacs, Node: Scrolling, Next: Recentering, Up: Display
  4194. 14.1 Scrolling
  4195. ==============
  4196. If a window is too small to display all the text in its buffer, it
  4197. displays only a portion of it. "Scrolling" commands change which
  4198. portion of the buffer is displayed.
  4199. Scrolling "forward" or "up" advances the portion of the buffer
  4200. displayed in the window; equivalently, it moves the buffer text upwards
  4201. relative to the window. Scrolling "backward" or "down" displays an
  4202. earlier portion of the buffer, and moves the text downwards relative to
  4203. the window.
  4204. In Emacs, scrolling "up" or "down" refers to the direction that the
  4205. text moves in the window, _not_ the direction that the window moves
  4206. relative to the text. This terminology was adopted by Emacs before the
  4207. modern meaning of "scrolling up" and "scrolling down" became
  4208. widespread. Hence, the strange result that <PageDown> scrolls "up" in
  4209. the Emacs sense.
  4210. The portion of a buffer displayed in a window always contains point.
  4211. If you move point past the bottom or top of the window, scrolling
  4212. occurs automatically to bring it back onscreen (*note Auto
  4213. Scrolling::). You can also scroll explicitly with these commands:
  4214. `C-v'
  4215. `<next>'
  4216. `<PageDown>'
  4217. Scroll forward by nearly a full window (`scroll-up-command').
  4218. `M-v'
  4219. `<prior>'
  4220. `<PageUp>'
  4221. Scroll backward (`scroll-down-command').
  4222. `C-v' (`scroll-up-command') scrolls forward by nearly the whole
  4223. window height. The effect is to take the two lines at the bottom of
  4224. the window and put them at the top, followed by lines that were not
  4225. previously visible. If point was in the text that scrolled off the
  4226. top, it ends up on the window's new topmost line. The <next> (or
  4227. <PageDown>) key is equivalent to `C-v'.
  4228. `M-v' (`scroll-down-command') scrolls backward in a similar way.
  4229. The <prior> (or <PageUp>) key is equivalent to `M-v'.
  4230. The number of lines of overlap left by these scroll commands is
  4231. controlled by the variable `next-screen-context-lines', whose default
  4232. value is 2. You can supply the commands with a numeric prefix
  4233. argument, N, to scroll by N lines; Emacs attempts to leave point
  4234. unchanged, so that the text and point move up or down together. `C-v'
  4235. with a negative argument is like `M-v' and vice versa.
  4236. By default, these commands signal an error (by beeping or flashing
  4237. the screen) if no more scrolling is possible, because the window has
  4238. reached the beginning or end of the buffer. If you change the variable
  4239. `scroll-error-top-bottom' to `t', the command moves point to the
  4240. farthest possible position. If point is already there, the command
  4241. signals an error.
  4242. Some users like scroll commands to keep point at the same screen
  4243. position, so that scrolling back to the same screen conveniently
  4244. returns point to its original position. You can enable this behavior
  4245. via the variable `scroll-preserve-screen-position'. If the value is
  4246. `t', Emacs adjusts point to keep the cursor at the same screen position
  4247. whenever a scroll command moves it off-window, rather than moving it to
  4248. the topmost or bottommost line. With any other non-`nil' value, Emacs
  4249. adjusts point this way even if the scroll command leaves point in the
  4250. window. This variable affects all the scroll commands documented in
  4251. this section, as well as scrolling with the mouse wheel (*note Mouse
  4252. Commands::); in general, it affects any command that has a non-`nil'
  4253. `scroll-command' property. *Note Property Lists: (elisp)Property Lists.
  4254. The commands `M-x scroll-up' and `M-x scroll-down' behave similarly
  4255. to `scroll-up-command' and `scroll-down-command', except they do not
  4256. obey `scroll-error-top-bottom'. Prior to Emacs 24, these were the
  4257. default commands for scrolling up and down. The commands `M-x
  4258. scroll-up-line' and `M-x scroll-down-line' scroll the current window by
  4259. one line at a time. If you intend to use any of these commands, you
  4260. might want to give them key bindings (*note Init Rebinding::).
  4261. 
  4262. File: emacs, Node: Recentering, Next: Auto Scrolling, Prev: Scrolling, Up: Display
  4263. 14.2 Recentering
  4264. ================
  4265. `C-l'
  4266. Scroll the selected window so the current line is the center-most
  4267. text line; on subsequent consecutive invocations, make the current
  4268. line the top line, the bottom line, and so on in cyclic order.
  4269. Possibly redisplay the screen too (`recenter-top-bottom').
  4270. `M-x recenter'
  4271. Scroll the selected window so the current line is the center-most
  4272. text line. Possibly redisplay the screen too.
  4273. `C-M-l'
  4274. Scroll heuristically to bring useful information onto the screen
  4275. (`reposition-window').
  4276. The `C-l' (`recenter-top-bottom') command "recenters" the selected
  4277. window, scrolling it so that the current screen line is exactly in the
  4278. center of the window, or as close to the center as possible.
  4279. Typing `C-l' twice in a row (`C-l C-l') scrolls the window so that
  4280. point is on the topmost screen line. Typing a third `C-l' scrolls the
  4281. window so that point is on the bottom-most screen line. Each
  4282. successive `C-l' cycles through these three positions.
  4283. You can change the cycling order by customizing the list variable
  4284. `recenter-positions'. Each list element should be the symbol `top',
  4285. `middle', or `bottom', or a number; an integer means to move the line
  4286. to the specified screen line, while a floating-point number between 0.0
  4287. and 1.0 specifies a percentage of the screen space from the top of the
  4288. window. The default, `(middle top bottom)', is the cycling order
  4289. described above. Furthermore, if you change the variable
  4290. `scroll-margin' to a non-zero value N, `C-l' always leaves at least N
  4291. screen lines between point and the top or bottom of the window (*note
  4292. Auto Scrolling::).
  4293. You can also give `C-l' a prefix argument. A plain prefix argument,
  4294. `C-u C-l', simply recenters point. A positive argument N puts point N
  4295. lines down from the top of the window. An argument of zero puts point
  4296. on the topmost line. A negative argument -N puts point N lines from
  4297. the bottom of the window. When given an argument, `C-l' does not clear
  4298. the screen or cycle through different screen positions.
  4299. If the variable `recenter-redisplay' has a non-`nil' value, each
  4300. invocation of `C-l' also clears and redisplays the screen; the special
  4301. value `tty' (the default) says to do this on text-terminal frames only.
  4302. Redisplaying is useful in case the screen becomes garbled for any
  4303. reason (*note Screen Garbled::).
  4304. The more primitive command `M-x recenter' behaves like
  4305. `recenter-top-bottom', but does not cycle among screen positions.
  4306. `C-M-l' (`reposition-window') scrolls the current window
  4307. heuristically in a way designed to get useful information onto the
  4308. screen. For example, in a Lisp file, this command tries to get the
  4309. entire current defun onto the screen if possible.
  4310. 
  4311. File: emacs, Node: Auto Scrolling, Next: Horizontal Scrolling, Prev: Recentering, Up: Display
  4312. 14.3 Automatic Scrolling
  4313. ========================
  4314. Emacs performs "automatic scrolling" when point moves out of the
  4315. visible portion of the text.
  4316. Normally, this centers point vertically within the window. However,
  4317. if you set `scroll-conservatively' to a small number N, then if you
  4318. move point just a little off the screen (less than N lines), Emacs
  4319. scrolls the text just far enough to bring point back on screen. By
  4320. default, `scroll-conservatively' is 0. If you set
  4321. `scroll-conservatively' to a large number (larger than 100), Emacs will
  4322. never center point as result of scrolling, even if point moves far away
  4323. from the text previously displayed in the window. With such a large
  4324. value, Emacs will always scroll text just enough for bringing point
  4325. into view, so point will end up at the top or bottom of the window,
  4326. depending on the scroll direction.
  4327. The variable `scroll-step' determines how many lines to scroll the
  4328. window when point moves off the screen. If moving by that number of
  4329. lines fails to bring point back into view, point is centered instead.
  4330. The default value is zero, which causes point to always be centered
  4331. after scrolling.
  4332. When the window does scroll by a distance longer than `scroll-step',
  4333. you can control how aggressively it scrolls by setting the variables
  4334. `scroll-up-aggressively' and `scroll-down-aggressively'. The value of
  4335. `scroll-up-aggressively' should be either `nil', or a fraction F
  4336. between 0 and 1. A fraction specifies where on the screen to put point
  4337. when scrolling upward, i.e. forward. When point goes off the window
  4338. end, the new start position is chosen to put point F parts of the
  4339. window height from the bottom margin. Thus, larger F means more
  4340. aggressive scrolling: more new text is brought into view. The default
  4341. value, `nil', is equivalent to 0.5.
  4342. Likewise, `scroll-down-aggressively' is used for scrolling down,
  4343. i.e. backward. The value specifies how far point should be placed from
  4344. the top margin of the window; thus, as with `scroll-up-aggressively', a
  4345. larger value is more aggressive.
  4346. These two variables are ignored if either `scroll-step' or
  4347. `scroll-conservatively' are set to a non-zero value.
  4348. The variable `scroll-margin' restricts how close point can come to
  4349. the top or bottom of a window (even if aggressive scrolling specifies a
  4350. fraction F that is larger than the window portion between the top and
  4351. the bottom margins). Its value is a number of screen lines; if point
  4352. comes within that many lines of the top or bottom of the window, Emacs
  4353. performs automatic scrolling. By default, `scroll-margin' is 0.
  4354. 
  4355. File: emacs, Node: Horizontal Scrolling, Next: Narrowing, Prev: Auto Scrolling, Up: Display
  4356. 14.4 Horizontal Scrolling
  4357. =========================
  4358. "Horizontal scrolling" means shifting all the lines sideways within a
  4359. window, so that some of the text near the left margin is not displayed.
  4360. When the text in a window is scrolled horizontally, text lines are
  4361. truncated rather than continued (*note Line Truncation::). If a window
  4362. shows truncated lines, Emacs performs automatic horizontal scrolling
  4363. whenever point moves off the left or right edge of the screen. To
  4364. disable automatic horizontal scrolling, set the variable
  4365. `auto-hscroll-mode' to `nil'. Note that when the automatic horizontal
  4366. scrolling is turned off, if point moves off the edge of the screen, the
  4367. cursor disappears to indicate that. (On text terminals, the cursor is
  4368. left at the edge instead.)
  4369. The variable `hscroll-margin' controls how close point can get to
  4370. the window's edges before automatic scrolling occurs. It is measured
  4371. in columns. For example, if the value is 5, then moving point within 5
  4372. columns of an edge causes horizontal scrolling away from that edge.
  4373. The variable `hscroll-step' determines how many columns to scroll
  4374. the window when point gets too close to the edge. Zero, the default
  4375. value, means to center point horizontally within the window. A
  4376. positive integer value specifies the number of columns to scroll by. A
  4377. floating-point number specifies the fraction of the window's width to
  4378. scroll by.
  4379. You can also perform explicit horizontal scrolling with the
  4380. following commands:
  4381. `C-x <'
  4382. Scroll text in current window to the left (`scroll-left').
  4383. `C-x >'
  4384. Scroll to the right (`scroll-right').
  4385. `C-x <' (`scroll-left') scrolls text in the selected window to the
  4386. left by the full width of the window, less two columns. (In other
  4387. words, the text in the window moves left relative to the window.) With
  4388. a numeric argument N, it scrolls by N columns.
  4389. If the text is scrolled to the left, and point moves off the left
  4390. edge of the window, the cursor will freeze at the left edge of the
  4391. window, until point moves back to the displayed portion of the text.
  4392. This is independent of the current setting of `auto-hscroll-mode',
  4393. which, for text scrolled to the left, only affects the behavior at the
  4394. right edge of the window.
  4395. `C-x >' (`scroll-right') scrolls similarly to the right. The window
  4396. cannot be scrolled any farther to the right once it is displayed
  4397. normally, with each line starting at the window's left margin;
  4398. attempting to do so has no effect. This means that you don't have to
  4399. calculate the argument precisely for `C-x >'; any sufficiently large
  4400. argument will restore the normal display.
  4401. If you use those commands to scroll a window horizontally, that sets
  4402. a lower bound for automatic horizontal scrolling. Automatic scrolling
  4403. will continue to scroll the window, but never farther to the right than
  4404. the amount you previously set by `scroll-left'.
  4405. 
  4406. File: emacs, Node: Narrowing, Next: View Mode, Prev: Horizontal Scrolling, Up: Display
  4407. 14.5 Narrowing
  4408. ==============
  4409. "Narrowing" means focusing in on some portion of the buffer, making the
  4410. rest temporarily inaccessible. The portion which you can still get to
  4411. is called the "accessible portion". Canceling the narrowing, which
  4412. makes the entire buffer once again accessible, is called "widening".
  4413. The bounds of narrowing in effect in a buffer are called the buffer's
  4414. "restriction".
  4415. Narrowing can make it easier to concentrate on a single subroutine or
  4416. paragraph by eliminating clutter. It can also be used to limit the
  4417. range of operation of a replace command or repeating keyboard macro.
  4418. `C-x n n'
  4419. Narrow down to between point and mark (`narrow-to-region').
  4420. `C-x n w'
  4421. Widen to make the entire buffer accessible again (`widen').
  4422. `C-x n p'
  4423. Narrow down to the current page (`narrow-to-page').
  4424. `C-x n d'
  4425. Narrow down to the current defun (`narrow-to-defun').
  4426. When you have narrowed down to a part of the buffer, that part
  4427. appears to be all there is. You can't see the rest, you can't move
  4428. into it (motion commands won't go outside the accessible part), you
  4429. can't change it in any way. However, it is not gone, and if you save
  4430. the file all the inaccessible text will be saved. The word `Narrow'
  4431. appears in the mode line whenever narrowing is in effect.
  4432. The primary narrowing command is `C-x n n' (`narrow-to-region'). It
  4433. sets the current buffer's restrictions so that the text in the current
  4434. region remains accessible, but all text before the region or after the
  4435. region is inaccessible. Point and mark do not change.
  4436. Alternatively, use `C-x n p' (`narrow-to-page') to narrow down to
  4437. the current page. *Note Pages::, for the definition of a page. `C-x n
  4438. d' (`narrow-to-defun') narrows down to the defun containing point
  4439. (*note Defuns::).
  4440. The way to cancel narrowing is to widen with `C-x n w' (`widen').
  4441. This makes all text in the buffer accessible again.
  4442. You can get information on what part of the buffer you are narrowed
  4443. down to using the `C-x =' command. *Note Position Info::.
  4444. Because narrowing can easily confuse users who do not understand it,
  4445. `narrow-to-region' is normally a disabled command. Attempting to use
  4446. this command asks for confirmation and gives you the option of enabling
  4447. it; if you enable the command, confirmation will no longer be required
  4448. for it. *Note Disabling::.
  4449. 
  4450. File: emacs, Node: View Mode, Next: Follow Mode, Prev: Narrowing, Up: Display
  4451. 14.6 View Mode
  4452. ==============
  4453. View mode is a minor mode that lets you scan a buffer by sequential
  4454. screenfuls. It provides commands for scrolling through the buffer
  4455. conveniently but not for changing it. Apart from the usual Emacs
  4456. cursor motion commands, you can type <SPC> to scroll forward one
  4457. windowful, <DEL> to scroll backward, and `s' to start an incremental
  4458. search.
  4459. Typing `q' (`View-quit') disables View mode, and switches back to
  4460. the buffer and position before View mode was enabled. Typing `e'
  4461. (`View-exit') disables View mode, keeping the current buffer and
  4462. position.
  4463. `M-x view-buffer' prompts for an existing Emacs buffer, switches to
  4464. it, and enables View mode. `M-x view-file' prompts for a file and
  4465. visits it with View mode enabled.
  4466. 
  4467. File: emacs, Node: Follow Mode, Next: Faces, Prev: View Mode, Up: Display
  4468. 14.7 Follow Mode
  4469. ================
  4470. "Follow mode" is a minor mode that makes two windows, both showing the
  4471. same buffer, scroll as a single tall "virtual window". To use Follow
  4472. mode, go to a frame with just one window, split it into two
  4473. side-by-side windows using `C-x 3', and then type `M-x follow-mode'.
  4474. From then on, you can edit the buffer in either of the two windows, or
  4475. scroll either one; the other window follows it.
  4476. In Follow mode, if you move point outside the portion visible in one
  4477. window and into the portion visible in the other window, that selects
  4478. the other window--again, treating the two as if they were parts of one
  4479. large window.
  4480. To turn off Follow mode, type `M-x follow-mode' a second time.
  4481. 
  4482. File: emacs, Node: Faces, Next: Colors, Prev: Follow Mode, Up: Display
  4483. 14.8 Text Faces
  4484. ===============
  4485. Emacs can display text in several different styles, called "faces".
  4486. Each face can specify various "face attributes", such as the font,
  4487. height, weight, slant, foreground and background color, and underlining
  4488. or overlining. Most major modes assign faces to the text
  4489. automatically, via Font Lock mode. *Note Font Lock::, for more
  4490. information about how these faces are assigned.
  4491. To see what faces are currently defined, and what they look like,
  4492. type `M-x list-faces-display'. With a prefix argument, this prompts
  4493. for a regular expression, and displays only faces with names matching
  4494. that regular expression (*note Regexps::).
  4495. It's possible for a given face to look different in different
  4496. frames. For instance, some text terminals do not support all face
  4497. attributes, particularly font, height, and width, and some support a
  4498. limited range of colors.
  4499. You can customize a face to alter its appearance, and save those
  4500. changes for future Emacs sessions. *Note Face Customization::. A face
  4501. does not have to specify every single attribute; often it inherits most
  4502. attributes from another face. Any ultimately unspecified attribute is
  4503. taken from the face named `default'.
  4504. The `default' face is the default for displaying text, and all of
  4505. its attributes are specified. Its background color is also used as the
  4506. frame's background color. *Note Colors::.
  4507. Another special face is the `cursor' face. On graphical displays,
  4508. the background color of this face is used to draw the text cursor.
  4509. None of the other attributes of this face have any effect; the
  4510. foreground color for text under the cursor is taken from the background
  4511. color of the underlying text. On text terminals, the appearance of the
  4512. text cursor is determined by the terminal, not by the `cursor' face.
  4513. You can also use X resources to specify attributes of any particular
  4514. face. *Note Resources::.
  4515. Emacs can display variable-width fonts, but some Emacs commands,
  4516. particularly indentation commands, do not account for variable
  4517. character display widths. Therefore, we recommend not using
  4518. variable-width fonts for most faces, particularly those assigned by
  4519. Font Lock mode.
  4520. 
  4521. File: emacs, Node: Colors, Next: Standard Faces, Prev: Faces, Up: Display
  4522. 14.9 Colors for Faces
  4523. =====================
  4524. Faces can have various foreground and background colors. When you
  4525. specify a color for a face--for instance, when customizing the face
  4526. (*note Face Customization::)--you can use either a "color name" or an
  4527. "RGB triplet".
  4528. A color name is a pre-defined name, such as `dark orange' or `medium
  4529. sea green'. To view a list of color names, type `M-x
  4530. list-colors-display'. To control the order in which colors are shown,
  4531. customize `list-colors-sort'. If you run this command on a graphical
  4532. display, it shows the full range of color names known to Emacs (these
  4533. are the standard X11 color names, defined in X's `rgb.txt' file). If
  4534. you run the command on a text terminal, it shows only a small subset of
  4535. colors that can be safely displayed on such terminals. However, Emacs
  4536. understands X11 color names even on text terminals; if a face is given
  4537. a color specified by an X11 color name, it is displayed using the
  4538. closest-matching terminal color.
  4539. An RGB triplet is a string of the form `#RRGGBB'. Each of the R, G,
  4540. and B components is a hexadecimal number specifying the component's
  4541. relative intensity, one to four digits long (usually two digits are
  4542. used). The components must have the same number of digits. For
  4543. hexadecimal values A to F, either upper or lower case are acceptable.
  4544. The `M-x list-colors-display' command also shows the equivalent RGB
  4545. triplet for each named color. For instance, `medium sea green' is
  4546. equivalent to `#3CB371'.
  4547. You can change the foreground and background colors of a face with
  4548. `M-x set-face-foreground' and `M-x set-face-background'. These
  4549. commands prompt in the minibuffer for a face name and a color, with
  4550. completion, and then set that face to use the specified color. They
  4551. affect the face colors on all frames, but their effects do not persist
  4552. for future Emacs sessions, unlike using the customization buffer or X
  4553. resources. You can also use frame parameters to set foreground and
  4554. background colors for a specific frame; *Note Frame Parameters::.
  4555. 
  4556. File: emacs, Node: Standard Faces, Next: Text Scale, Prev: Colors, Up: Display
  4557. 14.10 Standard Faces
  4558. ====================
  4559. Here are the standard faces for specifying text appearance. You can
  4560. apply them to specific text when you want the effects they produce.
  4561. `default'
  4562. This face is used for ordinary text that doesn't specify any face.
  4563. Its background color is used as the frame's background color.
  4564. `bold'
  4565. This face uses a bold variant of the default font.
  4566. `italic'
  4567. This face uses an italic variant of the default font.
  4568. `bold-italic'
  4569. This face uses a bold italic variant of the default font.
  4570. `underline'
  4571. This face underlines text.
  4572. `fixed-pitch'
  4573. This face forces use of a fixed-width font. It's reasonable to
  4574. customize this face to use a different fixed-width font, if you
  4575. like, but you should not make it a variable-width font.
  4576. `variable-pitch'
  4577. This face forces use of a variable-width font.
  4578. `shadow'
  4579. This face is used for making the text less noticeable than the
  4580. surrounding ordinary text. Usually this can be achieved by using
  4581. shades of gray in contrast with either black or white default
  4582. foreground color.
  4583. Here's an incomplete list of faces used to highlight parts of the
  4584. text temporarily for specific purposes. (Many other modes define their
  4585. own faces for this purpose.)
  4586. `highlight'
  4587. This face is used for text highlighting in various contexts, such
  4588. as when the mouse cursor is moved over a hyperlink.
  4589. `isearch'
  4590. This face is used to highlight the current Isearch match (*note
  4591. Incremental Search::).
  4592. `query-replace'
  4593. This face is used to highlight the current Query Replace match
  4594. (*note Replace::).
  4595. `lazy-highlight'
  4596. This face is used to highlight "lazy matches" for Isearch and Query
  4597. Replace (matches other than the current one).
  4598. `region'
  4599. This face is used for displaying an active region (*note Mark::).
  4600. When Emacs is built with GTK support, its colors are taken from the
  4601. current GTK theme.
  4602. `secondary-selection'
  4603. This face is used for displaying a secondary X selection (*note
  4604. Secondary Selection::).
  4605. `trailing-whitespace'
  4606. The face for highlighting excess spaces and tabs at the end of a
  4607. line when `show-trailing-whitespace' is non-`nil' (*note Useless
  4608. Whitespace::).
  4609. `escape-glyph'
  4610. The face for displaying control characters and escape sequences
  4611. (*note Text Display::).
  4612. `nobreak-space'
  4613. The face for displaying "no-break" space characters (*note Text
  4614. Display::).
  4615. The following faces control the appearance of parts of the Emacs
  4616. frame:
  4617. `mode-line'
  4618. This face is used for the mode line of the currently selected
  4619. window, and for menu bars when toolkit menus are not used. By
  4620. default, it's drawn with shadows for a "raised" effect on
  4621. graphical displays, and drawn as the inverse of the default face
  4622. on non-windowed terminals.
  4623. `mode-line-inactive'
  4624. Like `mode-line', but used for mode lines of the windows other
  4625. than the selected one (if `mode-line-in-non-selected-windows' is
  4626. non-`nil'). This face inherits from `mode-line', so changes in
  4627. that face affect mode lines in all windows.
  4628. `mode-line-highlight'
  4629. Like `highlight', but used for portions of text on mode lines.
  4630. `mode-line-buffer-id'
  4631. This face is used for buffer identification parts in the mode line.
  4632. `header-line'
  4633. Similar to `mode-line' for a window's header line, which appears
  4634. at the top of a window just as the mode line appears at the bottom.
  4635. Most windows do not have a header line--only some special modes,
  4636. such Info mode, create one.
  4637. `vertical-border'
  4638. This face is used for the vertical divider between windows on text
  4639. terminals.
  4640. `minibuffer-prompt'
  4641. This face is used for the prompt strings displayed in the
  4642. minibuffer. By default, Emacs automatically adds this face to the
  4643. value of `minibuffer-prompt-properties', which is a list of text
  4644. properties used to display the prompt text. (This variable takes
  4645. effect when you enter the minibuffer.)
  4646. `fringe'
  4647. The face for the fringes to the left and right of windows on
  4648. graphic displays. (The fringes are the narrow portions of the
  4649. Emacs frame between the text area and the window's right and left
  4650. borders.) *Note Fringes::.
  4651. `cursor'
  4652. The `:background' attribute of this face specifies the color of
  4653. the text cursor. *Note Cursor Display::.
  4654. `tooltip'
  4655. This face is used for tooltip text. By default, if Emacs is built
  4656. with GTK support, tooltips are drawn via GTK and this face has no
  4657. effect. *Note Tooltips::.
  4658. `mouse'
  4659. This face determines the color of the mouse pointer.
  4660. The following faces likewise control the appearance of parts of the
  4661. Emacs frame, but only on text terminals, or when Emacs is built on X
  4662. with no toolkit support. (For all other cases, the appearance of the
  4663. respective frame elements is determined by system-wide settings.)
  4664. `scroll-bar'
  4665. This face determines the visual appearance of the scroll bar.
  4666. *Note Scroll Bars::.
  4667. `tool-bar'
  4668. This face determines the color of tool bar icons. *Note Tool
  4669. Bars::.
  4670. `menu'
  4671. This face determines the colors and font of Emacs's menus. *Note
  4672. Menu Bars::.
  4673. 
  4674. File: emacs, Node: Text Scale, Next: Font Lock, Prev: Standard Faces, Up: Display
  4675. 14.11 Text Scale
  4676. ================
  4677. To increase the height of the default face in the current buffer, type
  4678. `C-x C-+' or `C-x C-='. To decrease it, type `C-x C--'. To restore
  4679. the default (global) face height, type `C-x C-0'. These keys are all
  4680. bound to the same command, `text-scale-adjust', which looks at the last
  4681. key typed to determine which action to take.
  4682. The final key of these commands may be repeated without the leading
  4683. `C-x'. For instance, `C-x C-= C-= C-=' increases the face height by
  4684. three steps. Each step scales the text height by a factor of 1.2; to
  4685. change this factor, customize the variable `text-scale-mode-step'. As
  4686. an exception, a numeric argument of 0 to the `text-scale-adjust'
  4687. command restores the default height, similar to typing `C-x C-0'.
  4688. The commands `text-scale-increase' and `text-scale-decrease'
  4689. increase or decrease the height of the default face, just like `C-x
  4690. C-+' and `C-x C--' respectively. You may find it convenient to bind to
  4691. these commands, rather than `text-scale-adjust'.
  4692. The command `text-scale-set' scales the height of the default face
  4693. in the current buffer to an absolute level specified by its prefix
  4694. argument.
  4695. The above commands automatically enable the minor mode
  4696. `text-scale-mode' if the current font scaling is other than 1, and
  4697. disable it otherwise.
  4698. 
  4699. File: emacs, Node: Font Lock, Next: Highlight Interactively, Prev: Text Scale, Up: Display
  4700. 14.12 Font Lock mode
  4701. ====================
  4702. Font Lock mode is a minor mode, always local to a particular buffer,
  4703. which assigns faces to (or "fontifies") the text in the buffer. Each
  4704. buffer's major mode tells Font Lock mode which text to fontify; for
  4705. instance, programming language modes fontify syntactically relevant
  4706. constructs like comments, strings, and function names.
  4707. Font Lock mode is enabled by default. To toggle it in the current
  4708. buffer, type `M-x font-lock-mode'. A positive numeric argument
  4709. unconditionally enables Font Lock mode, and a negative or zero argument
  4710. disables it.
  4711. Type `M-x global-font-lock-mode' to toggle Font Lock mode in all
  4712. buffers. To impose this setting for future Emacs sessions, customize
  4713. the variable `global-font-lock-mode' (*note Easy Customization::), or
  4714. add the following line to your init file:
  4715. (global-font-lock-mode 0)
  4716. If you have disabled Global Font Lock mode, you can still enable Font
  4717. Lock for specific major modes by adding the function `font-lock-mode'
  4718. to the mode hooks (*note Hooks::). For example, to enable Font Lock
  4719. mode for editing C files, you can do this:
  4720. (add-hook 'c-mode-hook 'font-lock-mode)
  4721. Font Lock mode uses several specifically named faces to do its job,
  4722. including `font-lock-string-face', `font-lock-comment-face', and
  4723. others. The easiest way to find them all is to use `M-x
  4724. customize-group <RET> font-lock-faces <RET>'. You can then use that
  4725. customization buffer to customize the appearance of these faces. *Note
  4726. Face Customization::.
  4727. You can customize the variable `font-lock-maximum-decoration' to
  4728. alter the amount of fontification applied by Font Lock mode, for major
  4729. modes that support this feature. The value should be a number (with 1
  4730. representing a minimal amount of fontification; some modes support
  4731. levels as high as 3); or `t', meaning "as high as possible" (the
  4732. default). You can also specify different numbers for particular major
  4733. modes; for example, to use level 1 for C/C++ modes, and the default
  4734. level otherwise, use the value
  4735. '((c-mode . 1) (c++-mode . 1)))
  4736. Comment and string fontification (or "syntactic" fontification)
  4737. relies on analysis of the syntactic structure of the buffer text. For
  4738. the sake of speed, some modes, including Lisp mode, rely on a special
  4739. convention: an open-parenthesis or open-brace in the leftmost column
  4740. always defines the beginning of a defun, and is thus always outside any
  4741. string or comment. Therefore, you should avoid placing an
  4742. open-parenthesis or open-brace in the leftmost column, if it is inside
  4743. a string or comment. *Note Left Margin Paren::, for details.
  4744. The variable `font-lock-beginning-of-syntax-function', which is
  4745. always buffer-local, specifies how Font Lock mode can find a position
  4746. guaranteed to be outside any comment or string. In modes which use the
  4747. leftmost column parenthesis convention, the default value of the
  4748. variable is `beginning-of-defun'--that tells Font Lock mode to use the
  4749. convention. If you set this variable to `nil', Font Lock no longer
  4750. relies on the convention. This avoids incorrect results, but the price
  4751. is that, in some cases, fontification for a changed text must rescan
  4752. buffer text from the beginning of the buffer. This can considerably
  4753. slow down redisplay while scrolling, particularly if you are close to
  4754. the end of a large buffer.
  4755. Font Lock highlighting patterns already exist for most modes, but
  4756. you may want to fontify additional patterns. You can use the function
  4757. `font-lock-add-keywords', to add your own highlighting patterns for a
  4758. particular mode. For example, to highlight `FIXME:' words in C
  4759. comments, use this:
  4760. (add-hook 'c-mode-hook
  4761. (lambda ()
  4762. (font-lock-add-keywords nil
  4763. '(("\\<\\(FIXME\\):" 1
  4764. font-lock-warning-face t)))))
  4765. To remove keywords from the font-lock highlighting patterns, use the
  4766. function `font-lock-remove-keywords'. *Note Search-based
  4767. Fontification: (elisp)Search-based Fontification.
  4768. Fontifying large buffers can take a long time. To avoid large
  4769. delays when a file is visited, Emacs initially fontifies only the
  4770. visible portion of a buffer. As you scroll through the buffer, each
  4771. portion that becomes visible is fontified as soon as it is displayed;
  4772. this type of Font Lock is called "Just-In-Time" (or "JIT") Lock. You
  4773. can control how JIT Lock behaves, including telling it to perform
  4774. fontification while idle, by customizing variables in the customization
  4775. group `jit-lock'. *Note Specific Customization::.
  4776. 
  4777. File: emacs, Node: Highlight Interactively, Next: Fringes, Prev: Font Lock, Up: Display
  4778. 14.13 Interactive Highlighting
  4779. ==============================
  4780. Highlight Changes mode is a minor mode that "highlights" the parts of
  4781. the buffer that were changed most recently, by giving that text a
  4782. different face. To enable or disable Highlight Changes mode, use `M-x
  4783. highlight-changes-mode'.
  4784. Hi Lock mode is a minor mode that highlights text that matches
  4785. regular expressions you specify. For example, you can use it to
  4786. highlight all the references to a certain variable in a program source
  4787. file, highlight certain parts in a voluminous output of some program,
  4788. or highlight certain names in an article. To enable or disable Hi Lock
  4789. mode, use the command `M-x hi-lock-mode'. To enable Hi Lock mode for
  4790. all buffers, use `M-x global-hi-lock-mode' or place
  4791. `(global-hi-lock-mode 1)' in your `.emacs' file.
  4792. Hi Lock mode works like Font Lock mode (*note Font Lock::), except
  4793. that you specify explicitly the regular expressions to highlight. You
  4794. control them with these commands:
  4795. `C-x w h REGEXP <RET> FACE <RET>'
  4796. Highlight text that matches REGEXP using face FACE
  4797. (`highlight-regexp'). The highlighting will remain as long as the
  4798. buffer is loaded. For example, to highlight all occurrences of
  4799. the word "whim" using the default face (a yellow background) `C-x
  4800. w h whim <RET> <RET>'. Any face can be used for highlighting, Hi
  4801. Lock provides several of its own and these are pre-loaded into a
  4802. list of default values. While being prompted for a face use `M-n'
  4803. and `M-p' to cycle through them.
  4804. You can use this command multiple times, specifying various regular
  4805. expressions to highlight in different ways.
  4806. `C-x w r REGEXP <RET>'
  4807. Unhighlight REGEXP (`unhighlight-regexp').
  4808. If you invoke this from the menu, you select the expression to
  4809. unhighlight from a list. If you invoke this from the keyboard, you
  4810. use the minibuffer. It will show the most recently added regular
  4811. expression; use `M-p' to show the next older expression and `M-n'
  4812. to select the next newer expression. (You can also type the
  4813. expression by hand, with completion.) When the expression you
  4814. want to unhighlight appears in the minibuffer, press `<RET>' to
  4815. exit the minibuffer and unhighlight it.
  4816. `C-x w l REGEXP <RET> FACE <RET>'
  4817. Highlight entire lines containing a match for REGEXP, using face
  4818. FACE (`highlight-lines-matching-regexp').
  4819. `C-x w b'
  4820. Insert all the current highlighting regexp/face pairs into the
  4821. buffer at point, with comment delimiters to prevent them from
  4822. changing your program. (This key binding runs the
  4823. `hi-lock-write-interactive-patterns' command.)
  4824. These patterns are extracted from the comments, if appropriate, if
  4825. you invoke `M-x hi-lock-find-patterns', or if you visit the file
  4826. while Hi Lock mode is enabled (since that runs
  4827. `hi-lock-find-patterns').
  4828. `C-x w i'
  4829. Extract regexp/face pairs from comments in the current buffer
  4830. (`hi-lock-find-patterns'). Thus, you can enter patterns
  4831. interactively with `highlight-regexp', store them into the file
  4832. with `hi-lock-write-interactive-patterns', edit them (perhaps
  4833. including different faces for different parenthesized parts of the
  4834. match), and finally use this command (`hi-lock-find-patterns') to
  4835. have Hi Lock highlight the edited patterns.
  4836. The variable `hi-lock-file-patterns-policy' controls whether Hi
  4837. Lock mode should automatically extract and highlight patterns
  4838. found in a file when it is visited. Its value can be `nil' (never
  4839. highlight), `ask' (query the user), or a function. If it is a
  4840. function, `hi-lock-find-patterns' calls it with the patterns as
  4841. argument; if the function returns non-`nil', the patterns are
  4842. used. The default is `ask'. Note that patterns are always
  4843. highlighted if you call `hi-lock-find-patterns' directly,
  4844. regardless of the value of this variable.
  4845. Also, `hi-lock-find-patterns' does nothing if the current major
  4846. mode's symbol is a member of the list `hi-lock-exclude-modes'.
  4847. 
  4848. File: emacs, Node: Fringes, Next: Displaying Boundaries, Prev: Highlight Interactively, Up: Display
  4849. 14.14 Window Fringes
  4850. ====================
  4851. On graphical displays, each Emacs window normally has narrow "fringes"
  4852. on the left and right edges. The fringes are used to display symbols
  4853. that provide information about the text in the window. You can type
  4854. `M-x fringe-mode' to disable the fringes, or modify their width. This
  4855. command affects fringes in all frames; to modify fringes on the
  4856. selected frame only, use `M-x set-fringe-style'.
  4857. The most common use of the fringes is to indicate a continuation
  4858. line (*note Continuation Lines::). When one line of text is split into
  4859. multiple screen lines, the left fringe shows a curving arrow for each
  4860. screen line except the first, indicating that "this is not the real
  4861. beginning". The right fringe shows a curving arrow for each screen
  4862. line except the last, indicating that "this is not the real end". If
  4863. the line's direction is right-to-left (*note Bidirectional Editing::),
  4864. the meanings of the curving arrows in the fringes are swapped.
  4865. The fringes indicate line truncation with short horizontal arrows
  4866. meaning "there's more text on this line which is scrolled horizontally
  4867. out of view". Clicking the mouse on one of the arrows scrolls the
  4868. display horizontally in the direction of the arrow.
  4869. The fringes can also indicate other things, such as buffer
  4870. boundaries (*note Displaying Boundaries::), and where a program you are
  4871. debugging is executing (*note Debuggers::).
  4872. The fringe is also used for drawing the cursor, if the current line
  4873. is exactly as wide as the window and point is at the end of the line.
  4874. To disable this, change the variable `overflow-newline-into-fringe' to
  4875. `nil'; this causes Emacs to continue or truncate lines that are exactly
  4876. as wide as the window.
  4877. 
  4878. File: emacs, Node: Displaying Boundaries, Next: Useless Whitespace, Prev: Fringes, Up: Display
  4879. 14.15 Displaying Boundaries
  4880. ===========================
  4881. On graphical displays, Emacs can indicate the buffer boundaries in the
  4882. fringes. If you enable this feature, the first line and the last line
  4883. are marked with angle images in the fringes. This can be combined with
  4884. up and down arrow images which say whether it is possible to scroll the
  4885. window.
  4886. The buffer-local variable `indicate-buffer-boundaries' controls how
  4887. the buffer boundaries and window scrolling is indicated in the fringes.
  4888. If the value is `left' or `right', both angle and arrow bitmaps are
  4889. displayed in the left or right fringe, respectively.
  4890. If value is an alist, each element `(INDICATOR . POSITION)'
  4891. specifies the position of one of the indicators. The INDICATOR must be
  4892. one of `top', `bottom', `up', `down', or `t' which specifies the default
  4893. position for the indicators not present in the alist. The POSITION is
  4894. one of `left', `right', or `nil' which specifies not to show this
  4895. indicator.
  4896. For example, `((top . left) (t . right))' places the top angle
  4897. bitmap in left fringe, the bottom angle bitmap in right fringe, and
  4898. both arrow bitmaps in right fringe. To show just the angle bitmaps in
  4899. the left fringe, but no arrow bitmaps, use `((top . left) (bottom .
  4900. left))'.
  4901. 
  4902. File: emacs, Node: Useless Whitespace, Next: Selective Display, Prev: Displaying Boundaries, Up: Display
  4903. 14.16 Useless Whitespace
  4904. ========================
  4905. It is easy to leave unnecessary spaces at the end of a line, or empty
  4906. lines at the end of a file, without realizing it. In most cases, this
  4907. "trailing whitespace" has no effect, but there are special
  4908. circumstances where it matters, and it can be a nuisance.
  4909. You can make trailing whitespace at the end of a line visible by
  4910. setting the buffer-local variable `show-trailing-whitespace' to `t'.
  4911. Then Emacs displays trailing whitespace, using the face
  4912. `trailing-whitespace'.
  4913. This feature does not apply when point is at the end of the line
  4914. containing the whitespace. Strictly speaking, that is "trailing
  4915. whitespace" nonetheless, but displaying it specially in that case looks
  4916. ugly while you are typing in new text. In this special case, the
  4917. location of point is enough to show you that the spaces are present.
  4918. Type `M-x delete-trailing-whitespace' to delete all trailing
  4919. whitespace within the buffer. If the region is active, it deletes all
  4920. trailing whitespace in the region instead.
  4921. On graphical displays, Emacs can indicate unused lines at the end of
  4922. the window with a small image in the left fringe (*note Fringes::).
  4923. The image appears for screen lines that do not correspond to any buffer
  4924. text, so blank lines at the end of the buffer stand out because they
  4925. lack this image. To enable this feature, set the buffer-local variable
  4926. `indicate-empty-lines' to a non-`nil' value. You can enable or disable
  4927. this feature for all new buffers by setting the default value of this
  4928. variable, e.g. `(setq-default indicate-empty-lines t)'.
  4929. Whitespace mode is a buffer-local minor mode that lets you
  4930. "visualize" many kinds of whitespace in the buffer, by either drawing
  4931. the whitespace characters with a special face or displaying them as
  4932. special glyphs. To toggle this mode, type `M-x whitespace-mode'. The
  4933. kinds of whitespace visualized are determined by the list variable
  4934. `whitespace-style'. Here is a partial list of possible elements (see
  4935. the variable's documentation for the full list):
  4936. `face'
  4937. Enable all visualizations which use special faces. This element
  4938. has a special meaning: if it is absent from the list, none of the
  4939. other visualizations take effect except `space-mark', `tab-mark',
  4940. and `newline-mark'.
  4941. `trailing'
  4942. Highlight trailing whitespace.
  4943. `tabs'
  4944. Highlight tab characters.
  4945. `spaces'
  4946. Highlight space and non-breaking space characters.
  4947. `lines'
  4948. Highlight lines longer than 80 lines. To change the column limit,
  4949. customize the variable `whitespace-line-column'.
  4950. `newline'
  4951. Highlight newlines.
  4952. `empty'
  4953. Highlight empty lines.
  4954. `space-mark'
  4955. Draw space and non-breaking characters with a special glyph.
  4956. `tab-mark'
  4957. Draw tab characters with a special glyph.
  4958. `newline-mark'
  4959. Draw newline characters with a special glyph.
  4960. 
  4961. File: emacs, Node: Selective Display, Next: Optional Mode Line, Prev: Useless Whitespace, Up: Display
  4962. 14.17 Selective Display
  4963. =======================
  4964. Emacs has the ability to hide lines indented more than a given number
  4965. of columns. You can use this to get an overview of a part of a program.
  4966. To hide lines in the current buffer, type `C-x $'
  4967. (`set-selective-display') with a numeric argument N. Then lines with
  4968. at least N columns of indentation disappear from the screen. The only
  4969. indication of their presence is that three dots (`...') appear at the
  4970. end of each visible line that is followed by one or more hidden ones.
  4971. The commands `C-n' and `C-p' move across the hidden lines as if they
  4972. were not there.
  4973. The hidden lines are still present in the buffer, and most editing
  4974. commands see them as usual, so you may find point in the middle of the
  4975. hidden text. When this happens, the cursor appears at the end of the
  4976. previous line, after the three dots. If point is at the end of the
  4977. visible line, before the newline that ends it, the cursor appears before
  4978. the three dots.
  4979. To make all lines visible again, type `C-x $' with no argument.
  4980. If you set the variable `selective-display-ellipses' to `nil', the
  4981. three dots do not appear at the end of a line that precedes hidden
  4982. lines. Then there is no visible indication of the hidden lines. This
  4983. variable becomes local automatically when set.
  4984. See also *note Outline Mode:: for another way to hide part of the
  4985. text in a buffer.
  4986. 
  4987. File: emacs, Node: Optional Mode Line, Next: Text Display, Prev: Selective Display, Up: Display
  4988. 14.18 Optional Mode Line Features
  4989. =================================
  4990. The buffer percentage POS indicates the percentage of the buffer above
  4991. the top of the window. You can additionally display the size of the
  4992. buffer by typing `M-x size-indication-mode' to turn on Size Indication
  4993. mode. The size will be displayed immediately following the buffer
  4994. percentage like this:
  4995. POS of SIZE
  4996. Here SIZE is the human readable representation of the number of
  4997. characters in the buffer, which means that `k' for 10^3, `M' for 10^6,
  4998. `G' for 10^9, etc., are used to abbreviate.
  4999. The current line number of point appears in the mode line when Line
  5000. Number mode is enabled. Use the command `M-x line-number-mode' to turn
  5001. this mode on and off; normally it is on. The line number appears after
  5002. the buffer percentage POS, with the letter `L' to indicate what it is.
  5003. Similarly, you can display the current column number by turning on
  5004. Column number mode with `M-x column-number-mode'. The column number is
  5005. indicated by the letter `C'. However, when both of these modes are
  5006. enabled, the line and column numbers are displayed in parentheses, the
  5007. line number first, rather than with `L' and `C'. For example:
  5008. `(561,2)'. *Note Minor Modes::, for more information about minor modes
  5009. and about how to use these commands.
  5010. If you have narrowed the buffer (*note Narrowing::), the displayed
  5011. line number is relative to the accessible portion of the buffer. Thus,
  5012. it isn't suitable as an argument to `goto-line'. (Use `what-line'
  5013. command to see the line number relative to the whole file.)
  5014. If the buffer is very large (larger than the value of
  5015. `line-number-display-limit'), Emacs won't compute the line number,
  5016. because that would be too slow; therefore, the line number won't appear
  5017. on the mode-line. To remove this limit, set
  5018. `line-number-display-limit' to `nil'.
  5019. Line-number computation can also be slow if the lines in the buffer
  5020. are too long. For this reason, Emacs doesn't display line numbers if
  5021. the average width, in characters, of lines near point is larger than
  5022. the value of `line-number-display-limit-width'. The default value is
  5023. 200 characters.
  5024. Emacs can optionally display the time and system load in all mode
  5025. lines. To enable this feature, type `M-x display-time' or customize
  5026. the option `display-time-mode'. The information added to the mode line
  5027. looks like this:
  5028. HH:MMpm L.LL
  5029. Here HH and MM are the hour and minute, followed always by `am' or
  5030. `pm'. L.LL is the average number, collected for the last few minutes,
  5031. of processes in the whole system that were either running or ready to
  5032. run (i.e. were waiting for an available processor). (Some fields may
  5033. be missing if your operating system cannot support them.) If you
  5034. prefer time display in 24-hour format, set the variable
  5035. `display-time-24hr-format' to `t'.
  5036. The word `Mail' appears after the load level if there is mail for
  5037. you that you have not read yet. On graphical displays, you can use an
  5038. icon instead of `Mail' by customizing `display-time-use-mail-icon';
  5039. this may save some space on the mode line. You can customize
  5040. `display-time-mail-face' to make the mail indicator prominent. Use
  5041. `display-time-mail-file' to specify the mail file to check, or set
  5042. `display-time-mail-directory' to specify the directory to check for
  5043. incoming mail (any nonempty regular file in the directory is considered
  5044. as "newly arrived mail").
  5045. When running Emacs on a laptop computer, you can display the battery
  5046. charge on the mode-line, by using the command `display-battery-mode' or
  5047. customizing the variable `display-battery-mode'. The variable
  5048. `battery-mode-line-format' determines the way the battery charge is
  5049. displayed; the exact mode-line message depends on the operating system,
  5050. and it usually shows the current battery charge as a percentage of the
  5051. total charge.
  5052. On graphical displays, the mode line is drawn as a 3D box. If you
  5053. don't like this effect, you can disable it by customizing the
  5054. `mode-line' face and setting its `box' attribute to `nil'. *Note Face
  5055. Customization::.
  5056. By default, the mode line of nonselected windows is displayed in a
  5057. different face, called `mode-line-inactive'. Only the selected window
  5058. is displayed in the `mode-line' face. This helps show which window is
  5059. selected. When the minibuffer is selected, since it has no mode line,
  5060. the window from which you activated the minibuffer has its mode line
  5061. displayed using `mode-line'; as a result, ordinary entry to the
  5062. minibuffer does not change any mode lines.
  5063. You can disable use of `mode-line-inactive' by setting variable
  5064. `mode-line-in-non-selected-windows' to `nil'; then all mode lines are
  5065. displayed in the `mode-line' face.
  5066. You can customize the mode line display for each of the end-of-line
  5067. formats by setting each of the variables `eol-mnemonic-unix',
  5068. `eol-mnemonic-dos', `eol-mnemonic-mac', and `eol-mnemonic-undecided' to
  5069. the strings you prefer.
  5070. 
  5071. File: emacs, Node: Text Display, Next: Cursor Display, Prev: Optional Mode Line, Up: Display
  5072. 14.19 How Text Is Displayed
  5073. ===========================
  5074. Most characters are "printing characters": when they appear in a
  5075. buffer, they are displayed literally on the screen. Printing
  5076. characters include ASCII numbers, letters, and punctuation characters,
  5077. as well as many non-ASCII characters.
  5078. The ASCII character set contains non-printing "control characters".
  5079. Two of these are displayed specially: the newline character (Unicode
  5080. code point `U+000A') is displayed by starting a new line, while the tab
  5081. character (`U+0009') is displayed as a space that extends to the next
  5082. tab stop column (normally every 8 columns). The number of spaces per
  5083. tab is controlled by the buffer-local variable `tab-width', which must
  5084. have an integer value between 1 and 1000, inclusive. Note that how the
  5085. tab character in the buffer is displayed has nothing to do with the
  5086. definition of <TAB> as a command.
  5087. Other ASCII control characters, whose codes are below `U+0020'
  5088. (octal 40, decimal 32), are displayed as a caret (`^') followed by the
  5089. non-control version of the character, with the `escape-glyph' face.
  5090. For instance, the `control-A' character, `U+0001', is displayed as `^A'.
  5091. The raw bytes with codes `U+0080' (octal 200) through `U+009F'
  5092. (octal 237) are displayed as "octal escape sequences", with the
  5093. `escape-glyph' face. For instance, character code `U+0098' (octal 230)
  5094. is displayed as `\230'. If you change the buffer-local variable
  5095. `ctl-arrow' to `nil', the ASCII control characters are also displayed
  5096. as octal escape sequences instead of caret escape sequences.
  5097. Some non-ASCII characters have the same appearance as an ASCII space
  5098. or hyphen (minus) character. Such characters can cause problems if
  5099. they are entered into a buffer without your realization, e.g. by
  5100. yanking; for instance, source code compilers typically do not treat
  5101. non-ASCII spaces as whitespace characters. To deal with this problem,
  5102. Emacs displays such characters specially: it displays `U+00A0'
  5103. (no-break space) with the `nobreak-space' face, and it displays
  5104. `U+00AD' (soft hyphen), `U+2010' (hyphen), and `U+2011' (non-breaking
  5105. hyphen) with the `escape-glyph' face. To disable this, change the
  5106. variable `nobreak-char-display' to `nil'. If you give this variable a
  5107. non-`nil' and non-`t' value, Emacs instead displays such characters as
  5108. a highlighted backslash followed by a space or hyphen.
  5109. You can customize the way any particular character code is displayed
  5110. by means of a display table. *Note Display Tables: (elisp)Display
  5111. Tables.
  5112. On graphical displays, some characters may have no glyphs in any of
  5113. the fonts available to Emacs. These "glyphless characters" are
  5114. normally displayed as boxes containing the hexadecimal character code.
  5115. Similarly, on text terminals, characters that cannot be displayed using
  5116. the terminal encoding (*note Terminal Coding::) are normally displayed
  5117. as question signs. You can control the display method by customizing
  5118. the variable `glyphless-char-display-control'. *Note Glyphless
  5119. Character Display: (elisp)Glyphless Chars, for details.
  5120. 
  5121. File: emacs, Node: Cursor Display, Next: Line Truncation, Prev: Text Display, Up: Display
  5122. 14.20 Displaying the Cursor
  5123. ===========================
  5124. On a text terminal, the cursor's appearance is controlled by the
  5125. terminal, largely out of the control of Emacs. Some terminals offer
  5126. two different cursors: a "visible" static cursor, and a "very visible"
  5127. blinking cursor. By default, Emacs uses the very visible cursor, and
  5128. switches to it when you start or resume Emacs. If the variable
  5129. `visible-cursor' is `nil' when Emacs starts or resumes, it uses the
  5130. normal cursor.
  5131. On a graphical display, many more properties of the text cursor can
  5132. be altered. To customize its color, change the `:background' attribute
  5133. of the face named `cursor' (*note Face Customization::). (The other
  5134. attributes of this face have no effect; the text shown under the cursor
  5135. is drawn using the frame's background color.) To change its shape,
  5136. customize the buffer-local variable `cursor-type'; possible values are
  5137. `box' (the default), `hollow' (a hollow box), `bar' (a vertical bar),
  5138. `(bar . N)' (a vertical bar N pixels wide), `hbar' (a horizontal bar),
  5139. `(hbar . N)' (a horizontal bar N pixels tall), or `nil' (no cursor at
  5140. all).
  5141. To disable cursor blinking, change the variable `blink-cursor-mode'
  5142. to `nil' (*note Easy Customization::), or add the line
  5143. `(blink-cursor-mode 0)' to your init file. Alternatively, you can
  5144. change how the cursor looks when it "blinks off" by customizing the
  5145. list variable `blink-cursor-alist'. Each element in the list should
  5146. have the form `(ON-TYPE . OFF-TYPE)'; this means that if the cursor is
  5147. displayed as ON-TYPE when it blinks on (where ON-TYPE is one of the
  5148. cursor types described above), then it is displayed as OFF-TYPE when it
  5149. blinks off.
  5150. Some characters, such as tab characters, are "extra wide". When the
  5151. cursor is positioned over such a character, it is normally drawn with
  5152. the default character width. You can make the cursor stretch to cover
  5153. wide characters, by changing the variable `x-stretch-cursor' to a
  5154. non-`nil' value.
  5155. The cursor normally appears in non-selected windows as a
  5156. non-blinking hollow box. (For a bar cursor, it instead appears as a
  5157. thinner bar.) To turn off cursors in non-selected windows, change the
  5158. variable `cursor-in-non-selected-windows' to `nil'.
  5159. To make the cursor even more visible, you can use HL Line mode, a
  5160. minor mode that highlights the line containing point. Use `M-x
  5161. hl-line-mode' to enable or disable it in the current buffer. `M-x
  5162. global-hl-line-mode' enables or disables the same mode globally.
  5163. 
  5164. File: emacs, Node: Line Truncation, Next: Visual Line Mode, Prev: Cursor Display, Up: Display
  5165. 14.21 Line Truncation
  5166. =====================
  5167. As an alternative to continuation (*note Continuation Lines::), Emacs
  5168. can display long lines by "truncation". This means that all the
  5169. characters that do not fit in the width of the screen or window do not
  5170. appear at all. On graphical displays, a small straight arrow in the
  5171. fringe indicates truncation at either end of the line. On text
  5172. terminals, this is indicated with `$' signs in the leftmost and/or
  5173. rightmost columns.
  5174. Horizontal scrolling automatically causes line truncation (*note
  5175. Horizontal Scrolling::). You can explicitly enable line truncation for
  5176. a particular buffer with the command `M-x toggle-truncate-lines'. This
  5177. works by locally changing the variable `truncate-lines'. If that
  5178. variable is non-`nil', long lines are truncated; if it is `nil', they
  5179. are continued onto multiple screen lines. Setting the variable
  5180. `truncate-lines' in any way makes it local to the current buffer; until
  5181. that time, the default value, which is normally `nil', is in effect.
  5182. If a split window becomes too narrow, Emacs may automatically enable
  5183. line truncation. *Note Split Window::, for the variable
  5184. `truncate-partial-width-windows' which controls this.
  5185. 
  5186. File: emacs, Node: Visual Line Mode, Next: Display Custom, Prev: Line Truncation, Up: Display
  5187. 14.22 Visual Line Mode
  5188. ======================
  5189. Another alternative to ordinary line continuation is to use "word
  5190. wrap". Here, each long logical line is divided into two or more screen
  5191. lines, like in ordinary line continuation. However, Emacs attempts to
  5192. wrap the line at word boundaries near the right window edge. This
  5193. makes the text easier to read, as wrapping does not occur in the middle
  5194. of words.
  5195. Word wrap is enabled by Visual Line mode, an optional minor mode.
  5196. To turn on Visual Line mode in the current buffer, type `M-x
  5197. visual-line-mode'; repeating this command turns it off. You can also
  5198. turn on Visual Line mode using the menu bar: in the Options menu,
  5199. select the `Line Wrapping in this Buffer' submenu, followed by the
  5200. `Word Wrap (Visual Line Mode)' menu item. While Visual Line mode is
  5201. enabled, the mode-line shows the string `wrap' in the mode display.
  5202. The command `M-x global-visual-line-mode' toggles Visual Line mode in
  5203. all buffers.
  5204. In Visual Line mode, some editing commands work on screen lines
  5205. instead of logical lines: `C-a' (`beginning-of-visual-line') moves to
  5206. the beginning of the screen line, `C-e' (`end-of-visual-line') moves to
  5207. the end of the screen line, and `C-k' (`kill-visual-line') kills text
  5208. to the end of the screen line.
  5209. To move by logical lines, use the commands `M-x next-logical-line'
  5210. and `M-x previous-logical-line'. These move point to the next logical
  5211. line and the previous logical line respectively, regardless of whether
  5212. Visual Line mode is enabled. If you use these commands frequently, it
  5213. may be convenient to assign key bindings to them. *Note Init
  5214. Rebinding::.
  5215. By default, word-wrapped lines do not display fringe indicators.
  5216. Visual Line mode is often used to edit files that contain many long
  5217. logical lines, so having a fringe indicator for each wrapped line would
  5218. be visually distracting. You can change this by customizing the
  5219. variable `visual-line-fringe-indicators'.
  5220. 
  5221. File: emacs, Node: Display Custom, Prev: Visual Line Mode, Up: Display
  5222. 14.23 Customization of Display
  5223. ==============================
  5224. This section describes variables that control miscellaneous aspects of
  5225. the appearance of the Emacs screen. Beginning users can skip it.
  5226. If the variable `visible-bell' is non-`nil', Emacs attempts to make
  5227. the whole screen blink when it would normally make an audible bell
  5228. sound. This variable has no effect if your terminal does not have a way
  5229. to make the screen blink.
  5230. The variable `echo-keystrokes' controls the echoing of
  5231. multi-character keys; its value is the number of seconds of pause
  5232. required to cause echoing to start, or zero, meaning don't echo at all.
  5233. The value takes effect when there is something to echo. *Note Echo
  5234. Area::.
  5235. On graphical displays, Emacs displays the mouse pointer as an
  5236. hourglass if Emacs is busy. To disable this feature, set the variable
  5237. `display-hourglass' to `nil'. The variable `hourglass-delay'
  5238. determines the number of seconds of "busy time" before the hourglass is
  5239. shown; the default is 1.
  5240. If the mouse pointer lies inside an Emacs frame, Emacs makes it
  5241. invisible each time you type a character to insert text, to prevent it
  5242. from obscuring the text. (To be precise, the hiding occurs when you
  5243. type a "self-inserting" character. *Note Inserting Text::.) Moving
  5244. the mouse pointer makes it visible again. To disable this feature, set
  5245. the variable `make-pointer-invisible' to `nil'.
  5246. On graphical displays, the variable `underline-minimum-offset'
  5247. determines the minimum distance between the baseline and underline, in
  5248. pixels, for underlined text. By default, the value is 1; increasing it
  5249. may improve the legibility of underlined text for certain fonts.
  5250. (However, Emacs will never draw the underline below the current line
  5251. area.) The variable `x-underline-at-descent-line' determines how to
  5252. draw underlined text. The default is `nil', which means to draw it at
  5253. the baseline level of the font; if you change it to `nil', Emacs draws
  5254. the underline at the same height as the font's descent line.
  5255. The variable `overline-margin' specifies the vertical position of an
  5256. overline above the text, including the height of the overline itself,
  5257. in pixels; the default is 2.
  5258. On some text terminals, bold face and inverse video together result
  5259. in text that is hard to read. Call the function
  5260. `tty-suppress-bold-inverse-default-colors' with a non-`nil' argument to
  5261. suppress the effect of bold-face in this case.
  5262. 
  5263. File: emacs, Node: Search, Next: Fixit, Prev: Display, Up: Top
  5264. 15 Searching and Replacement
  5265. ****************************
  5266. Like other editors, Emacs has commands to search for occurrences of a
  5267. string. Emacs also has commands to replace occurrences of a string
  5268. with a different string. There are also commands that do the same
  5269. thing, but search for patterns instead of fixed strings.
  5270. You can also search multiple files under the control of a tags table
  5271. (*note Tags Search::) or through the Dired `A' command (*note Operating
  5272. on Files::), or ask the `grep' program to do it (*note Grep
  5273. Searching::).
  5274. * Menu:
  5275. * Incremental Search:: Search happens as you type the string.
  5276. * Nonincremental Search:: Specify entire string and then search.
  5277. * Word Search:: Search for sequence of words.
  5278. * Regexp Search:: Search for match for a regexp.
  5279. * Regexps:: Syntax of regular expressions.
  5280. * Regexp Backslash:: Regular expression constructs starting with `\'.
  5281. * Regexp Example:: A complex regular expression explained.
  5282. * Search Case:: To ignore case while searching, or not.
  5283. * Replace:: Search, and replace some or all matches.
  5284. * Other Repeating Search:: Operating on all matches for some regexp.
  5285. 
  5286. File: emacs, Node: Incremental Search, Next: Nonincremental Search, Up: Search
  5287. 15.1 Incremental Search
  5288. =======================
  5289. The principal search command in Emacs is "incremental": it begins
  5290. searching as soon as you type the first character of the search string.
  5291. As you type in the search string, Emacs shows you where the string (as
  5292. you have typed it so far) would be found. When you have typed enough
  5293. characters to identify the place you want, you can stop. Depending on
  5294. what you plan to do next, you may or may not need to terminate the
  5295. search explicitly with <RET>.
  5296. `C-s'
  5297. Incremental search forward (`isearch-forward').
  5298. `C-r'
  5299. Incremental search backward (`isearch-backward').
  5300. * Menu:
  5301. * Basic Isearch:: Basic incremental search commands.
  5302. * Repeat Isearch:: Searching for the same string again.
  5303. * Error in Isearch:: When your string is not found.
  5304. * Special Isearch:: Special input in incremental search.
  5305. * Isearch Yank:: Commands that grab text into the search string
  5306. or else edit the search string.
  5307. * Isearch Scroll:: Scrolling during an incremental search.
  5308. * Isearch Minibuffer:: Incremental search of the minibuffer history.
  5309. 
  5310. Local Variables:
  5311. coding: iso-8859-1
  5312. End: