elisp-10 274 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585
  1. This is /home/cyd/emacs/doc/lispref/../../info/elisp, produced by
  2. makeinfo version 4.13 from /home/cyd/emacs/doc/lispref/elisp.texi.
  3. This is the `GNU Emacs Lisp Reference Manual' corresponding to Emacs
  4. version 24.2.
  5. Copyright (C) 1990-1996, 1998-2012 Free Software Foundation, Inc.
  6. Permission is granted to copy, distribute and/or modify this
  7. document under the terms of the GNU Free Documentation License,
  8. Version 1.3 or any later version published by the Free Software
  9. Foundation; with the Invariant Sections being "GNU General Public
  10. License," with the Front-Cover texts being "A GNU Manual," and
  11. with the Back-Cover Texts as in (a) below. A copy of the license
  12. is included in the section entitled "GNU Free Documentation
  13. License."
  14. (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
  15. modify this GNU manual. Buying copies from the FSF supports it in
  16. developing GNU and promoting software freedom."
  17. INFO-DIR-SECTION GNU Emacs Lisp
  18. START-INFO-DIR-ENTRY
  19. * Elisp: (elisp). The Emacs Lisp Reference Manual.
  20. END-INFO-DIR-ENTRY
  21. 
  22. File: elisp, Node: Startup Summary, Next: Init File, Up: Starting Up
  23. 39.1.1 Summary: Sequence of Actions at Startup
  24. ----------------------------------------------
  25. When Emacs is started up, it performs the following operations (see
  26. `normal-top-level' in `startup.el'):
  27. 1. It adds subdirectories to `load-path', by running the file named
  28. `subdirs.el' in each directory in the list. Normally, this file
  29. adds the directory's subdirectories to the list, and those are
  30. scanned in their turn. The files `subdirs.el' are normally
  31. generated automatically when Emacs is installed.
  32. 2. It registers input methods by loading any `leim-list.el' file
  33. found in the `load-path'.
  34. 3. It sets the variable `before-init-time' to the value of
  35. `current-time' (*note Time of Day::). It also sets
  36. `after-init-time' to `nil', which signals to Lisp programs that
  37. Emacs is being initialized.
  38. 4. It sets the language environment and the terminal coding system,
  39. if requested by environment variables such as `LANG'.
  40. 5. It does some basic parsing of the command-line arguments.
  41. 6. If not running in batch mode, it initializes the window system that
  42. the variable `initial-window-system' specifies (*note
  43. initial-window-system: Window Systems.). The initialization
  44. function for each supported window system is specified by
  45. `window-system-initialization-alist'. If the value of
  46. `initial-window-system' is WINDOWSYSTEM, then the appropriate
  47. initialization function is defined in the file
  48. `term/WINDOWSYSTEM-win.el'. This file should have been compiled
  49. into the Emacs executable when it was built.
  50. 7. It runs the normal hook `before-init-hook'.
  51. 8. If appropriate, it creates a graphical frame. This is not done if
  52. the options `--batch' or `--daemon' were specified.
  53. 9. It initializes the initial frame's faces, and sets up the menu bar
  54. and tool bar if needed. If graphical frames are supported, it
  55. sets up the tool bar even if the current frame is not a graphical
  56. one, since a graphical frame may be created later on.
  57. 10. It use `custom-reevaluate-setting' to re-initialize the members of
  58. the list `custom-delayed-init-variables'. These are any
  59. pre-loaded user options whose default value depends on the
  60. run-time, rather than build-time, context. *Note
  61. custom-initialize-delay: Building Emacs.
  62. 11. It loads the library `site-start', if it exists. This is not done
  63. if the options `-Q' or `--no-site-file' were specified.
  64. 12. It loads your init file (*note Init File::). This is not done if
  65. the options `-q', `-Q', or `--batch' were specified. If the `-u'
  66. option was specified, Emacs looks for the init file in that user's
  67. home directory instead.
  68. 13. It loads the library `default', if it exists. This is not done if
  69. `inhibit-default-init' is non-`nil', nor if the options `-q',
  70. `-Q', or `--batch' were specified.
  71. 14. It loads your abbrevs from the file specified by
  72. `abbrev-file-name', if that file exists and can be read (*note
  73. abbrev-file-name: Abbrev Files.). This is not done if the option
  74. `--batch' was specified.
  75. 15. If `package-enable-at-startup' is non-`nil', it calls the function
  76. `package-initialize' to activate any optional Emacs Lisp package
  77. that has been installed. *Note Packaging Basics::.
  78. 16. It sets the variable `after-init-time' to the value of
  79. `current-time'. This variable was set to `nil' earlier; setting
  80. it to the current time signals that the initialization phase is
  81. over, and, together with `before-init-time', provides the
  82. measurement of how long it took.
  83. 17. It runs the normal hook `after-init-hook'.
  84. 18. If the buffer `*scratch*' exists and is still in Fundamental mode
  85. (as it should be by default), it sets its major mode according to
  86. `initial-major-mode'.
  87. 19. If started on a text terminal, it loads the terminal-specific Lisp
  88. library, which is specified by the variable `term-file-prefix'
  89. (*note Terminal-Specific::). This is not done in `--batch' mode,
  90. nor if `term-file-prefix' is `nil'.
  91. 20. It displays the initial echo area message, unless you have
  92. suppressed that with `inhibit-startup-echo-area-message'.
  93. 21. It processes any command-line options that were not handled
  94. earlier.
  95. 22. It now exits if the option `--batch' was specified.
  96. 23. If `initial-buffer-choice' is a string, it visits the file with
  97. that name. If the `*scratch*' buffer exists and is empty, it
  98. inserts `initial-scratch-message' into that buffer.
  99. 24. It runs `emacs-startup-hook' and then `term-setup-hook'.
  100. 25. It calls `frame-notice-user-settings', which modifies the
  101. parameters of the selected frame according to whatever the init
  102. files specify.
  103. 26. It runs `window-setup-hook'. *Note Window Systems::.
  104. 27. It displays the "startup screen", which is a special buffer that
  105. contains information about copyleft and basic Emacs usage. This is
  106. not done if `inhibit-startup-screen' or `initial-buffer-choice'
  107. are non-`nil', or if the `--no-splash' or `-Q' command-line
  108. options were specified.
  109. 28. If the option `--daemon' was specified, it calls `server-start'
  110. and detaches from the controlling terminal. *Note Emacs Server:
  111. (emacs)Emacs Server.
  112. 29. If started by the X session manager, it calls
  113. `emacs-session-restore' passing it as argument the ID of the
  114. previous session. *Note Session Management::.
  115. The following options affect some aspects of the startup sequence.
  116. -- User Option: inhibit-startup-screen
  117. This variable, if non-`nil', inhibits the startup screen. In that
  118. case, Emacs typically displays the `*scratch*' buffer; but see
  119. `initial-buffer-choice', below.
  120. Do not set this variable in the init file of a new user, or in a
  121. way that affects more than one user, as that would prevent new
  122. users from receiving information about copyleft and basic Emacs
  123. usage.
  124. `inhibit-startup-message' and `inhibit-splash-screen' are aliases
  125. for this variable.
  126. -- User Option: initial-buffer-choice
  127. If non-`nil', this variable is a string that specifies a file or
  128. directory for Emacs to display after starting up, instead of the
  129. startup screen.
  130. -- User Option: inhibit-startup-echo-area-message
  131. This variable controls the display of the startup echo area
  132. message. You can suppress the startup echo area message by adding
  133. text with this form to your init file:
  134. (setq inhibit-startup-echo-area-message
  135. "YOUR-LOGIN-NAME")
  136. Emacs explicitly checks for an expression as shown above in your
  137. init file; your login name must appear in the expression as a Lisp
  138. string constant. You can also use the Customize interface. Other
  139. methods of setting `inhibit-startup-echo-area-message' to the same
  140. value do not inhibit the startup message. This way, you can
  141. easily inhibit the message for yourself if you wish, but
  142. thoughtless copying of your init file will not inhibit the message
  143. for someone else.
  144. -- User Option: initial-scratch-message
  145. This variable, if non-`nil', should be a string, which is inserted
  146. into the `*scratch*' buffer when Emacs starts up. If it is `nil',
  147. the `*scratch*' buffer is empty.
  148. The following command-line options affect some aspects of the startup
  149. sequence. *Note Initial Options: (emacs)Initial Options.
  150. `--no-splash'
  151. Do not display a splash screen.
  152. `--batch'
  153. Run without an interactive terminal. *Note Batch Mode::.
  154. `--daemon'
  155. Do not initialize any display; just start a server in the
  156. background.
  157. `--no-init-file'
  158. `-Q'
  159. Do not load either the init file, or the `default' library.
  160. `--no-site-file'
  161. Do not load the `site-start' library.
  162. `--quick'
  163. `-Q'
  164. Equivalent to `-q --no-site-file --no-splash'.
  165. 
  166. File: elisp, Node: Init File, Next: Terminal-Specific, Prev: Startup Summary, Up: Starting Up
  167. 39.1.2 The Init File
  168. --------------------
  169. When you start Emacs, it normally attempts to load your "init file".
  170. This is either a file named `.emacs' or `.emacs.el' in your home
  171. directory, or a file named `init.el' in a subdirectory named `.emacs.d'
  172. in your home directory.
  173. The command-line switches `-q', `-Q', and `-u' control whether and
  174. where to find the init file; `-q' (and the stronger `-Q') says not to
  175. load an init file, while `-u USER' says to load USER's init file
  176. instead of yours. *Note Entering Emacs: (emacs)Entering Emacs. If
  177. neither option is specified, Emacs uses the `LOGNAME' environment
  178. variable, or the `USER' (most systems) or `USERNAME' (MS systems)
  179. variable, to find your home directory and thus your init file; this
  180. way, even if you have su'd, Emacs still loads your own init file. If
  181. those environment variables are absent, though, Emacs uses your user-id
  182. to find your home directory.
  183. An Emacs installation may have a "default init file", which is a
  184. Lisp library named `default.el'. Emacs finds this file through the
  185. standard search path for libraries (*note How Programs Do Loading::).
  186. The Emacs distribution does not come with this file; it is intended for
  187. local customizations. If the default init file exists, it is loaded
  188. whenever you start Emacs. But your own personal init file, if any, is
  189. loaded first; if it sets `inhibit-default-init' to a non-`nil' value,
  190. then Emacs does not subsequently load the `default.el' file. In batch
  191. mode, or if you specify `-q' (or `-Q'), Emacs loads neither your
  192. personal init file nor the default init file.
  193. Another file for site-customization is `site-start.el'. Emacs loads
  194. this _before_ the user's init file. You can inhibit the loading of
  195. this file with the option `--no-site-file'.
  196. -- User Option: site-run-file
  197. This variable specifies the site-customization file to load before
  198. the user's init file. Its normal value is `"site-start"'. The
  199. only way you can change it with real effect is to do so before
  200. dumping Emacs.
  201. *Note Init File Examples: (emacs)Init Examples, for examples of how
  202. to make various commonly desired customizations in your `.emacs' file.
  203. -- User Option: inhibit-default-init
  204. If this variable is non-`nil', it prevents Emacs from loading the
  205. default initialization library file. The default value is `nil'.
  206. -- Variable: before-init-hook
  207. This normal hook is run, once, just before loading all the init
  208. files (`site-start.el', your init file, and `default.el'). (The
  209. only way to change it with real effect is before dumping Emacs.)
  210. -- Variable: after-init-hook
  211. This normal hook is run, once, just after loading all the init
  212. files (`site-start.el', your init file, and `default.el'), before
  213. loading the terminal-specific library (if started on a text
  214. terminal) and processing the command-line action arguments.
  215. -- Variable: emacs-startup-hook
  216. This normal hook is run, once, just after handling the command line
  217. arguments, just before `term-setup-hook'. In batch mode, Emacs
  218. does not run either of these hooks.
  219. -- Variable: user-init-file
  220. This variable holds the absolute file name of the user's init
  221. file. If the actual init file loaded is a compiled file, such as
  222. `.emacs.elc', the value refers to the corresponding source file.
  223. -- Variable: user-emacs-directory
  224. This variable holds the name of the `.emacs.d' directory. It is
  225. `~/.emacs.d' on all platforms but MS-DOS.
  226. 
  227. File: elisp, Node: Terminal-Specific, Next: Command-Line Arguments, Prev: Init File, Up: Starting Up
  228. 39.1.3 Terminal-Specific Initialization
  229. ---------------------------------------
  230. Each terminal type can have its own Lisp library that Emacs loads when
  231. run on that type of terminal. The library's name is constructed by
  232. concatenating the value of the variable `term-file-prefix' and the
  233. terminal type (specified by the environment variable `TERM').
  234. Normally, `term-file-prefix' has the value `"term/"'; changing this is
  235. not recommended. Emacs finds the file in the normal manner, by
  236. searching the `load-path' directories, and trying the `.elc' and `.el'
  237. suffixes.
  238. The usual role of a terminal-specific library is to enable special
  239. keys to send sequences that Emacs can recognize. It may also need to
  240. set or add to `input-decode-map' if the Termcap or Terminfo entry does
  241. not specify all the terminal's function keys. *Note Terminal Input::.
  242. When the name of the terminal type contains a hyphen or underscore,
  243. and no library is found whose name is identical to the terminal's name,
  244. Emacs strips from the terminal's name the last hyphen or underscore and
  245. everything that follows it, and tries again. This process is repeated
  246. until Emacs finds a matching library, or until there are no more
  247. hyphens or underscores in the name (i.e. there is no terminal-specific
  248. library). For example, if the terminal name is `xterm-256color' and
  249. there is no `term/xterm-256color.el' library, Emacs tries to load
  250. `term/xterm.el'. If necessary, the terminal library can evaluate
  251. `(getenv "TERM")' to find the full name of the terminal type.
  252. Your init file can prevent the loading of the terminal-specific
  253. library by setting the variable `term-file-prefix' to `nil'. This
  254. feature is useful when experimenting with your own peculiar
  255. customizations.
  256. You can also arrange to override some of the actions of the
  257. terminal-specific library by setting the variable `term-setup-hook'.
  258. This is a normal hook that Emacs runs at the end of its initialization,
  259. after loading both your init file and any terminal-specific libraries.
  260. You could use this hook to define initializations for terminals that do
  261. not have their own libraries. *Note Hooks::.
  262. -- Variable: term-file-prefix
  263. If the value of this variable is non-`nil', Emacs loads a
  264. terminal-specific initialization file as follows:
  265. (load (concat term-file-prefix (getenv "TERM")))
  266. You may set the `term-file-prefix' variable to `nil' in your init
  267. file if you do not wish to load the terminal-initialization file.
  268. On MS-DOS, Emacs sets the `TERM' environment variable to
  269. `internal'.
  270. -- Variable: term-setup-hook
  271. This variable is a normal hook that Emacs runs after loading your
  272. init file, the default initialization file (if any) and the
  273. terminal-specific Lisp file.
  274. You can use `term-setup-hook' to override the definitions made by a
  275. terminal-specific file.
  276. For a related feature, *note window-setup-hook: Window Systems.
  277. 
  278. File: elisp, Node: Command-Line Arguments, Prev: Terminal-Specific, Up: Starting Up
  279. 39.1.4 Command-Line Arguments
  280. -----------------------------
  281. You can use command-line arguments to request various actions when you
  282. start Emacs. Note that the recommended way of using Emacs is to start
  283. it just once, after logging in, and then do all editing in the same
  284. Emacs session (*note Entering Emacs: (emacs)Entering Emacs.). For this
  285. reason, you might not use command-line arguments very often;
  286. nonetheless, they can be useful when invoking Emacs from session
  287. scripts or debugging Emacs. This section describes how Emacs processes
  288. command-line arguments.
  289. -- Function: command-line
  290. This function parses the command line that Emacs was called with,
  291. processes it, and (amongst other things) loads the user's init
  292. file and displays the startup messages.
  293. -- Variable: command-line-processed
  294. The value of this variable is `t' once the command line has been
  295. processed.
  296. If you redump Emacs by calling `dump-emacs', you may wish to set
  297. this variable to `nil' first in order to cause the new dumped Emacs
  298. to process its new command-line arguments.
  299. -- Variable: command-switch-alist
  300. This variable is an alist of user-defined command-line options and
  301. associated handler functions. By default it is empty, but you can
  302. add elements if you wish.
  303. A "command-line option" is an argument on the command line, which
  304. has the form:
  305. -OPTION
  306. The elements of the `command-switch-alist' look like this:
  307. (OPTION . HANDLER-FUNCTION)
  308. The CAR, OPTION, is a string, the name of a command-line option
  309. (not including the initial hyphen). The HANDLER-FUNCTION is
  310. called to handle OPTION, and receives the option name as its sole
  311. argument.
  312. In some cases, the option is followed in the command line by an
  313. argument. In these cases, the HANDLER-FUNCTION can find all the
  314. remaining command-line arguments in the variable
  315. `command-line-args-left'. (The entire list of command-line
  316. arguments is in `command-line-args'.)
  317. The command-line arguments are parsed by the `command-line-1'
  318. function in the `startup.el' file. See also *note Command Line
  319. Arguments for Emacs Invocation: (emacs)Emacs Invocation.
  320. -- Variable: command-line-args
  321. The value of this variable is the list of command-line arguments
  322. passed to Emacs.
  323. -- Variable: command-line-args-left
  324. The value of this variable is the list of command-line arguments
  325. that have not yet been processed.
  326. -- Variable: command-line-functions
  327. This variable's value is a list of functions for handling an
  328. unrecognized command-line argument. Each time the next argument
  329. to be processed has no special meaning, the functions in this list
  330. are called, in order of appearance, until one of them returns a
  331. non-`nil' value.
  332. These functions are called with no arguments. They can access the
  333. command-line argument under consideration through the variable
  334. `argi', which is bound temporarily at this point. The remaining
  335. arguments (not including the current one) are in the variable
  336. `command-line-args-left'.
  337. When a function recognizes and processes the argument in `argi', it
  338. should return a non-`nil' value to say it has dealt with that
  339. argument. If it has also dealt with some of the following
  340. arguments, it can indicate that by deleting them from
  341. `command-line-args-left'.
  342. If all of these functions return `nil', then the argument is
  343. treated as a file name to visit.
  344. 
  345. File: elisp, Node: Getting Out, Next: System Environment, Prev: Starting Up, Up: System Interface
  346. 39.2 Getting Out of Emacs
  347. =========================
  348. There are two ways to get out of Emacs: you can kill the Emacs job,
  349. which exits permanently, or you can suspend it, which permits you to
  350. reenter the Emacs process later. (In a graphical environment, you can
  351. of course simply switch to another application without doing anything
  352. special to Emacs, then switch back to Emacs when you want.)
  353. * Menu:
  354. * Killing Emacs:: Exiting Emacs irreversibly.
  355. * Suspending Emacs:: Exiting Emacs reversibly.
  356. 
  357. File: elisp, Node: Killing Emacs, Next: Suspending Emacs, Up: Getting Out
  358. 39.2.1 Killing Emacs
  359. --------------------
  360. Killing Emacs means ending the execution of the Emacs process. If you
  361. started Emacs from a terminal, the parent process normally resumes
  362. control. The low-level primitive for killing Emacs is `kill-emacs'.
  363. -- Command: kill-emacs &optional exit-data
  364. This command calls the hook `kill-emacs-hook', then exits the
  365. Emacs process and kills it.
  366. If EXIT-DATA is an integer, that is used as the exit status of the
  367. Emacs process. (This is useful primarily in batch operation; see
  368. *note Batch Mode::.)
  369. If EXIT-DATA is a string, its contents are stuffed into the
  370. terminal input buffer so that the shell (or whatever program next
  371. reads input) can read them.
  372. The `kill-emacs' function is normally called via the higher-level
  373. command `C-x C-c' (`save-buffers-kill-terminal'). *Note Exiting:
  374. (emacs)Exiting. It is also called automatically if Emacs receives a
  375. `SIGTERM' or `SIGHUP' operating system signal (e.g. when the
  376. controlling terminal is disconnected), or if it receives a `SIGINT'
  377. signal while running in batch mode (*note Batch Mode::).
  378. -- Variable: kill-emacs-hook
  379. This normal hook is run by `kill-emacs', before it kills Emacs.
  380. Because `kill-emacs' can be called in situations where user
  381. interaction is impossible (e.g. when the terminal is disconnected),
  382. functions on this hook should not attempt to interact with the
  383. user. If you want to interact with the user when Emacs is
  384. shutting down, use `kill-emacs-query-functions', described below.
  385. When Emacs is killed, all the information in the Emacs process,
  386. aside from files that have been saved, is lost. Because killing Emacs
  387. inadvertently can lose a lot of work, the `save-buffers-kill-terminal'
  388. command queries for confirmation if you have buffers that need saving
  389. or subprocesses that are running. It also runs the abnormal hook
  390. `kill-emacs-query-functions':
  391. -- Variable: kill-emacs-query-functions
  392. When `save-buffers-kill-terminal' is killing Emacs, it calls the
  393. functions in this hook, after asking the standard questions and
  394. before calling `kill-emacs'. The functions are called in order of
  395. appearance, with no arguments. Each function can ask for
  396. additional confirmation from the user. If any of them returns
  397. `nil', `save-buffers-kill-emacs' does not kill Emacs, and does not
  398. run the remaining functions in this hook. Calling `kill-emacs'
  399. directly does not run this hook.
  400. 
  401. File: elisp, Node: Suspending Emacs, Prev: Killing Emacs, Up: Getting Out
  402. 39.2.2 Suspending Emacs
  403. -----------------------
  404. On text terminals, it is possible to "suspend Emacs", which means
  405. stopping Emacs temporarily and returning control to its superior
  406. process, which is usually the shell. This allows you to resume editing
  407. later in the same Emacs process, with the same buffers, the same kill
  408. ring, the same undo history, and so on. To resume Emacs, use the
  409. appropriate command in the parent shell--most likely `fg'.
  410. Suspending works only on a terminal device from which the Emacs
  411. session was started. We call that device the "controlling terminal" of
  412. the session. Suspending is not allowed if the controlling terminal is
  413. a graphical terminal. Suspending is usually not relevant in graphical
  414. environments, since you can simply switch to another application
  415. without doing anything special to Emacs.
  416. Some operating systems (those without `SIGTSTP', or MS-DOS) do not
  417. support suspension of jobs; on these systems, "suspension" actually
  418. creates a new shell temporarily as a subprocess of Emacs. Then you
  419. would exit the shell to return to Emacs.
  420. -- Command: suspend-emacs &optional string
  421. This function stops Emacs and returns control to the superior
  422. process. If and when the superior process resumes Emacs,
  423. `suspend-emacs' returns `nil' to its caller in Lisp.
  424. This function works only on the controlling terminal of the Emacs
  425. session; to relinquish control of other tty devices, use
  426. `suspend-tty' (see below). If the Emacs session uses more than
  427. one terminal, you must delete the frames on all the other terminals
  428. before suspending Emacs, or this function signals an error. *Note
  429. Multiple Terminals::.
  430. If STRING is non-`nil', its characters are sent to Emacs's
  431. superior shell, to be read as terminal input. The characters in
  432. STRING are not echoed by the superior shell; only the results
  433. appear.
  434. Before suspending, `suspend-emacs' runs the normal hook
  435. `suspend-hook'. After the user resumes Emacs, `suspend-emacs'
  436. runs the normal hook `suspend-resume-hook'. *Note Hooks::.
  437. The next redisplay after resumption will redraw the entire screen,
  438. unless the variable `no-redraw-on-reenter' is non-`nil'. *Note
  439. Refresh Screen::.
  440. Here is an example of how you could use these hooks:
  441. (add-hook 'suspend-hook
  442. (lambda () (or (y-or-n-p "Really suspend? ")
  443. (error "Suspend canceled"))))
  444. (add-hook 'suspend-resume-hook (lambda () (message "Resumed!")
  445. (sit-for 2)))
  446. Here is what you would see upon evaluating `(suspend-emacs "pwd")':
  447. ---------- Buffer: Minibuffer ----------
  448. Really suspend? y
  449. ---------- Buffer: Minibuffer ----------
  450. ---------- Parent Shell ----------
  451. bash$ /home/username
  452. bash$ fg
  453. ---------- Echo Area ----------
  454. Resumed!
  455. Note that `pwd' is not echoed after Emacs is suspended. But it is
  456. read and executed by the shell.
  457. -- Variable: suspend-hook
  458. This variable is a normal hook that Emacs runs before suspending.
  459. -- Variable: suspend-resume-hook
  460. This variable is a normal hook that Emacs runs on resuming after a
  461. suspension.
  462. -- Function: suspend-tty &optional tty
  463. If TTY specifies a terminal device used by Emacs, this function
  464. relinquishes the device and restores it to its prior state. Frames
  465. that used the device continue to exist, but are not updated and
  466. Emacs doesn't read input from them. TTY can be a terminal object,
  467. a frame (meaning the terminal for that frame), or `nil' (meaning
  468. the terminal for the selected frame). *Note Multiple Terminals::.
  469. If TTY is already suspended, this function does nothing.
  470. This function runs the hook `suspend-tty-functions', passing the
  471. terminal object as an argument to each function.
  472. -- Function: resume-tty &optional tty
  473. This function resumes the previously suspended terminal device
  474. TTY; where TTY has the same possible values as it does for
  475. `suspend-tty'.
  476. This function reopens the terminal device, re-initializes it, and
  477. redraws it with that terminal's selected frame. It then runs the
  478. hook `resume-tty-functions', passing the terminal object as an
  479. argument to each function.
  480. If the same device is already used by another Emacs terminal, this
  481. function signals an error. If TTY is not suspended, this function
  482. does nothing.
  483. -- Function: controlling-tty-p &optional tty
  484. This function returns non-`nil' if TTY is the controlling terminal
  485. of the Emacs session; TTY can be a terminal object, a frame
  486. (meaning the terminal for that frame), or `nil' (meaning the
  487. terminal for the selected frame).
  488. -- Command: suspend-frame
  489. This command "suspends" a frame. For GUI frames, it calls
  490. `iconify-frame' (*note Visibility of Frames::); for frames on text
  491. terminals, it calls either `suspend-emacs' or `suspend-tty',
  492. depending on whether the frame is displayed on the controlling
  493. terminal device or not.
  494. 
  495. File: elisp, Node: System Environment, Next: User Identification, Prev: Getting Out, Up: System Interface
  496. 39.3 Operating System Environment
  497. =================================
  498. Emacs provides access to variables in the operating system environment
  499. through various functions. These variables include the name of the
  500. system, the user's UID, and so on.
  501. -- Variable: system-configuration
  502. This variable holds the standard GNU configuration name for the
  503. hardware/software configuration of your system, as a string. For
  504. example, a typical value for a 64-bit GNU/Linux system is
  505. `"x86_64-unknown-linux-gnu"'.
  506. -- Variable: system-type
  507. The value of this variable is a symbol indicating the type of
  508. operating system Emacs is running on. The possible values are:
  509. `aix'
  510. IBM's AIX.
  511. `berkeley-unix'
  512. Berkeley BSD and its variants.
  513. `cygwin'
  514. Cygwin, a Posix layer on top of MS-Windows.
  515. `darwin'
  516. Darwin (Mac OS X).
  517. `gnu'
  518. The GNU system (using the GNU kernel, which consists of the
  519. HURD and Mach).
  520. `gnu/linux'
  521. A GNU/Linux system--that is, a variant GNU system, using the
  522. Linux kernel. (These systems are the ones people often call
  523. "Linux", but actually Linux is just the kernel, not the whole
  524. system.)
  525. `gnu/kfreebsd'
  526. A GNU (glibc-based) system with a FreeBSD kernel.
  527. `hpux'
  528. Hewlett-Packard HPUX operating system.
  529. `irix'
  530. Silicon Graphics Irix system.
  531. `ms-dos'
  532. Microsoft's DOS. Emacs compiled with DJGPP for MS-DOS binds
  533. `system-type' to `ms-dos' even when you run it on MS-Windows.
  534. `usg-unix-v'
  535. AT&T Unix System V.
  536. `windows-nt'
  537. Microsoft Windows NT, 9X and later. The value of
  538. `system-type' is always `windows-nt', e.g. even on Windows 7.
  539. We do not wish to add new symbols to make finer distinctions
  540. unless it is absolutely necessary! In fact, we hope to eliminate
  541. some of these alternatives in the future. If you need to make a
  542. finer distinction than `system-type' allows for, you can test
  543. `system-configuration', e.g. against a regexp.
  544. -- Function: system-name
  545. This function returns the name of the machine you are running on,
  546. as a string.
  547. The symbol `system-name' is a variable as well as a function. In
  548. fact, the function returns whatever value the variable `system-name'
  549. currently holds. Thus, you can set the variable `system-name' in case
  550. Emacs is confused about the name of your system. The variable is also
  551. useful for constructing frame titles (*note Frame Titles::).
  552. -- User Option: mail-host-address
  553. If this variable is non-`nil', it is used instead of `system-name'
  554. for purposes of generating email addresses. For example, it is
  555. used when constructing the default value of `user-mail-address'.
  556. *Note User Identification::. (Since this is done when Emacs
  557. starts up, the value actually used is the one saved when Emacs was
  558. dumped. *Note Building Emacs::.)
  559. -- Command: getenv var &optional frame
  560. This function returns the value of the environment variable VAR,
  561. as a string. VAR should be a string. If VAR is undefined in the
  562. environment, `getenv' returns `nil'. It returns `""' if VAR is
  563. set but null. Within Emacs, a list of environment variables and
  564. their values is kept in the variable `process-environment'.
  565. (getenv "USER")
  566. => "lewis"
  567. The shell command `printenv' prints all or part of the environment:
  568. bash$ printenv
  569. PATH=/usr/local/bin:/usr/bin:/bin
  570. USER=lewis
  571. TERM=xterm
  572. SHELL=/bin/bash
  573. HOME=/home/lewis
  574. ...
  575. -- Command: setenv variable &optional value substitute
  576. This command sets the value of the environment variable named
  577. VARIABLE to VALUE. VARIABLE should be a string. Internally,
  578. Emacs Lisp can handle any string. However, normally VARIABLE
  579. should be a valid shell identifier, that is, a sequence of
  580. letters, digits and underscores, starting with a letter or
  581. underscore. Otherwise, errors may occur if subprocesses of Emacs
  582. try to access the value of VARIABLE. If VALUE is omitted or `nil'
  583. (or, interactively, with a prefix argument), `setenv' removes
  584. VARIABLE from the environment. Otherwise, VALUE should be a
  585. string.
  586. If the optional argument SUBSTITUTE is non-`nil', Emacs calls the
  587. function `substitute-env-vars' to expand any environment variables
  588. in VALUE.
  589. `setenv' works by modifying `process-environment'; binding that
  590. variable with `let' is also reasonable practice.
  591. `setenv' returns the new value of VARIABLE, or `nil' if it removed
  592. VARIABLE from the environment.
  593. -- Variable: process-environment
  594. This variable is a list of strings, each describing one environment
  595. variable. The functions `getenv' and `setenv' work by means of
  596. this variable.
  597. process-environment
  598. => ("PATH=/usr/local/bin:/usr/bin:/bin"
  599. "USER=lewis"
  600. "TERM=xterm"
  601. "SHELL=/bin/bash"
  602. "HOME=/home/lewis"
  603. ...)
  604. If `process-environment' contains "duplicate" elements that
  605. specify the same environment variable, the first of these elements
  606. specifies the variable, and the other "duplicates" are ignored.
  607. -- Variable: initial-environment
  608. This variable holds the list of environment variables Emacs
  609. inherited from its parent process when Emacs started.
  610. -- Variable: path-separator
  611. This variable holds a string that says which character separates
  612. directories in a search path (as found in an environment
  613. variable). Its value is `":"' for Unix and GNU systems, and `";"'
  614. for MS systems.
  615. -- Function: parse-colon-path path
  616. This function takes a search path string such as the value of the
  617. `PATH' environment variable, and splits it at the separators,
  618. returning a list of directory names. `nil' in this list means the
  619. current directory. Although the function's name says "colon", it
  620. actually uses the value of `path-separator'.
  621. (parse-colon-path ":/foo:/bar")
  622. => (nil "/foo/" "/bar/")
  623. -- Variable: invocation-name
  624. This variable holds the program name under which Emacs was
  625. invoked. The value is a string, and does not include a directory
  626. name.
  627. -- Variable: invocation-directory
  628. This variable holds the directory from which the Emacs executable
  629. was invoked, or `nil' if that directory cannot be determined.
  630. -- Variable: installation-directory
  631. If non-`nil', this is a directory within which to look for the
  632. `lib-src' and `etc' subdirectories. In an installed Emacs, it is
  633. normally `nil'. It is non-`nil' when Emacs can't find those
  634. directories in their standard installed locations, but can find
  635. them in a directory related somehow to the one containing the
  636. Emacs executable (i.e., `invocation-directory').
  637. -- Function: load-average &optional use-float
  638. This function returns the current 1-minute, 5-minute, and 15-minute
  639. system load averages, in a list. The load average indicates the
  640. number of processes trying to run on the system.
  641. By default, the values are integers that are 100 times the system
  642. load averages, but if USE-FLOAT is non-`nil', then they are
  643. returned as floating point numbers without multiplying by 100.
  644. If it is impossible to obtain the load average, this function
  645. signals an error. On some platforms, access to load averages
  646. requires installing Emacs as setuid or setgid so that it can read
  647. kernel information, and that usually isn't advisable.
  648. If the 1-minute load average is available, but the 5- or 15-minute
  649. averages are not, this function returns a shortened list containing
  650. the available averages.
  651. (load-average)
  652. => (169 48 36)
  653. (load-average t)
  654. => (1.69 0.48 0.36)
  655. The shell command `uptime' returns similar information.
  656. -- Function: emacs-pid
  657. This function returns the process ID of the Emacs process, as an
  658. integer.
  659. -- Variable: tty-erase-char
  660. This variable holds the erase character that was selected in the
  661. system's terminal driver, before Emacs was started.
  662. 
  663. File: elisp, Node: User Identification, Next: Time of Day, Prev: System Environment, Up: System Interface
  664. 39.4 User Identification
  665. ========================
  666. -- Variable: init-file-user
  667. This variable says which user's init files should be used by
  668. Emacs--or `nil' if none. `""' stands for the user who originally
  669. logged in. The value reflects command-line options such as `-q'
  670. or `-u USER'.
  671. Lisp packages that load files of customizations, or any other sort
  672. of user profile, should obey this variable in deciding where to
  673. find it. They should load the profile of the user name found in
  674. this variable. If `init-file-user' is `nil', meaning that the `-q'
  675. option was used, then Lisp packages should not load any
  676. customization files or user profile.
  677. -- User Option: user-mail-address
  678. This holds the nominal email address of the user who is using
  679. Emacs. Emacs normally sets this variable to a default value after
  680. reading your init files, but not if you have already set it. So
  681. you can set the variable to some other value in your init file if
  682. you do not want to use the default value.
  683. -- Function: user-login-name &optional uid
  684. This function returns the name under which the user is logged in.
  685. It uses the environment variables `LOGNAME' or `USER' if either is
  686. set. Otherwise, the value is based on the effective UID, not the
  687. real UID.
  688. If you specify UID (a number), the result is the user name that
  689. corresponds to UID, or `nil' if there is no such user.
  690. -- Function: user-real-login-name
  691. This function returns the user name corresponding to Emacs's real
  692. UID. This ignores the effective UID, and the environment
  693. variables `LOGNAME' and `USER'.
  694. -- Function: user-full-name &optional uid
  695. This function returns the full name of the logged-in user--or the
  696. value of the environment variable `NAME', if that is set.
  697. If the Emacs process's user-id does not correspond to any known
  698. user (and provided `NAME' is not set), the result is `"unknown"'.
  699. If UID is non-`nil', then it should be a number (a user-id) or a
  700. string (a login name). Then `user-full-name' returns the full
  701. name corresponding to that user-id or login name. If you specify a
  702. user-id or login name that isn't defined, it returns `nil'.
  703. The symbols `user-login-name', `user-real-login-name' and
  704. `user-full-name' are variables as well as functions. The functions
  705. return the same values that the variables hold. These variables allow
  706. you to "fake out" Emacs by telling the functions what to return. The
  707. variables are also useful for constructing frame titles (*note Frame
  708. Titles::).
  709. -- Function: user-real-uid
  710. This function returns the real UID of the user. The value may be
  711. a floating point number, in the (unlikely) event that the UID is
  712. too large to fit in a Lisp integer.
  713. -- Function: user-uid
  714. This function returns the effective UID of the user. The value
  715. may be a floating point number.
  716. 
  717. File: elisp, Node: Time of Day, Next: Time Conversion, Prev: User Identification, Up: System Interface
  718. 39.5 Time of Day
  719. ================
  720. This section explains how to determine the current time and time zone.
  721. Most of these functions represent time as a list of either three
  722. integers, `(SEC-HIGH SEC-LOW MICROSEC)', or of two integers, `(SEC-HIGH
  723. SEC-LOW)'. The integers SEC-HIGH and SEC-LOW give the high and low
  724. bits of an integer number of seconds. This integer number, HIGH *
  725. 2**16 + LOW, is the number of seconds from the "epoch" (0:00 January 1,
  726. 1970 UTC) to the specified time. The third list element MICROSEC, if
  727. present, gives the number of microseconds from the start of that second
  728. to the specified time.
  729. The return value of `current-time' represents time using three
  730. integers, while the timestamps in the return value of `file-attributes'
  731. use two integers (*note Definition of file-attributes::). In function
  732. arguments, e.g. the TIME-VALUE argument to `current-time-string', both
  733. two- and three-integer lists are accepted. You can convert times from
  734. the list representation into standard human-readable strings using
  735. `current-time', or to other forms using the `decode-time' and
  736. `format-time-string' functions documented in the following sections.
  737. -- Function: current-time-string &optional time-value
  738. This function returns the current time and date as a human-readable
  739. string. The format of the string is unvarying; the number of
  740. characters used for each part is always the same, so you can
  741. reliably use `substring' to extract pieces of it. You should count
  742. characters from the beginning of the string rather than from the
  743. end, as additional information may some day be added at the end.
  744. The argument TIME-VALUE, if given, specifies a time to format
  745. (represented as a list of integers), instead of the current time.
  746. (current-time-string)
  747. => "Wed Oct 14 22:21:05 1987"
  748. -- Function: current-time
  749. This function returns the current time, represented as a list of
  750. three integers `(SEC-HIGH SEC-LOW MICROSEC)'. On systems with
  751. only one-second time resolutions, MICROSEC is 0.
  752. -- Function: float-time &optional time-value
  753. This function returns the current time as a floating-point number
  754. of seconds since the epoch. The optional argument TIME-VALUE, if
  755. given, specifies a time (represented as a list of integers) to
  756. convert instead of the current time.
  757. _Warning_: Since the result is floating point, it may not be
  758. exact. Do not use this function if precise time stamps are
  759. required.
  760. -- Function: current-time-zone &optional time-value
  761. This function returns a list describing the time zone that the
  762. user is in.
  763. The value has the form `(OFFSET NAME)'. Here OFFSET is an integer
  764. giving the number of seconds ahead of UTC (east of Greenwich). A
  765. negative value means west of Greenwich. The second element, NAME,
  766. is a string giving the name of the time zone. Both elements
  767. change when daylight saving time begins or ends; if the user has
  768. specified a time zone that does not use a seasonal time
  769. adjustment, then the value is constant through time.
  770. If the operating system doesn't supply all the information
  771. necessary to compute the value, the unknown elements of the list
  772. are `nil'.
  773. The argument TIME-VALUE, if given, specifies a time (represented
  774. as a list of integers) to analyze instead of the current time.
  775. The current time zone is determined by the `TZ' environment
  776. variable. *Note System Environment::. For example, you can tell Emacs
  777. to use universal time with `(setenv "TZ" "UTC0")'. If `TZ' is not in
  778. the environment, Emacs uses a platform-dependent default time zone.
  779. 
  780. File: elisp, Node: Time Conversion, Next: Time Parsing, Prev: Time of Day, Up: System Interface
  781. 39.6 Time Conversion
  782. ====================
  783. These functions convert time values (lists of two or three integers, as
  784. explained in the previous section) into calendrical information and
  785. vice versa.
  786. Many 32-bit operating systems are limited to time values containing
  787. 32 bits of information; these systems typically handle only the times
  788. from 1901-12-13 20:45:52 UTC through 2038-01-19 03:14:07 UTC. However,
  789. 64-bit and some 32-bit operating systems have larger time values, and
  790. can represent times far in the past or future.
  791. Time conversion functions always use the Gregorian calendar, even
  792. for dates before the Gregorian calendar was introduced. Year numbers
  793. count the number of years since the year 1 B.C., and do not skip zero
  794. as traditional Gregorian years do; for example, the year number -37
  795. represents the Gregorian year 38 B.C.
  796. -- Function: decode-time &optional time
  797. This function converts a time value into calendrical information.
  798. If you don't specify TIME, it decodes the current time. The return
  799. value is a list of nine elements, as follows:
  800. (SECONDS MINUTES HOUR DAY MONTH YEAR DOW DST ZONE)
  801. Here is what the elements mean:
  802. SECONDS
  803. The number of seconds past the minute, as an integer between
  804. 0 and 59. On some operating systems, this is 60 for leap
  805. seconds.
  806. MINUTES
  807. The number of minutes past the hour, as an integer between 0
  808. and 59.
  809. HOUR
  810. The hour of the day, as an integer between 0 and 23.
  811. DAY
  812. The day of the month, as an integer between 1 and 31.
  813. MONTH
  814. The month of the year, as an integer between 1 and 12.
  815. YEAR
  816. The year, an integer typically greater than 1900.
  817. DOW
  818. The day of week, as an integer between 0 and 6, where 0
  819. stands for Sunday.
  820. DST
  821. `t' if daylight saving time is effect, otherwise `nil'.
  822. ZONE
  823. An integer indicating the time zone, as the number of seconds
  824. east of Greenwich.
  825. *Common Lisp Note:* Common Lisp has different meanings for DOW and
  826. ZONE.
  827. -- Function: encode-time seconds minutes hour day month year &optional
  828. zone
  829. This function is the inverse of `decode-time'. It converts seven
  830. items of calendrical data into a time value. For the meanings of
  831. the arguments, see the table above under `decode-time'.
  832. Year numbers less than 100 are not treated specially. If you want
  833. them to stand for years above 1900, or years above 2000, you must
  834. alter them yourself before you call `encode-time'.
  835. The optional argument ZONE defaults to the current time zone and
  836. its daylight saving time rules. If specified, it can be either a
  837. list (as you would get from `current-time-zone'), a string as in
  838. the `TZ' environment variable, `t' for Universal Time, or an
  839. integer (as you would get from `decode-time'). The specified zone
  840. is used without any further alteration for daylight saving time.
  841. If you pass more than seven arguments to `encode-time', the first
  842. six are used as SECONDS through YEAR, the last argument is used as
  843. ZONE, and the arguments in between are ignored. This feature
  844. makes it possible to use the elements of a list returned by
  845. `decode-time' as the arguments to `encode-time', like this:
  846. (apply 'encode-time (decode-time ...))
  847. You can perform simple date arithmetic by using out-of-range
  848. values for the SECONDS, MINUTES, HOUR, DAY, and MONTH arguments;
  849. for example, day 0 means the day preceding the given month.
  850. The operating system puts limits on the range of possible time
  851. values; if you try to encode a time that is out of range, an error
  852. results. For instance, years before 1970 do not work on some
  853. systems; on others, years as early as 1901 do work.
  854. 
  855. File: elisp, Node: Time Parsing, Next: Processor Run Time, Prev: Time Conversion, Up: System Interface
  856. 39.7 Parsing and Formatting Times
  857. =================================
  858. These functions convert time values (lists of two or three integers) to
  859. text in a string, and vice versa.
  860. -- Function: date-to-time string
  861. This function parses the time-string STRING and returns the
  862. corresponding time value.
  863. -- Function: format-time-string format-string &optional time universal
  864. This function converts TIME (or the current time, if TIME is
  865. omitted) to a string according to FORMAT-STRING. The argument
  866. FORMAT-STRING may contain `%'-sequences which say to substitute
  867. parts of the time. Here is a table of what the `%'-sequences mean:
  868. `%a'
  869. This stands for the abbreviated name of the day of week.
  870. `%A'
  871. This stands for the full name of the day of week.
  872. `%b'
  873. This stands for the abbreviated name of the month.
  874. `%B'
  875. This stands for the full name of the month.
  876. `%c'
  877. This is a synonym for `%x %X'.
  878. `%C'
  879. This has a locale-specific meaning. In the default locale
  880. (named C), it is equivalent to `%A, %B %e, %Y'.
  881. `%d'
  882. This stands for the day of month, zero-padded.
  883. `%D'
  884. This is a synonym for `%m/%d/%y'.
  885. `%e'
  886. This stands for the day of month, blank-padded.
  887. `%h'
  888. This is a synonym for `%b'.
  889. `%H'
  890. This stands for the hour (00-23).
  891. `%I'
  892. This stands for the hour (01-12).
  893. `%j'
  894. This stands for the day of the year (001-366).
  895. `%k'
  896. This stands for the hour (0-23), blank padded.
  897. `%l'
  898. This stands for the hour (1-12), blank padded.
  899. `%m'
  900. This stands for the month (01-12).
  901. `%M'
  902. This stands for the minute (00-59).
  903. `%n'
  904. This stands for a newline.
  905. `%N'
  906. This stands for the nanoseconds (000000000-999999999). To
  907. ask for fewer digits, use `%3N' for milliseconds, `%6N' for
  908. microseconds, etc. Any excess digits are discarded, without
  909. rounding. Currently Emacs time stamps are at best
  910. microsecond resolution so the last three digits generated by
  911. plain `%N' are always zero.
  912. `%p'
  913. This stands for `AM' or `PM', as appropriate.
  914. `%r'
  915. This is a synonym for `%I:%M:%S %p'.
  916. `%R'
  917. This is a synonym for `%H:%M'.
  918. `%S'
  919. This stands for the seconds (00-59).
  920. `%t'
  921. This stands for a tab character.
  922. `%T'
  923. This is a synonym for `%H:%M:%S'.
  924. `%U'
  925. This stands for the week of the year (01-52), assuming that
  926. weeks start on Sunday.
  927. `%w'
  928. This stands for the numeric day of week (0-6). Sunday is day
  929. 0.
  930. `%W'
  931. This stands for the week of the year (01-52), assuming that
  932. weeks start on Monday.
  933. `%x'
  934. This has a locale-specific meaning. In the default locale
  935. (named `C'), it is equivalent to `%D'.
  936. `%X'
  937. This has a locale-specific meaning. In the default locale
  938. (named `C'), it is equivalent to `%T'.
  939. `%y'
  940. This stands for the year without century (00-99).
  941. `%Y'
  942. This stands for the year with century.
  943. `%Z'
  944. This stands for the time zone abbreviation (e.g., `EST').
  945. `%z'
  946. This stands for the time zone numerical offset (e.g.,
  947. `-0500').
  948. You can also specify the field width and type of padding for any of
  949. these `%'-sequences. This works as in `printf': you write the
  950. field width as digits in the middle of a `%'-sequences. If you
  951. start the field width with `0', it means to pad with zeros. If you
  952. start the field width with `_', it means to pad with spaces.
  953. For example, `%S' specifies the number of seconds since the minute;
  954. `%03S' means to pad this with zeros to 3 positions, `%_3S' to pad
  955. with spaces to 3 positions. Plain `%3S' pads with zeros, because
  956. that is how `%S' normally pads to two positions.
  957. The characters `E' and `O' act as modifiers when used between `%'
  958. and one of the letters in the table above. `E' specifies using
  959. the current locale's "alternative" version of the date and time.
  960. In a Japanese locale, for example, `%Ex' might yield a date format
  961. based on the Japanese Emperors' reigns. `E' is allowed in `%Ec',
  962. `%EC', `%Ex', `%EX', `%Ey', and `%EY'.
  963. `O' means to use the current locale's "alternative" representation
  964. of numbers, instead of the ordinary decimal digits. This is
  965. allowed with most letters, all the ones that output numbers.
  966. If UNIVERSAL is non-`nil', that means to describe the time as
  967. Universal Time; `nil' means describe it using what Emacs believes
  968. is the local time zone (see `current-time-zone').
  969. This function uses the C library function `strftime' (*note
  970. Formatting Calendar Time: (libc)Formatting Calendar Time.) to do
  971. most of the work. In order to communicate with that function, it
  972. first encodes its argument using the coding system specified by
  973. `locale-coding-system' (*note Locales::); after `strftime' returns
  974. the resulting string, `format-time-string' decodes the string
  975. using that same coding system.
  976. -- Function: seconds-to-time seconds
  977. This function converts SECONDS, a floating point number of seconds
  978. since the epoch, to a time value and returns that. To perform the
  979. inverse conversion, use `float-time'.
  980. -- Function: format-seconds format-string seconds
  981. This function converts its argument SECONDS into a string of
  982. years, days, hours, etc., according to FORMAT-STRING. The
  983. argument FORMAT-STRING may contain `%'-sequences which control the
  984. conversion. Here is a table of what the `%'-sequences mean:
  985. `%y'
  986. `%Y'
  987. The integer number of 365-day years.
  988. `%d'
  989. `%D'
  990. The integer number of days.
  991. `%h'
  992. `%H'
  993. The integer number of hours.
  994. `%m'
  995. `%M'
  996. The integer number of minutes.
  997. `%s'
  998. `%S'
  999. The integer number of seconds.
  1000. `%z'
  1001. Non-printing control flag. When it is used, other specifiers
  1002. must be given in the order of decreasing size, i.e. years
  1003. before days, hours before minutes, etc. Nothing will be
  1004. produced in the result string to the left of `%z' until the
  1005. first non-zero conversion is encountered. For example, the
  1006. default format used by `emacs-uptime' (*note emacs-uptime:
  1007. Processor Run Time.) `"%Y, %D, %H, %M, %z%S"' means that the
  1008. number of seconds will always be produced, but years, days,
  1009. hours, and minutes will only be shown if they are non-zero.
  1010. `%%'
  1011. Produces a literal `%'.
  1012. Upper-case format sequences produce the units in addition to the
  1013. numbers, lower-case formats produce only the numbers.
  1014. You can also specify the field width by following the `%' with a
  1015. number; shorter numbers will be padded with blanks. An optional
  1016. period before the width requests zero-padding instead. For
  1017. example, `"%.3Y"' might produce `"004 years"'.
  1018. _Warning:_ This function works only with values of SECONDS that
  1019. don't exceed `most-positive-fixnum' (*note most-positive-fixnum:
  1020. Integer Basics.).
  1021. 
  1022. File: elisp, Node: Processor Run Time, Next: Time Calculations, Prev: Time Parsing, Up: System Interface
  1023. 39.8 Processor Run time
  1024. =======================
  1025. Emacs provides several functions and primitives that return time, both
  1026. elapsed and processor time, used by the Emacs process.
  1027. -- Command: emacs-uptime &optional format
  1028. This function returns a string representing the Emacs
  1029. "uptime"--the elapsed wall-clock time this instance of Emacs is
  1030. running. The string is formatted by `format-seconds' according to
  1031. the optional argument FORMAT. For the available format
  1032. descriptors, see *note format-seconds: Time Parsing. If FORMAT is
  1033. `nil' or omitted, it defaults to `"%Y, %D, %H, %M, %z%S"'.
  1034. When called interactively, it prints the uptime in the echo area.
  1035. -- Function: get-internal-run-time
  1036. This function returns the processor run time used by Emacs as a
  1037. list of three integers: `(HIGH LOW MICROSEC)'. The integers HIGH
  1038. and LOW combine to give the number of seconds, which is HIGH *
  1039. 2**16 + LOW.
  1040. The third element, MICROSEC, gives the microseconds (or 0 for
  1041. systems that return time with the resolution of only one second).
  1042. Note that the time returned by this function excludes the time
  1043. Emacs was not using the processor, and if the Emacs process has
  1044. several threads, the returned value is the sum of the processor
  1045. times used up by all Emacs threads.
  1046. If the system doesn't provide a way to determine the processor run
  1047. time, `get-internal-run-time' returns the same time as
  1048. `current-time'.
  1049. -- Command: emacs-init-time
  1050. This function returns the duration of the Emacs initialization
  1051. (*note Startup Summary::) in seconds, as a string. When called
  1052. interactively, it prints the duration in the echo area.
  1053. 
  1054. File: elisp, Node: Time Calculations, Next: Timers, Prev: Processor Run Time, Up: System Interface
  1055. 39.9 Time Calculations
  1056. ======================
  1057. These functions perform calendrical computations using time values (the
  1058. kind of list that `current-time' returns).
  1059. -- Function: time-less-p t1 t2
  1060. This returns `t' if time value T1 is less than time value T2.
  1061. -- Function: time-subtract t1 t2
  1062. This returns the time difference T1 - T2 between two time values,
  1063. in the same format as a time value.
  1064. -- Function: time-add t1 t2
  1065. This returns the sum of two time values, one of which ought to
  1066. represent a time difference rather than a point in time. Here is
  1067. how to add a number of seconds to a time value:
  1068. (time-add TIME (seconds-to-time SECONDS))
  1069. -- Function: time-to-days time
  1070. This function returns the number of days between the beginning of
  1071. year 1 and TIME.
  1072. -- Function: time-to-day-in-year time
  1073. This returns the day number within the year corresponding to TIME.
  1074. -- Function: date-leap-year-p year
  1075. This function returns `t' if YEAR is a leap year.
  1076. 
  1077. File: elisp, Node: Timers, Next: Idle Timers, Prev: Time Calculations, Up: System Interface
  1078. 39.10 Timers for Delayed Execution
  1079. ==================================
  1080. You can set up a "timer" to call a function at a specified future time
  1081. or after a certain length of idleness.
  1082. Emacs cannot run timers at any arbitrary point in a Lisp program; it
  1083. can run them only when Emacs could accept output from a subprocess:
  1084. namely, while waiting or inside certain primitive functions such as
  1085. `sit-for' or `read-event' which _can_ wait. Therefore, a timer's
  1086. execution may be delayed if Emacs is busy. However, the time of
  1087. execution is very precise if Emacs is idle.
  1088. Emacs binds `inhibit-quit' to `t' before calling the timer function,
  1089. because quitting out of many timer functions can leave things in an
  1090. inconsistent state. This is normally unproblematical because most
  1091. timer functions don't do a lot of work. Indeed, for a timer to call a
  1092. function that takes substantial time to run is likely to be annoying.
  1093. If a timer function needs to allow quitting, it should use
  1094. `with-local-quit' (*note Quitting::). For example, if a timer function
  1095. calls `accept-process-output' to receive output from an external
  1096. process, that call should be wrapped inside `with-local-quit', to
  1097. ensure that `C-g' works if the external process hangs.
  1098. It is usually a bad idea for timer functions to alter buffer
  1099. contents. When they do, they usually should call `undo-boundary' both
  1100. before and after changing the buffer, to separate the timer's changes
  1101. from user commands' changes and prevent a single undo entry from
  1102. growing to be quite large.
  1103. Timer functions should also avoid calling functions that cause Emacs
  1104. to wait, such as `sit-for' (*note Waiting::). This can lead to
  1105. unpredictable effects, since other timers (or even the same timer) can
  1106. run while waiting. If a timer function needs to perform an action
  1107. after a certain time has elapsed, it can do this by scheduling a new
  1108. timer.
  1109. If a timer function calls functions that can change the match data,
  1110. it should save and restore the match data. *Note Saving Match Data::.
  1111. -- Command: run-at-time time repeat function &rest args
  1112. This sets up a timer that calls the function FUNCTION with
  1113. arguments ARGS at time TIME. If REPEAT is a number (integer or
  1114. floating point), the timer is scheduled to run again every REPEAT
  1115. seconds after TIME. If REPEAT is `nil', the timer runs only once.
  1116. TIME may specify an absolute or a relative time.
  1117. Absolute times may be specified using a string with a limited
  1118. variety of formats, and are taken to be times _today_, even if
  1119. already in the past. The recognized forms are `XXXX', `X:XX', or
  1120. `XX:XX' (military time), and `XXam', `XXAM', `XXpm', `XXPM',
  1121. `XX:XXam', `XX:XXAM', `XX:XXpm', or `XX:XXPM'. A period can be
  1122. used instead of a colon to separate the hour and minute parts.
  1123. To specify a relative time as a string, use numbers followed by
  1124. units. For example:
  1125. `1 min'
  1126. denotes 1 minute from now.
  1127. `1 min 5 sec'
  1128. denotes 65 seconds from now.
  1129. `1 min 2 sec 3 hour 4 day 5 week 6 fortnight 7 month 8 year'
  1130. denotes exactly 103 months, 123 days, and 10862 seconds from
  1131. now.
  1132. For relative time values, Emacs considers a month to be exactly
  1133. thirty days, and a year to be exactly 365.25 days.
  1134. Not all convenient formats are strings. If TIME is a number
  1135. (integer or floating point), that specifies a relative time
  1136. measured in seconds. The result of `encode-time' can also be used
  1137. to specify an absolute value for TIME.
  1138. In most cases, REPEAT has no effect on when _first_ call takes
  1139. place--TIME alone specifies that. There is one exception: if TIME
  1140. is `t', then the timer runs whenever the time is a multiple of
  1141. REPEAT seconds after the epoch. This is useful for functions like
  1142. `display-time'.
  1143. The function `run-at-time' returns a timer value that identifies
  1144. the particular scheduled future action. You can use this value to
  1145. call `cancel-timer' (see below).
  1146. A repeating timer nominally ought to run every REPEAT seconds, but
  1147. remember that any invocation of a timer can be late. Lateness of one
  1148. repetition has no effect on the scheduled time of the next repetition.
  1149. For instance, if Emacs is busy computing for long enough to cover three
  1150. scheduled repetitions of the timer, and then starts to wait, it will
  1151. immediately call the timer function three times in immediate succession
  1152. (presuming no other timers trigger before or between them). If you
  1153. want a timer to run again no less than N seconds after the last
  1154. invocation, don't use the REPEAT argument. Instead, the timer function
  1155. should explicitly reschedule the timer.
  1156. -- Variable: timer-max-repeats
  1157. This variable's value specifies the maximum number of times to
  1158. repeat calling a timer function in a row, when many previously
  1159. scheduled calls were unavoidably delayed.
  1160. -- Macro: with-timeout (seconds timeout-forms...) body...
  1161. Execute BODY, but give up after SECONDS seconds. If BODY finishes
  1162. before the time is up, `with-timeout' returns the value of the
  1163. last form in BODY. If, however, the execution of BODY is cut
  1164. short by the timeout, then `with-timeout' executes all the
  1165. TIMEOUT-FORMS and returns the value of the last of them.
  1166. This macro works by setting a timer to run after SECONDS seconds.
  1167. If BODY finishes before that time, it cancels the timer. If the
  1168. timer actually runs, it terminates execution of BODY, then
  1169. executes TIMEOUT-FORMS.
  1170. Since timers can run within a Lisp program only when the program
  1171. calls a primitive that can wait, `with-timeout' cannot stop
  1172. executing BODY while it is in the midst of a computation--only
  1173. when it calls one of those primitives. So use `with-timeout' only
  1174. with a BODY that waits for input, not one that does a long
  1175. computation.
  1176. The function `y-or-n-p-with-timeout' provides a simple way to use a
  1177. timer to avoid waiting too long for an answer. *Note Yes-or-No
  1178. Queries::.
  1179. -- Function: cancel-timer timer
  1180. This cancels the requested action for TIMER, which should be a
  1181. timer--usually, one previously returned by `run-at-time' or
  1182. `run-with-idle-timer'. This cancels the effect of that call to
  1183. one of these functions; the arrival of the specified time will not
  1184. cause anything special to happen.
  1185. 
  1186. File: elisp, Node: Idle Timers, Next: Terminal Input, Prev: Timers, Up: System Interface
  1187. 39.11 Idle Timers
  1188. =================
  1189. Here is how to set up a timer that runs when Emacs is idle for a
  1190. certain length of time. Aside from how to set them up, idle timers
  1191. work just like ordinary timers.
  1192. -- Command: run-with-idle-timer secs repeat function &rest args
  1193. Set up a timer which runs the next time Emacs is idle for SECS
  1194. seconds. The value of SECS may be an integer or a floating point
  1195. number; a value of the type returned by `current-idle-time' is
  1196. also allowed.
  1197. If REPEAT is `nil', the timer runs just once, the first time Emacs
  1198. remains idle for a long enough time. More often REPEAT is
  1199. non-`nil', which means to run the timer _each time_ Emacs remains
  1200. idle for SECS seconds.
  1201. The function `run-with-idle-timer' returns a timer value which you
  1202. can use in calling `cancel-timer' (*note Timers::).
  1203. Emacs becomes "idle" when it starts waiting for user input, and it
  1204. remains idle until the user provides some input. If a timer is set for
  1205. five seconds of idleness, it runs approximately five seconds after
  1206. Emacs first becomes idle. Even if REPEAT is non-`nil', this timer will
  1207. not run again as long as Emacs remains idle, because the duration of
  1208. idleness will continue to increase and will not go down to five seconds
  1209. again.
  1210. Emacs can do various things while idle: garbage collect, autosave or
  1211. handle data from a subprocess. But these interludes during idleness do
  1212. not interfere with idle timers, because they do not reset the clock of
  1213. idleness to zero. An idle timer set for 600 seconds will run when ten
  1214. minutes have elapsed since the last user command was finished, even if
  1215. subprocess output has been accepted thousands of times within those ten
  1216. minutes, and even if there have been garbage collections and autosaves.
  1217. When the user supplies input, Emacs becomes non-idle while executing
  1218. the input. Then it becomes idle again, and all the idle timers that are
  1219. set up to repeat will subsequently run another time, one by one.
  1220. -- Function: current-idle-time
  1221. If Emacs is idle, this function returns the length of time Emacs
  1222. has been idle, as a list of three integers: `(SEC-HIGH SEC-LOW
  1223. MICROSEC)', where HIGH and LOW are the high and low bits for the
  1224. number of seconds and MICROSEC is the additional number of
  1225. microseconds (*note Time of Day::).
  1226. When Emacs is not idle, `current-idle-time' returns `nil'. This
  1227. is a convenient way to test whether Emacs is idle.
  1228. The main use of this function is when an idle timer function wants
  1229. to "take a break" for a while. It can set up another idle timer to
  1230. call the same function again, after a few seconds more idleness.
  1231. Here's an example:
  1232. (defvar resume-timer nil
  1233. "Timer that `timer-function' used to reschedule itself, or nil.")
  1234. (defun timer-function ()
  1235. ;; If the user types a command while `resume-timer'
  1236. ;; is active, the next time this function is called from
  1237. ;; its main idle timer, deactivate `resume-timer'.
  1238. (when resume-timer
  1239. (cancel-timer resume-timer))
  1240. ...DO THE WORK FOR A WHILE...
  1241. (when TAKING-A-BREAK
  1242. (setq resume-timer
  1243. (run-with-idle-timer
  1244. ;; Compute an idle time BREAK-LENGTH
  1245. ;; more than the current value.
  1246. (time-add (current-idle-time)
  1247. (seconds-to-time BREAK-LENGTH))
  1248. nil
  1249. 'timer-function))))
  1250. Do not write an idle timer function containing a loop which does a
  1251. certain amount of processing each time around, and exits when
  1252. `(input-pending-p)' is non-`nil'. This approach seems very natural but
  1253. has two problems:
  1254. * It blocks out all process output (since Emacs accepts process
  1255. output only while waiting).
  1256. * It blocks out any idle timers that ought to run during that time.
  1257. The correct approach is for the idle timer to reschedule itself after a
  1258. brief pause, using the method in the `timer-function' example above.
  1259. 
  1260. File: elisp, Node: Terminal Input, Next: Terminal Output, Prev: Idle Timers, Up: System Interface
  1261. 39.12 Terminal Input
  1262. ====================
  1263. This section describes functions and variables for recording or
  1264. manipulating terminal input. See *note Display::, for related
  1265. functions.
  1266. * Menu:
  1267. * Input Modes:: Options for how input is processed.
  1268. * Recording Input:: Saving histories of recent or all input events.
  1269. 
  1270. File: elisp, Node: Input Modes, Next: Recording Input, Up: Terminal Input
  1271. 39.12.1 Input Modes
  1272. -------------------
  1273. -- Function: set-input-mode interrupt flow meta &optional quit-char
  1274. This function sets the mode for reading keyboard input. If
  1275. INTERRUPT is non-null, then Emacs uses input interrupts. If it is
  1276. `nil', then it uses CBREAK mode. The default setting is
  1277. system-dependent. Some systems always use CBREAK mode regardless
  1278. of what is specified.
  1279. When Emacs communicates directly with X, it ignores this argument
  1280. and uses interrupts if that is the way it knows how to communicate.
  1281. If FLOW is non-`nil', then Emacs uses XON/XOFF (`C-q', `C-s') flow
  1282. control for output to the terminal. This has no effect except in
  1283. CBREAK mode.
  1284. The argument META controls support for input character codes above
  1285. 127. If META is `t', Emacs converts characters with the 8th bit
  1286. set into Meta characters. If META is `nil', Emacs disregards the
  1287. 8th bit; this is necessary when the terminal uses it as a parity
  1288. bit. If META is neither `t' nor `nil', Emacs uses all 8 bits of
  1289. input unchanged. This is good for terminals that use 8-bit
  1290. character sets.
  1291. If QUIT-CHAR is non-`nil', it specifies the character to use for
  1292. quitting. Normally this character is `C-g'. *Note Quitting::.
  1293. The `current-input-mode' function returns the input mode settings
  1294. Emacs is currently using.
  1295. -- Function: current-input-mode
  1296. This function returns the current mode for reading keyboard input.
  1297. It returns a list, corresponding to the arguments of
  1298. `set-input-mode', of the form `(INTERRUPT FLOW META QUIT)' in
  1299. which:
  1300. INTERRUPT
  1301. is non-`nil' when Emacs is using interrupt-driven input. If
  1302. `nil', Emacs is using CBREAK mode.
  1303. FLOW
  1304. is non-`nil' if Emacs uses XON/XOFF (`C-q', `C-s') flow
  1305. control for output to the terminal. This value is meaningful
  1306. only when INTERRUPT is `nil'.
  1307. META
  1308. is `t' if Emacs treats the eighth bit of input characters as
  1309. the meta bit; `nil' means Emacs clears the eighth bit of every
  1310. input character; any other value means Emacs uses all eight
  1311. bits as the basic character code.
  1312. QUIT
  1313. is the character Emacs currently uses for quitting, usually
  1314. `C-g'.
  1315. 
  1316. File: elisp, Node: Recording Input, Prev: Input Modes, Up: Terminal Input
  1317. 39.12.2 Recording Input
  1318. -----------------------
  1319. -- Function: recent-keys
  1320. This function returns a vector containing the last 300 input
  1321. events from the keyboard or mouse. All input events are included,
  1322. whether or not they were used as parts of key sequences. Thus,
  1323. you always get the last 100 input events, not counting events
  1324. generated by keyboard macros. (These are excluded because they
  1325. are less interesting for debugging; it should be enough to see the
  1326. events that invoked the macros.)
  1327. A call to `clear-this-command-keys' (*note Command Loop Info::)
  1328. causes this function to return an empty vector immediately
  1329. afterward.
  1330. -- Command: open-dribble-file filename
  1331. This function opens a "dribble file" named FILENAME. When a
  1332. dribble file is open, each input event from the keyboard or mouse
  1333. (but not those from keyboard macros) is written in that file. A
  1334. non-character event is expressed using its printed representation
  1335. surrounded by `<...>'.
  1336. You close the dribble file by calling this function with an
  1337. argument of `nil'.
  1338. This function is normally used to record the input necessary to
  1339. trigger an Emacs bug, for the sake of a bug report.
  1340. (open-dribble-file "~/dribble")
  1341. => nil
  1342. See also the `open-termscript' function (*note Terminal Output::).
  1343. 
  1344. File: elisp, Node: Terminal Output, Next: Sound Output, Prev: Terminal Input, Up: System Interface
  1345. 39.13 Terminal Output
  1346. =====================
  1347. The terminal output functions send output to a text terminal, or keep
  1348. track of output sent to the terminal. The variable `baud-rate' tells
  1349. you what Emacs thinks is the output speed of the terminal.
  1350. -- User Option: baud-rate
  1351. This variable's value is the output speed of the terminal, as far
  1352. as Emacs knows. Setting this variable does not change the speed
  1353. of actual data transmission, but the value is used for
  1354. calculations such as padding.
  1355. It also affects decisions about whether to scroll part of the
  1356. screen or repaint on text terminals. *Note Forcing Redisplay::,
  1357. for the corresponding functionality on graphical terminals.
  1358. The value is measured in baud.
  1359. If you are running across a network, and different parts of the
  1360. network work at different baud rates, the value returned by Emacs may be
  1361. different from the value used by your local terminal. Some network
  1362. protocols communicate the local terminal speed to the remote machine, so
  1363. that Emacs and other programs can get the proper value, but others do
  1364. not. If Emacs has the wrong value, it makes decisions that are less
  1365. than optimal. To fix the problem, set `baud-rate'.
  1366. -- Function: send-string-to-terminal string &optional terminal
  1367. This function sends STRING to TERMINAL without alteration.
  1368. Control characters in STRING have terminal-dependent effects.
  1369. This function operates only on text terminals. TERMINAL may be a
  1370. terminal object, a frame, or `nil' for the selected frame's
  1371. terminal. In batch mode, STRING is sent to `stdout' when TERMINAL
  1372. is `nil'.
  1373. One use of this function is to define function keys on terminals
  1374. that have downloadable function key definitions. For example,
  1375. this is how (on certain terminals) to define function key 4 to
  1376. move forward four characters (by transmitting the characters `C-u
  1377. C-f' to the computer):
  1378. (send-string-to-terminal "\eF4\^U\^F")
  1379. => nil
  1380. -- Command: open-termscript filename
  1381. This function is used to open a "termscript file" that will record
  1382. all the characters sent by Emacs to the terminal. It returns
  1383. `nil'. Termscript files are useful for investigating problems
  1384. where Emacs garbles the screen, problems that are due to incorrect
  1385. Termcap entries or to undesirable settings of terminal options more
  1386. often than to actual Emacs bugs. Once you are certain which
  1387. characters were actually output, you can determine reliably
  1388. whether they correspond to the Termcap specifications in use.
  1389. You close the termscript file by calling this function with an
  1390. argument of `nil'.
  1391. See also `open-dribble-file' in *note Recording Input::.
  1392. (open-termscript "../junk/termscript")
  1393. => nil
  1394. 
  1395. File: elisp, Node: Sound Output, Next: X11 Keysyms, Prev: Terminal Output, Up: System Interface
  1396. 39.14 Sound Output
  1397. ==================
  1398. To play sound using Emacs, use the function `play-sound'. Only certain
  1399. systems are supported; if you call `play-sound' on a system which
  1400. cannot really do the job, it gives an error.
  1401. The sound must be stored as a file in RIFF-WAVE format (`.wav') or
  1402. Sun Audio format (`.au').
  1403. -- Function: play-sound sound
  1404. This function plays a specified sound. The argument, SOUND, has
  1405. the form `(sound PROPERTIES...)', where the PROPERTIES consist of
  1406. alternating keywords (particular symbols recognized specially) and
  1407. values corresponding to them.
  1408. Here is a table of the keywords that are currently meaningful in
  1409. SOUND, and their meanings:
  1410. `:file FILE'
  1411. This specifies the file containing the sound to play. If the
  1412. file name is not absolute, it is expanded against the
  1413. directory `data-directory'.
  1414. `:data DATA'
  1415. This specifies the sound to play without need to refer to a
  1416. file. The value, DATA, should be a string containing the
  1417. same bytes as a sound file. We recommend using a unibyte
  1418. string.
  1419. `:volume VOLUME'
  1420. This specifies how loud to play the sound. It should be a
  1421. number in the range of 0 to 1. The default is to use
  1422. whatever volume has been specified before.
  1423. `:device DEVICE'
  1424. This specifies the system device on which to play the sound,
  1425. as a string. The default device is system-dependent.
  1426. Before actually playing the sound, `play-sound' calls the
  1427. functions in the list `play-sound-functions'. Each function is
  1428. called with one argument, SOUND.
  1429. -- Command: play-sound-file file &optional volume device
  1430. This function is an alternative interface to playing a sound FILE
  1431. specifying an optional VOLUME and DEVICE.
  1432. -- Variable: play-sound-functions
  1433. A list of functions to be called before playing a sound. Each
  1434. function is called with one argument, a property list that
  1435. describes the sound.
  1436. 
  1437. File: elisp, Node: X11 Keysyms, Next: Batch Mode, Prev: Sound Output, Up: System Interface
  1438. 39.15 Operating on X11 Keysyms
  1439. ==============================
  1440. To define system-specific X11 keysyms, set the variable
  1441. `system-key-alist'.
  1442. -- Variable: system-key-alist
  1443. This variable's value should be an alist with one element for each
  1444. system-specific keysym. Each element has the form `(CODE .
  1445. SYMBOL)', where CODE is the numeric keysym code (not including the
  1446. "vendor specific" bit, -2**28), and SYMBOL is the name for the
  1447. function key.
  1448. For example `(168 . mute-acute)' defines a system-specific key
  1449. (used by HP X servers) whose numeric code is -2**28 + 168.
  1450. It is not crucial to exclude from the alist the keysyms of other X
  1451. servers; those do no harm, as long as they don't conflict with the
  1452. ones used by the X server actually in use.
  1453. The variable is always local to the current terminal, and cannot be
  1454. buffer-local. *Note Multiple Terminals::.
  1455. You can specify which keysyms Emacs should use for the Meta, Alt,
  1456. Hyper, and Super modifiers by setting these variables:
  1457. -- Variable: x-alt-keysym
  1458. -- Variable: x-meta-keysym
  1459. -- Variable: x-hyper-keysym
  1460. -- Variable: x-super-keysym
  1461. The name of the keysym that should stand for the Alt modifier
  1462. (respectively, for Meta, Hyper, and Super). For example, here is
  1463. how to swap the Meta and Alt modifiers within Emacs:
  1464. (setq x-alt-keysym 'meta)
  1465. (setq x-meta-keysym 'alt)
  1466. 
  1467. File: elisp, Node: Batch Mode, Next: Session Management, Prev: X11 Keysyms, Up: System Interface
  1468. 39.16 Batch Mode
  1469. ================
  1470. The command-line option `-batch' causes Emacs to run noninteractively.
  1471. In this mode, Emacs does not read commands from the terminal, it does
  1472. not alter the terminal modes, and it does not expect to be outputting
  1473. to an erasable screen. The idea is that you specify Lisp programs to
  1474. run; when they are finished, Emacs should exit. The way to specify the
  1475. programs to run is with `-l FILE', which loads the library named FILE,
  1476. or `-f FUNCTION', which calls FUNCTION with no arguments, or `--eval
  1477. FORM'.
  1478. Any Lisp program output that would normally go to the echo area,
  1479. either using `message', or using `prin1', etc., with `t' as the stream,
  1480. goes instead to Emacs's standard error descriptor when in batch mode.
  1481. Similarly, input that would normally come from the minibuffer is read
  1482. from the standard input descriptor. Thus, Emacs behaves much like a
  1483. noninteractive application program. (The echo area output that Emacs
  1484. itself normally generates, such as command echoing, is suppressed
  1485. entirely.)
  1486. -- Variable: noninteractive
  1487. This variable is non-`nil' when Emacs is running in batch mode.
  1488. 
  1489. File: elisp, Node: Session Management, Next: Notifications, Prev: Batch Mode, Up: System Interface
  1490. 39.17 Session Management
  1491. ========================
  1492. Emacs supports the X Session Management Protocol, which is used to
  1493. suspend and restart applications. In the X Window System, a program
  1494. called the "session manager" is responsible for keeping track of the
  1495. applications that are running. When the X server shuts down, the
  1496. session manager asks applications to save their state, and delays the
  1497. actual shutdown until they respond. An application can also cancel the
  1498. shutdown.
  1499. When the session manager restarts a suspended session, it directs
  1500. these applications to individually reload their saved state. It does
  1501. this by specifying a special command-line argument that says what saved
  1502. session to restore. For Emacs, this argument is `--smid SESSION'.
  1503. -- Variable: emacs-save-session-functions
  1504. Emacs supports saving state via a hook called
  1505. `emacs-save-session-functions'. Emacs runs this hook when the
  1506. session manager tells it that the window system is shutting down.
  1507. The functions are called with no arguments, and with the current
  1508. buffer set to a temporary buffer. Each function can use `insert'
  1509. to add Lisp code to this buffer. At the end, Emacs saves the
  1510. buffer in a file, called the "session file".
  1511. Subsequently, when the session manager restarts Emacs, it loads the
  1512. session file automatically (*note Loading::). This is performed
  1513. by a function named `emacs-session-restore', which is called during
  1514. startup. *Note Startup Summary::.
  1515. If a function in `emacs-save-session-functions' returns non-`nil',
  1516. Emacs tells the session manager to cancel the shutdown.
  1517. Here is an example that just inserts some text into `*scratch*' when
  1518. Emacs is restarted by the session manager.
  1519. (add-hook 'emacs-save-session-functions 'save-yourself-test)
  1520. (defun save-yourself-test ()
  1521. (insert "(save-current-buffer
  1522. (switch-to-buffer \"*scratch*\")
  1523. (insert \"I am restored\"))")
  1524. nil)
  1525. 
  1526. File: elisp, Node: Notifications, Next: Dynamic Libraries, Prev: Session Management, Up: System Interface
  1527. 39.18 Desktop Notifications
  1528. ===========================
  1529. Emacs is able to send "notifications" on systems that support the
  1530. freedesktop.org Desktop Notifications Specification. In order to use
  1531. this functionality, Emacs must have been compiled with D-Bus support,
  1532. and the `notifications' library must be loaded.
  1533. -- Function: notifications-notify &rest params
  1534. This function sends a notification to the desktop via D-Bus,
  1535. consisting of the parameters specified by the PARAMS arguments.
  1536. These arguments should consist of alternating keyword and value
  1537. pairs. The supported keywords and values are as follows:
  1538. `:title TITLE'
  1539. The notification title.
  1540. `:body TEXT'
  1541. The notification body text. Depending on the implementation
  1542. of the notification server, the text could contain HTML
  1543. markups, like `"<b>bold text</b>"', or hyperlinks.
  1544. `:app-name NAME'
  1545. The name of the application sending the notification. The
  1546. default is `notifications-application-name'.
  1547. `:replaces-id ID'
  1548. The notification ID that this notification replaces. ID must
  1549. be the result of a previous `notifications-notify' call.
  1550. `:app-icon ICON-FILE'
  1551. The file name of the notification icon. If set to `nil', no
  1552. icon is displayed. The default is
  1553. `notifications-application-icon'.
  1554. `:actions (KEY TITLE KEY TITLE ...)'
  1555. A list of actions to be applied. KEY and TITLE are both
  1556. strings. The default action (usually invoked by clicking the
  1557. notification) should have a key named `"default"'. The title
  1558. can be anything, though implementations are free not to
  1559. display it.
  1560. `:timeout TIMEOUT'
  1561. The timeout time in milliseconds since the display of the
  1562. notification at which the notification should automatically
  1563. close. If -1, the notification's expiration time is
  1564. dependent on the notification server's settings, and may vary
  1565. for the type of notification. If 0, the notification never
  1566. expires. Default value is -1.
  1567. `:urgency URGENCY'
  1568. The urgency level. It can be `low', `normal', or `critical'.
  1569. `:category CATEGORY'
  1570. The type of notification this is, a string.
  1571. `:desktop-entry FILENAME'
  1572. This specifies the name of the desktop filename representing
  1573. the calling program, like `"emacs"'.
  1574. `:image-data (WIDTH HEIGHT ROWSTRIDE HAS-ALPHA BITS CHANNELS DATA)'
  1575. This is a raw data image format that describes the width,
  1576. height, rowstride, whether there is an alpha channel, bits
  1577. per sample, channels and image data, respectively.
  1578. `:image-path PATH'
  1579. This is represented either as a URI (`file://' is the only URI
  1580. schema supported right now) or a name in a
  1581. freedesktop.org-compliant icon theme from
  1582. `$XDG_DATA_DIRS/icons'.
  1583. `:sound-file FILENAME'
  1584. The path to a sound file to play when the notification pops
  1585. up.
  1586. `:sound-name NAME'
  1587. A themable named sound from the freedesktop.org sound naming
  1588. specification from `$XDG_DATA_DIRS/sounds', to play when the
  1589. notification pops up. Similar to the icon name, only for
  1590. sounds. An example would be `"message-new-instant"'.
  1591. `:suppress-sound'
  1592. Causes the server to suppress playing any sounds, if it has
  1593. that ability.
  1594. `:x POSITION'
  1595. `:y POSITION'
  1596. Specifies the X, Y location on the screen that the
  1597. notification should point to. Both arguments must be used
  1598. together.
  1599. `:on-action FUNCTION'
  1600. Function to call when an action is invoked. The notification
  1601. ID and the KEY of the action are passed as arguments to the
  1602. function.
  1603. `:on-close FUNCTION'
  1604. Function to call when the notification has been closed by
  1605. timeout or by the user. The function receive the
  1606. notification ID and the closing REASON as arguments:
  1607. * `expired' if the notification has expired
  1608. * `dismissed' if the notification was dismissed by the user
  1609. * `close-notification' if the notification was closed by a
  1610. call to `notifications-close-notification'
  1611. * `undefined' if the notification server hasn't provided a
  1612. reason
  1613. This function returns a notification id, an integer, which can be
  1614. used to manipulate the notification item with
  1615. `notifications-close-notification' or the `:replaces-id' argument
  1616. of another `notifications-notify' call. For example:
  1617. (defun my-on-action-function (id key)
  1618. (message "Message %d, key \"%s\" pressed" id key))
  1619. => my-on-action-function
  1620. (defun my-on-close-function (id reason)
  1621. (message "Message %d, closed due to \"%s\"" id reason))
  1622. => my-on-close-function
  1623. (notifications-notify
  1624. :title "Title"
  1625. :body "This is <b>important</b>."
  1626. :actions '("Confirm" "I agree" "Refuse" "I disagree")
  1627. :on-action 'my-on-action-function
  1628. :on-close 'my-on-close-function)
  1629. => 22
  1630. A message window opens on the desktop. Press "I agree"
  1631. => Message 22, key "Confirm" pressed
  1632. Message 22, closed due to "dismissed"
  1633. -- Function: notifications-close-notification id
  1634. This function closes a notification with identifier ID.
  1635. 
  1636. File: elisp, Node: Dynamic Libraries, Prev: Notifications, Up: System Interface
  1637. 39.19 Dynamically Loaded Libraries
  1638. ==================================
  1639. A "dynamically loaded library" is a library that is loaded on demand,
  1640. when its facilities are first needed. Emacs supports such on-demand
  1641. loading of support libraries for some of its features.
  1642. -- Variable: dynamic-library-alist
  1643. This is an alist of dynamic libraries and external library files
  1644. implementing them.
  1645. Each element is a list of the form `(LIBRARY FILES...)', where the
  1646. `car' is a symbol representing a supported external library, and
  1647. the rest are strings giving alternate filenames for that library.
  1648. Emacs tries to load the library from the files in the order they
  1649. appear in the list; if none is found, the Emacs session won't have
  1650. access to that library, and the features it provides will be
  1651. unavailable.
  1652. Image support on some platforms uses this facility. Here's an
  1653. example of setting this variable for supporting images on
  1654. MS-Windows:
  1655. (setq dynamic-library-alist
  1656. '((xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll")
  1657. (png "libpng12d.dll" "libpng12.dll" "libpng.dll"
  1658. "libpng13d.dll" "libpng13.dll")
  1659. (jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll"
  1660. "jpeg.dll")
  1661. (tiff "libtiff3.dll" "libtiff.dll")
  1662. (gif "giflib4.dll" "libungif4.dll" "libungif.dll")
  1663. (svg "librsvg-2-2.dll")
  1664. (gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
  1665. (glib "libglib-2.0-0.dll")
  1666. (gobject "libgobject-2.0-0.dll")))
  1667. Note that image types `pbm' and `xbm' do not need entries in this
  1668. variable because they do not depend on external libraries and are
  1669. always available in Emacs.
  1670. Also note that this variable is not meant to be a generic facility
  1671. for accessing external libraries; only those already known by
  1672. Emacs can be loaded through it.
  1673. This variable is ignored if the given LIBRARY is statically linked
  1674. into Emacs.
  1675. 
  1676. File: elisp, Node: Packaging, Next: Antinews, Prev: System Interface, Up: Top
  1677. 40 Preparing Lisp code for distribution
  1678. ***************************************
  1679. Emacs provides a standard way to distribute Emacs Lisp code to users.
  1680. A "package" is a collection of one or more files, formatted and bundled
  1681. in such a way that users can easily download, install, uninstall, and
  1682. upgrade it.
  1683. The following sections describe how to create a package, and how to
  1684. put it in a "package archive" for others to download. *Note Packages:
  1685. (emacs)Packages, for a description of user-level features of the
  1686. packaging system.
  1687. * Menu:
  1688. * Packaging Basics:: The basic concepts of Emacs Lisp packages.
  1689. * Simple Packages:: How to package a single .el file.
  1690. * Multi-file Packages:: How to package multiple files.
  1691. * Package Archives:: Maintaining package archives.
  1692. 
  1693. File: elisp, Node: Packaging Basics, Next: Simple Packages, Up: Packaging
  1694. 40.1 Packaging Basics
  1695. =====================
  1696. A package is either a "simple package" or a "multi-file package". A
  1697. simple package is stored in a package archive as a single Emacs Lisp
  1698. file, while a multi-file package is stored as a tar file (containing
  1699. multiple Lisp files, and possibly non-Lisp files such as a manual).
  1700. In ordinary usage, the difference between simple packages and
  1701. multi-file packages is relatively unimportant; the Package Menu
  1702. interface makes no distinction between them. However, the procedure
  1703. for creating them differs, as explained in the following sections.
  1704. Each package (whether simple or multi-file) has certain "attributes":
  1705. Name
  1706. A short word (e.g. `auctex'). This is usually also the symbol
  1707. prefix used in the program (*note Coding Conventions::).
  1708. Version
  1709. A version number, in a form that the function `version-to-list'
  1710. understands (e.g. `11.86'). Each release of a package should be
  1711. accompanied by an increase in the version number.
  1712. Brief description
  1713. This is shown when the package is listed in the Package Menu. It
  1714. should occupy a single line, ideally in 36 characters or less.
  1715. Long description
  1716. This is shown in the buffer created by `C-h P'
  1717. (`describe-package'), following the package's brief description
  1718. and installation status. It normally spans multiple lines, and
  1719. should fully describe the package's capabilities and how to begin
  1720. using it once it is installed.
  1721. Dependencies
  1722. A list of other packages (possibly including minimal acceptable
  1723. version numbers) on which this package depends. The list may be
  1724. empty, meaning this package has no dependencies. Otherwise,
  1725. installing this package also automatically installs its
  1726. dependencies; if any dependency cannot be found, the package
  1727. cannot be installed.
  1728. Installing a package, either via the command `package-install-file',
  1729. or via the Package Menu, creates a subdirectory of `package-user-dir'
  1730. named `NAME-VERSION', where NAME is the package's name and VERSION its
  1731. version (e.g. `~/.emacs.d/elpa/auctex-11.86/'). We call this the
  1732. package's "content directory". It is where Emacs puts the package's
  1733. contents (the single Lisp file for a simple package, or the files
  1734. extracted from a multi-file package).
  1735. Emacs then searches every Lisp file in the content directory for
  1736. autoload magic comments (*note Autoload::). These autoload definitions
  1737. are saved to a file named `NAME-autoloads.el' in the content directory.
  1738. They are typically used to autoload the principal user commands defined
  1739. in the package, but they can also perform other tasks, such as adding
  1740. an element to `auto-mode-alist' (*note Auto Major Mode::). Note that a
  1741. package typically does _not_ autoload every function and variable
  1742. defined within it--only the handful of commands typically called to
  1743. begin using the package. Emacs then byte-compiles every Lisp file in
  1744. the package.
  1745. After installation, the installed package is "loaded": Emacs adds
  1746. the package's content directory to `load-path', and evaluates the
  1747. autoload definitions in `NAME-autoloads.el'.
  1748. Whenever Emacs starts up, it automatically calls the function
  1749. `package-initialize' to load installed packages. This is done after
  1750. loading the init file and abbrev file (if any) and before running
  1751. `after-init-hook' (*note Startup Summary::). Automatic package loading
  1752. is disabled if the user option `package-enable-at-startup' is `nil'.
  1753. -- Command: package-initialize &optional no-activate
  1754. This function initializes Emacs' internal record of which packages
  1755. are installed, and loads them. The user option `package-load-list'
  1756. specifies which packages to load; by default, all installed
  1757. packages are loaded. *Note Package Installation: (emacs)Package
  1758. Installation.
  1759. The optional argument NO-ACTIVATE, if non-`nil', causes Emacs to
  1760. update its record of installed packages without actually loading
  1761. them; it is for internal use only.
  1762. 
  1763. File: elisp, Node: Simple Packages, Next: Multi-file Packages, Prev: Packaging Basics, Up: Packaging
  1764. 40.2 Simple Packages
  1765. ====================
  1766. A simple package consists of a single Emacs Lisp source file. The file
  1767. must conform to the Emacs Lisp library header conventions (*note
  1768. Library Headers::). The package's attributes are taken from the
  1769. various headers, as illustrated by the following example:
  1770. ;;; superfrobnicator.el --- Frobnicate and bifurcate flanges
  1771. ;; Copyright (C) 2011 Free Software Foundation, Inc.
  1772. ;; Author: J. R. Hacker <jrh@example.com>
  1773. ;; Version: 1.3
  1774. ;; Package-Requires: ((flange "1.0"))
  1775. ;; Keywords: frobnicate
  1776. ...
  1777. ;;; Commentary:
  1778. ;; This package provides a minor mode to frobnicate and/or
  1779. ;; bifurcate any flanges you desire. To activate it, just type
  1780. ...
  1781. ;;;###autoload
  1782. (define-minor-mode superfrobnicator-mode
  1783. ...
  1784. The name of the package is the same as the base name of the file, as
  1785. written on the first line. Here, it is `superfrobnicator'.
  1786. The brief description is also taken from the first line. Here, it
  1787. is `Frobnicate and bifurcate flanges'.
  1788. The version number comes from the `Package-Version' header, if it
  1789. exists, or from the `Version' header otherwise. One or the other
  1790. _must_ be present. Here, the version number is 1.3.
  1791. If the file has a `;;; Commentary:' section, this section is used as
  1792. the long description. (When displaying the description, Emacs omits
  1793. the `;;; Commentary:' line, as well as the leading comment characters
  1794. in the commentary itself.)
  1795. If the file has a `Package-Requires' header, that is used as the
  1796. package dependencies. In the above example, the package depends on the
  1797. `flange' package, version 1.0 or higher. *Note Library Headers::, for
  1798. a description of the `Package-Requires' header. If the header is
  1799. omitted, the package has no dependencies.
  1800. The file ought to also contain one or more autoload magic comments,
  1801. as explained in *note Packaging Basics::. In the above example, a magic
  1802. comment autoloads `superfrobnicator-mode'.
  1803. *Note Package Archives::, for a explanation of how to add a
  1804. single-file package to a package archive.
  1805. 
  1806. File: elisp, Node: Multi-file Packages, Next: Package Archives, Prev: Simple Packages, Up: Packaging
  1807. 40.3 Multi-file Packages
  1808. ========================
  1809. A multi-file package is less convenient to create than a single-file
  1810. package, but it offers more features: it can include multiple Emacs
  1811. Lisp files, an Info manual, and other file types (such as images).
  1812. Prior to installation, a multi-file package is stored in a package
  1813. archive as a tar file. The tar file must be named `NAME-VERSION.tar',
  1814. where NAME is the package name and VERSION is the version number. Its
  1815. contents, once extracted, must all appear in a directory named
  1816. `NAME-VERSION', the "content directory" (*note Packaging Basics::).
  1817. Files may also extract into subdirectories of the content directory.
  1818. One of the files in the content directory must be named
  1819. `NAME-pkg.el'. It must contain a single Lisp form, consisting of a
  1820. call to the function `define-package', described below. This defines
  1821. the package's version, brief description, and requirements.
  1822. For example, if we distribute version 1.3 of the superfrobnicator as
  1823. a multi-file package, the tar file would be `superfrobnicator-1.3.tar'.
  1824. Its contents would extract into the directory `superfrobnicator-1.3',
  1825. and one of these would be the file `superfrobnicator-pkg.el'.
  1826. -- Function: define-package name version &optional docstring
  1827. requirements
  1828. This function defines a package. NAME is the package name, a
  1829. string. VERSION is the version, as a string of a form that can be
  1830. understood by the function `version-to-list'. DOCSTRING is the
  1831. brief description.
  1832. REQUIREMENTS is a list of required packages and their versions.
  1833. Each element in this list should have the form `(DEP-NAME
  1834. DEP-VERSION)', where DEP-NAME is a symbol whose name is the
  1835. dependency's package name, and DEP-VERSION is the dependency's
  1836. version (a string).
  1837. If the content directory contains a file named `README', this file
  1838. is used as the long description.
  1839. If the content directory contains a file named `dir', this is
  1840. assumed to be an Info directory file made with `install-info'. *Note
  1841. Invoking install-info: (texinfo)Invoking install-info. The relevant
  1842. Info files should also be present in the content directory. In this
  1843. case, Emacs will automatically add the content directory to
  1844. `Info-directory-list' when the package is activated.
  1845. Do not include any `.elc' files in the package. Those are created
  1846. when the package is installed. Note that there is no way to control
  1847. the order in which files are byte-compiled.
  1848. Do not include any file named `NAME-autoloads.el'. This file is
  1849. reserved for the package's autoload definitions (*note Packaging
  1850. Basics::). It is created automatically when the package is installed,
  1851. by searching all the Lisp files in the package for autoload magic
  1852. comments.
  1853. If the multi-file package contains auxiliary data files (such as
  1854. images), the package's Lisp code can refer to these files via the
  1855. variable `load-file-name' (*note Loading::). Here is an example:
  1856. (defconst superfrobnicator-base (file-name-directory load-file-name))
  1857. (defun superfrobnicator-fetch-image (file)
  1858. (expand-file-name file superfrobnicator-base))
  1859. 
  1860. File: elisp, Node: Package Archives, Prev: Multi-file Packages, Up: Packaging
  1861. 40.4 Creating and Maintaining Package Archives
  1862. ==============================================
  1863. Via the Package Menu, users may download packages from "package
  1864. archives". Such archives are specified by the variable
  1865. `package-archives', whose default value contains a single entry: the
  1866. archive hosted by the GNU project at `elpa.gnu.org'. This section
  1867. describes how to set up and maintain a package archive.
  1868. -- User Option: package-archives
  1869. The value of this variable is an alist of package archives
  1870. recognized by the Emacs package manager.
  1871. Each alist element corresponds to one archive, and should have the
  1872. form `(ID . LOCATION)', where ID is the name of the archive (a
  1873. string) and LOCATION is its "base location" (a string).
  1874. If the base location starts with `http:', it is treated as a HTTP
  1875. URL, and packages are downloaded from this archive via HTTP (as is
  1876. the case for the default GNU archive).
  1877. Otherwise, the base location should be a directory name. In this
  1878. case, Emacs retrieves packages from this archive via ordinary file
  1879. access. Such "local" archives are mainly useful for testing.
  1880. A package archive is simply a directory in which the package files,
  1881. and associated files, are stored. If you want the archive to be
  1882. reachable via HTTP, this directory must be accessible to a web server.
  1883. How to accomplish this is beyond the scope of this manual.
  1884. A convenient way to set up and update a package archive is via the
  1885. `package-x' library. This is included with Emacs, but not loaded by
  1886. default; type `M-x load-library <RET> package-x <RET>' to load it, or
  1887. add `(require 'package-x)' to your init file. *Note Lisp Libraries:
  1888. (emacs)Lisp Libraries. Once loaded, you can make use of the following:
  1889. -- User Option: package-archive-upload-base
  1890. The value of this variable is the base location of a package
  1891. archive, as a directory name. The commands in the `package-x'
  1892. library will use this base location.
  1893. The directory name should be absolute. You may specify a remote
  1894. name, such as `/ssh:foo@example.com:/var/www/packages/', if the
  1895. package archive is on a different machine. *Note Remote Files:
  1896. (emacs)Remote Files.
  1897. -- Command: package-upload-file filename
  1898. This command prompts for FILENAME, a file name, and uploads that
  1899. file to `package-archive-upload-base'. The file must be either a
  1900. simple package (a `.el' file) or a multi-file package (a `.tar'
  1901. file); otherwise, an error is raised. The package attributes are
  1902. automatically extracted, and the archive's contents list is
  1903. updated with this information.
  1904. If `package-archive-upload-base' does not specify a valid
  1905. directory, the function prompts interactively for one. If the
  1906. directory does not exist, it is created. The directory need not
  1907. have any initial contents (i.e., you can use this command to
  1908. populate an initially empty archive).
  1909. -- Command: package-upload-buffer
  1910. This command is similar to `package-upload-file', but instead of
  1911. prompting for a package file, it uploads the contents of the
  1912. current buffer. The current buffer must be visiting a simple
  1913. package (a `.el' file) or a multi-file package (a `.tar' file);
  1914. otherwise, an error is raised.
  1915. After you create an archive, remember that it is not accessible in the
  1916. Package Menu interface unless it is in `package-archives'.
  1917. 
  1918. File: elisp, Node: Antinews, Next: GNU Free Documentation License, Prev: Packaging, Up: Top
  1919. Appendix A Emacs 23 Antinews
  1920. ****************************
  1921. For those users who live backwards in time, here is information about
  1922. downgrading to Emacs version 23.4. We hope you will enjoy the greater
  1923. simplicity that results from the absence of many Emacs 24.2 features.
  1924. A.1 Old Lisp Features in Emacs 23
  1925. =================================
  1926. * Support for lexical scoping has been removed; all variables are
  1927. dynamically scoped. The `lexical-binding' variable has been
  1928. removed, and so has the LEXICAL argument to `eval'. The `defvar'
  1929. and `defconst' forms no longer mark variables as dynamic, since
  1930. all variables are dynamic.
  1931. Having only dynamic binding follows the spirit of Emacs
  1932. extensibility, for it allows any Emacs code to access any defined
  1933. variable with a minimum of fuss. But *Note Dynamic Binding
  1934. Tips::, for tips to avoid making your programs hard to understand.
  1935. * Calling a minor mode function from Lisp with a nil or omitted
  1936. argument does not enable the minor mode unconditionally; instead,
  1937. it toggles the minor mode--which is the straightforward thing to
  1938. do, since that is the behavior when invoked interactively. One
  1939. downside is that it is more troublesome to enable minor modes from
  1940. hooks; you have to do something like
  1941. (add-hook 'foo-hook (lambda () (bar-mode 1)))
  1942. or define `turn-on-bar-mode' and call that from the hook.
  1943. * The `prog-mode' dummy major mode has been removed. Instead of
  1944. using it as a crutch to meet programming mode conventions, you
  1945. should explicitly ensure that your mode follows those conventions.
  1946. *Note Major Mode Conventions::.
  1947. * Emacs no longer supports bidirectional display and editing. Since
  1948. there is no need to worry about the insertion of right-to-left text
  1949. messing up how lines and paragraphs are displayed, the function
  1950. `bidi-string-mark-left-to-right' has been removed; so have many
  1951. other functions and variables related to bidirectional display.
  1952. Unicode directionality characters like `U+200E' ("left-to-right
  1953. mark") have no special effect on display.
  1954. * Emacs windows now have most of their internal state hidden from
  1955. Lisp. Internal windows are no longer visible to Lisp; functions
  1956. such as `window-parent', window parameters related to window
  1957. arrangement, and window-local buffer lists have all been removed.
  1958. Functions for resizing windows can delete windows if they become
  1959. too small.
  1960. The "action function" feature for controlling buffer display has
  1961. been removed, including `display-buffer-overriding-action' and
  1962. related variables, as well as the ACTION argument to
  1963. `display-buffer' and other functions. The way to programmatically
  1964. control how Emacs chooses a window to display a buffer is to bind
  1965. the right combination of `special-display-regexps',
  1966. `pop-up-frames', and other variables.
  1967. * The standard completion interface has been simplified, eliminating
  1968. the `completion-extra-properties' variable, the `metadata' action
  1969. flag for completion functions, and the concept of "completion
  1970. categories". Lisp programmers may now find the choice of methods
  1971. for tuning completion less bewildering, but if a package finds the
  1972. streamlined interface insufficient for its needs, it must
  1973. implement its own specialized completion feature.
  1974. * `copy-directory' now behaves the same whether or not the
  1975. destination is an existing directory: if the destination exists,
  1976. the _contents_ of the first directory are copied into it (with
  1977. subdirectories handled recursively), rather than copying the first
  1978. directory into a subdirectory.
  1979. * The TRASH arguments for `delete-file' and `delete-directory' have
  1980. been removed. The variable `delete-by-moving-to-trash' must now
  1981. be used with care; whenever it is non-`nil', all calls to
  1982. `delete-file' or `delete-directory' use the trash.
  1983. * Because Emacs no longer supports SELinux file contexts, the
  1984. PRESERVE-SELINUX-CONTEXT argument to `copy-file' has been removed.
  1985. The return value of `backup-buffer' no longer has an entry for the
  1986. SELinux file context.
  1987. * For mouse click input events in the text area, the Y pixel
  1988. coordinate in the POSITION list (*note Click Events::) now counts
  1989. from the top of the header line, if there is one, rather than the
  1990. top of the text area.
  1991. * Bindings in menu keymaps (*note Format of Keymaps::) now sometimes
  1992. get an additional CACHE entry in their definitions, like this:
  1993. (TYPE ITEM-NAME CACHE . BINDING)
  1994. The CACHE entry is used internally by Emacs to record equivalent
  1995. keyboard key sequences for invoking the same command; Lisp programs
  1996. should never use it.
  1997. * The `gnutls' library has been removed, and the function
  1998. `open-network-stream' correspondingly simplified. Lisp programs
  1999. that want an encrypted network connection must now call external
  2000. utilities such as `starttls' or `gnutls-cli'.
  2001. * Tool bars can no longer display separators, which frees up several
  2002. pixels of space on each graphical frame.
  2003. * As part of the ongoing quest for simplicity, many other functions
  2004. and variables have been eliminated.
  2005. 
  2006. File: elisp, Node: GNU Free Documentation License, Next: GPL, Prev: Antinews, Up: Top
  2007. Appendix B GNU Free Documentation License
  2008. *****************************************
  2009. Version 1.3, 3 November 2008
  2010. Copyright (C) 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
  2011. `http://fsf.org/'
  2012. Everyone is permitted to copy and distribute verbatim copies
  2013. of this license document, but changing it is not allowed.
  2014. 0. PREAMBLE
  2015. The purpose of this License is to make a manual, textbook, or other
  2016. functional and useful document "free" in the sense of freedom: to
  2017. assure everyone the effective freedom to copy and redistribute it,
  2018. with or without modifying it, either commercially or
  2019. noncommercially. Secondarily, this License preserves for the
  2020. author and publisher a way to get credit for their work, while not
  2021. being considered responsible for modifications made by others.
  2022. This License is a kind of "copyleft", which means that derivative
  2023. works of the document must themselves be free in the same sense.
  2024. It complements the GNU General Public License, which is a copyleft
  2025. license designed for free software.
  2026. We have designed this License in order to use it for manuals for
  2027. free software, because free software needs free documentation: a
  2028. free program should come with manuals providing the same freedoms
  2029. that the software does. But this License is not limited to
  2030. software manuals; it can be used for any textual work, regardless
  2031. of subject matter or whether it is published as a printed book.
  2032. We recommend this License principally for works whose purpose is
  2033. instruction or reference.
  2034. 1. APPLICABILITY AND DEFINITIONS
  2035. This License applies to any manual or other work, in any medium,
  2036. that contains a notice placed by the copyright holder saying it
  2037. can be distributed under the terms of this License. Such a notice
  2038. grants a world-wide, royalty-free license, unlimited in duration,
  2039. to use that work under the conditions stated herein. The
  2040. "Document", below, refers to any such manual or work. Any member
  2041. of the public is a licensee, and is addressed as "you". You
  2042. accept the license if you copy, modify or distribute the work in a
  2043. way requiring permission under copyright law.
  2044. A "Modified Version" of the Document means any work containing the
  2045. Document or a portion of it, either copied verbatim, or with
  2046. modifications and/or translated into another language.
  2047. A "Secondary Section" is a named appendix or a front-matter section
  2048. of the Document that deals exclusively with the relationship of the
  2049. publishers or authors of the Document to the Document's overall
  2050. subject (or to related matters) and contains nothing that could
  2051. fall directly within that overall subject. (Thus, if the Document
  2052. is in part a textbook of mathematics, a Secondary Section may not
  2053. explain any mathematics.) The relationship could be a matter of
  2054. historical connection with the subject or with related matters, or
  2055. of legal, commercial, philosophical, ethical or political position
  2056. regarding them.
  2057. The "Invariant Sections" are certain Secondary Sections whose
  2058. titles are designated, as being those of Invariant Sections, in
  2059. the notice that says that the Document is released under this
  2060. License. If a section does not fit the above definition of
  2061. Secondary then it is not allowed to be designated as Invariant.
  2062. The Document may contain zero Invariant Sections. If the Document
  2063. does not identify any Invariant Sections then there are none.
  2064. The "Cover Texts" are certain short passages of text that are
  2065. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  2066. that says that the Document is released under this License. A
  2067. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  2068. be at most 25 words.
  2069. A "Transparent" copy of the Document means a machine-readable copy,
  2070. represented in a format whose specification is available to the
  2071. general public, that is suitable for revising the document
  2072. straightforwardly with generic text editors or (for images
  2073. composed of pixels) generic paint programs or (for drawings) some
  2074. widely available drawing editor, and that is suitable for input to
  2075. text formatters or for automatic translation to a variety of
  2076. formats suitable for input to text formatters. A copy made in an
  2077. otherwise Transparent file format whose markup, or absence of
  2078. markup, has been arranged to thwart or discourage subsequent
  2079. modification by readers is not Transparent. An image format is
  2080. not Transparent if used for any substantial amount of text. A
  2081. copy that is not "Transparent" is called "Opaque".
  2082. Examples of suitable formats for Transparent copies include plain
  2083. ASCII without markup, Texinfo input format, LaTeX input format,
  2084. SGML or XML using a publicly available DTD, and
  2085. standard-conforming simple HTML, PostScript or PDF designed for
  2086. human modification. Examples of transparent image formats include
  2087. PNG, XCF and JPG. Opaque formats include proprietary formats that
  2088. can be read and edited only by proprietary word processors, SGML or
  2089. XML for which the DTD and/or processing tools are not generally
  2090. available, and the machine-generated HTML, PostScript or PDF
  2091. produced by some word processors for output purposes only.
  2092. The "Title Page" means, for a printed book, the title page itself,
  2093. plus such following pages as are needed to hold, legibly, the
  2094. material this License requires to appear in the title page. For
  2095. works in formats which do not have any title page as such, "Title
  2096. Page" means the text near the most prominent appearance of the
  2097. work's title, preceding the beginning of the body of the text.
  2098. The "publisher" means any person or entity that distributes copies
  2099. of the Document to the public.
  2100. A section "Entitled XYZ" means a named subunit of the Document
  2101. whose title either is precisely XYZ or contains XYZ in parentheses
  2102. following text that translates XYZ in another language. (Here XYZ
  2103. stands for a specific section name mentioned below, such as
  2104. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  2105. To "Preserve the Title" of such a section when you modify the
  2106. Document means that it remains a section "Entitled XYZ" according
  2107. to this definition.
  2108. The Document may include Warranty Disclaimers next to the notice
  2109. which states that this License applies to the Document. These
  2110. Warranty Disclaimers are considered to be included by reference in
  2111. this License, but only as regards disclaiming warranties: any other
  2112. implication that these Warranty Disclaimers may have is void and
  2113. has no effect on the meaning of this License.
  2114. 2. VERBATIM COPYING
  2115. You may copy and distribute the Document in any medium, either
  2116. commercially or noncommercially, provided that this License, the
  2117. copyright notices, and the license notice saying this License
  2118. applies to the Document are reproduced in all copies, and that you
  2119. add no other conditions whatsoever to those of this License. You
  2120. may not use technical measures to obstruct or control the reading
  2121. or further copying of the copies you make or distribute. However,
  2122. you may accept compensation in exchange for copies. If you
  2123. distribute a large enough number of copies you must also follow
  2124. the conditions in section 3.
  2125. You may also lend copies, under the same conditions stated above,
  2126. and you may publicly display copies.
  2127. 3. COPYING IN QUANTITY
  2128. If you publish printed copies (or copies in media that commonly
  2129. have printed covers) of the Document, numbering more than 100, and
  2130. the Document's license notice requires Cover Texts, you must
  2131. enclose the copies in covers that carry, clearly and legibly, all
  2132. these Cover Texts: Front-Cover Texts on the front cover, and
  2133. Back-Cover Texts on the back cover. Both covers must also clearly
  2134. and legibly identify you as the publisher of these copies. The
  2135. front cover must present the full title with all words of the
  2136. title equally prominent and visible. You may add other material
  2137. on the covers in addition. Copying with changes limited to the
  2138. covers, as long as they preserve the title of the Document and
  2139. satisfy these conditions, can be treated as verbatim copying in
  2140. other respects.
  2141. If the required texts for either cover are too voluminous to fit
  2142. legibly, you should put the first ones listed (as many as fit
  2143. reasonably) on the actual cover, and continue the rest onto
  2144. adjacent pages.
  2145. If you publish or distribute Opaque copies of the Document
  2146. numbering more than 100, you must either include a
  2147. machine-readable Transparent copy along with each Opaque copy, or
  2148. state in or with each Opaque copy a computer-network location from
  2149. which the general network-using public has access to download
  2150. using public-standard network protocols a complete Transparent
  2151. copy of the Document, free of added material. If you use the
  2152. latter option, you must take reasonably prudent steps, when you
  2153. begin distribution of Opaque copies in quantity, to ensure that
  2154. this Transparent copy will remain thus accessible at the stated
  2155. location until at least one year after the last time you
  2156. distribute an Opaque copy (directly or through your agents or
  2157. retailers) of that edition to the public.
  2158. It is requested, but not required, that you contact the authors of
  2159. the Document well before redistributing any large number of
  2160. copies, to give them a chance to provide you with an updated
  2161. version of the Document.
  2162. 4. MODIFICATIONS
  2163. You may copy and distribute a Modified Version of the Document
  2164. under the conditions of sections 2 and 3 above, provided that you
  2165. release the Modified Version under precisely this License, with
  2166. the Modified Version filling the role of the Document, thus
  2167. licensing distribution and modification of the Modified Version to
  2168. whoever possesses a copy of it. In addition, you must do these
  2169. things in the Modified Version:
  2170. A. Use in the Title Page (and on the covers, if any) a title
  2171. distinct from that of the Document, and from those of
  2172. previous versions (which should, if there were any, be listed
  2173. in the History section of the Document). You may use the
  2174. same title as a previous version if the original publisher of
  2175. that version gives permission.
  2176. B. List on the Title Page, as authors, one or more persons or
  2177. entities responsible for authorship of the modifications in
  2178. the Modified Version, together with at least five of the
  2179. principal authors of the Document (all of its principal
  2180. authors, if it has fewer than five), unless they release you
  2181. from this requirement.
  2182. C. State on the Title page the name of the publisher of the
  2183. Modified Version, as the publisher.
  2184. D. Preserve all the copyright notices of the Document.
  2185. E. Add an appropriate copyright notice for your modifications
  2186. adjacent to the other copyright notices.
  2187. F. Include, immediately after the copyright notices, a license
  2188. notice giving the public permission to use the Modified
  2189. Version under the terms of this License, in the form shown in
  2190. the Addendum below.
  2191. G. Preserve in that license notice the full lists of Invariant
  2192. Sections and required Cover Texts given in the Document's
  2193. license notice.
  2194. H. Include an unaltered copy of this License.
  2195. I. Preserve the section Entitled "History", Preserve its Title,
  2196. and add to it an item stating at least the title, year, new
  2197. authors, and publisher of the Modified Version as given on
  2198. the Title Page. If there is no section Entitled "History" in
  2199. the Document, create one stating the title, year, authors,
  2200. and publisher of the Document as given on its Title Page,
  2201. then add an item describing the Modified Version as stated in
  2202. the previous sentence.
  2203. J. Preserve the network location, if any, given in the Document
  2204. for public access to a Transparent copy of the Document, and
  2205. likewise the network locations given in the Document for
  2206. previous versions it was based on. These may be placed in
  2207. the "History" section. You may omit a network location for a
  2208. work that was published at least four years before the
  2209. Document itself, or if the original publisher of the version
  2210. it refers to gives permission.
  2211. K. For any section Entitled "Acknowledgements" or "Dedications",
  2212. Preserve the Title of the section, and preserve in the
  2213. section all the substance and tone of each of the contributor
  2214. acknowledgements and/or dedications given therein.
  2215. L. Preserve all the Invariant Sections of the Document,
  2216. unaltered in their text and in their titles. Section numbers
  2217. or the equivalent are not considered part of the section
  2218. titles.
  2219. M. Delete any section Entitled "Endorsements". Such a section
  2220. may not be included in the Modified Version.
  2221. N. Do not retitle any existing section to be Entitled
  2222. "Endorsements" or to conflict in title with any Invariant
  2223. Section.
  2224. O. Preserve any Warranty Disclaimers.
  2225. If the Modified Version includes new front-matter sections or
  2226. appendices that qualify as Secondary Sections and contain no
  2227. material copied from the Document, you may at your option
  2228. designate some or all of these sections as invariant. To do this,
  2229. add their titles to the list of Invariant Sections in the Modified
  2230. Version's license notice. These titles must be distinct from any
  2231. other section titles.
  2232. You may add a section Entitled "Endorsements", provided it contains
  2233. nothing but endorsements of your Modified Version by various
  2234. parties--for example, statements of peer review or that the text
  2235. has been approved by an organization as the authoritative
  2236. definition of a standard.
  2237. You may add a passage of up to five words as a Front-Cover Text,
  2238. and a passage of up to 25 words as a Back-Cover Text, to the end
  2239. of the list of Cover Texts in the Modified Version. Only one
  2240. passage of Front-Cover Text and one of Back-Cover Text may be
  2241. added by (or through arrangements made by) any one entity. If the
  2242. Document already includes a cover text for the same cover,
  2243. previously added by you or by arrangement made by the same entity
  2244. you are acting on behalf of, you may not add another; but you may
  2245. replace the old one, on explicit permission from the previous
  2246. publisher that added the old one.
  2247. The author(s) and publisher(s) of the Document do not by this
  2248. License give permission to use their names for publicity for or to
  2249. assert or imply endorsement of any Modified Version.
  2250. 5. COMBINING DOCUMENTS
  2251. You may combine the Document with other documents released under
  2252. this License, under the terms defined in section 4 above for
  2253. modified versions, provided that you include in the combination
  2254. all of the Invariant Sections of all of the original documents,
  2255. unmodified, and list them all as Invariant Sections of your
  2256. combined work in its license notice, and that you preserve all
  2257. their Warranty Disclaimers.
  2258. The combined work need only contain one copy of this License, and
  2259. multiple identical Invariant Sections may be replaced with a single
  2260. copy. If there are multiple Invariant Sections with the same name
  2261. but different contents, make the title of each such section unique
  2262. by adding at the end of it, in parentheses, the name of the
  2263. original author or publisher of that section if known, or else a
  2264. unique number. Make the same adjustment to the section titles in
  2265. the list of Invariant Sections in the license notice of the
  2266. combined work.
  2267. In the combination, you must combine any sections Entitled
  2268. "History" in the various original documents, forming one section
  2269. Entitled "History"; likewise combine any sections Entitled
  2270. "Acknowledgements", and any sections Entitled "Dedications". You
  2271. must delete all sections Entitled "Endorsements."
  2272. 6. COLLECTIONS OF DOCUMENTS
  2273. You may make a collection consisting of the Document and other
  2274. documents released under this License, and replace the individual
  2275. copies of this License in the various documents with a single copy
  2276. that is included in the collection, provided that you follow the
  2277. rules of this License for verbatim copying of each of the
  2278. documents in all other respects.
  2279. You may extract a single document from such a collection, and
  2280. distribute it individually under this License, provided you insert
  2281. a copy of this License into the extracted document, and follow
  2282. this License in all other respects regarding verbatim copying of
  2283. that document.
  2284. 7. AGGREGATION WITH INDEPENDENT WORKS
  2285. A compilation of the Document or its derivatives with other
  2286. separate and independent documents or works, in or on a volume of
  2287. a storage or distribution medium, is called an "aggregate" if the
  2288. copyright resulting from the compilation is not used to limit the
  2289. legal rights of the compilation's users beyond what the individual
  2290. works permit. When the Document is included in an aggregate, this
  2291. License does not apply to the other works in the aggregate which
  2292. are not themselves derivative works of the Document.
  2293. If the Cover Text requirement of section 3 is applicable to these
  2294. copies of the Document, then if the Document is less than one half
  2295. of the entire aggregate, the Document's Cover Texts may be placed
  2296. on covers that bracket the Document within the aggregate, or the
  2297. electronic equivalent of covers if the Document is in electronic
  2298. form. Otherwise they must appear on printed covers that bracket
  2299. the whole aggregate.
  2300. 8. TRANSLATION
  2301. Translation is considered a kind of modification, so you may
  2302. distribute translations of the Document under the terms of section
  2303. 4. Replacing Invariant Sections with translations requires special
  2304. permission from their copyright holders, but you may include
  2305. translations of some or all Invariant Sections in addition to the
  2306. original versions of these Invariant Sections. You may include a
  2307. translation of this License, and all the license notices in the
  2308. Document, and any Warranty Disclaimers, provided that you also
  2309. include the original English version of this License and the
  2310. original versions of those notices and disclaimers. In case of a
  2311. disagreement between the translation and the original version of
  2312. this License or a notice or disclaimer, the original version will
  2313. prevail.
  2314. If a section in the Document is Entitled "Acknowledgements",
  2315. "Dedications", or "History", the requirement (section 4) to
  2316. Preserve its Title (section 1) will typically require changing the
  2317. actual title.
  2318. 9. TERMINATION
  2319. You may not copy, modify, sublicense, or distribute the Document
  2320. except as expressly provided under this License. Any attempt
  2321. otherwise to copy, modify, sublicense, or distribute it is void,
  2322. and will automatically terminate your rights under this License.
  2323. However, if you cease all violation of this License, then your
  2324. license from a particular copyright holder is reinstated (a)
  2325. provisionally, unless and until the copyright holder explicitly
  2326. and finally terminates your license, and (b) permanently, if the
  2327. copyright holder fails to notify you of the violation by some
  2328. reasonable means prior to 60 days after the cessation.
  2329. Moreover, your license from a particular copyright holder is
  2330. reinstated permanently if the copyright holder notifies you of the
  2331. violation by some reasonable means, this is the first time you have
  2332. received notice of violation of this License (for any work) from
  2333. that copyright holder, and you cure the violation prior to 30 days
  2334. after your receipt of the notice.
  2335. Termination of your rights under this section does not terminate
  2336. the licenses of parties who have received copies or rights from
  2337. you under this License. If your rights have been terminated and
  2338. not permanently reinstated, receipt of a copy of some or all of
  2339. the same material does not give you any rights to use it.
  2340. 10. FUTURE REVISIONS OF THIS LICENSE
  2341. The Free Software Foundation may publish new, revised versions of
  2342. the GNU Free Documentation License from time to time. Such new
  2343. versions will be similar in spirit to the present version, but may
  2344. differ in detail to address new problems or concerns. See
  2345. `http://www.gnu.org/copyleft/'.
  2346. Each version of the License is given a distinguishing version
  2347. number. If the Document specifies that a particular numbered
  2348. version of this License "or any later version" applies to it, you
  2349. have the option of following the terms and conditions either of
  2350. that specified version or of any later version that has been
  2351. published (not as a draft) by the Free Software Foundation. If
  2352. the Document does not specify a version number of this License,
  2353. you may choose any version ever published (not as a draft) by the
  2354. Free Software Foundation. If the Document specifies that a proxy
  2355. can decide which future versions of this License can be used, that
  2356. proxy's public statement of acceptance of a version permanently
  2357. authorizes you to choose that version for the Document.
  2358. 11. RELICENSING
  2359. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  2360. World Wide Web server that publishes copyrightable works and also
  2361. provides prominent facilities for anybody to edit those works. A
  2362. public wiki that anybody can edit is an example of such a server.
  2363. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  2364. site means any set of copyrightable works thus published on the MMC
  2365. site.
  2366. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  2367. license published by Creative Commons Corporation, a not-for-profit
  2368. corporation with a principal place of business in San Francisco,
  2369. California, as well as future copyleft versions of that license
  2370. published by that same organization.
  2371. "Incorporate" means to publish or republish a Document, in whole or
  2372. in part, as part of another Document.
  2373. An MMC is "eligible for relicensing" if it is licensed under this
  2374. License, and if all works that were first published under this
  2375. License somewhere other than this MMC, and subsequently
  2376. incorporated in whole or in part into the MMC, (1) had no cover
  2377. texts or invariant sections, and (2) were thus incorporated prior
  2378. to November 1, 2008.
  2379. The operator of an MMC Site may republish an MMC contained in the
  2380. site under CC-BY-SA on the same site at any time before August 1,
  2381. 2009, provided the MMC is eligible for relicensing.
  2382. ADDENDUM: How to use this License for your documents
  2383. ====================================================
  2384. To use this License in a document you have written, include a copy of
  2385. the License in the document and put the following copyright and license
  2386. notices just after the title page:
  2387. Copyright (C) YEAR YOUR NAME.
  2388. Permission is granted to copy, distribute and/or modify this document
  2389. under the terms of the GNU Free Documentation License, Version 1.3
  2390. or any later version published by the Free Software Foundation;
  2391. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  2392. Texts. A copy of the license is included in the section entitled ``GNU
  2393. Free Documentation License''.
  2394. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  2395. Texts, replace the "with...Texts." line with this:
  2396. with the Invariant Sections being LIST THEIR TITLES, with
  2397. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  2398. being LIST.
  2399. If you have Invariant Sections without Cover Texts, or some other
  2400. combination of the three, merge those two alternatives to suit the
  2401. situation.
  2402. If your document contains nontrivial examples of program code, we
  2403. recommend releasing these examples in parallel under your choice of
  2404. free software license, such as the GNU General Public License, to
  2405. permit their use in free software.
  2406. 
  2407. File: elisp, Node: GPL, Next: Tips, Prev: GNU Free Documentation License, Up: Top
  2408. Appendix C GNU General Public License
  2409. *************************************
  2410. Version 3, 29 June 2007
  2411. Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/'
  2412. Everyone is permitted to copy and distribute verbatim copies of this
  2413. license document, but changing it is not allowed.
  2414. Preamble
  2415. ========
  2416. The GNU General Public License is a free, copyleft license for software
  2417. and other kinds of works.
  2418. The licenses for most software and other practical works are designed
  2419. to take away your freedom to share and change the works. By contrast,
  2420. the GNU General Public License is intended to guarantee your freedom to
  2421. share and change all versions of a program--to make sure it remains
  2422. free software for all its users. We, the Free Software Foundation, use
  2423. the GNU General Public License for most of our software; it applies
  2424. also to any other work released this way by its authors. You can apply
  2425. it to your programs, too.
  2426. When we speak of free software, we are referring to freedom, not
  2427. price. Our General Public Licenses are designed to make sure that you
  2428. have the freedom to distribute copies of free software (and charge for
  2429. them if you wish), that you receive source code or can get it if you
  2430. want it, that you can change the software or use pieces of it in new
  2431. free programs, and that you know you can do these things.
  2432. To protect your rights, we need to prevent others from denying you
  2433. these rights or asking you to surrender the rights. Therefore, you
  2434. have certain responsibilities if you distribute copies of the software,
  2435. or if you modify it: responsibilities to respect the freedom of others.
  2436. For example, if you distribute copies of such a program, whether
  2437. gratis or for a fee, you must pass on to the recipients the same
  2438. freedoms that you received. You must make sure that they, too, receive
  2439. or can get the source code. And you must show them these terms so they
  2440. know their rights.
  2441. Developers that use the GNU GPL protect your rights with two steps:
  2442. (1) assert copyright on the software, and (2) offer you this License
  2443. giving you legal permission to copy, distribute and/or modify it.
  2444. For the developers' and authors' protection, the GPL clearly explains
  2445. that there is no warranty for this free software. For both users' and
  2446. authors' sake, the GPL requires that modified versions be marked as
  2447. changed, so that their problems will not be attributed erroneously to
  2448. authors of previous versions.
  2449. Some devices are designed to deny users access to install or run
  2450. modified versions of the software inside them, although the
  2451. manufacturer can do so. This is fundamentally incompatible with the
  2452. aim of protecting users' freedom to change the software. The
  2453. systematic pattern of such abuse occurs in the area of products for
  2454. individuals to use, which is precisely where it is most unacceptable.
  2455. Therefore, we have designed this version of the GPL to prohibit the
  2456. practice for those products. If such problems arise substantially in
  2457. other domains, we stand ready to extend this provision to those domains
  2458. in future versions of the GPL, as needed to protect the freedom of
  2459. users.
  2460. Finally, every program is threatened constantly by software patents.
  2461. States should not allow patents to restrict development and use of
  2462. software on general-purpose computers, but in those that do, we wish to
  2463. avoid the special danger that patents applied to a free program could
  2464. make it effectively proprietary. To prevent this, the GPL assures that
  2465. patents cannot be used to render the program non-free.
  2466. The precise terms and conditions for copying, distribution and
  2467. modification follow.
  2468. TERMS AND CONDITIONS
  2469. ====================
  2470. 0. Definitions.
  2471. "This License" refers to version 3 of the GNU General Public
  2472. License.
  2473. "Copyright" also means copyright-like laws that apply to other
  2474. kinds of works, such as semiconductor masks.
  2475. "The Program" refers to any copyrightable work licensed under this
  2476. License. Each licensee is addressed as "you". "Licensees" and
  2477. "recipients" may be individuals or organizations.
  2478. To "modify" a work means to copy from or adapt all or part of the
  2479. work in a fashion requiring copyright permission, other than the
  2480. making of an exact copy. The resulting work is called a "modified
  2481. version" of the earlier work or a work "based on" the earlier work.
  2482. A "covered work" means either the unmodified Program or a work
  2483. based on the Program.
  2484. To "propagate" a work means to do anything with it that, without
  2485. permission, would make you directly or secondarily liable for
  2486. infringement under applicable copyright law, except executing it
  2487. on a computer or modifying a private copy. Propagation includes
  2488. copying, distribution (with or without modification), making
  2489. available to the public, and in some countries other activities as
  2490. well.
  2491. To "convey" a work means any kind of propagation that enables other
  2492. parties to make or receive copies. Mere interaction with a user
  2493. through a computer network, with no transfer of a copy, is not
  2494. conveying.
  2495. An interactive user interface displays "Appropriate Legal Notices"
  2496. to the extent that it includes a convenient and prominently visible
  2497. feature that (1) displays an appropriate copyright notice, and (2)
  2498. tells the user that there is no warranty for the work (except to
  2499. the extent that warranties are provided), that licensees may
  2500. convey the work under this License, and how to view a copy of this
  2501. License. If the interface presents a list of user commands or
  2502. options, such as a menu, a prominent item in the list meets this
  2503. criterion.
  2504. 1. Source Code.
  2505. The "source code" for a work means the preferred form of the work
  2506. for making modifications to it. "Object code" means any
  2507. non-source form of a work.
  2508. A "Standard Interface" means an interface that either is an
  2509. official standard defined by a recognized standards body, or, in
  2510. the case of interfaces specified for a particular programming
  2511. language, one that is widely used among developers working in that
  2512. language.
  2513. The "System Libraries" of an executable work include anything,
  2514. other than the work as a whole, that (a) is included in the normal
  2515. form of packaging a Major Component, but which is not part of that
  2516. Major Component, and (b) serves only to enable use of the work
  2517. with that Major Component, or to implement a Standard Interface
  2518. for which an implementation is available to the public in source
  2519. code form. A "Major Component", in this context, means a major
  2520. essential component (kernel, window system, and so on) of the
  2521. specific operating system (if any) on which the executable work
  2522. runs, or a compiler used to produce the work, or an object code
  2523. interpreter used to run it.
  2524. The "Corresponding Source" for a work in object code form means all
  2525. the source code needed to generate, install, and (for an executable
  2526. work) run the object code and to modify the work, including
  2527. scripts to control those activities. However, it does not include
  2528. the work's System Libraries, or general-purpose tools or generally
  2529. available free programs which are used unmodified in performing
  2530. those activities but which are not part of the work. For example,
  2531. Corresponding Source includes interface definition files
  2532. associated with source files for the work, and the source code for
  2533. shared libraries and dynamically linked subprograms that the work
  2534. is specifically designed to require, such as by intimate data
  2535. communication or control flow between those subprograms and other
  2536. parts of the work.
  2537. The Corresponding Source need not include anything that users can
  2538. regenerate automatically from other parts of the Corresponding
  2539. Source.
  2540. The Corresponding Source for a work in source code form is that
  2541. same work.
  2542. 2. Basic Permissions.
  2543. All rights granted under this License are granted for the term of
  2544. copyright on the Program, and are irrevocable provided the stated
  2545. conditions are met. This License explicitly affirms your unlimited
  2546. permission to run the unmodified Program. The output from running
  2547. a covered work is covered by this License only if the output,
  2548. given its content, constitutes a covered work. This License
  2549. acknowledges your rights of fair use or other equivalent, as
  2550. provided by copyright law.
  2551. You may make, run and propagate covered works that you do not
  2552. convey, without conditions so long as your license otherwise
  2553. remains in force. You may convey covered works to others for the
  2554. sole purpose of having them make modifications exclusively for
  2555. you, or provide you with facilities for running those works,
  2556. provided that you comply with the terms of this License in
  2557. conveying all material for which you do not control copyright.
  2558. Those thus making or running the covered works for you must do so
  2559. exclusively on your behalf, under your direction and control, on
  2560. terms that prohibit them from making any copies of your
  2561. copyrighted material outside their relationship with you.
  2562. Conveying under any other circumstances is permitted solely under
  2563. the conditions stated below. Sublicensing is not allowed; section
  2564. 10 makes it unnecessary.
  2565. 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
  2566. No covered work shall be deemed part of an effective technological
  2567. measure under any applicable law fulfilling obligations under
  2568. article 11 of the WIPO copyright treaty adopted on 20 December
  2569. 1996, or similar laws prohibiting or restricting circumvention of
  2570. such measures.
  2571. When you convey a covered work, you waive any legal power to forbid
  2572. circumvention of technological measures to the extent such
  2573. circumvention is effected by exercising rights under this License
  2574. with respect to the covered work, and you disclaim any intention
  2575. to limit operation or modification of the work as a means of
  2576. enforcing, against the work's users, your or third parties' legal
  2577. rights to forbid circumvention of technological measures.
  2578. 4. Conveying Verbatim Copies.
  2579. You may convey verbatim copies of the Program's source code as you
  2580. receive it, in any medium, provided that you conspicuously and
  2581. appropriately publish on each copy an appropriate copyright notice;
  2582. keep intact all notices stating that this License and any
  2583. non-permissive terms added in accord with section 7 apply to the
  2584. code; keep intact all notices of the absence of any warranty; and
  2585. give all recipients a copy of this License along with the Program.
  2586. You may charge any price or no price for each copy that you convey,
  2587. and you may offer support or warranty protection for a fee.
  2588. 5. Conveying Modified Source Versions.
  2589. You may convey a work based on the Program, or the modifications to
  2590. produce it from the Program, in the form of source code under the
  2591. terms of section 4, provided that you also meet all of these
  2592. conditions:
  2593. a. The work must carry prominent notices stating that you
  2594. modified it, and giving a relevant date.
  2595. b. The work must carry prominent notices stating that it is
  2596. released under this License and any conditions added under
  2597. section 7. This requirement modifies the requirement in
  2598. section 4 to "keep intact all notices".
  2599. c. You must license the entire work, as a whole, under this
  2600. License to anyone who comes into possession of a copy. This
  2601. License will therefore apply, along with any applicable
  2602. section 7 additional terms, to the whole of the work, and all
  2603. its parts, regardless of how they are packaged. This License
  2604. gives no permission to license the work in any other way, but
  2605. it does not invalidate such permission if you have separately
  2606. received it.
  2607. d. If the work has interactive user interfaces, each must display
  2608. Appropriate Legal Notices; however, if the Program has
  2609. interactive interfaces that do not display Appropriate Legal
  2610. Notices, your work need not make them do so.
  2611. A compilation of a covered work with other separate and independent
  2612. works, which are not by their nature extensions of the covered
  2613. work, and which are not combined with it such as to form a larger
  2614. program, in or on a volume of a storage or distribution medium, is
  2615. called an "aggregate" if the compilation and its resulting
  2616. copyright are not used to limit the access or legal rights of the
  2617. compilation's users beyond what the individual works permit.
  2618. Inclusion of a covered work in an aggregate does not cause this
  2619. License to apply to the other parts of the aggregate.
  2620. 6. Conveying Non-Source Forms.
  2621. You may convey a covered work in object code form under the terms
  2622. of sections 4 and 5, provided that you also convey the
  2623. machine-readable Corresponding Source under the terms of this
  2624. License, in one of these ways:
  2625. a. Convey the object code in, or embodied in, a physical product
  2626. (including a physical distribution medium), accompanied by the
  2627. Corresponding Source fixed on a durable physical medium
  2628. customarily used for software interchange.
  2629. b. Convey the object code in, or embodied in, a physical product
  2630. (including a physical distribution medium), accompanied by a
  2631. written offer, valid for at least three years and valid for
  2632. as long as you offer spare parts or customer support for that
  2633. product model, to give anyone who possesses the object code
  2634. either (1) a copy of the Corresponding Source for all the
  2635. software in the product that is covered by this License, on a
  2636. durable physical medium customarily used for software
  2637. interchange, for a price no more than your reasonable cost of
  2638. physically performing this conveying of source, or (2) access
  2639. to copy the Corresponding Source from a network server at no
  2640. charge.
  2641. c. Convey individual copies of the object code with a copy of
  2642. the written offer to provide the Corresponding Source. This
  2643. alternative is allowed only occasionally and noncommercially,
  2644. and only if you received the object code with such an offer,
  2645. in accord with subsection 6b.
  2646. d. Convey the object code by offering access from a designated
  2647. place (gratis or for a charge), and offer equivalent access
  2648. to the Corresponding Source in the same way through the same
  2649. place at no further charge. You need not require recipients
  2650. to copy the Corresponding Source along with the object code.
  2651. If the place to copy the object code is a network server, the
  2652. Corresponding Source may be on a different server (operated
  2653. by you or a third party) that supports equivalent copying
  2654. facilities, provided you maintain clear directions next to
  2655. the object code saying where to find the Corresponding Source.
  2656. Regardless of what server hosts the Corresponding Source, you
  2657. remain obligated to ensure that it is available for as long
  2658. as needed to satisfy these requirements.
  2659. e. Convey the object code using peer-to-peer transmission,
  2660. provided you inform other peers where the object code and
  2661. Corresponding Source of the work are being offered to the
  2662. general public at no charge under subsection 6d.
  2663. A separable portion of the object code, whose source code is
  2664. excluded from the Corresponding Source as a System Library, need
  2665. not be included in conveying the object code work.
  2666. A "User Product" is either (1) a "consumer product", which means
  2667. any tangible personal property which is normally used for personal,
  2668. family, or household purposes, or (2) anything designed or sold for
  2669. incorporation into a dwelling. In determining whether a product
  2670. is a consumer product, doubtful cases shall be resolved in favor of
  2671. coverage. For a particular product received by a particular user,
  2672. "normally used" refers to a typical or common use of that class of
  2673. product, regardless of the status of the particular user or of the
  2674. way in which the particular user actually uses, or expects or is
  2675. expected to use, the product. A product is a consumer product
  2676. regardless of whether the product has substantial commercial,
  2677. industrial or non-consumer uses, unless such uses represent the
  2678. only significant mode of use of the product.
  2679. "Installation Information" for a User Product means any methods,
  2680. procedures, authorization keys, or other information required to
  2681. install and execute modified versions of a covered work in that
  2682. User Product from a modified version of its Corresponding Source.
  2683. The information must suffice to ensure that the continued
  2684. functioning of the modified object code is in no case prevented or
  2685. interfered with solely because modification has been made.
  2686. If you convey an object code work under this section in, or with,
  2687. or specifically for use in, a User Product, and the conveying
  2688. occurs as part of a transaction in which the right of possession
  2689. and use of the User Product is transferred to the recipient in
  2690. perpetuity or for a fixed term (regardless of how the transaction
  2691. is characterized), the Corresponding Source conveyed under this
  2692. section must be accompanied by the Installation Information. But
  2693. this requirement does not apply if neither you nor any third party
  2694. retains the ability to install modified object code on the User
  2695. Product (for example, the work has been installed in ROM).
  2696. The requirement to provide Installation Information does not
  2697. include a requirement to continue to provide support service,
  2698. warranty, or updates for a work that has been modified or
  2699. installed by the recipient, or for the User Product in which it
  2700. has been modified or installed. Access to a network may be denied
  2701. when the modification itself materially and adversely affects the
  2702. operation of the network or violates the rules and protocols for
  2703. communication across the network.
  2704. Corresponding Source conveyed, and Installation Information
  2705. provided, in accord with this section must be in a format that is
  2706. publicly documented (and with an implementation available to the
  2707. public in source code form), and must require no special password
  2708. or key for unpacking, reading or copying.
  2709. 7. Additional Terms.
  2710. "Additional permissions" are terms that supplement the terms of
  2711. this License by making exceptions from one or more of its
  2712. conditions. Additional permissions that are applicable to the
  2713. entire Program shall be treated as though they were included in
  2714. this License, to the extent that they are valid under applicable
  2715. law. If additional permissions apply only to part of the Program,
  2716. that part may be used separately under those permissions, but the
  2717. entire Program remains governed by this License without regard to
  2718. the additional permissions.
  2719. When you convey a copy of a covered work, you may at your option
  2720. remove any additional permissions from that copy, or from any part
  2721. of it. (Additional permissions may be written to require their own
  2722. removal in certain cases when you modify the work.) You may place
  2723. additional permissions on material, added by you to a covered work,
  2724. for which you have or can give appropriate copyright permission.
  2725. Notwithstanding any other provision of this License, for material
  2726. you add to a covered work, you may (if authorized by the copyright
  2727. holders of that material) supplement the terms of this License
  2728. with terms:
  2729. a. Disclaiming warranty or limiting liability differently from
  2730. the terms of sections 15 and 16 of this License; or
  2731. b. Requiring preservation of specified reasonable legal notices
  2732. or author attributions in that material or in the Appropriate
  2733. Legal Notices displayed by works containing it; or
  2734. c. Prohibiting misrepresentation of the origin of that material,
  2735. or requiring that modified versions of such material be
  2736. marked in reasonable ways as different from the original
  2737. version; or
  2738. d. Limiting the use for publicity purposes of names of licensors
  2739. or authors of the material; or
  2740. e. Declining to grant rights under trademark law for use of some
  2741. trade names, trademarks, or service marks; or
  2742. f. Requiring indemnification of licensors and authors of that
  2743. material by anyone who conveys the material (or modified
  2744. versions of it) with contractual assumptions of liability to
  2745. the recipient, for any liability that these contractual
  2746. assumptions directly impose on those licensors and authors.
  2747. All other non-permissive additional terms are considered "further
  2748. restrictions" within the meaning of section 10. If the Program as
  2749. you received it, or any part of it, contains a notice stating that
  2750. it is governed by this License along with a term that is a further
  2751. restriction, you may remove that term. If a license document
  2752. contains a further restriction but permits relicensing or
  2753. conveying under this License, you may add to a covered work
  2754. material governed by the terms of that license document, provided
  2755. that the further restriction does not survive such relicensing or
  2756. conveying.
  2757. If you add terms to a covered work in accord with this section, you
  2758. must place, in the relevant source files, a statement of the
  2759. additional terms that apply to those files, or a notice indicating
  2760. where to find the applicable terms.
  2761. Additional terms, permissive or non-permissive, may be stated in
  2762. the form of a separately written license, or stated as exceptions;
  2763. the above requirements apply either way.
  2764. 8. Termination.
  2765. You may not propagate or modify a covered work except as expressly
  2766. provided under this License. Any attempt otherwise to propagate or
  2767. modify it is void, and will automatically terminate your rights
  2768. under this License (including any patent licenses granted under
  2769. the third paragraph of section 11).
  2770. However, if you cease all violation of this License, then your
  2771. license from a particular copyright holder is reinstated (a)
  2772. provisionally, unless and until the copyright holder explicitly
  2773. and finally terminates your license, and (b) permanently, if the
  2774. copyright holder fails to notify you of the violation by some
  2775. reasonable means prior to 60 days after the cessation.
  2776. Moreover, your license from a particular copyright holder is
  2777. reinstated permanently if the copyright holder notifies you of the
  2778. violation by some reasonable means, this is the first time you have
  2779. received notice of violation of this License (for any work) from
  2780. that copyright holder, and you cure the violation prior to 30 days
  2781. after your receipt of the notice.
  2782. Termination of your rights under this section does not terminate
  2783. the licenses of parties who have received copies or rights from
  2784. you under this License. If your rights have been terminated and
  2785. not permanently reinstated, you do not qualify to receive new
  2786. licenses for the same material under section 10.
  2787. 9. Acceptance Not Required for Having Copies.
  2788. You are not required to accept this License in order to receive or
  2789. run a copy of the Program. Ancillary propagation of a covered work
  2790. occurring solely as a consequence of using peer-to-peer
  2791. transmission to receive a copy likewise does not require
  2792. acceptance. However, nothing other than this License grants you
  2793. permission to propagate or modify any covered work. These actions
  2794. infringe copyright if you do not accept this License. Therefore,
  2795. by modifying or propagating a covered work, you indicate your
  2796. acceptance of this License to do so.
  2797. 10. Automatic Licensing of Downstream Recipients.
  2798. Each time you convey a covered work, the recipient automatically
  2799. receives a license from the original licensors, to run, modify and
  2800. propagate that work, subject to this License. You are not
  2801. responsible for enforcing compliance by third parties with this
  2802. License.
  2803. An "entity transaction" is a transaction transferring control of an
  2804. organization, or substantially all assets of one, or subdividing an
  2805. organization, or merging organizations. If propagation of a
  2806. covered work results from an entity transaction, each party to that
  2807. transaction who receives a copy of the work also receives whatever
  2808. licenses to the work the party's predecessor in interest had or
  2809. could give under the previous paragraph, plus a right to
  2810. possession of the Corresponding Source of the work from the
  2811. predecessor in interest, if the predecessor has it or can get it
  2812. with reasonable efforts.
  2813. You may not impose any further restrictions on the exercise of the
  2814. rights granted or affirmed under this License. For example, you
  2815. may not impose a license fee, royalty, or other charge for
  2816. exercise of rights granted under this License, and you may not
  2817. initiate litigation (including a cross-claim or counterclaim in a
  2818. lawsuit) alleging that any patent claim is infringed by making,
  2819. using, selling, offering for sale, or importing the Program or any
  2820. portion of it.
  2821. 11. Patents.
  2822. A "contributor" is a copyright holder who authorizes use under this
  2823. License of the Program or a work on which the Program is based.
  2824. The work thus licensed is called the contributor's "contributor
  2825. version".
  2826. A contributor's "essential patent claims" are all patent claims
  2827. owned or controlled by the contributor, whether already acquired or
  2828. hereafter acquired, that would be infringed by some manner,
  2829. permitted by this License, of making, using, or selling its
  2830. contributor version, but do not include claims that would be
  2831. infringed only as a consequence of further modification of the
  2832. contributor version. For purposes of this definition, "control"
  2833. includes the right to grant patent sublicenses in a manner
  2834. consistent with the requirements of this License.
  2835. Each contributor grants you a non-exclusive, worldwide,
  2836. royalty-free patent license under the contributor's essential
  2837. patent claims, to make, use, sell, offer for sale, import and
  2838. otherwise run, modify and propagate the contents of its
  2839. contributor version.
  2840. In the following three paragraphs, a "patent license" is any
  2841. express agreement or commitment, however denominated, not to
  2842. enforce a patent (such as an express permission to practice a
  2843. patent or covenant not to sue for patent infringement). To
  2844. "grant" such a patent license to a party means to make such an
  2845. agreement or commitment not to enforce a patent against the party.
  2846. If you convey a covered work, knowingly relying on a patent
  2847. license, and the Corresponding Source of the work is not available
  2848. for anyone to copy, free of charge and under the terms of this
  2849. License, through a publicly available network server or other
  2850. readily accessible means, then you must either (1) cause the
  2851. Corresponding Source to be so available, or (2) arrange to deprive
  2852. yourself of the benefit of the patent license for this particular
  2853. work, or (3) arrange, in a manner consistent with the requirements
  2854. of this License, to extend the patent license to downstream
  2855. recipients. "Knowingly relying" means you have actual knowledge
  2856. that, but for the patent license, your conveying the covered work
  2857. in a country, or your recipient's use of the covered work in a
  2858. country, would infringe one or more identifiable patents in that
  2859. country that you have reason to believe are valid.
  2860. If, pursuant to or in connection with a single transaction or
  2861. arrangement, you convey, or propagate by procuring conveyance of, a
  2862. covered work, and grant a patent license to some of the parties
  2863. receiving the covered work authorizing them to use, propagate,
  2864. modify or convey a specific copy of the covered work, then the
  2865. patent license you grant is automatically extended to all
  2866. recipients of the covered work and works based on it.
  2867. A patent license is "discriminatory" if it does not include within
  2868. the scope of its coverage, prohibits the exercise of, or is
  2869. conditioned on the non-exercise of one or more of the rights that
  2870. are specifically granted under this License. You may not convey a
  2871. covered work if you are a party to an arrangement with a third
  2872. party that is in the business of distributing software, under
  2873. which you make payment to the third party based on the extent of
  2874. your activity of conveying the work, and under which the third
  2875. party grants, to any of the parties who would receive the covered
  2876. work from you, a discriminatory patent license (a) in connection
  2877. with copies of the covered work conveyed by you (or copies made
  2878. from those copies), or (b) primarily for and in connection with
  2879. specific products or compilations that contain the covered work,
  2880. unless you entered into that arrangement, or that patent license
  2881. was granted, prior to 28 March 2007.
  2882. Nothing in this License shall be construed as excluding or limiting
  2883. any implied license or other defenses to infringement that may
  2884. otherwise be available to you under applicable patent law.
  2885. 12. No Surrender of Others' Freedom.
  2886. If conditions are imposed on you (whether by court order,
  2887. agreement or otherwise) that contradict the conditions of this
  2888. License, they do not excuse you from the conditions of this
  2889. License. If you cannot convey a covered work so as to satisfy
  2890. simultaneously your obligations under this License and any other
  2891. pertinent obligations, then as a consequence you may not convey it
  2892. at all. For example, if you agree to terms that obligate you to
  2893. collect a royalty for further conveying from those to whom you
  2894. convey the Program, the only way you could satisfy both those
  2895. terms and this License would be to refrain entirely from conveying
  2896. the Program.
  2897. 13. Use with the GNU Affero General Public License.
  2898. Notwithstanding any other provision of this License, you have
  2899. permission to link or combine any covered work with a work licensed
  2900. under version 3 of the GNU Affero General Public License into a
  2901. single combined work, and to convey the resulting work. The terms
  2902. of this License will continue to apply to the part which is the
  2903. covered work, but the special requirements of the GNU Affero
  2904. General Public License, section 13, concerning interaction through
  2905. a network will apply to the combination as such.
  2906. 14. Revised Versions of this License.
  2907. The Free Software Foundation may publish revised and/or new
  2908. versions of the GNU General Public License from time to time.
  2909. Such new versions will be similar in spirit to the present
  2910. version, but may differ in detail to address new problems or
  2911. concerns.
  2912. Each version is given a distinguishing version number. If the
  2913. Program specifies that a certain numbered version of the GNU
  2914. General Public License "or any later version" applies to it, you
  2915. have the option of following the terms and conditions either of
  2916. that numbered version or of any later version published by the
  2917. Free Software Foundation. If the Program does not specify a
  2918. version number of the GNU General Public License, you may choose
  2919. any version ever published by the Free Software Foundation.
  2920. If the Program specifies that a proxy can decide which future
  2921. versions of the GNU General Public License can be used, that
  2922. proxy's public statement of acceptance of a version permanently
  2923. authorizes you to choose that version for the Program.
  2924. Later license versions may give you additional or different
  2925. permissions. However, no additional obligations are imposed on any
  2926. author or copyright holder as a result of your choosing to follow a
  2927. later version.
  2928. 15. Disclaimer of Warranty.
  2929. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
  2930. APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
  2931. COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
  2932. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
  2933. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  2934. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
  2935. RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
  2936. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
  2937. NECESSARY SERVICING, REPAIR OR CORRECTION.
  2938. 16. Limitation of Liability.
  2939. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  2940. WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
  2941. AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
  2942. FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  2943. CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
  2944. THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  2945. BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
  2946. PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  2947. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
  2948. THE POSSIBILITY OF SUCH DAMAGES.
  2949. 17. Interpretation of Sections 15 and 16.
  2950. If the disclaimer of warranty and limitation of liability provided
  2951. above cannot be given local legal effect according to their terms,
  2952. reviewing courts shall apply local law that most closely
  2953. approximates an absolute waiver of all civil liability in
  2954. connection with the Program, unless a warranty or assumption of
  2955. liability accompanies a copy of the Program in return for a fee.
  2956. END OF TERMS AND CONDITIONS
  2957. ===========================
  2958. How to Apply These Terms to Your New Programs
  2959. =============================================
  2960. If you develop a new program, and you want it to be of the greatest
  2961. possible use to the public, the best way to achieve this is to make it
  2962. free software which everyone can redistribute and change under these
  2963. terms.
  2964. To do so, attach the following notices to the program. It is safest
  2965. to attach them to the start of each source file to most effectively
  2966. state the exclusion of warranty; and each file should have at least the
  2967. "copyright" line and a pointer to where the full notice is found.
  2968. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
  2969. Copyright (C) YEAR NAME OF AUTHOR
  2970. This program is free software: you can redistribute it and/or modify
  2971. it under the terms of the GNU General Public License as published by
  2972. the Free Software Foundation, either version 3 of the License, or (at
  2973. your option) any later version.
  2974. This program is distributed in the hope that it will be useful, but
  2975. WITHOUT ANY WARRANTY; without even the implied warranty of
  2976. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  2977. General Public License for more details.
  2978. You should have received a copy of the GNU General Public License
  2979. along with this program. If not, see `http://www.gnu.org/licenses/'.
  2980. Also add information on how to contact you by electronic and paper
  2981. mail.
  2982. If the program does terminal interaction, make it output a short
  2983. notice like this when it starts in an interactive mode:
  2984. PROGRAM Copyright (C) YEAR NAME OF AUTHOR
  2985. This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  2986. This is free software, and you are welcome to redistribute it
  2987. under certain conditions; type `show c' for details.
  2988. The hypothetical commands `show w' and `show c' should show the
  2989. appropriate parts of the General Public License. Of course, your
  2990. program's commands might be different; for a GUI interface, you would
  2991. use an "about box".
  2992. You should also get your employer (if you work as a programmer) or
  2993. school, if any, to sign a "copyright disclaimer" for the program, if
  2994. necessary. For more information on this, and how to apply and follow
  2995. the GNU GPL, see `http://www.gnu.org/licenses/'.
  2996. The GNU General Public License does not permit incorporating your
  2997. program into proprietary programs. If your program is a subroutine
  2998. library, you may consider it more useful to permit linking proprietary
  2999. applications with the library. If this is what you want to do, use the
  3000. GNU Lesser General Public License instead of this License. But first,
  3001. please read `http://www.gnu.org/philosophy/why-not-lgpl.html'.
  3002. 
  3003. File: elisp, Node: Tips, Next: GNU Emacs Internals, Prev: GPL, Up: Top
  3004. Appendix D Tips and Conventions
  3005. *******************************
  3006. This chapter describes no additional features of Emacs Lisp. Instead
  3007. it gives advice on making effective use of the features described in the
  3008. previous chapters, and describes conventions Emacs Lisp programmers
  3009. should follow.
  3010. You can automatically check some of the conventions described below
  3011. by running the command `M-x checkdoc RET' when visiting a Lisp file.
  3012. It cannot check all of the conventions, and not all the warnings it
  3013. gives necessarily correspond to problems, but it is worth examining them
  3014. all.
  3015. * Menu:
  3016. * Coding Conventions:: Conventions for clean and robust programs.
  3017. * Key Binding Conventions:: Which keys should be bound by which programs.
  3018. * Programming Tips:: Making Emacs code fit smoothly in Emacs.
  3019. * Compilation Tips:: Making compiled code run fast.
  3020. * Warning Tips:: Turning off compiler warnings.
  3021. * Documentation Tips:: Writing readable documentation strings.
  3022. * Comment Tips:: Conventions for writing comments.
  3023. * Library Headers:: Standard headers for library packages.
  3024. 
  3025. File: elisp, Node: Coding Conventions, Next: Key Binding Conventions, Up: Tips
  3026. D.1 Emacs Lisp Coding Conventions
  3027. =================================
  3028. Here are conventions that you should follow when writing Emacs Lisp
  3029. code intended for widespread use:
  3030. * Simply loading a package should not change Emacs's editing
  3031. behavior. Include a command or commands to enable and disable the
  3032. feature, or to invoke it.
  3033. This convention is mandatory for any file that includes custom
  3034. definitions. If fixing such a file to follow this convention
  3035. requires an incompatible change, go ahead and make the
  3036. incompatible change; don't postpone it.
  3037. * You should choose a short word to distinguish your program from
  3038. other Lisp programs. The names of all global variables,
  3039. constants, and functions in your program should begin with that
  3040. chosen prefix. Separate the prefix from the rest of the name with
  3041. a hyphen, `-'. This practice helps avoid name conflicts, since
  3042. all global variables in Emacs Lisp share the same name space, and
  3043. all functions share another name space(1).
  3044. Occasionally, for a command name intended for users to use, it is
  3045. more convenient if some words come before the package's name
  3046. prefix. And constructs that define functions, variables, etc.,
  3047. work better if they start with `defun' or `defvar', so put the
  3048. name prefix later on in the name.
  3049. This recommendation applies even to names for traditional Lisp
  3050. primitives that are not primitives in Emacs Lisp--such as
  3051. `copy-list'. Believe it or not, there is more than one plausible
  3052. way to define `copy-list'. Play it safe; append your name prefix
  3053. to produce a name like `foo-copy-list' or `mylib-copy-list'
  3054. instead.
  3055. If you write a function that you think ought to be added to Emacs
  3056. under a certain name, such as `twiddle-files', don't call it by
  3057. that name in your program. Call it `mylib-twiddle-files' in your
  3058. program, and send mail to `bug-gnu-emacs@gnu.org' suggesting we add
  3059. it to Emacs. If and when we do, we can change the name easily
  3060. enough.
  3061. If one prefix is insufficient, your package can use two or three
  3062. alternative common prefixes, so long as they make sense.
  3063. * Put a call to `provide' at the end of each separate Lisp file.
  3064. *Note Named Features::.
  3065. * If a file requires certain other Lisp programs to be loaded
  3066. beforehand, then the comments at the beginning of the file should
  3067. say so. Also, use `require' to make sure they are loaded. *Note
  3068. Named Features::.
  3069. * If a file FOO uses a macro defined in another file BAR, but does
  3070. not use any functions or variables defined in BAR, then FOO should
  3071. contain the following expression:
  3072. (eval-when-compile (require 'BAR))
  3073. This tells Emacs to load BAR just before byte-compiling FOO, so
  3074. that the macro definition is available during compilation. Using
  3075. `eval-when-compile' avoids loading BAR when the compiled version
  3076. of FOO is _used_. It should be called before the first use of the
  3077. macro in the file. *Note Compiling Macros::.
  3078. * Avoid loading additional libraries at run time unless they are
  3079. really needed. If your file simply cannot work without some other
  3080. library, then just `require' that library at the top-level and be
  3081. done with it. But if your file contains several independent
  3082. features, and only one or two require the extra library, then
  3083. consider putting `require' statements inside the relevant
  3084. functions rather than at the top-level. Or use `autoload'
  3085. statements to load the extra library when needed. This way people
  3086. who don't use those aspects of your file do not need to load the
  3087. extra library.
  3088. * Please don't require the `cl' package of Common Lisp extensions at
  3089. run time. Use of this package is optional, and it is not part of
  3090. the standard Emacs namespace. If your package loads `cl' at run
  3091. time, that could cause name clashes for users who don't use that
  3092. package.
  3093. However, there is no problem with using the `cl' package at
  3094. compile time, with `(eval-when-compile (require 'cl))'. That's
  3095. sufficient for using the macros in the `cl' package, because the
  3096. compiler expands them before generating the byte-code.
  3097. * When defining a major mode, please follow the major mode
  3098. conventions. *Note Major Mode Conventions::.
  3099. * When defining a minor mode, please follow the minor mode
  3100. conventions. *Note Minor Mode Conventions::.
  3101. * If the purpose of a function is to tell you whether a certain
  3102. condition is true or false, give the function a name that ends in
  3103. `p' (which stands for "predicate"). If the name is one word, add
  3104. just `p'; if the name is multiple words, add `-p'. Examples are
  3105. `framep' and `frame-live-p'.
  3106. * If the purpose of a variable is to store a single function, give
  3107. it a name that ends in `-function'. If the purpose of a variable
  3108. is to store a list of functions (i.e., the variable is a hook),
  3109. please follow the naming conventions for hooks. *Note Hooks::.
  3110. * If loading the file adds functions to hooks, define a function
  3111. `FEATURE-unload-hook', where FEATURE is the name of the feature
  3112. the package provides, and make it undo any such changes. Using
  3113. `unload-feature' to unload the file will run this function. *Note
  3114. Unloading::.
  3115. * It is a bad idea to define aliases for the Emacs primitives.
  3116. Normally you should use the standard names instead. The case
  3117. where an alias may be useful is where it facilitates backwards
  3118. compatibility or portability.
  3119. * If a package needs to define an alias or a new function for
  3120. compatibility with some other version of Emacs, name it with the
  3121. package prefix, not with the raw name with which it occurs in the
  3122. other version. Here is an example from Gnus, which provides many
  3123. examples of such compatibility issues.
  3124. (defalias 'gnus-point-at-bol
  3125. (if (fboundp 'point-at-bol)
  3126. 'point-at-bol
  3127. 'line-beginning-position))
  3128. * Redefining or advising an Emacs primitive is a bad idea. It may do
  3129. the right thing for a particular program, but there is no telling
  3130. what other programs might break as a result.
  3131. * It is likewise a bad idea for one Lisp package to advise a
  3132. function in another Lisp package (*note Advising Functions::).
  3133. * Avoid using `eval-after-load' in libraries and packages (*note
  3134. Hooks for Loading::). This feature is meant for personal
  3135. customizations; using it in a Lisp program is unclean, because it
  3136. modifies the behavior of another Lisp file in a way that's not
  3137. visible in that file. This is an obstacle for debugging, much
  3138. like advising a function in the other package.
  3139. * If a file does replace any of the standard functions or library
  3140. programs of Emacs, prominent comments at the beginning of the file
  3141. should say which functions are replaced, and how the behavior of
  3142. the replacements differs from that of the originals.
  3143. * Constructs that define a function or variable should be macros,
  3144. not functions, and their names should start with `define-'. The
  3145. macro should receive the name to be defined as the first argument.
  3146. That will help various tools find the definition automatically.
  3147. Avoid constructing the names in the macro itself, since that would
  3148. confuse these tools.
  3149. * In some other systems there is a convention of choosing variable
  3150. names that begin and end with `*'. We don't use that convention
  3151. in Emacs Lisp, so please don't use it in your programs. (Emacs
  3152. uses such names only for special-purpose buffers.) People will
  3153. find Emacs more coherent if all libraries use the same conventions.
  3154. * If your program contains non-ASCII characters in string or
  3155. character constants, you should make sure Emacs always decodes
  3156. these characters the same way, regardless of the user's settings.
  3157. The easiest way to do this is to use the coding system
  3158. `utf-8-emacs' (*note Coding System Basics::), and specify that
  3159. coding in the `-*-' line or the local variables list. *Note Local
  3160. Variables in Files: (emacs)File Variables.
  3161. ;; XXX.el -*- coding: utf-8-emacs; -*-
  3162. * Indent the file using the default indentation parameters.
  3163. * Don't make a habit of putting close-parentheses on lines by
  3164. themselves; Lisp programmers find this disconcerting.
  3165. * Please put a copyright notice and copying permission notice on the
  3166. file if you distribute copies. *Note Library Headers::.
  3167. ---------- Footnotes ----------
  3168. (1) The benefits of a Common Lisp-style package system are
  3169. considered not to outweigh the costs.
  3170. 
  3171. File: elisp, Node: Key Binding Conventions, Next: Programming Tips, Prev: Coding Conventions, Up: Tips
  3172. D.2 Key Binding Conventions
  3173. ===========================
  3174. * Many special major modes, like Dired, Info, Compilation, and Occur,
  3175. are designed to handle read-only text that contains "hyper-links".
  3176. Such a major mode should redefine `mouse-2' and <RET> to follow
  3177. the links. It should also set up a `follow-link' condition, so
  3178. that the link obeys `mouse-1-click-follows-link'. *Note Clickable
  3179. Text::. *Note Buttons::, for an easy method of implementing such
  3180. clickable links.
  3181. * Don't define `C-c LETTER' as a key in Lisp programs. Sequences
  3182. consisting of `C-c' and a letter (either upper or lower case) are
  3183. reserved for users; they are the *only* sequences reserved for
  3184. users, so do not block them.
  3185. Changing all the Emacs major modes to respect this convention was a
  3186. lot of work; abandoning this convention would make that work go to
  3187. waste, and inconvenience users. Please comply with it.
  3188. * Function keys <F5> through <F9> without modifier keys are also
  3189. reserved for users to define.
  3190. * Sequences consisting of `C-c' followed by a control character or a
  3191. digit are reserved for major modes.
  3192. * Sequences consisting of `C-c' followed by `{', `}', `<', `>', `:'
  3193. or `;' are also reserved for major modes.
  3194. * Sequences consisting of `C-c' followed by any other punctuation
  3195. character are allocated for minor modes. Using them in a major
  3196. mode is not absolutely prohibited, but if you do that, the major
  3197. mode binding may be shadowed from time to time by minor modes.
  3198. * Don't bind `C-h' following any prefix character (including `C-c').
  3199. If you don't bind `C-h', it is automatically available as a help
  3200. character for listing the subcommands of the prefix character.
  3201. * Don't bind a key sequence ending in <ESC> except following another
  3202. <ESC>. (That is, it is OK to bind a sequence ending in `<ESC>
  3203. <ESC>'.)
  3204. The reason for this rule is that a non-prefix binding for <ESC> in
  3205. any context prevents recognition of escape sequences as function
  3206. keys in that context.
  3207. * Similarly, don't bind a key sequence ending in <C-g>, since that
  3208. is commonly used to cancel a key sequence.
  3209. * Anything that acts like a temporary mode or state that the user can
  3210. enter and leave should define `<ESC> <ESC>' or `<ESC> <ESC> <ESC>'
  3211. as a way to escape.
  3212. For a state that accepts ordinary Emacs commands, or more
  3213. generally any kind of state in which <ESC> followed by a function
  3214. key or arrow key is potentially meaningful, then you must not
  3215. define `<ESC> <ESC>', since that would preclude recognizing an
  3216. escape sequence after <ESC>. In these states, you should define
  3217. `<ESC> <ESC> <ESC>' as the way to escape. Otherwise, define
  3218. `<ESC> <ESC>' instead.
  3219. 
  3220. File: elisp, Node: Programming Tips, Next: Compilation Tips, Prev: Key Binding Conventions, Up: Tips
  3221. D.3 Emacs Programming Tips
  3222. ==========================
  3223. Following these conventions will make your program fit better into
  3224. Emacs when it runs.
  3225. * Don't use `next-line' or `previous-line' in programs; nearly
  3226. always, `forward-line' is more convenient as well as more
  3227. predictable and robust. *Note Text Lines::.
  3228. * Don't call functions that set the mark, unless setting the mark is
  3229. one of the intended features of your program. The mark is a
  3230. user-level feature, so it is incorrect to change the mark except
  3231. to supply a value for the user's benefit. *Note The Mark::.
  3232. In particular, don't use any of these functions:
  3233. * `beginning-of-buffer', `end-of-buffer'
  3234. * `replace-string', `replace-regexp'
  3235. * `insert-file', `insert-buffer'
  3236. If you just want to move point, or replace a certain string, or
  3237. insert a file or buffer's contents, without any of the other
  3238. features intended for interactive users, you can replace these
  3239. functions with one or two lines of simple Lisp code.
  3240. * Use lists rather than vectors, except when there is a particular
  3241. reason to use a vector. Lisp has more facilities for manipulating
  3242. lists than for vectors, and working with lists is usually more
  3243. convenient.
  3244. Vectors are advantageous for tables that are substantial in size
  3245. and are accessed in random order (not searched front to back),
  3246. provided there is no need to insert or delete elements (only lists
  3247. allow that).
  3248. * The recommended way to show a message in the echo area is with the
  3249. `message' function, not `princ'. *Note The Echo Area::.
  3250. * When you encounter an error condition, call the function `error'
  3251. (or `signal'). The function `error' does not return. *Note
  3252. Signaling Errors::.
  3253. Don't use `message', `throw', `sleep-for', or `beep' to report
  3254. errors.
  3255. * An error message should start with a capital letter but should not
  3256. end with a period.
  3257. * A question asked in the minibuffer with `yes-or-no-p' or
  3258. `y-or-n-p' should start with a capital letter and end with `? '.
  3259. * When you mention a default value in a minibuffer prompt, put it
  3260. and the word `default' inside parentheses. It should look like
  3261. this:
  3262. Enter the answer (default 42):
  3263. * In `interactive', if you use a Lisp expression to produce a list
  3264. of arguments, don't try to provide the "correct" default values for
  3265. region or position arguments. Instead, provide `nil' for those
  3266. arguments if they were not specified, and have the function body
  3267. compute the default value when the argument is `nil'. For
  3268. instance, write this:
  3269. (defun foo (pos)
  3270. (interactive
  3271. (list (if SPECIFIED SPECIFIED-POS)))
  3272. (unless pos (setq pos DEFAULT-POS))
  3273. ...)
  3274. rather than this:
  3275. (defun foo (pos)
  3276. (interactive
  3277. (list (if SPECIFIED SPECIFIED-POS
  3278. DEFAULT-POS)))
  3279. ...)
  3280. This is so that repetition of the command will recompute these
  3281. defaults based on the current circumstances.
  3282. You do not need to take such precautions when you use interactive
  3283. specs `d', `m' and `r', because they make special arrangements to
  3284. recompute the argument values on repetition of the command.
  3285. * Many commands that take a long time to execute display a message
  3286. that says something like `Operating...' when they start, and
  3287. change it to `Operating...done' when they finish. Please keep the
  3288. style of these messages uniform: _no_ space around the ellipsis,
  3289. and _no_ period after `done'. *Note Progress::, for an easy way
  3290. to generate such messages.
  3291. * Try to avoid using recursive edits. Instead, do what the Rmail `e'
  3292. command does: use a new local keymap that contains a command
  3293. defined to switch back to the old local keymap. Or simply switch
  3294. to another buffer and let the user switch back at will. *Note
  3295. Recursive Editing::.
  3296. 
  3297. File: elisp, Node: Compilation Tips, Next: Warning Tips, Prev: Programming Tips, Up: Tips
  3298. D.4 Tips for Making Compiled Code Fast
  3299. ======================================
  3300. Here are ways of improving the execution speed of byte-compiled Lisp
  3301. programs.
  3302. * Profile your program with the `elp' library. See the file
  3303. `elp.el' for instructions.
  3304. * Check the speed of individual Emacs Lisp forms using the
  3305. `benchmark' library. See the functions `benchmark-run' and
  3306. `benchmark-run-compiled' in `benchmark.el'.
  3307. * Use iteration rather than recursion whenever possible. Function
  3308. calls are slow in Emacs Lisp even when a compiled function is
  3309. calling another compiled function.
  3310. * Using the primitive list-searching functions `memq', `member',
  3311. `assq', or `assoc' is even faster than explicit iteration. It can
  3312. be worth rearranging a data structure so that one of these
  3313. primitive search functions can be used.
  3314. * Certain built-in functions are handled specially in byte-compiled
  3315. code, avoiding the need for an ordinary function call. It is a
  3316. good idea to use these functions rather than alternatives. To see
  3317. whether a function is handled specially by the compiler, examine
  3318. its `byte-compile' property. If the property is non-`nil', then
  3319. the function is handled specially.
  3320. For example, the following input will show you that `aref' is
  3321. compiled specially (*note Array Functions::):
  3322. (get 'aref 'byte-compile)
  3323. => byte-compile-two-args
  3324. Note that in this case (and many others), you must first load the
  3325. `bytecomp' library, which defines the `byte-compile' property.
  3326. * If calling a small function accounts for a substantial part of your
  3327. program's running time, make the function inline. This eliminates
  3328. the function call overhead. Since making a function inline reduces
  3329. the flexibility of changing the program, don't do it unless it
  3330. gives a noticeable speedup in something slow enough that users
  3331. care about the speed. *Note Inline Functions::.
  3332. 
  3333. File: elisp, Node: Warning Tips, Next: Documentation Tips, Prev: Compilation Tips, Up: Tips
  3334. D.5 Tips for Avoiding Compiler Warnings
  3335. =======================================
  3336. * Try to avoid compiler warnings about undefined free variables, by
  3337. adding dummy `defvar' definitions for these variables, like this:
  3338. (defvar foo)
  3339. Such a definition has no effect except to tell the compiler not to
  3340. warn about uses of the variable `foo' in this file.
  3341. * Similarly, to avoid a compiler warning about an undefined function
  3342. that you know _will_ be defined, use a `declare-function'
  3343. statement (*note Declaring Functions::).
  3344. * If you use many functions and variables from a certain file, you
  3345. can add a `require' for that package to avoid compilation warnings
  3346. for them. For instance,
  3347. (eval-when-compile
  3348. (require 'foo))
  3349. * If you bind a variable in one function, and use it or set it in
  3350. another function, the compiler warns about the latter function
  3351. unless the variable has a definition. But adding a definition
  3352. would be unclean if the variable has a short name, since Lisp
  3353. packages should not define short variable names. The right thing
  3354. to do is to rename this variable to start with the name prefix
  3355. used for the other functions and variables in your package.
  3356. * The last resort for avoiding a warning, when you want to do
  3357. something that is usually a mistake but you know is not a mistake
  3358. in your usage, is to put it inside `with-no-warnings'. *Note
  3359. Compiler Errors::.
  3360. 
  3361. File: elisp, Node: Documentation Tips, Next: Comment Tips, Prev: Warning Tips, Up: Tips
  3362. D.6 Tips for Documentation Strings
  3363. ==================================
  3364. Here are some tips and conventions for the writing of documentation
  3365. strings. You can check many of these conventions by running the command
  3366. `M-x checkdoc-minor-mode'.
  3367. * Every command, function, or variable intended for users to know
  3368. about should have a documentation string.
  3369. * An internal variable or subroutine of a Lisp program might as well
  3370. have a documentation string. Documentation strings take up very
  3371. little space in a running Emacs.
  3372. * Format the documentation string so that it fits in an Emacs window
  3373. on an 80-column screen. It is a good idea for most lines to be no
  3374. wider than 60 characters. The first line should not be wider than
  3375. 67 characters or it will look bad in the output of `apropos'.
  3376. You can fill the text if that looks good. However, rather than
  3377. blindly filling the entire documentation string, you can often
  3378. make it much more readable by choosing certain line breaks with
  3379. care. Use blank lines between sections if the documentation
  3380. string is long.
  3381. * The first line of the documentation string should consist of one
  3382. or two complete sentences that stand on their own as a summary.
  3383. `M-x apropos' displays just the first line, and if that line's
  3384. contents don't stand on their own, the result looks bad. In
  3385. particular, start the first line with a capital letter and end it
  3386. with a period.
  3387. For a function, the first line should briefly answer the question,
  3388. "What does this function do?" For a variable, the first line
  3389. should briefly answer the question, "What does this value mean?"
  3390. Don't limit the documentation string to one line; use as many
  3391. lines as you need to explain the details of how to use the
  3392. function or variable. Please use complete sentences for the rest
  3393. of the text too.
  3394. * When the user tries to use a disabled command, Emacs displays just
  3395. the first paragraph of its documentation string--everything
  3396. through the first blank line. If you wish, you can choose which
  3397. information to include before the first blank line so as to make
  3398. this display useful.
  3399. * The first line should mention all the important arguments of the
  3400. function, and should mention them in the order that they are
  3401. written in a function call. If the function has many arguments,
  3402. then it is not feasible to mention them all in the first line; in
  3403. that case, the first line should mention the first few arguments,
  3404. including the most important arguments.
  3405. * When a function's documentation string mentions the value of an
  3406. argument of the function, use the argument name in capital letters
  3407. as if it were a name for that value. Thus, the documentation
  3408. string of the function `eval' refers to its first argument as
  3409. `FORM', because the actual argument name is `form':
  3410. Evaluate FORM and return its value.
  3411. Also write metasyntactic variables in capital letters, such as
  3412. when you show the decomposition of a list or vector into subunits,
  3413. some of which may vary. `KEY' and `VALUE' in the following example
  3414. illustrate this practice:
  3415. The argument TABLE should be an alist whose elements
  3416. have the form (KEY . VALUE). Here, KEY is ...
  3417. * Never change the case of a Lisp symbol when you mention it in a doc
  3418. string. If the symbol's name is `foo', write "foo", not "Foo"
  3419. (which is a different symbol).
  3420. This might appear to contradict the policy of writing function
  3421. argument values, but there is no real contradiction; the argument
  3422. _value_ is not the same thing as the _symbol_ that the function
  3423. uses to hold the value.
  3424. If this puts a lower-case letter at the beginning of a sentence
  3425. and that annoys you, rewrite the sentence so that the symbol is
  3426. not at the start of it.
  3427. * Do not start or end a documentation string with whitespace.
  3428. * *Do not* indent subsequent lines of a documentation string so that
  3429. the text is lined up in the source code with the text of the first
  3430. line. This looks nice in the source code, but looks bizarre when
  3431. users view the documentation. Remember that the indentation
  3432. before the starting double-quote is not part of the string!
  3433. * When a documentation string refers to a Lisp symbol, write it as it
  3434. would be printed (which usually means in lower case), with
  3435. single-quotes around it. For example: `lambda'. There are two
  3436. exceptions: write t and nil without single-quotes. (In this
  3437. manual, we use a different convention, with single-quotes for all
  3438. symbols.)
  3439. Help mode automatically creates a hyperlink when a documentation
  3440. string uses a symbol name inside single quotes, if the symbol has
  3441. either a function or a variable definition. You do not need to do
  3442. anything special to make use of this feature. However, when a
  3443. symbol has both a function definition and a variable definition,
  3444. and you want to refer to just one of them, you can specify which
  3445. one by writing one of the words `variable', `option', `function',
  3446. or `command', immediately before the symbol name. (Case makes no
  3447. difference in recognizing these indicator words.) For example, if
  3448. you write
  3449. This function sets the variable `buffer-file-name'.
  3450. then the hyperlink will refer only to the variable documentation of
  3451. `buffer-file-name', and not to its function documentation.
  3452. If a symbol has a function definition and/or a variable
  3453. definition, but those are irrelevant to the use of the symbol that
  3454. you are documenting, you can write the words `symbol' or `program'
  3455. before the symbol name to prevent making any hyperlink. For
  3456. example,
  3457. If the argument KIND-OF-RESULT is the symbol `list',
  3458. this function returns a list of all the objects
  3459. that satisfy the criterion.
  3460. does not make a hyperlink to the documentation, irrelevant here,
  3461. of the function `list'.
  3462. Normally, no hyperlink is made for a variable without variable
  3463. documentation. You can force a hyperlink for such variables by
  3464. preceding them with one of the words `variable' or `option'.
  3465. Hyperlinks for faces are only made if the face name is preceded or
  3466. followed by the word `face'. In that case, only the face
  3467. documentation will be shown, even if the symbol is also defined as
  3468. a variable or as a function.
  3469. To make a hyperlink to Info documentation, write the name of the
  3470. Info node (or anchor) in single quotes, preceded by `info node',
  3471. `Info node', `info anchor' or `Info anchor'. The Info file name
  3472. defaults to `emacs'. For example,
  3473. See Info node `Font Lock' and Info node `(elisp)Font Lock Basics'.
  3474. Finally, to create a hyperlink to URLs, write the URL in single
  3475. quotes, preceded by `URL'. For example,
  3476. The home page for the GNU project has more information (see URL
  3477. `http://www.gnu.org/').
  3478. * Don't write key sequences directly in documentation strings.
  3479. Instead, use the `\\[...]' construct to stand for them. For
  3480. example, instead of writing `C-f', write the construct
  3481. `\\[forward-char]'. When Emacs displays the documentation string,
  3482. it substitutes whatever key is currently bound to `forward-char'.
  3483. (This is normally `C-f', but it may be some other character if the
  3484. user has moved key bindings.) *Note Keys in Documentation::.
  3485. * In documentation strings for a major mode, you will want to refer
  3486. to the key bindings of that mode's local map, rather than global
  3487. ones. Therefore, use the construct `\\<...>' once in the
  3488. documentation string to specify which key map to use. Do this
  3489. before the first use of `\\[...]'. The text inside the `\\<...>'
  3490. should be the name of the variable containing the local keymap for
  3491. the major mode.
  3492. It is not practical to use `\\[...]' very many times, because
  3493. display of the documentation string will become slow. So use this
  3494. to describe the most important commands in your major mode, and
  3495. then use `\\{...}' to display the rest of the mode's keymap.
  3496. * For consistency, phrase the verb in the first sentence of a
  3497. function's documentation string as an imperative--for instance,
  3498. use "Return the cons of A and B." in preference to "Returns the
  3499. cons of A and B." Usually it looks good to do likewise for the
  3500. rest of the first paragraph. Subsequent paragraphs usually look
  3501. better if each sentence is indicative and has a proper subject.
  3502. * The documentation string for a function that is a yes-or-no
  3503. predicate should start with words such as "Return t if", to
  3504. indicate explicitly what constitutes "truth". The word "return"
  3505. avoids starting the sentence with lower-case "t", which could be
  3506. somewhat distracting.
  3507. * If a line in a documentation string begins with an
  3508. open-parenthesis, write a backslash before the open-parenthesis,
  3509. like this:
  3510. The argument FOO can be either a number
  3511. \(a buffer position) or a string (a file name).
  3512. This prevents the open-parenthesis from being treated as the start
  3513. of a defun (*note Defuns: (emacs)Defuns.).
  3514. * Write documentation strings in the active voice, not the passive,
  3515. and in the present tense, not the future. For instance, use
  3516. "Return a list containing A and B." instead of "A list containing
  3517. A and B will be returned."
  3518. * Avoid using the word "cause" (or its equivalents) unnecessarily.
  3519. Instead of, "Cause Emacs to display text in boldface", write just
  3520. "Display text in boldface".
  3521. * Avoid using "iff" (a mathematics term meaning "if and only if"),
  3522. since many people are unfamiliar with it and mistake it for a
  3523. typo. In most cases, the meaning is clear with just "if".
  3524. Otherwise, try to find an alternate phrasing that conveys the
  3525. meaning.
  3526. * When a command is meaningful only in a certain mode or situation,
  3527. do mention that in the documentation string. For example, the
  3528. documentation of `dired-find-file' is:
  3529. In Dired, visit the file or directory named on this line.
  3530. * When you define a variable that represents an option users might
  3531. want to set, use `defcustom'. *Note Defining Variables::.
  3532. * The documentation string for a variable that is a yes-or-no flag
  3533. should start with words such as "Non-nil means", to make it clear
  3534. that all non-`nil' values are equivalent and indicate explicitly
  3535. what `nil' and non-`nil' mean.
  3536. 
  3537. File: elisp, Node: Comment Tips, Next: Library Headers, Prev: Documentation Tips, Up: Tips
  3538. D.7 Tips on Writing Comments
  3539. ============================
  3540. We recommend these conventions for comments:
  3541. `;'
  3542. Comments that start with a single semicolon, `;', should all be
  3543. aligned to the same column on the right of the source code. Such
  3544. comments usually explain how the code on that line does its job.
  3545. For example:
  3546. (setq base-version-list ; there was a base
  3547. (assoc (substring fn 0 start-vn) ; version to which
  3548. file-version-assoc-list)) ; this looks like
  3549. ; a subversion
  3550. `;;'
  3551. Comments that start with two semicolons, `;;', should be aligned to
  3552. the same level of indentation as the code. Such comments usually
  3553. describe the purpose of the following lines or the state of the
  3554. program at that point. For example:
  3555. (prog1 (setq auto-fill-function
  3556. ...
  3557. ...
  3558. ;; Update mode line.
  3559. (force-mode-line-update)))
  3560. We also normally use two semicolons for comments outside functions.
  3561. ;; This Lisp code is run in Emacs when it is to operate as
  3562. ;; a server for other processes.
  3563. If a function has no documentation string, it should instead have a
  3564. two-semicolon comment right before the function, explaining what
  3565. the function does and how to call it properly. Explain precisely
  3566. what each argument means and how the function interprets its
  3567. possible values. It is much better to convert such comments to
  3568. documentation strings, though.
  3569. `;;;'
  3570. Comments that start with three semicolons, `;;;', should start at
  3571. the left margin. These are used, occasionally, for comments within
  3572. functions that should start at the margin. We also use them
  3573. sometimes for comments that are between functions--whether to use
  3574. two or three semicolons depends on whether the comment should be
  3575. considered a "heading" by Outline minor mode. By default,
  3576. comments starting with at least three semicolons (followed by a
  3577. single space and a non-whitespace character) are considered
  3578. headings, comments starting with two or fewer are not.
  3579. Another use for triple-semicolon comments is for commenting out
  3580. lines within a function. We use three semicolons for this
  3581. precisely so that they remain at the left margin. By default,
  3582. Outline minor mode does not consider a comment to be a heading
  3583. (even if it starts with at least three semicolons) if the
  3584. semicolons are followed by at least two spaces. Thus, if you add
  3585. an introductory comment to the commented out code, make sure to
  3586. indent it by at least two spaces after the three semicolons.
  3587. (defun foo (a)
  3588. ;;; This is no longer necessary.
  3589. ;;; (force-mode-line-update)
  3590. (message "Finished with %s" a))
  3591. When commenting out entire functions, use two semicolons.
  3592. `;;;;'
  3593. Comments that start with four semicolons, `;;;;', should be aligned
  3594. to the left margin and are used for headings of major sections of a
  3595. program. For example:
  3596. ;;;; The kill ring
  3597. Generally speaking, the `M-;' (`comment-dwim') command automatically
  3598. starts a comment of the appropriate type; or indents an existing
  3599. comment to the right place, depending on the number of semicolons.
  3600. *Note Manipulating Comments: (emacs)Comments.
  3601. 
  3602. File: elisp, Node: Library Headers, Prev: Comment Tips, Up: Tips
  3603. D.8 Conventional Headers for Emacs Libraries
  3604. ============================================
  3605. Emacs has conventions for using special comments in Lisp libraries to
  3606. divide them into sections and give information such as who wrote them.
  3607. Using a standard format for these items makes it easier for tools (and
  3608. people) to extract the relevant information. This section explains
  3609. these conventions, starting with an example:
  3610. ;;; foo.el --- Support for the Foo programming language
  3611. ;; Copyright (C) 2010-2012 Your Name
  3612. ;; Author: Your Name <yourname@example.com>
  3613. ;; Maintainer: Someone Else <someone@example.com>
  3614. ;; Created: 14 Jul 2010
  3615. ;; Keywords: languages
  3616. ;; This file is not part of GNU Emacs.
  3617. ;; This file is free software...
  3618. ...
  3619. ;; along with this file. If not, see <http://www.gnu.org/licenses/>.
  3620. The very first line should have this format:
  3621. ;;; FILENAME --- DESCRIPTION
  3622. The description should be contained in one line. If the file needs a
  3623. `-*-' specification, put it after DESCRIPTION. If this would make the
  3624. first line too long, use a Local Variables section at the end of the
  3625. file.
  3626. The copyright notice usually lists your name (if you wrote the
  3627. file). If you have an employer who claims copyright on your work, you
  3628. might need to list them instead. Do not say that the copyright holder
  3629. is the Free Software Foundation (or that the file is part of GNU Emacs)
  3630. unless your file has been accepted into the Emacs distribution. For
  3631. more information on the form of copyright and license notices, see the
  3632. guide on the GNU website (http://www.gnu.org/licenses/gpl-howto.html).
  3633. After the copyright notice come several "header comment" lines, each
  3634. beginning with `;; HEADER-NAME:'. Here is a table of the conventional
  3635. possibilities for HEADER-NAME:
  3636. `Author'
  3637. This line states the name and email address of at least the
  3638. principal author of the library. If there are multiple authors,
  3639. list them on continuation lines led by `;;' and whitespace (this
  3640. is easier for tools to parse than having more than one author on
  3641. one line). We recommend including a contact email address, of the
  3642. form `<...>'. For example:
  3643. ;; Author: Your Name <yourname@example.com>
  3644. ;; Someone Else <someone@example.com>
  3645. ;; Another Person <another@example.com>
  3646. `Maintainer'
  3647. This header has the same format as the Author header. It lists the
  3648. person(s) who currently maintain(s) the file (respond to bug
  3649. reports, etc.).
  3650. If there is no maintainer line, the person(s) in the Author field
  3651. is/are presumed to be the maintainers. Some files in Emacs use
  3652. `FSF' for the maintainer. This means that the original author is
  3653. no longer responsible for the file, and that it is maintained as
  3654. part of Emacs.
  3655. `Created'
  3656. This optional line gives the original creation date of the file,
  3657. and is for historical interest only.
  3658. `Version'
  3659. If you wish to record version numbers for the individual Lisp
  3660. program, put them in this line. Lisp files distributed with Emacs
  3661. generally do not have a `Version' header, since the version number
  3662. of Emacs itself serves the same purpose. If you are distributing
  3663. a collection of multiple files, we recommend not writing the
  3664. version in every file, but only the main one.
  3665. `Keywords'
  3666. This line lists keywords for the `finder-by-keyword' help command.
  3667. Please use that command to see a list of the meaningful keywords.
  3668. This field is how people will find your package when they're
  3669. looking for things by topic. To separate the keywords, you can
  3670. use spaces, commas, or both.
  3671. The name of this field is unfortunate, since people often assume
  3672. it is the place to write arbitrary keywords that describe their
  3673. package, rather than just the relevant Finder keywords.
  3674. `Package-Version'
  3675. If `Version' is not suitable for use by the package manager, then
  3676. a package can define `Package-Version'; it will be used instead.
  3677. This is handy if `Version' is an RCS id or something else that
  3678. cannot be parsed by `version-to-list'. *Note Packaging Basics::.
  3679. `Package-Requires'
  3680. If this exists, it names packages on which the current package
  3681. depends for proper operation. *Note Packaging Basics::. This is
  3682. used by the package manager both at download time (to ensure that
  3683. a complete set of packages is downloaded) and at activation time
  3684. (to ensure that a package is only activated if all its
  3685. dependencies have been).
  3686. Its format is a list of lists. The `car' of each sub-list is the
  3687. name of a package, as a symbol. The `cadr' of each sub-list is
  3688. the minimum acceptable version number, as a string. For instance:
  3689. ;; Package-Requires: ((gnus "1.0") (bubbles "2.7.2"))
  3690. The package code automatically defines a package named `emacs'
  3691. with the version number of the currently running Emacs. This can
  3692. be used to require a minimal version of Emacs for a package.
  3693. Just about every Lisp library ought to have the `Author' and
  3694. `Keywords' header comment lines. Use the others if they are
  3695. appropriate. You can also put in header lines with other header
  3696. names--they have no standard meanings, so they can't do any harm.
  3697. We use additional stylized comments to subdivide the contents of the
  3698. library file. These should be separated from anything else by blank
  3699. lines. Here is a table of them:
  3700. `;;; Commentary:'
  3701. This begins introductory comments that explain how the library
  3702. works. It should come right after the copying permissions,
  3703. terminated by a `Change Log', `History' or `Code' comment line.
  3704. This text is used by the Finder package, so it should make sense
  3705. in that context.
  3706. `;;; Change Log:'
  3707. This begins an optional log of changes to the file over time.
  3708. Don't put too much information in this section--it is better to
  3709. keep the detailed logs in a separate `ChangeLog' file (as Emacs
  3710. does), and/or to use a version control system. `History' is an
  3711. alternative to `Change Log'.
  3712. `;;; Code:'
  3713. This begins the actual code of the program.
  3714. `;;; FILENAME ends here'
  3715. This is the "footer line"; it appears at the very end of the file.
  3716. Its purpose is to enable people to detect truncated versions of
  3717. the file from the lack of a footer line.
  3718. 
  3719. File: elisp, Node: GNU Emacs Internals, Next: Standard Errors, Prev: Tips, Up: Top
  3720. Appendix E GNU Emacs Internals
  3721. ******************************
  3722. This chapter describes how the runnable Emacs executable is dumped with
  3723. the preloaded Lisp libraries in it, how storage is allocated, and some
  3724. internal aspects of GNU Emacs that may be of interest to C programmers.
  3725. * Menu:
  3726. * Building Emacs:: How the dumped Emacs is made.
  3727. * Pure Storage:: Kludge to make preloaded Lisp functions shareable.
  3728. * Garbage Collection:: Reclaiming space for Lisp objects no longer used.
  3729. * Memory Usage:: Info about total size of Lisp objects made so far.
  3730. * Writing Emacs Primitives:: Writing C code for Emacs.
  3731. * Object Internals:: Data formats of buffers, windows, processes.
  3732. 
  3733. File: elisp, Node: Building Emacs, Next: Pure Storage, Up: GNU Emacs Internals
  3734. E.1 Building Emacs
  3735. ==================
  3736. This section explains the steps involved in building the Emacs
  3737. executable. You don't have to know this material to build and install
  3738. Emacs, since the makefiles do all these things automatically. This
  3739. information is pertinent to Emacs developers.
  3740. Compilation of the C source files in the `src' directory produces an
  3741. executable file called `temacs', also called a "bare impure Emacs". It
  3742. contains the Emacs Lisp interpreter and I/O routines, but not the
  3743. editing commands.
  3744. The command `temacs -l loadup' would run `temacs' and direct it to
  3745. load `loadup.el'. The `loadup' library loads additional Lisp
  3746. libraries, which set up the normal Emacs editing environment. After
  3747. this step, the Emacs executable is no longer "bare".
  3748. Because it takes some time to load the standard Lisp files, the
  3749. `temacs' executable usually isn't run directly by users. Instead, as
  3750. one of the last steps of building Emacs, the command `temacs -batch -l
  3751. loadup dump' is run. The special `dump' argument causes `temacs' to
  3752. dump out an executable program, called `emacs', which has all the
  3753. standard Lisp files preloaded. (The `-batch' argument prevents
  3754. `temacs' from trying to initialize any of its data on the terminal, so
  3755. that the tables of terminal information are empty in the dumped Emacs.)
  3756. The dumped `emacs' executable (also called a "pure" Emacs) is the
  3757. one which is installed. The variable `preloaded-file-list' stores a
  3758. list of the Lisp files preloaded into the dumped Emacs. If you port
  3759. Emacs to a new operating system, and are not able to implement dumping,
  3760. then Emacs must load `loadup.el' each time it starts.
  3761. You can specify additional files to preload by writing a library
  3762. named `site-load.el' that loads them. You may need to rebuild Emacs
  3763. with an added definition
  3764. #define SITELOAD_PURESIZE_EXTRA N
  3765. to make N added bytes of pure space to hold the additional files; see
  3766. `src/puresize.h'. (Try adding increments of 20000 until it is big
  3767. enough.) However, the advantage of preloading additional files
  3768. decreases as machines get faster. On modern machines, it is usually
  3769. not advisable.
  3770. After `loadup.el' reads `site-load.el', it finds the documentation
  3771. strings for primitive and preloaded functions (and variables) in the
  3772. file `etc/DOC' where they are stored, by calling `Snarf-documentation'
  3773. (*note Accessing Documentation: Definition of Snarf-documentation.).
  3774. You can specify other Lisp expressions to execute just before dumping
  3775. by putting them in a library named `site-init.el'. This file is
  3776. executed after the documentation strings are found.
  3777. If you want to preload function or variable definitions, there are
  3778. three ways you can do this and make their documentation strings
  3779. accessible when you subsequently run Emacs:
  3780. * Arrange to scan these files when producing the `etc/DOC' file, and
  3781. load them with `site-load.el'.
  3782. * Load the files with `site-init.el', then copy the files into the
  3783. installation directory for Lisp files when you install Emacs.
  3784. * Specify a `nil' value for `byte-compile-dynamic-docstrings' as a
  3785. local variable in each of these files, and load them with either
  3786. `site-load.el' or `site-init.el'. (This method has the drawback
  3787. that the documentation strings take up space in Emacs all the
  3788. time.)
  3789. It is not advisable to put anything in `site-load.el' or
  3790. `site-init.el' that would alter any of the features that users expect
  3791. in an ordinary unmodified Emacs. If you feel you must override normal
  3792. features for your site, do it with `default.el', so that users can
  3793. override your changes if they wish. *Note Startup Summary::.
  3794. In a package that can be preloaded, it is sometimes necessary (or
  3795. useful) to delay certain evaluations until Emacs subsequently starts
  3796. up. The vast majority of such cases relate to the values of
  3797. customizable variables. For example, `tutorial-directory' is a
  3798. variable defined in `startup.el', which is preloaded. The default
  3799. value is set based on `data-directory'. The variable needs to access
  3800. the value of `data-directory' when Emacs starts, not when it is dumped,
  3801. because the Emacs executable has probably been installed in a different
  3802. location since it was dumped.
  3803. -- Function: custom-initialize-delay symbol value
  3804. This function delays the initialization of SYMBOL to the next
  3805. Emacs start. You normally use this function by specifying it as
  3806. the `:initialize' property of a customizable variable. (The
  3807. argument VALUE is unused, and is provided only for compatibility
  3808. with the form Custom expects.)
  3809. In the unlikely event that you need a more general functionality than
  3810. `custom-initialize-delay' provides, you can use `before-init-hook'
  3811. (*note Startup Summary::).
  3812. -- Function: dump-emacs to-file from-file
  3813. This function dumps the current state of Emacs into an executable
  3814. file TO-FILE. It takes symbols from FROM-FILE (this is normally
  3815. the executable file `temacs').
  3816. If you want to use this function in an Emacs that was already
  3817. dumped, you must run Emacs with `-batch'.
  3818. 
  3819. File: elisp, Node: Pure Storage, Next: Garbage Collection, Prev: Building Emacs, Up: GNU Emacs Internals
  3820. E.2 Pure Storage
  3821. ================
  3822. Emacs Lisp uses two kinds of storage for user-created Lisp objects:
  3823. "normal storage" and "pure storage". Normal storage is where all the
  3824. new data created during an Emacs session are kept (*note Garbage
  3825. Collection::). Pure storage is used for certain data in the preloaded
  3826. standard Lisp files--data that should never change during actual use of
  3827. Emacs.
  3828. Pure storage is allocated only while `temacs' is loading the
  3829. standard preloaded Lisp libraries. In the file `emacs', it is marked
  3830. as read-only (on operating systems that permit this), so that the
  3831. memory space can be shared by all the Emacs jobs running on the machine
  3832. at once. Pure storage is not expandable; a fixed amount is allocated
  3833. when Emacs is compiled, and if that is not sufficient for the preloaded
  3834. libraries, `temacs' allocates dynamic memory for the part that didn't
  3835. fit. The resulting image will work, but garbage collection (*note
  3836. Garbage Collection::) is disabled in this situation, causing a memory
  3837. leak. Such an overflow normally won't happen unless you try to preload
  3838. additional libraries or add features to the standard ones. Emacs will
  3839. display a warning about the overflow when it starts. If this happens,
  3840. you should increase the compilation parameter `SYSTEM_PURESIZE_EXTRA'
  3841. in the file `src/puresize.h' and rebuild Emacs.
  3842. -- Function: purecopy object
  3843. This function makes a copy in pure storage of OBJECT, and returns
  3844. it. It copies a string by simply making a new string with the same
  3845. characters, but without text properties, in pure storage. It
  3846. recursively copies the contents of vectors and cons cells. It does
  3847. not make copies of other objects such as symbols, but just returns
  3848. them unchanged. It signals an error if asked to copy markers.
  3849. This function is a no-op except while Emacs is being built and
  3850. dumped; it is usually called only in preloaded Lisp files.
  3851. -- Variable: pure-bytes-used
  3852. The value of this variable is the number of bytes of pure storage
  3853. allocated so far. Typically, in a dumped Emacs, this number is
  3854. very close to the total amount of pure storage available--if it
  3855. were not, we would preallocate less.
  3856. -- Variable: purify-flag
  3857. This variable determines whether `defun' should make a copy of the
  3858. function definition in pure storage. If it is non-`nil', then the
  3859. function definition is copied into pure storage.
  3860. This flag is `t' while loading all of the basic functions for
  3861. building Emacs initially (allowing those functions to be shareable
  3862. and non-collectible). Dumping Emacs as an executable always writes
  3863. `nil' in this variable, regardless of the value it actually has
  3864. before and after dumping.
  3865. You should not change this flag in a running Emacs.
  3866. 
  3867. File: elisp, Node: Garbage Collection, Next: Memory Usage, Prev: Pure Storage, Up: GNU Emacs Internals
  3868. E.3 Garbage Collection
  3869. ======================
  3870. When a program creates a list or the user defines a new function (such
  3871. as by loading a library), that data is placed in normal storage. If
  3872. normal storage runs low, then Emacs asks the operating system to
  3873. allocate more memory. Different types of Lisp objects, such as
  3874. symbols, cons cells, markers, etc., are segregated in distinct blocks
  3875. in memory. (Vectors, long strings, buffers and certain other editing
  3876. types, which are fairly large, are allocated in individual blocks, one
  3877. per object, while small strings are packed into blocks of 8k bytes.)
  3878. It is quite common to use some storage for a while, then release it
  3879. by (for example) killing a buffer or deleting the last pointer to an
  3880. object. Emacs provides a "garbage collector" to reclaim this abandoned
  3881. storage. The garbage collector operates by finding and marking all
  3882. Lisp objects that are still accessible to Lisp programs. To begin
  3883. with, it assumes all the symbols, their values and associated function
  3884. definitions, and any data presently on the stack, are accessible. Any
  3885. objects that can be reached indirectly through other accessible objects
  3886. are also accessible.
  3887. When marking is finished, all objects still unmarked are garbage. No
  3888. matter what the Lisp program or the user does, it is impossible to refer
  3889. to them, since there is no longer a way to reach them. Their space
  3890. might as well be reused, since no one will miss them. The second
  3891. ("sweep") phase of the garbage collector arranges to reuse them.
  3892. The sweep phase puts unused cons cells onto a "free list" for future
  3893. allocation; likewise for symbols and markers. It compacts the
  3894. accessible strings so they occupy fewer 8k blocks; then it frees the
  3895. other 8k blocks. Vectors, buffers, windows, and other large objects are
  3896. individually allocated and freed using `malloc' and `free'.
  3897. Common Lisp note: Unlike other Lisps, GNU Emacs Lisp does not call
  3898. the garbage collector when the free list is empty. Instead, it
  3899. simply requests the operating system to allocate more storage, and
  3900. processing continues until `gc-cons-threshold' bytes have been
  3901. used.
  3902. This means that you can make sure that the garbage collector will
  3903. not run during a certain portion of a Lisp program by calling the
  3904. garbage collector explicitly just before it (provided that portion
  3905. of the program does not use so much space as to force a second
  3906. garbage collection).
  3907. -- Command: garbage-collect
  3908. This command runs a garbage collection, and returns information on
  3909. the amount of space in use. (Garbage collection can also occur
  3910. spontaneously if you use more than `gc-cons-threshold' bytes of
  3911. Lisp data since the previous garbage collection.)
  3912. `garbage-collect' returns a list containing the following
  3913. information:
  3914. ((USED-CONSES . FREE-CONSES)
  3915. (USED-SYMS . FREE-SYMS)
  3916. (USED-MISCS . FREE-MISCS)
  3917. USED-STRING-CHARS
  3918. USED-VECTOR-SLOTS
  3919. (USED-FLOATS . FREE-FLOATS)
  3920. (USED-INTERVALS . FREE-INTERVALS)
  3921. (USED-STRINGS . FREE-STRINGS))
  3922. Here is an example:
  3923. (garbage-collect)
  3924. => ((106886 . 13184) (9769 . 0)
  3925. (7731 . 4651) 347543 121628
  3926. (31 . 94) (1273 . 168)
  3927. (25474 . 3569))
  3928. Here is a table explaining each element:
  3929. USED-CONSES
  3930. The number of cons cells in use.
  3931. FREE-CONSES
  3932. The number of cons cells for which space has been obtained
  3933. from the operating system, but that are not currently being
  3934. used.
  3935. USED-SYMS
  3936. The number of symbols in use.
  3937. FREE-SYMS
  3938. The number of symbols for which space has been obtained from
  3939. the operating system, but that are not currently being used.
  3940. USED-MISCS
  3941. The number of miscellaneous objects in use. These include
  3942. markers and overlays, plus certain objects not visible to
  3943. users.
  3944. FREE-MISCS
  3945. The number of miscellaneous objects for which space has been
  3946. obtained from the operating system, but that are not
  3947. currently being used.
  3948. USED-STRING-CHARS
  3949. The total size of all strings, in characters.
  3950. USED-VECTOR-SLOTS
  3951. The total number of elements of existing vectors.
  3952. USED-FLOATS
  3953. The number of floats in use.
  3954. FREE-FLOATS
  3955. The number of floats for which space has been obtained from
  3956. the operating system, but that are not currently being used.
  3957. USED-INTERVALS
  3958. The number of intervals in use. Intervals are an internal
  3959. data structure used for representing text properties.
  3960. FREE-INTERVALS
  3961. The number of intervals for which space has been obtained
  3962. from the operating system, but that are not currently being
  3963. used.
  3964. USED-STRINGS
  3965. The number of strings in use.
  3966. FREE-STRINGS
  3967. The number of string headers for which the space was obtained
  3968. from the operating system, but which are currently not in
  3969. use. (A string object consists of a header and the storage
  3970. for the string text itself; the latter is only allocated when
  3971. the string is created.)
  3972. If there was overflow in pure space (*note Pure Storage::),
  3973. `garbage-collect' returns `nil', because a real garbage collection
  3974. cannot be done.
  3975. -- User Option: garbage-collection-messages
  3976. If this variable is non-`nil', Emacs displays a message at the
  3977. beginning and end of garbage collection. The default value is
  3978. `nil'.
  3979. -- Variable: post-gc-hook
  3980. This is a normal hook that is run at the end of garbage collection.
  3981. Garbage collection is inhibited while the hook functions run, so be
  3982. careful writing them.
  3983. -- User Option: gc-cons-threshold
  3984. The value of this variable is the number of bytes of storage that
  3985. must be allocated for Lisp objects after one garbage collection in
  3986. order to trigger another garbage collection. A cons cell counts
  3987. as eight bytes, a string as one byte per character plus a few
  3988. bytes of overhead, and so on; space allocated to the contents of
  3989. buffers does not count. Note that the subsequent garbage
  3990. collection does not happen immediately when the threshold is
  3991. exhausted, but only the next time the Lisp evaluator is called.
  3992. The initial threshold value is 800,000. If you specify a larger
  3993. value, garbage collection will happen less often. This reduces the
  3994. amount of time spent garbage collecting, but increases total
  3995. memory use. You may want to do this when running a program that
  3996. creates lots of Lisp data.
  3997. You can make collections more frequent by specifying a smaller
  3998. value, down to 10,000. A value less than 10,000 will remain in
  3999. effect only until the subsequent garbage collection, at which time
  4000. `garbage-collect' will set the threshold back to 10,000.
  4001. -- User Option: gc-cons-percentage
  4002. The value of this variable specifies the amount of consing before a
  4003. garbage collection occurs, as a fraction of the current heap size.
  4004. This criterion and `gc-cons-threshold' apply in parallel, and
  4005. garbage collection occurs only when both criteria are satisfied.
  4006. As the heap size increases, the time to perform a garbage
  4007. collection increases. Thus, it can be desirable to do them less
  4008. frequently in proportion.
  4009. The value returned by `garbage-collect' describes the amount of
  4010. memory used by Lisp data, broken down by data type. By contrast, the
  4011. function `memory-limit' provides information on the total amount of
  4012. memory Emacs is currently using.
  4013. -- Function: memory-limit
  4014. This function returns the address of the last byte Emacs has
  4015. allocated, divided by 1024. We divide the value by 1024 to make
  4016. sure it fits in a Lisp integer.
  4017. You can use this to get a general idea of how your actions affect
  4018. the memory usage.
  4019. -- Variable: memory-full
  4020. This variable is `t' if Emacs is nearly out of memory for Lisp
  4021. objects, and `nil' otherwise.
  4022. -- Function: memory-use-counts
  4023. This returns a list of numbers that count the number of objects
  4024. created in this Emacs session. Each of these counters increments
  4025. for a certain kind of object. See the documentation string for
  4026. details.
  4027. -- Variable: gcs-done
  4028. This variable contains the total number of garbage collections
  4029. done so far in this Emacs session.
  4030. -- Variable: gc-elapsed
  4031. This variable contains the total number of seconds of elapsed time
  4032. during garbage collection so far in this Emacs session, as a
  4033. floating point number.
  4034. 
  4035. File: elisp, Node: Memory Usage, Next: Writing Emacs Primitives, Prev: Garbage Collection, Up: GNU Emacs Internals
  4036. E.4 Memory Usage
  4037. ================
  4038. These functions and variables give information about the total amount
  4039. of memory allocation that Emacs has done, broken down by data type.
  4040. Note the difference between these and the values returned by
  4041. `garbage-collect'; those count objects that currently exist, but these
  4042. count the number or size of all allocations, including those for
  4043. objects that have since been freed.
  4044. -- Variable: cons-cells-consed
  4045. The total number of cons cells that have been allocated so far in
  4046. this Emacs session.
  4047. -- Variable: floats-consed
  4048. The total number of floats that have been allocated so far in this
  4049. Emacs session.
  4050. -- Variable: vector-cells-consed
  4051. The total number of vector cells that have been allocated so far
  4052. in this Emacs session.
  4053. -- Variable: symbols-consed
  4054. The total number of symbols that have been allocated so far in
  4055. this Emacs session.
  4056. -- Variable: string-chars-consed
  4057. The total number of string characters that have been allocated so
  4058. far in this session.
  4059. -- Variable: misc-objects-consed
  4060. The total number of miscellaneous objects that have been allocated
  4061. so far in this session. These include markers and overlays, plus
  4062. certain objects not visible to users.
  4063. -- Variable: intervals-consed
  4064. The total number of intervals that have been allocated so far in
  4065. this Emacs session.
  4066. -- Variable: strings-consed
  4067. The total number of strings that have been allocated so far in this
  4068. Emacs session.
  4069. 
  4070. File: elisp, Node: Writing Emacs Primitives, Next: Object Internals, Prev: Memory Usage, Up: GNU Emacs Internals
  4071. E.5 Writing Emacs Primitives
  4072. ============================
  4073. Lisp primitives are Lisp functions implemented in C. The details of
  4074. interfacing the C function so that Lisp can call it are handled by a few
  4075. C macros. The only way to really understand how to write new C code is
  4076. to read the source, but we can explain some things here.
  4077. An example of a special form is the definition of `or', from
  4078. `eval.c'. (An ordinary function would have the same general
  4079. appearance.)
  4080. DEFUN ("or", For, Sor, 0, UNEVALLED, 0,
  4081. doc: /* Eval args until one of them yields non-nil, then return
  4082. that value.
  4083. The remaining args are not evalled at all.
  4084. If all args return nil, return nil.
  4085. usage: (or CONDITIONS ...) */)
  4086. (Lisp_Object args)
  4087. {
  4088. register Lisp_Object val = Qnil;
  4089. struct gcpro gcpro1;
  4090. GCPRO1 (args);
  4091. while (CONSP (args))
  4092. {
  4093. val = eval_sub (XCAR (args));
  4094. if (!NILP (val))
  4095. break;
  4096. args = XCDR (args);
  4097. }
  4098. UNGCPRO;
  4099. return val;
  4100. }
  4101. Let's start with a precise explanation of the arguments to the
  4102. `DEFUN' macro. Here is a template for them:
  4103. DEFUN (LNAME, FNAME, SNAME, MIN, MAX, INTERACTIVE, DOC)
  4104. LNAME
  4105. This is the name of the Lisp symbol to define as the function
  4106. name; in the example above, it is `or'.
  4107. FNAME
  4108. This is the C function name for this function. This is the name
  4109. that is used in C code for calling the function. The name is, by
  4110. convention, `F' prepended to the Lisp name, with all dashes (`-')
  4111. in the Lisp name changed to underscores. Thus, to call this
  4112. function from C code, call `For'.
  4113. SNAME
  4114. This is a C variable name to use for a structure that holds the
  4115. data for the subr object that represents the function in Lisp.
  4116. This structure conveys the Lisp symbol name to the initialization
  4117. routine that will create the symbol and store the subr object as
  4118. its definition. By convention, this name is always FNAME with `F'
  4119. replaced with `S'.
  4120. MIN
  4121. This is the minimum number of arguments that the function
  4122. requires. The function `or' allows a minimum of zero arguments.
  4123. MAX
  4124. This is the maximum number of arguments that the function accepts,
  4125. if there is a fixed maximum. Alternatively, it can be `UNEVALLED',
  4126. indicating a special form that receives unevaluated arguments, or
  4127. `MANY', indicating an unlimited number of evaluated arguments (the
  4128. equivalent of `&rest'). Both `UNEVALLED' and `MANY' are macros.
  4129. If MAX is a number, it must be more than MIN but less than 8.
  4130. INTERACTIVE
  4131. This is an interactive specification, a string such as might be
  4132. used as the argument of `interactive' in a Lisp function. In the
  4133. case of `or', it is 0 (a null pointer), indicating that `or'
  4134. cannot be called interactively. A value of `""' indicates a
  4135. function that should receive no arguments when called
  4136. interactively. If the value begins with a `(', the string is
  4137. evaluated as a Lisp form. For examples of the last two forms, see
  4138. `widen' and `narrow-to-region' in `editfns.c'.
  4139. DOC
  4140. This is the documentation string. It uses C comment syntax rather
  4141. than C string syntax because comment syntax requires nothing
  4142. special to include multiple lines. The `doc:' identifies the
  4143. comment that follows as the documentation string. The `/*' and
  4144. `*/' delimiters that begin and end the comment are not part of the
  4145. documentation string.
  4146. If the last line of the documentation string begins with the
  4147. keyword `usage:', the rest of the line is treated as the argument
  4148. list for documentation purposes. This way, you can use different
  4149. argument names in the documentation string from the ones used in
  4150. the C code. `usage:' is required if the function has an unlimited
  4151. number of arguments.
  4152. All the usual rules for documentation strings in Lisp code (*note
  4153. Documentation Tips::) apply to C code documentation strings too.
  4154. After the call to the `DEFUN' macro, you must write the argument
  4155. list for the C function, including the types for the arguments. If the
  4156. primitive accepts a fixed maximum number of Lisp arguments, there must
  4157. be one C argument for each Lisp argument, and each argument must be of
  4158. type `Lisp_Object'. (Various macros and functions for creating values
  4159. of type `Lisp_Object' are declared in the file `lisp.h'.) If the
  4160. primitive has no upper limit on the number of Lisp arguments, it must
  4161. have exactly two C arguments: the first is the number of Lisp
  4162. arguments, and the second is the address of a block containing their
  4163. values. These have types `int' and `Lisp_Object *' respectively.
  4164. Within the function `For' itself, note the use of the macros
  4165. `GCPRO1' and `UNGCPRO'. These macros are defined for the sake of the
  4166. few platforms which do not use Emacs' default stack-marking garbage
  4167. collector. The `GCPRO1' macro "protects" a variable from garbage
  4168. collection, explicitly informing the garbage collector that that
  4169. variable and all its contents must be as accessible. GC protection is
  4170. necessary in any function which can perform Lisp evaluation by calling
  4171. `eval_sub' or `Feval' as a subroutine, either directly or indirectly.
  4172. It suffices to ensure that at least one pointer to each object is
  4173. GC-protected. Thus, a particular local variable can do without
  4174. protection if it is certain that the object it points to will be
  4175. preserved by some other pointer (such as another local variable that
  4176. has a `GCPRO'). Otherwise, the local variable needs a `GCPRO'.
  4177. The macro `GCPRO1' protects just one local variable. If you want to
  4178. protect two variables, use `GCPRO2' instead; repeating `GCPRO1' will
  4179. not work. Macros `GCPRO3', `GCPRO4', `GCPRO5', and `GCPRO6' also
  4180. exist. All these macros implicitly use local variables such as
  4181. `gcpro1'; you must declare these explicitly, with type `struct gcpro'.
  4182. Thus, if you use `GCPRO2', you must declare `gcpro1' and `gcpro2'.
  4183. `UNGCPRO' cancels the protection of the variables that are protected
  4184. in the current function. It is necessary to do this explicitly.
  4185. You must not use C initializers for static or global variables unless
  4186. the variables are never written once Emacs is dumped. These variables
  4187. with initializers are allocated in an area of memory that becomes
  4188. read-only (on certain operating systems) as a result of dumping Emacs.
  4189. *Note Pure Storage::.
  4190. Defining the C function is not enough to make a Lisp primitive
  4191. available; you must also create the Lisp symbol for the primitive and
  4192. store a suitable subr object in its function cell. The code looks like
  4193. this:
  4194. defsubr (&SNAME);
  4195. Here SNAME is the name you used as the third argument to `DEFUN'.
  4196. If you add a new primitive to a file that already has Lisp primitives
  4197. defined in it, find the function (near the end of the file) named
  4198. `syms_of_SOMETHING', and add the call to `defsubr' there. If the file
  4199. doesn't have this function, or if you create a new file, add to it a
  4200. `syms_of_FILENAME' (e.g., `syms_of_myfile'). Then find the spot in
  4201. `emacs.c' where all of these functions are called, and add a call to
  4202. `syms_of_FILENAME' there.
  4203. The function `syms_of_FILENAME' is also the place to define any C
  4204. variables that are to be visible as Lisp variables. `DEFVAR_LISP'
  4205. makes a C variable of type `Lisp_Object' visible in Lisp. `DEFVAR_INT'
  4206. makes a C variable of type `int' visible in Lisp with a value that is
  4207. always an integer. `DEFVAR_BOOL' makes a C variable of type `int'
  4208. visible in Lisp with a value that is either `t' or `nil'. Note that
  4209. variables defined with `DEFVAR_BOOL' are automatically added to the list
  4210. `byte-boolean-vars' used by the byte compiler.
  4211. If you want to make a Lisp variables that is defined in C behave
  4212. like one declared with `defcustom', add an appropriate entry to
  4213. `cus-start.el'.
  4214. If you define a file-scope C variable of type `Lisp_Object', you
  4215. must protect it from garbage-collection by calling `staticpro' in
  4216. `syms_of_FILENAME', like this:
  4217. staticpro (&VARIABLE);
  4218. Here is another example function, with more complicated arguments.
  4219. This comes from the code in `window.c', and it demonstrates the use of
  4220. macros and functions to manipulate Lisp objects.
  4221. DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
  4222. Scoordinates_in_window_p, 2, 2, 0,
  4223. doc: /* Return non-nil if COORDINATES are in WINDOW.
  4224. ...
  4225. or `right-margin' is returned. */)
  4226. (register Lisp_Object coordinates, Lisp_Object window)
  4227. {
  4228. struct window *w;
  4229. struct frame *f;
  4230. int x, y;
  4231. Lisp_Object lx, ly;
  4232. CHECK_LIVE_WINDOW (window);
  4233. w = XWINDOW (window);
  4234. f = XFRAME (w->frame);
  4235. CHECK_CONS (coordinates);
  4236. lx = Fcar (coordinates);
  4237. ly = Fcdr (coordinates);
  4238. CHECK_NUMBER_OR_FLOAT (lx);
  4239. CHECK_NUMBER_OR_FLOAT (ly);
  4240. x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH(f);
  4241. y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH(f);
  4242. switch (coordinates_in_window (w, x, y))
  4243. {
  4244. case ON_NOTHING: /* NOT in window at all. */
  4245. return Qnil;
  4246. ...
  4247. case ON_MODE_LINE: /* In mode line of window. */
  4248. return Qmode_line;
  4249. ...
  4250. case ON_SCROLL_BAR: /* On scroll-bar of window. */
  4251. /* Historically we are supposed to return nil in this case. */
  4252. return Qnil;
  4253. default:
  4254. abort ();
  4255. }
  4256. }
  4257. Note that C code cannot call functions by name unless they are
  4258. defined in C. The way to call a function written in Lisp is to use
  4259. `Ffuncall', which embodies the Lisp function `funcall'. Since the Lisp
  4260. function `funcall' accepts an unlimited number of arguments, in C it
  4261. takes two: the number of Lisp-level arguments, and a one-dimensional
  4262. array containing their values. The first Lisp-level argument is the
  4263. Lisp function to call, and the rest are the arguments to pass to it.
  4264. Since `Ffuncall' can call the evaluator, you must protect pointers from
  4265. garbage collection around the call to `Ffuncall'.
  4266. The C functions `call0', `call1', `call2', and so on, provide handy
  4267. ways to call a Lisp function conveniently with a fixed number of
  4268. arguments. They work by calling `Ffuncall'.
  4269. `eval.c' is a very good file to look through for examples; `lisp.h'
  4270. contains the definitions for some important macros and functions.
  4271. If you define a function which is side-effect free, update the code
  4272. in `byte-opt.el' that binds `side-effect-free-fns' and
  4273. `side-effect-and-error-free-fns' so that the compiler optimizer knows
  4274. about it.
  4275. 
  4276. File: elisp, Node: Object Internals, Prev: Writing Emacs Primitives, Up: GNU Emacs Internals
  4277. E.6 Object Internals
  4278. ====================
  4279. GNU Emacs Lisp manipulates many different types of data. The actual
  4280. data are stored in a heap and the only access that programs have to it
  4281. is through pointers. Each pointer is 32 bits wide on 32-bit machines,
  4282. and 64 bits wide on 64-bit machines; three of these bits are used for
  4283. the tag that identifies the object's type, and the remainder are used
  4284. to address the object.
  4285. Because Lisp objects are represented as tagged pointers, it is always
  4286. possible to determine the Lisp data type of any object. The C data type
  4287. `Lisp_Object' can hold any Lisp object of any data type. Ordinary
  4288. variables have type `Lisp_Object', which means they can hold any type
  4289. of Lisp value; you can determine the actual data type only at run time.
  4290. The same is true for function arguments; if you want a function to
  4291. accept only a certain type of argument, you must check the type
  4292. explicitly using a suitable predicate (*note Type Predicates::).
  4293. * Menu:
  4294. * Buffer Internals:: Components of a buffer structure.
  4295. * Window Internals:: Components of a window structure.
  4296. * Process Internals:: Components of a process structure.
  4297. 
  4298. File: elisp, Node: Buffer Internals, Next: Window Internals, Up: Object Internals
  4299. E.6.1 Buffer Internals
  4300. ----------------------
  4301. Two structures (see `buffer.h') are used to represent buffers in C.
  4302. The `buffer_text' structure contains fields describing the text of a
  4303. buffer; the `buffer' structure holds other fields. In the case of
  4304. indirect buffers, two or more `buffer' structures reference the same
  4305. `buffer_text' structure.
  4306. Here are some of the fields in `struct buffer_text':
  4307. `beg'
  4308. The address of the buffer contents.
  4309. `gpt'
  4310. `gpt_byte'
  4311. The character and byte positions of the buffer gap. *Note Buffer
  4312. Gap::.
  4313. `z'
  4314. `z_byte'
  4315. The character and byte positions of the end of the buffer text.
  4316. `gap_size'
  4317. The size of buffer's gap. *Note Buffer Gap::.
  4318. `modiff'
  4319. `save_modiff'
  4320. `chars_modiff'
  4321. `overlay_modiff'
  4322. These fields count the number of buffer-modification events
  4323. performed in this buffer. `modiff' is incremented after each
  4324. buffer-modification event, and is never otherwise changed;
  4325. `save_modiff' contains the value of `modiff' the last time the
  4326. buffer was visited or saved; `chars_modiff' counts only
  4327. modifications to the characters in the buffer, ignoring all other
  4328. kinds of changes; and `overlay_modiff' counts only modifications
  4329. to the overlays.
  4330. `beg_unchanged'
  4331. `end_unchanged'
  4332. The number of characters at the start and end of the text that are
  4333. known to be unchanged since the last complete redisplay.
  4334. `unchanged_modified'
  4335. `overlay_unchanged_modified'
  4336. The values of `modiff' and `overlay_modiff', respectively, after
  4337. the last complete redisplay. If their current values match
  4338. `modiff' or `overlay_modiff', that means `beg_unchanged' and
  4339. `end_unchanged' contain no useful information.
  4340. `markers'
  4341. The markers that refer to this buffer. This is actually a single
  4342. marker, and successive elements in its marker `chain' are the other
  4343. markers referring to this buffer text.
  4344. `intervals'
  4345. The interval tree which records the text properties of this buffer.
  4346. Some of the fields of `struct buffer' are:
  4347. `header'
  4348. A `struct vectorlike_header' structure where `header.next' points
  4349. to the next buffer, in the chain of all buffers (including killed
  4350. buffers). This chain is used only for garbage collection, in
  4351. order to collect killed buffers properly. Note that vectors, and
  4352. most kinds of objects allocated as vectors, are all on one chain,
  4353. but buffers are on a separate chain of their own.
  4354. `own_text'
  4355. A `struct buffer_text' structure that ordinarily holds the buffer
  4356. contents. In indirect buffers, this field is not used.
  4357. `text'
  4358. A pointer to the `buffer_text' structure for this buffer. In an
  4359. ordinary buffer, this is the `own_text' field above. In an
  4360. indirect buffer, this is the `own_text' field of the base buffer.
  4361. `pt'
  4362. `pt_byte'
  4363. The character and byte positions of point in a buffer.
  4364. `begv'
  4365. `begv_byte'
  4366. The character and byte positions of the beginning of the accessible
  4367. range of text in the buffer.
  4368. `zv'
  4369. `zv_byte'
  4370. The character and byte positions of the end of the accessible
  4371. range of text in the buffer.
  4372. `base_buffer'
  4373. In an indirect buffer, this points to the base buffer. In an
  4374. ordinary buffer, it is null.
  4375. `local_flags'
  4376. This field contains flags indicating that certain variables are
  4377. local in this buffer. Such variables are declared in the C code
  4378. using `DEFVAR_PER_BUFFER', and their buffer-local bindings are
  4379. stored in fields in the buffer structure itself. (Some of these
  4380. fields are described in this table.)
  4381. `modtime'
  4382. The modification time of the visited file. It is set when the
  4383. file is written or read. Before writing the buffer into a file,
  4384. this field is compared to the modification time of the file to see
  4385. if the file has changed on disk. *Note Buffer Modification::.
  4386. `auto_save_modified'
  4387. The time when the buffer was last auto-saved.
  4388. `last_window_start'
  4389. The `window-start' position in the buffer as of the last time the
  4390. buffer was displayed in a window.
  4391. `clip_changed'
  4392. This flag indicates that narrowing has changed in the buffer.
  4393. *Note Narrowing::.
  4394. `prevent_redisplay_optimizations_p'
  4395. This flag indicates that redisplay optimizations should not be
  4396. used to display this buffer.
  4397. `overlay_center'
  4398. This field holds the current overlay center position. *Note
  4399. Managing Overlays::.
  4400. `overlays_before'
  4401. `overlays_after'
  4402. These fields hold, respectively, a list of overlays that end at or
  4403. before the current overlay center, and a list of overlays that end
  4404. after the current overlay center. *Note Managing Overlays::.
  4405. `overlays_before' is sorted in order of decreasing end position,
  4406. and `overlays_after' is sorted in order of increasing beginning
  4407. position.
  4408. `name'
  4409. A Lisp string that names the buffer. It is guaranteed to be
  4410. unique. *Note Buffer Names::.
  4411. `save_length'
  4412. The length of the file this buffer is visiting, when last read or
  4413. saved. This and other fields concerned with saving are not kept in
  4414. the `buffer_text' structure because indirect buffers are never
  4415. saved.
  4416. `directory'
  4417. The directory for expanding relative file names. This is the
  4418. value of the buffer-local variable `default-directory' (*note File
  4419. Name Expansion::).
  4420. `filename'
  4421. The name of the file visited in this buffer, or `nil'. This is
  4422. the value of the buffer-local variable `buffer-file-name' (*note
  4423. Buffer File Name::).
  4424. `undo_list'
  4425. `backed_up'
  4426. `auto_save_file_name'
  4427. `auto_save_file_format'
  4428. `read_only'
  4429. `file_format'
  4430. `file_truename'
  4431. `invisibility_spec'
  4432. `display_count'
  4433. `display_time'
  4434. These fields store the values of Lisp variables that are
  4435. automatically buffer-local (*note Buffer-Local Variables::), whose
  4436. corresponding variable names have the additional prefix `buffer-'
  4437. and have underscores replaced with dashes. For instance,
  4438. `undo_list' stores the value of `buffer-undo-list'.
  4439. `mark'
  4440. The mark for the buffer. The mark is a marker, hence it is also
  4441. included on the list `markers'. *Note The Mark::.
  4442. `local_var_alist'
  4443. The association list describing the buffer-local variable bindings
  4444. of this buffer, not including the built-in buffer-local bindings
  4445. that have special slots in the buffer object. (Those slots are
  4446. omitted from this table.) *Note Buffer-Local Variables::.
  4447. `major_mode'
  4448. Symbol naming the major mode of this buffer, e.g., `lisp-mode'.
  4449. `mode_name'
  4450. Pretty name of the major mode, e.g., `"Lisp"'.
  4451. `keymap'
  4452. `abbrev_table'
  4453. `syntax_table'
  4454. `category_table'
  4455. `display_table'
  4456. These fields store the buffer's local keymap (*note Keymaps::),
  4457. abbrev table (*note Abbrev Tables::), syntax table (*note Syntax
  4458. Tables::), category table (*note Categories::), and display table
  4459. (*note Display Tables::).
  4460. `downcase_table'
  4461. `upcase_table'
  4462. `case_canon_table'
  4463. These fields store the conversion tables for converting text to
  4464. lower case, upper case, and for canonicalizing text for case-fold
  4465. search. *Note Case Tables::.
  4466. `minor_modes'
  4467. An alist of the minor modes of this buffer.
  4468. `pt_marker'
  4469. `begv_marker'
  4470. `zv_marker'
  4471. These fields are only used in an indirect buffer, or in a buffer
  4472. that is the base of an indirect buffer. Each holds a marker that
  4473. records `pt', `begv', and `zv' respectively, for this buffer when
  4474. the buffer is not current.
  4475. `mode_line_format'
  4476. `header_line_format'
  4477. `case_fold_search'
  4478. `tab_width'
  4479. `fill_column'
  4480. `left_margin'
  4481. `auto_fill_function'
  4482. `truncate_lines'
  4483. `word_wrap'
  4484. `ctl_arrow'
  4485. `bidi_display_reordering'
  4486. `bidi_paragraph_direction'
  4487. `selective_display'
  4488. `selective_display_ellipses'
  4489. `overwrite_mode'
  4490. `abbrev_mode'
  4491. `mark_active'
  4492. `enable_multibyte_characters'
  4493. `buffer_file_coding_system'
  4494. `cache_long_line_scans'
  4495. `point_before_scroll'
  4496. `left_fringe_width'
  4497. `right_fringe_width'
  4498. `fringes_outside_margins'
  4499. `scroll_bar_width'
  4500. `indicate_empty_lines'
  4501. `indicate_buffer_boundaries'
  4502. `fringe_indicator_alist'
  4503. `fringe_cursor_alist'
  4504. `scroll_up_aggressively'
  4505. `scroll_down_aggressively'
  4506. `cursor_type'
  4507. `cursor_in_non_selected_windows'
  4508. These fields store the values of Lisp variables that are
  4509. automatically buffer-local (*note Buffer-Local Variables::), whose
  4510. corresponding variable names have underscores replaced with
  4511. dashes. For instance, `mode_line_format' stores the value of
  4512. `mode-line-format'.
  4513. `last_selected_window'
  4514. This is the last window that was selected with this buffer in it,
  4515. or `nil' if that window no longer displays this buffer.
  4516. 
  4517. File: elisp, Node: Window Internals, Next: Process Internals, Prev: Buffer Internals, Up: Object Internals
  4518. E.6.2 Window Internals
  4519. ----------------------
  4520. The fields of a window (for a complete list, see the definition of
  4521. `struct window' in `window.h') include:
  4522. `frame'
  4523. The frame that this window is on.
  4524. `mini_p'
  4525. Non-`nil' if this window is a minibuffer window.
  4526. `parent'
  4527. Internally, Emacs arranges windows in a tree; each group of
  4528. siblings has a parent window whose area includes all the siblings.
  4529. This field points to a window's parent.
  4530. Parent windows do not display buffers, and play little role in
  4531. display except to shape their child windows. Emacs Lisp programs
  4532. usually have no access to the parent windows; they operate on the
  4533. windows at the leaves of the tree, which actually display buffers.
  4534. `hchild'
  4535. `vchild'
  4536. These fields contain the window's leftmost child and its topmost
  4537. child respectively. `hchild' is used if the window is subdivided
  4538. horizontally by child windows, and `vchild' if it is subdivided
  4539. vertically. In a live window, only one of `hchild', `vchild', and
  4540. `buffer' (q.v.) is non-`nil'.
  4541. `next'
  4542. `prev'
  4543. The next sibling and previous sibling of this window. `next' is
  4544. `nil' if the window is the right-most or bottom-most in its group;
  4545. `prev' is `nil' if it is the left-most or top-most in its group.
  4546. `left_col'
  4547. The left-hand edge of the window, measured in columns, relative to
  4548. the leftmost column in the frame (column 0).
  4549. `top_line'
  4550. The top edge of the window, measured in lines, relative to the
  4551. topmost line in the frame (line 0).
  4552. `total_cols'
  4553. `total_lines'
  4554. The width and height of the window, measured in columns and lines
  4555. respectively. The width includes the scroll bar and fringes,
  4556. and/or the separator line on the right of the window (if any).
  4557. `buffer'
  4558. The buffer that the window is displaying.
  4559. `start'
  4560. A marker pointing to the position in the buffer that is the first
  4561. character displayed in the window.
  4562. `pointm'
  4563. This is the value of point in the current buffer when this window
  4564. is selected; when it is not selected, it retains its previous
  4565. value.
  4566. `force_start'
  4567. If this flag is non-`nil', it says that the window has been
  4568. scrolled explicitly by the Lisp program. This affects what the
  4569. next redisplay does if point is off the screen: instead of
  4570. scrolling the window to show the text around point, it moves point
  4571. to a location that is on the screen.
  4572. `frozen_window_start_p'
  4573. This field is set temporarily to 1 to indicate to redisplay that
  4574. `start' of this window should not be changed, even if point gets
  4575. invisible.
  4576. `start_at_line_beg'
  4577. Non-`nil' means current value of `start' was the beginning of a
  4578. line when it was chosen.
  4579. `use_time'
  4580. This is the last time that the window was selected. The function
  4581. `get-lru-window' uses this field.
  4582. `sequence_number'
  4583. A unique number assigned to this window when it was created.
  4584. `last_modified'
  4585. The `modiff' field of the window's buffer, as of the last time a
  4586. redisplay completed in this window.
  4587. `last_overlay_modified'
  4588. The `overlay_modiff' field of the window's buffer, as of the last
  4589. time a redisplay completed in this window.
  4590. `last_point'
  4591. The buffer's value of point, as of the last time a redisplay
  4592. completed in this window.
  4593. `last_had_star'
  4594. A non-`nil' value means the window's buffer was "modified" when the
  4595. window was last updated.
  4596. `vertical_scroll_bar'
  4597. This window's vertical scroll bar.
  4598. `left_margin_cols'
  4599. `right_margin_cols'
  4600. The widths of the left and right margins in this window. A value
  4601. of `nil' means no margin.
  4602. `left_fringe_width'
  4603. `right_fringe_width'
  4604. The widths of the left and right fringes in this window. A value
  4605. of `nil' or `t' means use the values of the frame.
  4606. `fringes_outside_margins'
  4607. A non-`nil' value means the fringes outside the display margins;
  4608. othersize they are between the margin and the text.
  4609. `window_end_pos'
  4610. This is computed as `z' minus the buffer position of the last glyph
  4611. in the current matrix of the window. The value is only valid if
  4612. `window_end_valid' is not `nil'.
  4613. `window_end_bytepos'
  4614. The byte position corresponding to `window_end_pos'.
  4615. `window_end_vpos'
  4616. The window-relative vertical position of the line containing
  4617. `window_end_pos'.
  4618. `window_end_valid'
  4619. This field is set to a non-`nil' value if `window_end_pos' is truly
  4620. valid. This is `nil' if nontrivial redisplay is pre-empted, since
  4621. in that case the display that `window_end_pos' was computed for
  4622. did not get onto the screen.
  4623. `cursor'
  4624. A structure describing where the cursor is in this window.
  4625. `last_cursor'
  4626. The value of `cursor' as of the last redisplay that finished.
  4627. `phys_cursor'
  4628. A structure describing where the cursor of this window physically
  4629. is.
  4630. `phys_cursor_type'
  4631. `phys_cursor_height'
  4632. `phys_cursor_width'
  4633. The type, height, and width of the cursor that was last displayed
  4634. on this window.
  4635. `phys_cursor_on_p'
  4636. This field is non-zero if the cursor is physically on.
  4637. `cursor_off_p'
  4638. Non-zero means the cursor in this window is logically off. This is
  4639. used for blinking the cursor.
  4640. `last_cursor_off_p'
  4641. This field contains the value of `cursor_off_p' as of the time of
  4642. the last redisplay.
  4643. `must_be_updated_p'
  4644. This is set to 1 during redisplay when this window must be updated.
  4645. `hscroll'
  4646. This is the number of columns that the display in the window is
  4647. scrolled horizontally to the left. Normally, this is 0.
  4648. `vscroll'
  4649. Vertical scroll amount, in pixels. Normally, this is 0.
  4650. `dedicated'
  4651. Non-`nil' if this window is dedicated to its buffer.
  4652. `display_table'
  4653. The window's display table, or `nil' if none is specified for it.
  4654. `update_mode_line'
  4655. Non-`nil' means this window's mode line needs to be updated.
  4656. `base_line_number'
  4657. The line number of a certain position in the buffer, or `nil'.
  4658. This is used for displaying the line number of point in the mode
  4659. line.
  4660. `base_line_pos'
  4661. The position in the buffer for which the line number is known, or
  4662. `nil' meaning none is known. If it is a buffer, don't display the
  4663. line number as long as the window shows that buffer.
  4664. `region_showing'
  4665. If the region (or part of it) is highlighted in this window, this
  4666. field holds the mark position that made one end of that region.
  4667. Otherwise, this field is `nil'.
  4668. `column_number_displayed'
  4669. The column number currently displayed in this window's mode line,
  4670. or `nil' if column numbers are not being displayed.
  4671. `current_matrix'
  4672. `desired_matrix'
  4673. Glyph matrices describing the current and desired display of this
  4674. window.
  4675. 
  4676. File: elisp, Node: Process Internals, Prev: Window Internals, Up: Object Internals
  4677. E.6.3 Process Internals
  4678. -----------------------
  4679. The fields of a process (for a complete list, see the definition of
  4680. `struct Lisp_Process' in `process.h') include:
  4681. `name'
  4682. A string, the name of the process.
  4683. `command'
  4684. A list containing the command arguments that were used to start
  4685. this process. For a network or serial process, it is `nil' if the
  4686. process is running or `t' if the process is stopped.
  4687. `filter'
  4688. If non-`nil', a function used to accept output from the process
  4689. instead of a buffer.
  4690. `sentinel'
  4691. If non-`nil', a function called whenever the state of the process
  4692. changes.
  4693. `buffer'
  4694. The associated buffer of the process.
  4695. `pid'
  4696. An integer, the operating system's process ID. Pseudo-processes
  4697. such as network or serial connections use a value of 0.
  4698. `childp'
  4699. A flag, `t' if this is really a child process. For a network or
  4700. serial connection, it is a plist based on the arguments to
  4701. `make-network-process' or `make-serial-process'.
  4702. `mark'
  4703. A marker indicating the position of the end of the last output
  4704. from this process inserted into the buffer. This is often but not
  4705. always the end of the buffer.
  4706. `kill_without_query'
  4707. If this is non-zero, killing Emacs while this process is still
  4708. running does not ask for confirmation about killing the process.
  4709. `raw_status'
  4710. The raw process status, as returned by the `wait' system call.
  4711. `status'
  4712. The process status, as `process-status' should return it.
  4713. `tick'
  4714. `update_tick'
  4715. If these two fields are not equal, a change in the status of the
  4716. process needs to be reported, either by running the sentinel or by
  4717. inserting a message in the process buffer.
  4718. `pty_flag'
  4719. Non-`nil' if communication with the subprocess uses a PTY; `nil'
  4720. if it uses a pipe.
  4721. `infd'
  4722. The file descriptor for input from the process.
  4723. `outfd'
  4724. The file descriptor for output to the process.
  4725. `tty_name'
  4726. The name of the terminal that the subprocess is using, or `nil' if
  4727. it is using pipes.
  4728. `decode_coding_system'
  4729. Coding-system for decoding the input from this process.
  4730. `decoding_buf'
  4731. A working buffer for decoding.
  4732. `decoding_carryover'
  4733. Size of carryover in decoding.
  4734. `encode_coding_system'
  4735. Coding-system for encoding the output to this process.
  4736. `encoding_buf'
  4737. A working buffer for encoding.
  4738. `inherit_coding_system_flag'
  4739. Flag to set `coding-system' of the process buffer from the coding
  4740. system used to decode process output.
  4741. `type'
  4742. Symbol indicating the type of process: `real', `network', `serial'.
  4743. 
  4744. File: elisp, Node: Standard Errors, Next: Standard Keymaps, Prev: GNU Emacs Internals, Up: Top
  4745. Appendix F Standard Errors
  4746. **************************
  4747. Here is a list of the more important error symbols in standard Emacs,
  4748. grouped by concept. The list includes each symbol's message (on the
  4749. `error-message' property of the symbol) and a cross reference to a
  4750. description of how the error can occur.
  4751. Each error symbol has an `error-conditions' property that is a list
  4752. of symbols. Normally this list includes the error symbol itself and
  4753. the symbol `error'. Occasionally it includes additional symbols, which
  4754. are intermediate classifications, narrower than `error' but broader
  4755. than a single error symbol. For example, all the errors in accessing
  4756. files have the condition `file-error'. If we do not say here that a
  4757. certain error symbol has additional error conditions, that means it has
  4758. none.
  4759. As a special exception, the error symbol `quit' does not have the
  4760. condition `error', because quitting is not considered an error.
  4761. Most of these error symbols are defined in C (mainly `data.c'), but
  4762. some are defined in Lisp. For example, the file `userlock.el' defines
  4763. the `file-locked' and `file-supersession' errors. Several of the
  4764. specialized Lisp libraries distributed with Emacs define their own
  4765. error symbols. We do not attempt to list of all those here.
  4766. *Note Errors::, for an explanation of how errors are generated and
  4767. handled.
  4768. `error'
  4769. `"error"'
  4770. *Note Errors::.
  4771. `quit'
  4772. `"Quit"'
  4773. *Note Quitting::.
  4774. `args-out-of-range'
  4775. `"Args out of range"'
  4776. This happens when trying to access an element beyond the range of a
  4777. sequence or buffer.
  4778. *Note Sequences Arrays Vectors::, *Note Text::.
  4779. `arith-error'
  4780. `"Arithmetic error"'
  4781. *Note Arithmetic Operations::.
  4782. `beginning-of-buffer'
  4783. `"Beginning of buffer"'
  4784. *Note Character Motion::.
  4785. `buffer-read-only'
  4786. `"Buffer is read-only"'
  4787. *Note Read Only Buffers::.
  4788. `circular-list'
  4789. `"List contains a loop"'
  4790. This happens when some operations (e.g. resolving face names)
  4791. encounter circular structures.
  4792. *Note Circular Objects::.
  4793. `cl-assertion-failed'
  4794. `"Assertion failed"'
  4795. This happens when the `assert' macro fails a test.
  4796. *Note Assertions: (cl)Assertions.
  4797. `coding-system-error'
  4798. `"Invalid coding system"'
  4799. *Note Lisp and Coding Systems::.
  4800. `cyclic-function-indirection'
  4801. `"Symbol's chain of function indirections contains a loop"'
  4802. *Note Function Indirection::.
  4803. `cyclic-variable-indirection'
  4804. `"Symbol's chain of variable indirections contains a loop"'
  4805. *Note Variable Aliases::.
  4806. `dbus-error'
  4807. `"D-Bus error"'
  4808. This is only defined if Emacs was compiled with D-Bus support.
  4809. *Note Errors and Events: (dbus)Errors and Events.
  4810. `end-of-buffer'
  4811. `"End of buffer"'
  4812. *Note Character Motion::.
  4813. `end-of-file'
  4814. `"End of file during parsing"'
  4815. Note that this is not a subcategory of `file-error', because it
  4816. pertains to the Lisp reader, not to file I/O.
  4817. *Note Input Functions::.
  4818. `file-already-exists'
  4819. This is a subcategory of `file-error'.
  4820. *Note Writing to Files::.
  4821. `file-date-error'
  4822. This is a subcategory of `file-error'. It occurs when `copy-file'
  4823. tries and fails to set the last-modification time of the output
  4824. file.
  4825. *Note Changing Files::.
  4826. `file-error'
  4827. We do not list the error-strings of this error and its
  4828. subcategories, because the error message is normally constructed
  4829. from the data items alone when the error condition `file-error' is
  4830. present. Thus, the error-strings are not very relevant. However,
  4831. these error symbols do have `error-message' properties, and if no
  4832. data is provided, the `error-message' property _is_ used.
  4833. *Note Files::.
  4834. `compression-error'
  4835. This is a subcategory of `file-error', which results from problems
  4836. handling a compressed file.
  4837. *Note How Programs Do Loading::.
  4838. `file-locked'
  4839. This is a subcategory of `file-error'.
  4840. *Note File Locks::.
  4841. `file-supersession'
  4842. This is a subcategory of `file-error'.
  4843. *Note Modification Time::.
  4844. `ftp-error'
  4845. This is a subcategory of `file-error', which results from problems
  4846. in accessing a remote file using ftp.
  4847. *Note Remote Files: (emacs)Remote Files.
  4848. `invalid-function'
  4849. `"Invalid function"'
  4850. *Note Function Indirection::.
  4851. `invalid-read-syntax'
  4852. `"Invalid read syntax"'
  4853. *Note Printed Representation::.
  4854. `invalid-regexp'
  4855. `"Invalid regexp"'
  4856. *Note Regular Expressions::.
  4857. `mark-inactive'
  4858. `"The mark is not active now"'
  4859. *Note The Mark::.
  4860. `no-catch'
  4861. `"No catch for tag"'
  4862. *Note Catch and Throw::.
  4863. `scan-error'
  4864. `"Scan error"'
  4865. This happens when certain syntax-parsing functions find invalid
  4866. syntax or mismatched parentheses.
  4867. *Note List Motion::, and *note Parsing Expressions::.
  4868. `search-failed'
  4869. `"Search failed"'
  4870. *Note Searching and Matching::.
  4871. `setting-constant'
  4872. `"Attempt to set a constant symbol"'
  4873. The values of the symbols `nil' and `t', and any symbols that
  4874. start with `:', may not be changed.
  4875. *Note Variables that Never Change: Constant Variables.
  4876. `text-read-only'
  4877. `"Text is read-only"'
  4878. This is a subcategory of `buffer-read-only'.
  4879. *Note Special Properties::.
  4880. `undefined-color'
  4881. `"Undefined color"'
  4882. *Note Color Names::.
  4883. `void-function'
  4884. `"Symbol's function definition is void"'
  4885. *Note Function Cells::.
  4886. `void-variable'
  4887. `"Symbol's value as variable is void"'
  4888. *Note Accessing Variables::.
  4889. `wrong-number-of-arguments'
  4890. `"Wrong number of arguments"'
  4891. *Note Classifying Lists::.
  4892. `wrong-type-argument'
  4893. `"Wrong type argument"'
  4894. *Note Type Predicates::.
  4895. The following kinds of error, which are classified as special cases
  4896. of `arith-error', can occur on certain systems for invalid use of
  4897. mathematical functions. *Note Math Functions::.
  4898. `domain-error'
  4899. `"Arithmetic domain error"'
  4900. `overflow-error'
  4901. `"Arithmetic overflow error"'
  4902. This is a subcategory of `domain-error'.
  4903. `range-error'
  4904. `"Arithmetic range error"'
  4905. `singularity-error'
  4906. `"Arithmetic singularity error"'
  4907. This is a subcategory of `domain-error'.
  4908. `underflow-error'
  4909. `"Arithmetic underflow error"'
  4910. This is a subcategory of `domain-error'.
  4911. 
  4912. File: elisp, Node: Standard Keymaps, Next: Standard Hooks, Prev: Standard Errors, Up: Top
  4913. Appendix G Standard Keymaps
  4914. ***************************
  4915. In this section we list some of the more general keymaps. Many of
  4916. these exist when Emacs is first started, but some are loaded only when
  4917. the respective feature is accessed.
  4918. There are many other, more specialized, maps than these; in
  4919. particular those associated with major and minor modes. The minibuffer
  4920. uses several keymaps (*note Completion Commands::). For more details on
  4921. keymaps, *note Keymaps::.
  4922. `2C-mode-map'
  4923. A sparse keymap for subcommands of the prefix `C-x 6'.
  4924. *Note Two-Column Editing: (emacs)Two-Column.
  4925. `abbrev-map'
  4926. A sparse keymap for subcommands of the prefix `C-x a'.
  4927. *Note Defining Abbrevs: (emacs)Defining Abbrevs.
  4928. `button-buffer-map'
  4929. A sparse keymap useful for buffers containing buffers.
  4930. You may want to use this as a parent keymap. *Note Buttons::.
  4931. `button-map'
  4932. A sparse keymap used by buttons.
  4933. `ctl-x-4-map'
  4934. A sparse keymap for subcommands of the prefix `C-x 4'.
  4935. `ctl-x-5-map'
  4936. A sparse keymap for subcommands of the prefix `C-x 5'.
  4937. `ctl-x-map'
  4938. A full keymap for `C-x' commands.
  4939. `ctl-x-r-map'
  4940. A sparse keymap for subcommands of the prefix `C-x r'.
  4941. *Note Registers: (emacs)Registers.
  4942. `esc-map'
  4943. A full keymap for `ESC' (or `Meta') commands.
  4944. `facemenu-keymap'
  4945. A sparse keymap used for the `M-o' prefix key.
  4946. `function-key-map'
  4947. The parent keymap of all `local-function-key-map' (q.v.) instances.
  4948. `global-map'
  4949. The full keymap containing default global key bindings.
  4950. Modes should not modify the Global map.
  4951. `goto-map'
  4952. A sparse keymap used for the `M-g' prefix key.
  4953. `help-map'
  4954. A sparse keymap for the keys following the help character `C-h'.
  4955. *Note Help Functions::.
  4956. `Helper-help-map'
  4957. A full keymap used by the help utility package.
  4958. It has the same keymap in its value cell and in its function cell.
  4959. `input-decode-map'
  4960. The keymap for translating keypad and function keys.
  4961. If there are none, then it contains an empty sparse keymap. *Note
  4962. Translation Keymaps::.
  4963. `key-translation-map'
  4964. A keymap for translating keys. This one overrides ordinary key
  4965. bindings, unlike `local-function-key-map'. *Note Translation
  4966. Keymaps::.
  4967. `kmacro-keymap'
  4968. A sparse keymap for keys that follows the `C-x C-k' prefix search.
  4969. *Note Keyboard Macros: (emacs)Keyboard Macros.
  4970. `local-function-key-map'
  4971. The keymap for translating key sequences to preferred alternatives.
  4972. If there are none, then it contains an empty sparse keymap. *Note
  4973. Translation Keymaps::.
  4974. `menu-bar-file-menu'
  4975. `menu-bar-edit-menu'
  4976. `menu-bar-options-menu'
  4977. `global-buffers-menu-map'
  4978. `menu-bar-tools-menu'
  4979. `menu-bar-help-menu'
  4980. These keymaps display the main, top-level menus in the menu bar.
  4981. Some of them contain sub-menus. For example, the Edit menu
  4982. contains `menu-bar-search-menu', etc. *Note Menu Bar::.
  4983. `minibuffer-inactive-mode-map'
  4984. A full keymap used in the minibuffer when it is not active.
  4985. *Note Editing in the Minibuffer: (emacs)Minibuffer Edit.
  4986. `mode-line-coding-system-map'
  4987. `mode-line-input-method-map'
  4988. `mode-line-column-line-number-mode-map'
  4989. These keymaps control various areas of the mode line.
  4990. *Note Mode Line Format::.
  4991. `mode-specific-map'
  4992. The keymap for characters following `C-c'. Note, this is in the
  4993. global map. This map is not actually mode-specific: its name was
  4994. chosen to be informative in `C-h b' (`display-bindings'), where it
  4995. describes the main use of the `C-c' prefix key.
  4996. `mouse-appearance-menu-map'
  4997. A sparse keymap used for the `S-mouse-1' key.
  4998. `mule-keymap'
  4999. The global keymap used for the `C-x <RET>' prefix key.
  5000. `narrow-map'
  5001. A sparse keymap for subcommands of the prefix `C-x n'.
  5002. `prog-mode-map'
  5003. The keymap used by Prog mode.
  5004. *Note Basic Major Modes::.
  5005. `query-replace-map'
  5006. `multi-query-replace-map'
  5007. A sparse keymap used for responses in `query-replace' and related
  5008. commands; also for `y-or-n-p' and `map-y-or-n-p'. The functions
  5009. that use this map do not support prefix keys; they look up one
  5010. event at a time. `multi-query-replace-map' extends
  5011. `query-replace-map' for multi-buffer replacements. *Note
  5012. query-replace-map: Search and Replace.
  5013. `search-map'
  5014. A sparse keymap that provides global bindings for search-related
  5015. commands.
  5016. `special-mode-map'
  5017. The keymap used by Special mode.
  5018. *Note Basic Major Modes::.
  5019. `tool-bar-map'
  5020. The keymap defining the contents of the tool bar.
  5021. *Note Tool Bar::.
  5022. `universal-argument-map'
  5023. A sparse keymap used while processing `C-u'.
  5024. *Note Prefix Command Arguments::.
  5025. `vc-prefix-map'
  5026. The global keymap used for the `C-x v' prefix key.
  5027. `x-alternatives-map'
  5028. A sparse keymap used to map certain keys under graphical frames.
  5029. The function `x-setup-function-keys' uses this.
  5030. 
  5031. File: elisp, Node: Standard Hooks, Next: Index, Prev: Standard Keymaps, Up: Top
  5032. Appendix H Standard Hooks
  5033. *************************
  5034. The following is a list of some hook variables that let you provide
  5035. functions to be called from within Emacs on suitable occasions.
  5036. Most of these variables have names ending with `-hook'. They are
  5037. "normal hooks", run by means of `run-hooks'. The value of such a hook
  5038. is a list of functions; the functions are called with no arguments and
  5039. their values are completely ignored. The recommended way to put a new
  5040. function on such a hook is to call `add-hook'. *Note Hooks::, for more
  5041. information about using hooks.
  5042. The variables whose names end in `-hooks' or `-functions' are
  5043. usually "abnormal hooks"; their values are lists of functions, but
  5044. these functions are called in a special way (they are passed arguments,
  5045. or their values are used). The variables whose names end in `-function'
  5046. have single functions as their values.
  5047. This is not an exhaustive list, it only covers the more general
  5048. hooks. For example, every major mode defines a hook named
  5049. `MODENAME-mode-hook'. The major mode command runs this normal hook
  5050. with `run-mode-hooks' as the very last thing it does. *Note Mode
  5051. Hooks::. Most minor modes have mode hooks too.
  5052. A special feature allows you to specify expressions to evaluate if
  5053. and when a file is loaded (*note Hooks for Loading::). That feature is
  5054. not exactly a hook, but does a similar job.
  5055. `activate-mark-hook'
  5056. `deactivate-mark-hook'
  5057. *Note The Mark::.
  5058. `after-change-functions'
  5059. `before-change-functions'
  5060. `first-change-hook'
  5061. *Note Change Hooks::.
  5062. `after-change-major-mode-hook'
  5063. `change-major-mode-after-body-hook'
  5064. *Note Mode Hooks::.
  5065. `after-init-hook'
  5066. `before-init-hook'
  5067. `emacs-startup-hook'
  5068. *Note Init File::.
  5069. `after-insert-file-functions'
  5070. `write-region-annotate-functions'
  5071. `write-region-post-annotation-function'
  5072. *Note Format Conversion::.
  5073. `after-make-frame-functions'
  5074. `before-make-frame-hook'
  5075. *Note Creating Frames::.
  5076. `after-save-hook'
  5077. `before-save-hook'
  5078. `write-contents-functions'
  5079. `write-file-functions'
  5080. *Note Saving Buffers::.
  5081. `after-setting-font-hook'
  5082. Hook run after a frame's font changes.
  5083. `auto-save-hook'
  5084. *Note Auto-Saving::.
  5085. `before-hack-local-variables-hook'
  5086. `hack-local-variables-hook'
  5087. *Note File Local Variables::.
  5088. `buffer-access-fontify-functions'
  5089. *Note Lazy Properties::.
  5090. `buffer-list-update-hook'
  5091. Hook run when the buffer list changes.
  5092. `buffer-quit-function'
  5093. Function to call to "quit" the current buffer.
  5094. `change-major-mode-hook'
  5095. *Note Creating Buffer-Local::.
  5096. `command-line-functions'
  5097. *Note Command-Line Arguments::.
  5098. `delayed-warnings-hook'
  5099. The command loop runs this soon after `post-command-hook' (q.v.).
  5100. `delete-frame-functions'
  5101. *Note Deleting Frames::.
  5102. `delete-terminal-functions'
  5103. *Note Multiple Terminals::.
  5104. `display-buffer-function'
  5105. `pop-up-frame-function'
  5106. `special-display-function'
  5107. `split-window-preferred-function'
  5108. *Note Choosing Window Options::.
  5109. `echo-area-clear-hook'
  5110. *Note Echo Area Customization::.
  5111. `find-file-hook'
  5112. `find-file-not-found-functions'
  5113. *Note Visiting Functions::.
  5114. `font-lock-extend-after-change-region-function'
  5115. *Note Region to Refontify::.
  5116. `font-lock-extend-region-functions'
  5117. *Note Multiline Font Lock::.
  5118. `font-lock-fontify-buffer-function'
  5119. `font-lock-fontify-region-function'
  5120. `font-lock-mark-block-function'
  5121. `font-lock-unfontify-buffer-function'
  5122. `font-lock-unfontify-region-function'
  5123. *Note Other Font Lock Variables::.
  5124. `fontification-functions'
  5125. *Note Automatic Face Assignment: Auto Faces.
  5126. `frame-auto-hide-function'
  5127. *Note Quitting Windows::.
  5128. `kill-buffer-hook'
  5129. `kill-buffer-query-functions'
  5130. *Note Killing Buffers::.
  5131. `kill-emacs-hook'
  5132. `kill-emacs-query-functions'
  5133. *Note Killing Emacs::.
  5134. `menu-bar-update-hook'
  5135. *Note Menu Bar::.
  5136. `minibuffer-setup-hook'
  5137. `minibuffer-exit-hook'
  5138. *Note Minibuffer Misc::.
  5139. `mouse-leave-buffer-hook'
  5140. Hook run when about to switch windows with a mouse command.
  5141. `mouse-position-function'
  5142. *Note Mouse Position::.
  5143. `post-command-hook'
  5144. `pre-command-hook'
  5145. *Note Command Overview::.
  5146. `post-gc-hook'
  5147. *Note Garbage Collection::.
  5148. `post-self-insert-hook'
  5149. *Note Keymaps and Minor Modes::.
  5150. `suspend-hook'
  5151. `suspend-resume-hook'
  5152. `suspend-tty-functions'
  5153. `resume-tty-functions'
  5154. *Note Suspending Emacs::.
  5155. `syntax-begin-function'
  5156. `syntax-propertize-extend-region-functions'
  5157. `syntax-propertize-function'
  5158. `font-lock-syntactic-face-function'
  5159. *Note Syntactic Font Lock::. *Note Syntax Properties::.
  5160. `temp-buffer-setup-hook'
  5161. `temp-buffer-show-function'
  5162. `temp-buffer-show-hook'
  5163. *Note Temporary Displays::.
  5164. `term-setup-hook'
  5165. *Note Terminal-Specific::.
  5166. `window-configuration-change-hook'
  5167. `window-scroll-functions'
  5168. `window-size-change-functions'
  5169. *Note Window Hooks::.
  5170. `window-setup-hook'
  5171. *Note Window Systems::.
  5172. `window-text-change-functions'
  5173. Functions to call in redisplay when text in the window might
  5174. change.
  5175. 
  5176. Local Variables:
  5177. coding: iso-8859-1
  5178. End: