org.texi 350 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994
  1. \input texinfo
  2. @c %**start of header
  3. @setfilename ../../info/org
  4. @settitle The Org Manual
  5. @set VERSION 6.00pre-5
  6. @set DATE April 2008
  7. @dircategory Emacs
  8. @direntry
  9. * Org Mode: (org). Outline-based notes management and organizer
  10. @end direntry
  11. @c Version and Contact Info
  12. @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
  13. @set AUTHOR Carsten Dominik
  14. @set MAINTAINER Carsten Dominik
  15. @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
  16. @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
  17. @c %**end of header
  18. @finalout
  19. @c Macro definitions
  20. @c Subheadings inside a table.
  21. @macro tsubheading{text}
  22. @ifinfo
  23. @subsubheading \text\
  24. @end ifinfo
  25. @ifnotinfo
  26. @item @b{\text\}
  27. @end ifnotinfo
  28. @end macro
  29. @copying
  30. This manual is for Org (version @value{VERSION}).
  31. Copyright @copyright{} 2004, 2005, 2006, 2007, 2008 Free Software Foundation
  32. @quotation
  33. Permission is granted to copy, distribute and/or modify this document
  34. under the terms of the GNU Free Documentation License, Version 1.1 or
  35. any later version published by the Free Software Foundation; with no
  36. Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
  37. and with the Back-Cover Texts as in (a) below. A copy of the
  38. license is included in the section entitled ``GNU Free Documentation
  39. License.''
  40. (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
  41. this GNU Manual, like GNU software. Copies published by the Free
  42. Software Foundation raise funds for GNU development.''
  43. @end quotation
  44. @end copying
  45. @titlepage
  46. @title The Org Manual
  47. @subtitle Release @value{VERSION}
  48. @author by Carsten Dominik
  49. @c The following two commands start the copyright page.
  50. @page
  51. @vskip 0pt plus 1filll
  52. @insertcopying
  53. @end titlepage
  54. @c Output the table of contents at the beginning.
  55. @contents
  56. @ifnottex
  57. @node Top, Introduction, (dir), (dir)
  58. @top Org Mode Manual
  59. @insertcopying
  60. @end ifnottex
  61. @menu
  62. * Introduction:: Getting started
  63. * Document Structure:: A tree works like your brain
  64. * Tables:: Pure magic for quick formatting
  65. * Hyperlinks:: Notes in context
  66. * TODO Items:: Every tree branch can be a TODO item
  67. * Tags:: Tagging headlines and matching sets of tags
  68. * Properties and Columns:: Storing information about an entry
  69. * Dates and Times:: Making items useful for planning
  70. * Remember:: Quickly adding nodes to the outline tree
  71. * Agenda Views:: Collecting information into views
  72. * Embedded LaTeX:: LaTeX fragments and formulas
  73. * Exporting:: Sharing and publishing of notes
  74. * Publishing:: Create a web site of linked Org files
  75. * Miscellaneous:: All the rest which did not fit elsewhere
  76. * Extensions and Hacking:: It is possible to write add-on code
  77. * History and Acknowledgments:: How Org came into being
  78. * Main Index:: An index of Org's concepts and features
  79. * Key Index:: Key bindings and where they are described
  80. @detailmenu
  81. --- The Detailed Node Listing ---
  82. Introduction
  83. * Summary:: Brief summary of what Org does
  84. * Installation:: How to install a downloaded version of Org
  85. * Activation:: How to activate Org for certain buffers
  86. * Feedback:: Bug reports, ideas, patches etc.
  87. * Conventions:: Type-setting conventions in the manual
  88. Document Structure
  89. * Outlines:: Org is based on Outline mode
  90. * Headlines:: How to typeset Org tree headlines
  91. * Visibility cycling:: Show and hide, much simplified
  92. * Motion:: Jumping to other headlines
  93. * Structure editing:: Changing sequence and level of headlines
  94. * Archiving:: Move done task trees to a different place
  95. * Sparse trees:: Matches embedded in context
  96. * Plain lists:: Additional structure within an entry
  97. * Drawers:: Tucking stuff away
  98. * Orgstruct mode:: Structure editing outside Org
  99. Archiving
  100. * ARCHIVE tag:: Marking a tree as inactive
  101. * Moving subtrees:: Moving a tree to an archive file
  102. Tables
  103. * Built-in table editor:: Simple tables
  104. * Narrow columns:: Stop wasting space in tables
  105. * Column groups:: Grouping to trigger vertical lines
  106. * Orgtbl mode:: The table editor as minor mode
  107. * The spreadsheet:: The table editor has spreadsheet capabilities
  108. The spreadsheet
  109. * References:: How to refer to another field or range
  110. * Formula syntax for Calc:: Using Calc to compute stuff
  111. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
  112. * Field formulas:: Formulas valid for a single field
  113. * Column formulas:: Formulas valid for an entire column
  114. * Editing and debugging formulas:: Fixing formulas
  115. * Updating the table:: Recomputing all dependent fields
  116. * Advanced features:: Field names, parameters and automatic recalc
  117. Hyperlinks
  118. * Link format:: How links in Org are formatted
  119. * Internal links:: Links to other places in the current file
  120. * External links:: URL-like links to the world
  121. * Handling links:: Creating, inserting and following
  122. * Using links outside Org:: Linking from my C source code?
  123. * Link abbreviations:: Shortcuts for writing complex links
  124. * Search options:: Linking to a specific location
  125. * Custom searches:: When the default search is not enough
  126. Internal links
  127. * Radio targets:: Make targets trigger links in plain text
  128. TODO Items
  129. * TODO basics:: Marking and displaying TODO entries
  130. * TODO extensions:: Workflow and assignments
  131. * Progress logging:: Dates and notes for progress
  132. * Priorities:: Some things are more important than others
  133. * Breaking down tasks:: Splitting a task into manageable pieces
  134. * Checkboxes:: Tick-off lists
  135. Extended use of TODO keywords
  136. * Workflow states:: From TODO to DONE in steps
  137. * TODO types:: I do this, Fred does the rest
  138. * Multiple sets in one file:: Mixing it all, and still finding your way
  139. * Fast access to TODO states:: Single letter selection of a state
  140. * Per-file keywords:: Different files, different requirements
  141. * Faces for TODO keywords:: Highlighting states
  142. Progress logging
  143. * Closing items:: When was this entry marked DONE?
  144. * Tracking TODO state changes:: When did the status change?
  145. Tags
  146. * Tag inheritance:: Tags use the tree structure of the outline
  147. * Setting tags:: How to assign tags to a headline
  148. * Tag searches:: Searching for combinations of tags
  149. Properties and Columns
  150. * Property syntax:: How properties are spelled out
  151. * Special properties:: Access to other Org mode features
  152. * Property searches:: Matching property values
  153. * Property inheritance:: Passing values down the tree
  154. * Column view:: Tabular viewing and editing
  155. * Property API:: Properties for Lisp programmers
  156. Column view
  157. * Defining columns:: The COLUMNS format property
  158. * Using column view:: How to create and use column view
  159. * Capturing column view:: A dynamic block for column view
  160. Defining columns
  161. * Scope of column definitions:: Where defined, where valid?
  162. * Column attributes:: Appearance and content of a column
  163. Dates and Times
  164. * Timestamps:: Assigning a time to a tree entry
  165. * Creating timestamps:: Commands which insert timestamps
  166. * Deadlines and scheduling:: Planning your work
  167. * Clocking work time:: Tracking how long you spend on a task
  168. Creating timestamps
  169. * The date/time prompt:: How Org mode helps you entering date and time
  170. * Custom time format:: Making dates look different
  171. Deadlines and scheduling
  172. * Inserting deadline/schedule:: Planning items
  173. * Repeated tasks:: Items that show up again and again
  174. Remember
  175. * Setting up Remember:: Some code for .emacs to get things going
  176. * Remember templates:: Define the outline of different note types
  177. * Storing notes:: Directly get the note to where it belongs
  178. * Refiling notes:: Moving a note or task to a project
  179. Agenda Views
  180. * Agenda files:: Files being searched for agenda information
  181. * Agenda dispatcher:: Keyboard access to agenda views
  182. * Built-in agenda views:: What is available out of the box?
  183. * Presentation and sorting:: How agenda items are prepared for display
  184. * Agenda commands:: Remote editing of Org trees
  185. * Custom agenda views:: Defining special searches and views
  186. The built-in agenda views
  187. * Weekly/daily agenda:: The calendar page with current tasks
  188. * Global TODO list:: All unfinished action items
  189. * Matching tags and properties:: Structured information with fine-tuned search
  190. * Timeline:: Time-sorted view for single file
  191. * Keyword search:: Finding entries by keyword
  192. * Stuck projects:: Find projects you need to review
  193. Presentation and sorting
  194. * Categories:: Not all tasks are equal
  195. * Time-of-day specifications:: How the agenda knows the time
  196. * Sorting of agenda items:: The order of things
  197. Custom agenda views
  198. * Storing searches:: Type once, use often
  199. * Block agenda:: All the stuff you need in a single buffer
  200. * Setting Options:: Changing the rules
  201. * Exporting Agenda Views:: Writing agendas to files
  202. * Using the agenda elsewhere:: Using agenda information in other programs
  203. Embedded LaTeX
  204. * Math symbols:: TeX macros for symbols and Greek letters
  205. * Subscripts and superscripts:: Simple syntax for raising/lowering text
  206. * LaTeX fragments:: Complex formulas made easy
  207. * Processing LaTeX fragments:: Previewing LaTeX processing
  208. * CDLaTeX mode:: Speed up entering of formulas
  209. Exporting
  210. * ASCII export:: Exporting to plain ASCII
  211. * HTML export:: Exporting to HTML
  212. * LaTeX export:: Exporting to LaTeX
  213. * XOXO export:: Exporting to XOXO
  214. * iCalendar export:: Exporting in iCalendar format
  215. * Text interpretation:: How the exporter looks at the file
  216. HTML export
  217. * HTML Export commands:: How to invoke LaTeX export
  218. * Quoting HTML tags:: Using direct HTML in Org mode
  219. * Links:: Transformation of links for HTML
  220. * Images:: How to include images
  221. * CSS support:: Changing the appearance of the output
  222. * Javascript support:: Info and Folding in a web browser
  223. LaTeX export
  224. * LaTeX export commands:: How to invoke LaTeX export
  225. * Quoting LaTeX code:: Incorporating literal LaTeX code
  226. * Sectioning structure:: Changing sectioning in LaTeX output
  227. Text interpretation by the exporter
  228. * Comment lines:: Some lines will not be exported
  229. * Initial text:: Text before the first headline
  230. * Footnotes:: Numbers like [1]
  231. * Quoted examples:: Inserting quoted chunks of text
  232. * Enhancing text:: Subscripts, symbols and more
  233. * Export options:: How to influence the export settings
  234. Publishing
  235. * Configuration:: Defining projects
  236. * Sample configuration:: Example projects
  237. * Triggering publication:: Publication commands
  238. Configuration
  239. * Project alist:: The central configuration variable
  240. * Sources and destinations:: From here to there
  241. * Selecting files:: What files are part of the project?
  242. * Publishing action:: Setting the function doing the publishing
  243. * Publishing options:: Tweaking HTML export
  244. * Publishing links:: Which links keep working after publishing?
  245. * Project page index:: Publishing a list of project files
  246. Sample configuration
  247. * Simple example:: One-component publishing
  248. * Complex example:: A multi-component publishing example
  249. Miscellaneous
  250. * Completion:: M-TAB knows what you need
  251. * Customization:: Adapting Org to your taste
  252. * In-buffer settings:: Overview of the #+KEYWORDS
  253. * The very busy C-c C-c key:: When in doubt, press C-c C-c
  254. * Clean view:: Getting rid of leading stars in the outline
  255. * TTY keys:: Using Org on a tty
  256. * Interaction:: Other Emacs packages
  257. * Bugs:: Things which do not work perfectly
  258. Interaction with other packages
  259. * Cooperation:: Packages Org cooperates with
  260. * Conflicts:: Packages that lead to conflicts
  261. Extensions, Hooks and Hacking
  262. * Extensions:: Existing 3rd-party extensions
  263. * Adding hyperlink types:: New custom link types
  264. * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
  265. * Dynamic blocks:: Automatically filled blocks
  266. * Special agenda views:: Customized views
  267. * Using the property API:: Writing programs that use entry properties
  268. Tables and lists in arbitrary syntax
  269. * Radio tables:: Sending and receiving
  270. * A LaTeX example:: Step by step, almost a tutorial
  271. * Translator functions:: Copy and modify
  272. * Radio lists:: Doing the same for lists
  273. @end detailmenu
  274. @end menu
  275. @node Introduction, Document Structure, Top, Top
  276. @chapter Introduction
  277. @cindex introduction
  278. @menu
  279. * Summary:: Brief summary of what Org does
  280. * Installation:: How to install a downloaded version of Org
  281. * Activation:: How to activate Org for certain buffers
  282. * Feedback:: Bug reports, ideas, patches etc.
  283. * Conventions:: Type-setting conventions in the manual
  284. @end menu
  285. @node Summary, Installation, Introduction, Introduction
  286. @section Summary
  287. @cindex summary
  288. Org is a mode for keeping notes, maintaining TODO lists, and doing
  289. project planning with a fast and effective plain-text system.
  290. Org develops organizational tasks around NOTES files that contain
  291. lists or information about projects as plain text. Org is
  292. implemented on top of Outline mode, which makes it possible to keep the
  293. content of large files well structured. Visibility cycling and
  294. structure editing help to work with the tree. Tables are easily created
  295. with a built-in table editor. Org supports TODO items, deadlines,
  296. time stamps, and scheduling. It dynamically compiles entries into an
  297. agenda that utilizes and smoothly integrates much of the Emacs calendar
  298. and diary. Plain text URL-like links connect to websites, emails,
  299. Usenet messages, BBDB entries, and any files related to the projects.
  300. For printing and sharing of notes, an Org file can be exported as a
  301. structured ASCII file, as HTML, or (TODO and agenda items only) as an
  302. iCalendar file. It can also serve as a publishing tool for a set of
  303. linked web pages.
  304. An important design aspect that distinguishes Org from for example
  305. Planner/Muse is that it encourages to store every piece of information
  306. only once. In Planner, you have project pages, day pages and possibly
  307. other files, duplicating some information such as tasks. In Org,
  308. you only have notes files. In your notes you mark entries as tasks,
  309. label them with tags and timestamps. All necessary lists like a
  310. schedule for the day, the agenda for a meeting, tasks lists selected by
  311. tags etc are created dynamically when you need them.
  312. Org keeps simple things simple. When first fired up, it should
  313. feel like a straightforward, easy to use outliner. Complexity is not
  314. imposed, but a large amount of functionality is available when you need
  315. it. Org is a toolbox and can be used in different ways, for
  316. example as:
  317. @example
  318. @r{@bullet{} outline extension with visibility cycling and structure editing}
  319. @r{@bullet{} ASCII system and table editor for taking structured notes}
  320. @r{@bullet{} ASCII table editor with spreadsheet-like capabilities}
  321. @r{@bullet{} TODO list editor}
  322. @r{@bullet{} full agenda and planner with deadlines and work scheduling}
  323. @r{@bullet{} environment to implement David Allen's GTD system}
  324. @r{@bullet{} a basic database application}
  325. @r{@bullet{} simple hypertext system, with HTML and LaTeX export}
  326. @r{@bullet{} publishing tool to create a set of interlinked webpages}
  327. @end example
  328. Org's automatic, context sensitive table editor with spreadsheet
  329. capabilities can be integrated into any major mode by activating the
  330. minor Orgtbl mode. Using a translation step, it can be used to maintain
  331. tables in arbitrary file types, for example in La@TeX{}. The structure
  332. editing and list creation capabilities can be used outside Org with
  333. the minor Orgstruct mode.
  334. @cindex FAQ
  335. There is a website for Org which provides links to the newest
  336. version of Org, as well as additional information, frequently asked
  337. questions (FAQ), links to tutorials etc. This page is located at
  338. @uref{http://orgmode.org}.
  339. @page
  340. @node Installation, Activation, Summary, Introduction
  341. @section Installation
  342. @cindex installation
  343. @cindex XEmacs
  344. @b{Important:} @i{If Org is part of the Emacs distribution or an
  345. XEmacs package, please skip this section and go directly to
  346. @ref{Activation}.}
  347. If you have downloaded Org from the Web, either as a distribution @file{.zip}
  348. or @file{.tar} file, or as a GIT archive, you must take the following steps
  349. to install it: Go into the unpacked Org distribution directory and edit the
  350. top section of the file @file{Makefile}. You must set the name of the Emacs
  351. binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
  352. directories where local Lisp and Info files are kept. If you don't have
  353. access to the system-wide directories, you can simply run Org directly from
  354. the distribution directory by adding the @file{lisp} subdirectory to the
  355. Emacs load path. To do this, add the following line to @file{.emacs}:
  356. @example
  357. (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
  358. @end example
  359. @noindent
  360. If you plan to use code from the @file{contrib} subdirectory, do a similar
  361. step for this directory:
  362. @example
  363. (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
  364. @end example
  365. @b{XEmacs users now need to install the file @file{noutline.el} from
  366. the @file{xemacs} sub-directory of the Org distribution. Use the
  367. command:}
  368. @example
  369. @b{make install-noutline}
  370. @end example
  371. @noindent Now byte-compile the Lisp files with the shell command:
  372. @example
  373. make
  374. @end example
  375. @noindent If you are running Org from the distribution directory, this is
  376. all. If you want to install into the system directories, use
  377. @example
  378. make install
  379. make install-info
  380. @end example
  381. @noindent Then add to @file{.emacs}:
  382. @lisp
  383. ;; This line only if Org is not part of the X/Emacs distribution.
  384. (require 'org-install)
  385. @end lisp
  386. @node Activation, Feedback, Installation, Introduction
  387. @section Activation
  388. @cindex activation
  389. @cindex autoload
  390. @cindex global key bindings
  391. @cindex key bindings, global
  392. @iftex
  393. @b{Important:} @i{If you use copy-and-paste to copy lisp code from the
  394. PDF documentation as viewed by Acrobat reader to your .emacs file, the
  395. single quote character comes out incorrectly and the code will not work.
  396. You need to fix the single quotes by hand, or copy from Info
  397. documentation.}
  398. @end iftex
  399. Add the following lines to your @file{.emacs} file. The last two lines
  400. define @emph{global} keys for the commands @command{org-store-link} and
  401. @command{org-agenda} - please choose suitable keys yourself.
  402. @lisp
  403. ;; The following lines are always needed. Choose your own keys.
  404. (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
  405. (global-set-key "\C-cl" 'org-store-link)
  406. (global-set-key "\C-ca" 'org-agenda)
  407. @end lisp
  408. Furthermore, you must activate @code{font-lock-mode} in Org
  409. buffers, because significant functionality depends on font-locking being
  410. active. You can do this with either one of the following two lines
  411. (XEmacs user must use the second option):
  412. @lisp
  413. (global-font-lock-mode 1) ; for all buffers
  414. (add-hook 'org-mode-hook 'turn-on-font-lock) ; Org buffers only
  415. @end lisp
  416. @cindex Org mode, turning on
  417. With this setup, all files with extension @samp{.org} will be put
  418. into Org mode. As an alternative, make the first line of a file look
  419. like this:
  420. @example
  421. MY PROJECTS -*- mode: org; -*-
  422. @end example
  423. @noindent which will select Org mode for this buffer no matter what
  424. the file's name is. See also the variable
  425. @code{org-insert-mode-line-in-empty-file}.
  426. @node Feedback, Conventions, Activation, Introduction
  427. @section Feedback
  428. @cindex feedback
  429. @cindex bug reports
  430. @cindex maintainer
  431. @cindex author
  432. If you find problems with Org, or if you have questions, remarks,
  433. or ideas about it, please contact the maintainer @value{MAINTAINER} at
  434. @value{MAINTAINEREMAIL}.
  435. For bug reports, please provide as much information as possible,
  436. including the version information of Emacs (@kbd{C-h v emacs-version
  437. @key{RET}}) and Org (@kbd{C-h v org-version @key{RET}}), as well as
  438. the Org related setup in @file{.emacs}. If an error occurs, a
  439. backtrace can be very useful (see below on how to create one). Often a
  440. small example file helps, along with clear information about:
  441. @enumerate
  442. @item What exactly did you do?
  443. @item What did you expect to happen?
  444. @item What happened instead?
  445. @end enumerate
  446. @noindent Thank you for helping to improve this mode.
  447. @subsubheading How to create a useful backtrace
  448. @cindex backtrace of an error
  449. If working with Org produces an error with a message you don't
  450. understand, you may have hit a bug. The best way to report this is by
  451. providing, in addition to what was mentioned above, a @emph{Backtrace}.
  452. This is information from the built-in debugger about where and how the
  453. error occurred. Here is how to produce a useful backtrace:
  454. @enumerate
  455. @item
  456. Start a fresh Emacs or XEmacs, and make sure that it will load the
  457. original Lisp code in @file{org.el} instead of the compiled version in
  458. @file{org.elc}. The backtrace contains much more information if it is
  459. produced with uncompiled code. To do this, either rename @file{org.elc}
  460. to something else before starting Emacs, or ask Emacs explicitly to load
  461. @file{org.el} by using the command line
  462. @example
  463. emacs -l /path/to/org.el
  464. @end example
  465. @item
  466. Go to the @code{Options} menu and select @code{Enter Debugger on Error}
  467. (XEmacs has this option in the @code{Troubleshooting} sub-menu).
  468. @item
  469. Do whatever you have to do to hit the error. Don't forget to
  470. document the steps you take.
  471. @item
  472. When you hit the error, a @file{*Backtrace*} buffer will appear on the
  473. screen. Save this buffer to a file (for example using @kbd{C-x C-w}) and
  474. attach it to your bug report.
  475. @end enumerate
  476. @node Conventions, , Feedback, Introduction
  477. @section Typesetting conventions used in this manual
  478. Org uses three types of keywords: TODO keywords, tags, and property
  479. names. In this manual we use the following conventions:
  480. @table @code
  481. @item TODO
  482. @itemx WAITING
  483. TODO keywords are written with all capitals, even if they are
  484. user-defined.
  485. @item boss
  486. @itemx ARCHIVE
  487. User-defined tags are written in lowercase; built-in tags with special
  488. meaning are written with all capitals.
  489. @item Release
  490. @itemx PRIORITY
  491. User-defined properties are capitalized; built-in properties with
  492. special meaning are written with all capitals.
  493. @end table
  494. @node Document Structure, Tables, Introduction, Top
  495. @chapter Document Structure
  496. @cindex document structure
  497. @cindex structure of document
  498. Org is based on outline mode and provides flexible commands to
  499. edit the structure of the document.
  500. @menu
  501. * Outlines:: Org is based on Outline mode
  502. * Headlines:: How to typeset Org tree headlines
  503. * Visibility cycling:: Show and hide, much simplified
  504. * Motion:: Jumping to other headlines
  505. * Structure editing:: Changing sequence and level of headlines
  506. * Archiving:: Move done task trees to a different place
  507. * Sparse trees:: Matches embedded in context
  508. * Plain lists:: Additional structure within an entry
  509. * Drawers:: Tucking stuff away
  510. * Orgstruct mode:: Structure editing outside Org
  511. @end menu
  512. @node Outlines, Headlines, Document Structure, Document Structure
  513. @section Outlines
  514. @cindex outlines
  515. @cindex Outline mode
  516. Org is implemented on top of Outline mode. Outlines allow a
  517. document to be organized in a hierarchical structure, which (at least
  518. for me) is the best representation of notes and thoughts. An overview
  519. of this structure is achieved by folding (hiding) large parts of the
  520. document to show only the general document structure and the parts
  521. currently being worked on. Org greatly simplifies the use of
  522. outlines by compressing the entire show/hide functionality into a single
  523. command @command{org-cycle}, which is bound to the @key{TAB} key.
  524. @node Headlines, Visibility cycling, Outlines, Document Structure
  525. @section Headlines
  526. @cindex headlines
  527. @cindex outline tree
  528. Headlines define the structure of an outline tree. The headlines in
  529. Org start with one or more stars, on the left margin@footnote{See
  530. the variable @code{org-special-ctrl-a/e} to configure special behavior
  531. of @kbd{C-a} and @kbd{C-e} in headlines.}. For example:
  532. @example
  533. * Top level headline
  534. ** Second level
  535. *** 3rd level
  536. some text
  537. *** 3rd level
  538. more text
  539. * Another top level headline
  540. @end example
  541. @noindent Some people find the many stars too noisy and would prefer an
  542. outline that has whitespace followed by a single star as headline
  543. starters. @ref{Clean view} describes a setup to realize this.
  544. An empty line after the end of a subtree is considered part of it and
  545. will be hidden when the subtree is folded. However, if you leave at
  546. least two empty lines, one empty line will remain visible after folding
  547. the subtree, in order to structure the collapsed view. See the
  548. variable @code{org-cycle-separator-lines} to modify this behavior.
  549. @node Visibility cycling, Motion, Headlines, Document Structure
  550. @section Visibility cycling
  551. @cindex cycling, visibility
  552. @cindex visibility cycling
  553. @cindex trees, visibility
  554. @cindex show hidden text
  555. @cindex hide text
  556. Outlines make it possible to hide parts of the text in the buffer.
  557. Org uses just two commands, bound to @key{TAB} and
  558. @kbd{S-@key{TAB}} to change the visibility in the buffer.
  559. @cindex subtree visibility states
  560. @cindex subtree cycling
  561. @cindex folded, subtree visibility state
  562. @cindex children, subtree visibility state
  563. @cindex subtree, subtree visibility state
  564. @table @kbd
  565. @kindex @key{TAB}
  566. @item @key{TAB}
  567. @emph{Subtree cycling}: Rotate current subtree among the states
  568. @example
  569. ,-> FOLDED -> CHILDREN -> SUBTREE --.
  570. '-----------------------------------'
  571. @end example
  572. The cursor must be on a headline for this to work@footnote{see, however,
  573. the option @code{org-cycle-emulate-tab}.}. When the cursor is at the
  574. beginning of the buffer and the first line is not a headline, then
  575. @key{TAB} actually runs global cycling (see below)@footnote{see the
  576. option @code{org-cycle-global-at-bob}.}. Also when called with a prefix
  577. argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
  578. @cindex global visibility states
  579. @cindex global cycling
  580. @cindex overview, global visibility state
  581. @cindex contents, global visibility state
  582. @cindex show all, global visibility state
  583. @kindex S-@key{TAB}
  584. @item S-@key{TAB}
  585. @itemx C-u @key{TAB}
  586. @emph{Global cycling}: Rotate the entire buffer among the states
  587. @example
  588. ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
  589. '--------------------------------------'
  590. @end example
  591. When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
  592. CONTENTS view up to headlines of level N will be shown. Note that inside
  593. tables, @kbd{S-@key{TAB}} jumps to the previous field.
  594. @cindex show all, command
  595. @kindex C-c C-a
  596. @item C-c C-a
  597. Show all.
  598. @kindex C-c C-r
  599. @item C-c C-r
  600. Reveal context around point, showing the current entry, the following heading
  601. and the hierarchy above. Useful for working near a location that has been
  602. exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
  603. (@pxref{Agenda commands}). With a prefix argument show, on each
  604. level, all sibling headings.
  605. @kindex C-c C-x b
  606. @item C-c C-x b
  607. Show the current subtree in an indirect buffer@footnote{The indirect
  608. buffer
  609. @ifinfo
  610. (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
  611. @end ifinfo
  612. @ifnotinfo
  613. (see the Emacs manual for more information about indirect buffers)
  614. @end ifnotinfo
  615. will contain the entire buffer, but will be narrowed to the current
  616. tree. Editing the indirect buffer will also change the original buffer,
  617. but without affecting visibility in that buffer.}. With a numeric
  618. prefix argument N, go up to level N and then take that tree. If N is
  619. negative then go up that many levels. With a @kbd{C-u} prefix, do not remove
  620. the previously used indirect buffer.
  621. @end table
  622. When Emacs first visits an Org file, the global state is set to
  623. OVERVIEW, i.e. only the top level headlines are visible. This can be
  624. configured through the variable @code{org-startup-folded}, or on a
  625. per-file basis by adding one of the following lines anywhere in the
  626. buffer:
  627. @example
  628. #+STARTUP: overview
  629. #+STARTUP: content
  630. #+STARTUP: showall
  631. @end example
  632. @node Motion, Structure editing, Visibility cycling, Document Structure
  633. @section Motion
  634. @cindex motion, between headlines
  635. @cindex jumping, to headlines
  636. @cindex headline navigation
  637. The following commands jump to other headlines in the buffer.
  638. @table @kbd
  639. @kindex C-c C-n
  640. @item C-c C-n
  641. Next heading.
  642. @kindex C-c C-p
  643. @item C-c C-p
  644. Previous heading.
  645. @kindex C-c C-f
  646. @item C-c C-f
  647. Next heading same level.
  648. @kindex C-c C-b
  649. @item C-c C-b
  650. Previous heading same level.
  651. @kindex C-c C-u
  652. @item C-c C-u
  653. Backward to higher level heading.
  654. @kindex C-c C-j
  655. @item C-c C-j
  656. Jump to a different place without changing the current outline
  657. visibility. Shows the document structure in a temporary buffer, where
  658. you can use the following keys to find your destination:
  659. @example
  660. @key{TAB} @r{Cycle visibility.}
  661. @key{down} / @key{up} @r{Next/previous visible headline.}
  662. n / p @r{Next/previous visible headline.}
  663. f / b @r{Next/previous headline same level.}
  664. u @r{One level up.}
  665. 0-9 @r{Digit argument.}
  666. @key{RET} @r{Select this location.}
  667. @end example
  668. @end table
  669. @node Structure editing, Archiving, Motion, Document Structure
  670. @section Structure editing
  671. @cindex structure editing
  672. @cindex headline, promotion and demotion
  673. @cindex promotion, of subtrees
  674. @cindex demotion, of subtrees
  675. @cindex subtree, cut and paste
  676. @cindex pasting, of subtrees
  677. @cindex cutting, of subtrees
  678. @cindex copying, of subtrees
  679. @cindex subtrees, cut and paste
  680. @table @kbd
  681. @kindex M-@key{RET}
  682. @item M-@key{RET}
  683. Insert new heading with same level as current. If the cursor is in a
  684. plain list item, a new item is created (@pxref{Plain lists}). To force
  685. creation of a new headline, use a prefix argument, or first press @key{RET}
  686. to get to the beginning of the next line. When this command is used in
  687. the middle of a line, the line is split and the rest of the line becomes
  688. the new headline@footnote{If you do not want the line to be split,
  689. customize the variable @code{org-M-RET-may-split-line}.}. If the
  690. command is used at the beginning of a headline, the new headline is
  691. created before the current line. If at the beginning of any other line,
  692. the content of that line is made the new heading. If the command is
  693. used at the end of a folded subtree (i.e. behind the ellipses at the end
  694. of a headline), then a headline like the current one will be inserted
  695. after the end of the subtree.
  696. @kindex C-@key{RET}
  697. @item C-@key{RET}
  698. Insert a new heading after the current subtree, same level as the
  699. current headline. This command works from anywhere in the entry.
  700. @kindex M-S-@key{RET}
  701. @item M-S-@key{RET}
  702. Insert new TODO entry with same level as current heading.
  703. @kindex M-@key{left}
  704. @item M-@key{left}
  705. Promote current heading by one level.
  706. @kindex M-@key{right}
  707. @item M-@key{right}
  708. Demote current heading by one level.
  709. @kindex M-S-@key{left}
  710. @item M-S-@key{left}
  711. Promote the current subtree by one level.
  712. @kindex M-S-@key{right}
  713. @item M-S-@key{right}
  714. Demote the current subtree by one level.
  715. @kindex M-S-@key{up}
  716. @item M-S-@key{up}
  717. Move subtree up (swap with previous subtree of same
  718. level).
  719. @kindex M-S-@key{down}
  720. @item M-S-@key{down}
  721. Move subtree down (swap with next subtree of same level).
  722. @kindex C-c C-x C-w
  723. @kindex C-c C-x C-k
  724. @item C-c C-x C-w
  725. @itemx C-c C-x C-k
  726. Kill subtree, i.e. remove it from buffer but save in kill ring.
  727. With a numeric prefix argument N, kill N sequential subtrees.
  728. @kindex C-c C-x M-w
  729. @item C-c C-x M-w
  730. Copy subtree to kill ring. With a numeric prefix argument N, copy the N
  731. sequential subtrees.
  732. @kindex C-c C-x C-y
  733. @item C-c C-x C-y
  734. Yank subtree from kill ring. This does modify the level of the subtree to
  735. make sure the tree fits in nicely at the yank position. The yank level can
  736. also be specified with a numeric prefix argument, or by yanking after a
  737. headline marker like @samp{****}.
  738. @kindex C-c C-w
  739. @item C-c C-w
  740. Refile entry to a different location. @xref{Refiling notes}.
  741. @kindex C-c ^
  742. @item C-c ^
  743. Sort same-level entries. When there is an active region, all entries in the
  744. region will be sorted. Otherwise the children of the current headline are
  745. sorted. The command prompts for the sorting method, which can be
  746. alphabetically, numerically, by time (using the first time stamp in each
  747. entry), by priority, or by TODO keyword (in the sequence the keywords have
  748. been defined in the setup). Reverse sorting is possible as well. You can
  749. also supply your own function to extract the sorting key. With a @kbd{C-u}
  750. prefix, sorting will be case-sensitive. With two @kbd{C-u C-u} prefixes,
  751. duplicate entries will also be removed.
  752. @kindex C-c *
  753. @item C-c *
  754. Turn a normal line or plain list item into a headline (so that it
  755. becomes a subheading at its location). Also turn a headline into a
  756. normal line by removing the stars. If there is an active region, turn
  757. all lines in the region into headlines. Or, if the first line is a
  758. headline, remove the stars from all headlines in the region.
  759. @end table
  760. @cindex region, active
  761. @cindex active region
  762. @cindex Transient mark mode
  763. When there is an active region (Transient mark mode), promotion and
  764. demotion work on all headlines in the region. To select a region of
  765. headlines, it is best to place both point and mark at the beginning of a
  766. line, mark at the beginning of the first headline, and point at the line
  767. just after the last headline to change. Note that when the cursor is
  768. inside a table (@pxref{Tables}), the Meta-Cursor keys have different
  769. functionality.
  770. @node Archiving, Sparse trees, Structure editing, Document Structure
  771. @section Archiving
  772. @cindex archiving
  773. When a project represented by a (sub)tree is finished, you may want
  774. to move the tree out of the way and to stop it from contributing to the
  775. agenda. Org mode knows two ways of archiving. You can mark a tree with
  776. the ARCHIVE tag, or you can move an entire (sub)tree to a different
  777. location.
  778. @menu
  779. * ARCHIVE tag:: Marking a tree as inactive
  780. * Moving subtrees:: Moving a tree to an archive file
  781. @end menu
  782. @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
  783. @subsection The ARCHIVE tag
  784. @cindex internal archiving
  785. A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
  786. its location in the outline tree, but behaves in the following way:
  787. @itemize @minus
  788. @item
  789. It does not open when you attempt to do so with a visibility cycling
  790. command (@pxref{Visibility cycling}). You can force cycling archived
  791. subtrees with @kbd{C-@key{TAB}}, or by setting the option
  792. @code{org-cycle-open-archived-trees}. Also normal outline commands like
  793. @code{show-all} will open archived subtrees.
  794. @item
  795. During sparse tree construction (@pxref{Sparse trees}), matches in
  796. archived subtrees are not exposed, unless you configure the option
  797. @code{org-sparse-tree-open-archived-trees}.
  798. @item
  799. During agenda view construction (@pxref{Agenda Views}), the content of
  800. archived trees is ignored unless you configure the option
  801. @code{org-agenda-skip-archived-trees}.
  802. @item
  803. Archived trees are not exported (@pxref{Exporting}), only the headline
  804. is. Configure the details using the variable
  805. @code{org-export-with-archived-trees}.
  806. @end itemize
  807. The following commands help managing the ARCHIVE tag:
  808. @table @kbd
  809. @kindex C-c C-x a
  810. @item C-c C-x a
  811. Toggle the ARCHIVE tag for the current headline. When the tag is set,
  812. the headline changes to a shadowed face, and the subtree below it is
  813. hidden.
  814. @kindex C-u C-c C-x a
  815. @item C-u C-c C-x a
  816. Check if any direct children of the current headline should be archived.
  817. To do this, each subtree is checked for open TODO entries. If none are
  818. found, the command offers to set the ARCHIVE tag for the child. If the
  819. cursor is @emph{not} on a headline when this command is invoked, the
  820. level 1 trees will be checked.
  821. @kindex C-@kbd{TAB}
  822. @item C-@kbd{TAB}
  823. Cycle a tree even if it is tagged with ARCHIVE.
  824. @end table
  825. @node Moving subtrees, , ARCHIVE tag, Archiving
  826. @subsection Moving subtrees
  827. @cindex external archiving
  828. Once an entire project is finished, you may want to move it to a different
  829. location. Org can move it to an @emph{Attic Sibling} in the same tree, to a
  830. different tree in the current file, or to a different file, the archive file.
  831. @table @kbd
  832. @kindex C-c C-x A
  833. @item C-c C-x A
  834. Move the curent entry to the @emph{Attic Sibling}. This is a sibling of the
  835. entry with the heading @samp{Attic} and the tag @samp{ARCHIVE}
  836. (@pxref{ARCHIVE tag}). The entry becomes a child of that sibling and in this
  837. way retains a lot of its original context, including inherited tags and
  838. approximate position in the outline.
  839. @kindex C-c C-x C-s
  840. @item C-c C-x C-s
  841. Archive the subtree starting at the cursor position to the location
  842. given by @code{org-archive-location}. Context information that could be
  843. lost like the file name, the category, inherited tags, and the TODO
  844. state will be store as properties in the entry.
  845. @kindex C-u C-c C-x C-s
  846. @item C-u C-c C-x C-s
  847. Check if any direct children of the current headline could be moved to
  848. the archive. To do this, each subtree is checked for open TODO entries.
  849. If none are found, the command offers to move it to the archive
  850. location. If the cursor is @emph{not} on a headline when this command
  851. is invoked, the level 1 trees will be checked.
  852. @end table
  853. @cindex archive locations
  854. The default archive location is a file in the same directory as the
  855. current file, with the name derived by appending @file{_archive} to the
  856. current file name. For information and examples on how to change this,
  857. see the documentation string of the variable
  858. @code{org-archive-location}. There is also an in-buffer option for
  859. setting this variable, for example@footnote{For backward compatibility,
  860. the following also works: If there are several such lines in a file,
  861. each specifies the archive location for the text below it. The first
  862. such line also applies to any text before its definition. However,
  863. using this method is @emph{strongly} deprecated as it is incompatible
  864. with the outline structure of the document. The correct method for
  865. setting multiple archive locations in a buffer is using a property.}:
  866. @example
  867. #+ARCHIVE: %s_done::
  868. @end example
  869. @noindent
  870. If you would like to have a special ARCHIVE location for a single entry
  871. or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
  872. location as the value (@pxref{Properties and Columns}).
  873. When a subtree is moved, it receives a number of special properties that
  874. record context information like the file from where the entry came, it's
  875. outline path the archiving time etc. Configure the variable
  876. @code{org-archive-save-context-info} to adjust the amount of information
  877. added.
  878. @node Sparse trees, Plain lists, Archiving, Document Structure
  879. @section Sparse trees
  880. @cindex sparse trees
  881. @cindex trees, sparse
  882. @cindex folding, sparse trees
  883. @cindex occur, command
  884. An important feature of Org mode is the ability to construct
  885. @emph{sparse trees} for selected information in an outline tree, so that
  886. the entire document is folded as much as possible, but the selected
  887. information is made visible along with the headline structure above
  888. it@footnote{See also the variables @code{org-show-hierarchy-above},
  889. @code{org-show-following-heading}, and @code{org-show-siblings} for
  890. detailed control on how much context is shown around each match.}. Just
  891. try it out and you will see immediately how it works.
  892. Org mode contains several commands creating such trees, all these
  893. commands can be accessed through a dispatcher:
  894. @table @kbd
  895. @kindex C-c /
  896. @item C-c /
  897. This prompts for an extra key to select a sparse-tree creating command.
  898. @kindex C-c / r
  899. @item C-c / r
  900. Occur. Prompts for a regexp and shows a sparse tree with all matches.
  901. If the match is in a headline, the headline is made visible. If the
  902. match is in the body of an entry, headline and body are made visible.
  903. In order to provide minimal context, also the full hierarchy of
  904. headlines above the match is shown, as well as the headline following
  905. the match. Each match is also highlighted; the highlights disappear
  906. when the buffer is changed by an editing command, or by pressing
  907. @kbd{C-c C-c}. When called with a @kbd{C-u} prefix argument, previous
  908. highlights are kept, so several calls to this command can be stacked.
  909. @end table
  910. @noindent
  911. For frequently used sparse trees of specific search strings, you can
  912. use the variable @code{org-agenda-custom-commands} to define fast
  913. keyboard access to specific sparse trees. These commands will then be
  914. accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
  915. For example:
  916. @lisp
  917. (setq org-agenda-custom-commands
  918. '(("f" occur-tree "FIXME")))
  919. @end lisp
  920. @noindent will define the key @kbd{C-c a f} as a shortcut for creating
  921. a sparse tree matching the string @samp{FIXME}.
  922. The other sparse tree commands select headings based on TODO keywords,
  923. tags, or properties and will be discussed later in this manual.
  924. @kindex C-c C-e v
  925. @cindex printing sparse trees
  926. @cindex visible text, printing
  927. To print a sparse tree, you can use the Emacs command
  928. @code{ps-print-buffer-with-faces} which does not print invisible parts
  929. of the document @footnote{This does not work under XEmacs, because
  930. XEmacs uses selective display for outlining, not text properties.}.
  931. Or you can use the command @kbd{C-c C-e v} to export only the visible
  932. part of the document and print the resulting file.
  933. @node Plain lists, Drawers, Sparse trees, Document Structure
  934. @section Plain lists
  935. @cindex plain lists
  936. @cindex lists, plain
  937. @cindex lists, ordered
  938. @cindex ordered lists
  939. Within an entry of the outline tree, hand-formatted lists can provide
  940. additional structure. They also provide a way to create lists of
  941. checkboxes (@pxref{Checkboxes}). Org supports editing such lists,
  942. and the HTML exporter (@pxref{Exporting}) parses and formats them.
  943. Org knows ordered and unordered lists. Unordered list items start
  944. with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
  945. bullet, lines must be indented or they will be seen as top-level
  946. headlines. Also, when you are hiding leading stars to get a clean
  947. outline view, plain list items starting with a star are visually
  948. indistinguishable from true headlines. In short: even though @samp{*}
  949. is supported, it may be better to not use it for plain list items.} as
  950. bullets. Ordered list items start with a numeral followed by either a
  951. period or a right parenthesis, such as @samp{1.} or @samp{1)}. Items
  952. belonging to the same list must have the same indentation on the first
  953. line. In particular, if an ordered list reaches number @samp{10.}, then
  954. the 2--digit numbers must be written left-aligned with the other numbers
  955. in the list. Indentation also determines the end of a list item. It
  956. ends before the next line that is indented like the bullet/number, or
  957. less. Empty lines are part of the previous item, so you can have
  958. several paragraphs in one item. If you would like an empty line to
  959. terminate all currently open plain lists, configure the variable
  960. @code{org-empty-line-terminates-plain-lists}. Here is an example:
  961. @example
  962. @group
  963. ** Lord of the Rings
  964. My favorite scenes are (in this order)
  965. 1. The attack of the Rohirrim
  966. 2. Eowyns fight with the witch king
  967. + this was already my favorite scene in the book
  968. + I really like Miranda Otto.
  969. 3. Peter Jackson being shot by Legolas
  970. - on DVD only
  971. He makes a really funny face when it happens.
  972. But in the end, not individual scenes matter but the film as a whole.
  973. @end group
  974. @end example
  975. Org supports these lists by tuning filling and wrapping commands to
  976. deal with them correctly@footnote{Org only changes the filling
  977. settings for Emacs. For XEmacs, you should use Kyle E. Jones'
  978. @file{filladapt.el}. To turn this on, put into @file{.emacs}:
  979. @code{(require 'filladapt)}}.
  980. The following commands act on items when the cursor is in the first line
  981. of an item (the line with the bullet or number).
  982. @table @kbd
  983. @kindex @key{TAB}
  984. @item @key{TAB}
  985. Items can be folded just like headline levels if you set the variable
  986. @code{org-cycle-include-plain-lists}. The level of an item is then
  987. given by the indentation of the bullet/number. Items are always
  988. subordinate to real headlines, however; the hierarchies remain
  989. completely separated.
  990. If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
  991. fixes the indentation of the current line in a heuristic way.
  992. @kindex M-@key{RET}
  993. @item M-@key{RET}
  994. Insert new item at current level. With a prefix argument, force a new
  995. heading (@pxref{Structure editing}). If this command is used in the middle
  996. of a line, the line is @emph{split} and the rest of the line becomes the new
  997. item@footnote{If you do not want the line to be split, customize the variable
  998. @code{org-M-RET-may-split-line}.}. If this command is executed in the
  999. @emph{whitespace before a bullet or number}, the new item is created
  1000. @emph{before} the current item. If the command is executed in the white
  1001. space before the text that is part of an item but does not contain the
  1002. bullet, a bullet is added to the current line.
  1003. @kindex M-S-@key{RET}
  1004. @item M-S-@key{RET}
  1005. Insert a new item with a checkbox (@pxref{Checkboxes}).
  1006. @kindex S-@key{up}
  1007. @kindex S-@key{down}
  1008. @item S-@key{up}
  1009. @itemx S-@key{down}
  1010. Jump to the previous/next item in the current list.
  1011. @kindex M-S-@key{up}
  1012. @kindex M-S-@key{down}
  1013. @item M-S-@key{up}
  1014. @itemx M-S-@key{down}
  1015. Move the item including subitems up/down (swap with previous/next item
  1016. of same indentation). If the list is ordered, renumbering is
  1017. automatic.
  1018. @kindex M-S-@key{left}
  1019. @kindex M-S-@key{right}
  1020. @item M-S-@key{left}
  1021. @itemx M-S-@key{right}
  1022. Decrease/increase the indentation of the item, including subitems.
  1023. Initially, the item tree is selected based on current indentation.
  1024. When these commands are executed several times in direct succession,
  1025. the initially selected region is used, even if the new indentation
  1026. would imply a different hierarchy. To use the new hierarchy, break
  1027. the command chain with a cursor motion or so.
  1028. @kindex C-c C-c
  1029. @item C-c C-c
  1030. If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
  1031. state of the checkbox. If not, this command makes sure that all the
  1032. items on this list level use the same bullet. Furthermore, if this is
  1033. an ordered list, make sure the numbering is OK.
  1034. @kindex C-c -
  1035. @item C-c -
  1036. Cycle the entire list level through the different itemize/enumerate bullets
  1037. (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}). With a numeric prefix
  1038. argument N, select the Nth bullet from this list. If there is an active
  1039. region when calling this, all lines will be converted to list items. If the
  1040. first line already was a list item, any item markers will be removed from the
  1041. list. Finally, even without an active region, a normal line will be
  1042. converted into a list item.
  1043. @end table
  1044. @node Drawers, Orgstruct mode, Plain lists, Document Structure
  1045. @section Drawers
  1046. @cindex drawers
  1047. @cindex visibility cycling, drawers
  1048. Sometimes you want to keep information associated with an entry, but you
  1049. normally don't want to see it. For this, Org mode has @emph{drawers}.
  1050. Drawers need to be configured with the variable
  1051. @code{org-drawers}@footnote{You can define drawers on a per-file basis
  1052. with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}. Drawers
  1053. look like this:
  1054. @example
  1055. ** This is a headline
  1056. Still outside the drawer
  1057. :DRAWERNAME:
  1058. This is inside the drawer.
  1059. :END:
  1060. After the drawer.
  1061. @end example
  1062. Visibility cycling (@pxref{Visibility cycling}) on the headline will
  1063. hide and show the entry, but keep the drawer collapsed to a single line.
  1064. In order to look inside the drawer, you need to move the cursor to the
  1065. drawer line and press @key{TAB} there. Org mode uses a drawer for
  1066. storing properties (@pxref{Properties and Columns}).
  1067. @node Orgstruct mode, , Drawers, Document Structure
  1068. @section The Orgstruct minor mode
  1069. @cindex Orgstruct mode
  1070. @cindex minor mode for structure editing
  1071. If you like the intuitive way the Org mode structure editing and list
  1072. formatting works, you might want to use these commands in other modes
  1073. like Text mode or Mail mode as well. The minor mode Orgstruct mode
  1074. makes this possible. You can always toggle the mode with @kbd{M-x
  1075. orgstruct-mode}. To turn it on by default, for example in Mail mode,
  1076. use
  1077. @lisp
  1078. (add-hook 'mail-mode-hook 'turn-on-orgstruct)
  1079. @end lisp
  1080. When this mode is active and the cursor is on a line that looks to
  1081. Org like a headline of the first line of a list item, most
  1082. structure editing commands will work, even if the same keys normally
  1083. have different functionality in the major mode you are using. If the
  1084. cursor is not in one of those special lines, Orgstruct mode lurks
  1085. silently in the shadow.
  1086. @node Tables, Hyperlinks, Document Structure, Top
  1087. @chapter Tables
  1088. @cindex tables
  1089. @cindex editing tables
  1090. Org comes with a fast and intuitive table editor. Spreadsheet-like
  1091. calculations are supported in connection with the Emacs @file{calc}
  1092. package
  1093. @ifinfo
  1094. (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
  1095. @end ifinfo
  1096. @ifnotinfo
  1097. (see the Emacs Calculator manual for more information about the Emacs
  1098. calculator).
  1099. @end ifnotinfo
  1100. @menu
  1101. * Built-in table editor:: Simple tables
  1102. * Narrow columns:: Stop wasting space in tables
  1103. * Column groups:: Grouping to trigger vertical lines
  1104. * Orgtbl mode:: The table editor as minor mode
  1105. * The spreadsheet:: The table editor has spreadsheet capabilities
  1106. @end menu
  1107. @node Built-in table editor, Narrow columns, Tables, Tables
  1108. @section The built-in table editor
  1109. @cindex table editor, built-in
  1110. Org makes it easy to format tables in plain ASCII. Any line with
  1111. @samp{|} as the first non-whitespace character is considered part of a
  1112. table. @samp{|} is also the column separator. A table might look like
  1113. this:
  1114. @example
  1115. | Name | Phone | Age |
  1116. |-------+-------+-----|
  1117. | Peter | 1234 | 17 |
  1118. | Anna | 4321 | 25 |
  1119. @end example
  1120. A table is re-aligned automatically each time you press @key{TAB} or
  1121. @key{RET} or @kbd{C-c C-c} inside the table. @key{TAB} also moves to
  1122. the next field (@key{RET} to the next row) and creates new table rows
  1123. at the end of the table or before horizontal lines. The indentation
  1124. of the table is set by the first line. Any line starting with
  1125. @samp{|-} is considered as a horizontal separator line and will be
  1126. expanded on the next re-align to span the whole table width. So, to
  1127. create the above table, you would only type
  1128. @example
  1129. |Name|Phone|Age|
  1130. |-
  1131. @end example
  1132. @noindent and then press @key{TAB} to align the table and start filling in
  1133. fields.
  1134. When typing text into a field, Org treats @key{DEL},
  1135. @key{Backspace}, and all character keys in a special way, so that
  1136. inserting and deleting avoids shifting other fields. Also, when
  1137. typing @emph{immediately after the cursor was moved into a new field
  1138. with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
  1139. field is automatically made blank. If this behavior is too
  1140. unpredictable for you, configure the variables
  1141. @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
  1142. @table @kbd
  1143. @tsubheading{Creation and conversion}
  1144. @kindex C-c |
  1145. @item C-c |
  1146. Convert the active region to table. If every line contains at least one
  1147. TAB character, the function assumes that the material is tab separated.
  1148. If every line contains a comma, comma-separated values (CSV) are assumed.
  1149. If not, lines are split at whitespace into fields. You can use a prefix
  1150. argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
  1151. C-u} forces TAB, and a numeric argument N indicates that at least N
  1152. consecutive spaces, or alternatively a TAB will be the separator.
  1153. @*
  1154. If there is no active region, this command creates an empty Org
  1155. table. But it's easier just to start typing, like
  1156. @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
  1157. @tsubheading{Re-aligning and field motion}
  1158. @kindex C-c C-c
  1159. @item C-c C-c
  1160. Re-align the table without moving the cursor.
  1161. @c
  1162. @kindex @key{TAB}
  1163. @item @key{TAB}
  1164. Re-align the table, move to the next field. Creates a new row if
  1165. necessary.
  1166. @c
  1167. @kindex S-@key{TAB}
  1168. @item S-@key{TAB}
  1169. Re-align, move to previous field.
  1170. @c
  1171. @kindex @key{RET}
  1172. @item @key{RET}
  1173. Re-align the table and move down to next row. Creates a new row if
  1174. necessary. At the beginning or end of a line, @key{RET} still does
  1175. NEWLINE, so it can be used to split a table.
  1176. @tsubheading{Column and row editing}
  1177. @kindex M-@key{left}
  1178. @kindex M-@key{right}
  1179. @item M-@key{left}
  1180. @itemx M-@key{right}
  1181. Move the current column left/right.
  1182. @c
  1183. @kindex M-S-@key{left}
  1184. @item M-S-@key{left}
  1185. Kill the current column.
  1186. @c
  1187. @kindex M-S-@key{right}
  1188. @item M-S-@key{right}
  1189. Insert a new column to the left of the cursor position.
  1190. @c
  1191. @kindex M-@key{up}
  1192. @kindex M-@key{down}
  1193. @item M-@key{up}
  1194. @itemx M-@key{down}
  1195. Move the current row up/down.
  1196. @c
  1197. @kindex M-S-@key{up}
  1198. @item M-S-@key{up}
  1199. Kill the current row or horizontal line.
  1200. @c
  1201. @kindex M-S-@key{down}
  1202. @item M-S-@key{down}
  1203. Insert a new row above the current row. With a prefix argument, the line is
  1204. created below the current one.
  1205. @c
  1206. @kindex C-c -
  1207. @item C-c -
  1208. Insert a horizontal line below current row. With a prefix argument, the line
  1209. is created above the current line.
  1210. @c
  1211. @kindex C-c ^
  1212. @item C-c ^
  1213. Sort the table lines in the region. The position of point indicates the
  1214. column to be used for sorting, and the range of lines is the range
  1215. between the nearest horizontal separator lines, or the entire table. If
  1216. point is before the first column, you will be prompted for the sorting
  1217. column. If there is an active region, the mark specifies the first line
  1218. and the sorting column, while point should be in the last line to be
  1219. included into the sorting. The command prompts for the sorting type
  1220. (alphabetically, numerically, or by time). When called with a prefix
  1221. argument, alphabetic sorting will be case-sensitive.
  1222. @tsubheading{Regions}
  1223. @kindex C-c C-x M-w
  1224. @item C-c C-x M-w
  1225. Copy a rectangular region from a table to a special clipboard. Point
  1226. and mark determine edge fields of the rectangle. The process ignores
  1227. horizontal separator lines.
  1228. @c
  1229. @kindex C-c C-x C-w
  1230. @item C-c C-x C-w
  1231. Copy a rectangular region from a table to a special clipboard, and
  1232. blank all fields in the rectangle. So this is the ``cut'' operation.
  1233. @c
  1234. @kindex C-c C-x C-y
  1235. @item C-c C-x C-y
  1236. Paste a rectangular region into a table.
  1237. The upper right corner ends up in the current field. All involved fields
  1238. will be overwritten. If the rectangle does not fit into the present table,
  1239. the table is enlarged as needed. The process ignores horizontal separator
  1240. lines.
  1241. @c
  1242. @kindex C-c C-q
  1243. @kindex M-@key{RET}
  1244. @item C-c C-q
  1245. @itemx M-@kbd{RET}
  1246. Wrap several fields in a column like a paragraph. If there is an active
  1247. region, and both point and mark are in the same column, the text in the
  1248. column is wrapped to minimum width for the given number of lines. A numeric
  1249. prefix argument may be used to change the number of desired lines. If there
  1250. is no region, the current field is split at the cursor position and the text
  1251. fragment to the right of the cursor is prepended to the field one line
  1252. down. If there is no region, but you specify a prefix argument, the current
  1253. field is made blank, and the content is appended to the field above.
  1254. @tsubheading{Calculations}
  1255. @cindex formula, in tables
  1256. @cindex calculations, in tables
  1257. @cindex region, active
  1258. @cindex active region
  1259. @cindex Transient mark mode
  1260. @kindex C-c +
  1261. @item C-c +
  1262. Sum the numbers in the current column, or in the rectangle defined by
  1263. the active region. The result is shown in the echo area and can
  1264. be inserted with @kbd{C-y}.
  1265. @c
  1266. @kindex S-@key{RET}
  1267. @item S-@key{RET}
  1268. When current field is empty, copy from first non-empty field above.
  1269. When not empty, copy current field down to next row and move cursor
  1270. along with it. Depending on the variable
  1271. @code{org-table-copy-increment}, integer field values will be
  1272. incremented during copy. This key is also used by CUA mode
  1273. (@pxref{Cooperation}).
  1274. @tsubheading{Miscellaneous}
  1275. @kindex C-c `
  1276. @item C-c `
  1277. Edit the current field in a separate window. This is useful for fields
  1278. that are not fully visible (@pxref{Narrow columns}). When called with a
  1279. @kbd{C-u} prefix, just make the full field visible, so that it can be
  1280. edited in place.
  1281. @c
  1282. @item M-x org-table-import
  1283. Import a file as a table. The table should be TAB- or whitespace
  1284. separated. Useful, for example, to import a spreadsheet table or data
  1285. from a database, because these programs generally can write
  1286. TAB-separated text files. This command works by inserting the file into
  1287. the buffer and then converting the region to a table. Any prefix
  1288. argument is passed on to the converter, which uses it to determine the
  1289. separator.
  1290. @item C-c |
  1291. Tables can also be imported by pasting tabular text into the Org
  1292. buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
  1293. @kbd{C-c |} command (see above under @i{Creation and conversion}.
  1294. @c
  1295. @item M-x org-table-export
  1296. Export the table as a TAB-separated file. Useful for data exchange with,
  1297. for example, spreadsheet or database programs.
  1298. @end table
  1299. If you don't like the automatic table editor because it gets in your
  1300. way on lines which you would like to start with @samp{|}, you can turn
  1301. it off with
  1302. @lisp
  1303. (setq org-enable-table-editor nil)
  1304. @end lisp
  1305. @noindent Then the only table command that still works is
  1306. @kbd{C-c C-c} to do a manual re-align.
  1307. @node Narrow columns, Column groups, Built-in table editor, Tables
  1308. @section Narrow columns
  1309. @cindex narrow columns in tables
  1310. The width of columns is automatically determined by the table editor.
  1311. Sometimes a single field or a few fields need to carry more text,
  1312. leading to inconveniently wide columns. To limit@footnote{This feature
  1313. does not work on XEmacs.} the width of a column, one field anywhere in
  1314. the column may contain just the string @samp{<N>} where @samp{N} is an
  1315. integer specifying the width of the column in characters. The next
  1316. re-align will then set the width of this column to no more than this
  1317. value.
  1318. @example
  1319. @group
  1320. |---+------------------------------| |---+--------|
  1321. | | | | | <6> |
  1322. | 1 | one | | 1 | one |
  1323. | 2 | two | ----\ | 2 | two |
  1324. | 3 | This is a long chunk of text | ----/ | 3 | This=> |
  1325. | 4 | four | | 4 | four |
  1326. |---+------------------------------| |---+--------|
  1327. @end group
  1328. @end example
  1329. @noindent
  1330. Fields that are wider become clipped and end in the string @samp{=>}.
  1331. Note that the full text is still in the buffer, it is only invisible.
  1332. To see the full text, hold the mouse over the field - a tool-tip window
  1333. will show the full content. To edit such a field, use the command
  1334. @kbd{C-c `} (that is @kbd{C-c} followed by the backquote). This will
  1335. open a new window with the full field. Edit it and finish with @kbd{C-c
  1336. C-c}.
  1337. When visiting a file containing a table with narrowed columns, the
  1338. necessary character hiding has not yet happened, and the table needs to
  1339. be aligned before it looks nice. Setting the option
  1340. @code{org-startup-align-all-tables} will realign all tables in a file
  1341. upon visiting, but also slow down startup. You can also set this option
  1342. on a per-file basis with:
  1343. @example
  1344. #+STARTUP: align
  1345. #+STARTUP: noalign
  1346. @end example
  1347. @node Column groups, Orgtbl mode, Narrow columns, Tables
  1348. @section Column groups
  1349. @cindex grouping columns in tables
  1350. When Org exports tables, it does so by default without vertical
  1351. lines because that is visually more satisfying in general. Occasionally
  1352. however, vertical lines can be useful to structure a table into groups
  1353. of columns, much like horizontal lines can do for groups of rows. In
  1354. order to specify column groups, you can use a special row where the
  1355. first field contains only @samp{/}. The further fields can either
  1356. contain @samp{<} to indicate that this column should start a group,
  1357. @samp{>} to indicate the end of a column, or @samp{<>} to make a column
  1358. a group of its own. Boundaries between column groups will upon export be
  1359. marked with vertical lines. Here is an example:
  1360. @example
  1361. | | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1362. |---+----+-----+-----+-----+---------+------------|
  1363. | / | <> | < | | > | < | > |
  1364. | # | 1 | 1 | 1 | 1 | 1 | 1 |
  1365. | # | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
  1366. | # | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
  1367. |---+----+-----+-----+-----+---------+------------|
  1368. #+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))
  1369. @end example
  1370. It is also sufficient to just insert the column group starters after
  1371. every vertical line you'd like to have:
  1372. @example
  1373. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1374. |----+-----+-----+-----+---------+------------|
  1375. | / | < | | | < | |
  1376. @end example
  1377. @node Orgtbl mode, The spreadsheet, Column groups, Tables
  1378. @section The Orgtbl minor mode
  1379. @cindex Orgtbl mode
  1380. @cindex minor mode for tables
  1381. If you like the intuitive way the Org table editor works, you
  1382. might also want to use it in other modes like Text mode or Mail mode.
  1383. The minor mode Orgtbl mode makes this possible. You can always toggle
  1384. the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
  1385. example in mail mode, use
  1386. @lisp
  1387. (add-hook 'mail-mode-hook 'turn-on-orgtbl)
  1388. @end lisp
  1389. Furthermore, with some special setup, it is possible to maintain tables
  1390. in arbitrary syntax with Orgtbl mode. For example, it is possible to
  1391. construct La@TeX{} tables with the underlying ease and power of
  1392. Orgtbl mode, including spreadsheet capabilities. For details, see
  1393. @ref{Tables in arbitrary syntax}.
  1394. @node The spreadsheet, , Orgtbl mode, Tables
  1395. @section The spreadsheet
  1396. @cindex calculations, in tables
  1397. @cindex spreadsheet capabilities
  1398. @cindex @file{calc} package
  1399. The table editor makes use of the Emacs @file{calc} package to implement
  1400. spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to
  1401. derive fields from other fields. While fully featured, Org's
  1402. implementation is not identical to other spreadsheets. For example,
  1403. Org knows the concept of a @emph{column formula} that will be
  1404. applied to all non-header fields in a column without having to copy the
  1405. formula to each relevant field.
  1406. @menu
  1407. * References:: How to refer to another field or range
  1408. * Formula syntax for Calc:: Using Calc to compute stuff
  1409. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
  1410. * Field formulas:: Formulas valid for a single field
  1411. * Column formulas:: Formulas valid for an entire column
  1412. * Editing and debugging formulas:: Fixing formulas
  1413. * Updating the table:: Recomputing all dependent fields
  1414. * Advanced features:: Field names, parameters and automatic recalc
  1415. @end menu
  1416. @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
  1417. @subsection References
  1418. @cindex references
  1419. To compute fields in the table from other fields, formulas must
  1420. reference other fields or ranges. In Org, fields can be referenced
  1421. by name, by absolute coordinates, and by relative coordinates. To find
  1422. out what the coordinates of a field are, press @kbd{C-c ?} in that
  1423. field, or press @kbd{C-c @}} to toggle the display of a grid.
  1424. @subsubheading Field references
  1425. @cindex field references
  1426. @cindex references, to fields
  1427. Formulas can reference the value of another field in two ways. Like in
  1428. any other spreadsheet, you may reference fields with a letter/number
  1429. combination like @code{B3}, meaning the 2nd field in the 3rd row.
  1430. @c Such references are always fixed to that field, they don't change
  1431. @c when you copy and paste a formula to a different field. So
  1432. @c Org's @code{B3} behaves like @code{$B$3} in other spreadsheets.
  1433. @noindent
  1434. Org also uses another, more general operator that looks like this:
  1435. @example
  1436. @@row$column
  1437. @end example
  1438. @noindent
  1439. Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
  1440. or relative to the current column like @samp{+1} or @samp{-2}.
  1441. The row specification only counts data lines and ignores horizontal
  1442. separator lines (hlines). You can use absolute row numbers
  1443. @samp{1}...@samp{N}, and row numbers relative to the current row like
  1444. @samp{+3} or @samp{-1}. Or specify the row relative to one of the
  1445. hlines: @samp{I} refers to the first hline@footnote{Note that only
  1446. hlines are counted that @emph{separate} table lines. If the table
  1447. starts with a hline above the header, it does not count.}, @samp{II} to
  1448. the second etc. @samp{-I} refers to the first such line above the
  1449. current line, @samp{+I} to the first such line below the current line.
  1450. You can also write @samp{III+2} which is the second data line after the
  1451. third hline in the table. Relative row numbers like @samp{-3} will not
  1452. cross hlines if the current line is too close to the hline. Instead,
  1453. the value directly at the hline is used.
  1454. @samp{0} refers to the current row and column. Also, if you omit
  1455. either the column or the row part of the reference, the current
  1456. row/column is implied.
  1457. Org's references with @emph{unsigned} numbers are fixed references
  1458. in the sense that if you use the same reference in the formula for two
  1459. different fields, the same field will be referenced each time.
  1460. Org's references with @emph{signed} numbers are floating
  1461. references because the same reference operator can reference different
  1462. fields depending on the field being calculated by the formula.
  1463. Here are a few examples:
  1464. @example
  1465. @@2$3 @r{2nd row, 3rd column}
  1466. C2 @r{same as previous}
  1467. $5 @r{column 5 in the current row}
  1468. E& @r{same as previous}
  1469. @@2 @r{current column, row 2}
  1470. @@-1$-3 @r{the field one row up, three columns to the left}
  1471. @@-I$2 @r{field just under hline above current row, column 2}
  1472. @end example
  1473. @subsubheading Range references
  1474. @cindex range references
  1475. @cindex references, to ranges
  1476. You may reference a rectangular range of fields by specifying two field
  1477. references connected by two dots @samp{..}. If both fields are in the
  1478. current row, you may simply use @samp{$2..$7}, but if at least one field
  1479. is in a different row, you need to use the general @code{@@row$column}
  1480. format at least for the first field (i.e the reference must start with
  1481. @samp{@@} in order to be interpreted correctly). Examples:
  1482. @example
  1483. $1..$3 @r{First three fields in the current row.}
  1484. $P..$Q @r{Range, using column names (see under Advanced)}
  1485. @@2$1..@@4$3 @r{6 fields between these two fields.}
  1486. A2..C4 @r{Same as above.}
  1487. @@-1$-2..@@-1 @r{3 numbers from the column to the left, 2 up to current row}
  1488. @end example
  1489. @noindent Range references return a vector of values that can be fed
  1490. into Calc vector functions. Empty fields in ranges are normally
  1491. suppressed, so that the vector contains only the non-empty fields (but
  1492. see the @samp{E} mode switch below). If there are no non-empty fields,
  1493. @samp{[0]} is returned to avoid syntax errors in formulas.
  1494. @subsubheading Named references
  1495. @cindex named references
  1496. @cindex references, named
  1497. @cindex name, of column or field
  1498. @cindex constants, in calculations
  1499. @samp{$name} is interpreted as the name of a column, parameter or
  1500. constant. Constants are defined globally through the variable
  1501. @code{org-table-formula-constants}, and locally (for the file) through a
  1502. line like
  1503. @example
  1504. #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
  1505. @end example
  1506. @noindent
  1507. Also properties (@pxref{Properties and Columns}) can be used as
  1508. constants in table formulas: For a property @samp{:Xyz:} use the name
  1509. @samp{$PROP_Xyz}, and the property will be searched in the current
  1510. outline entry and in the hierarchy above it. If you have the
  1511. @file{constants.el} package, it will also be used to resolve constants,
  1512. including natural constants like @samp{$h} for Planck's constant, and
  1513. units like @samp{$km} for kilometers@footnote{@file{Constant.el} can
  1514. supply the values of constants in two different unit systems, @code{SI}
  1515. and @code{cgs}. Which one is used depends on the value of the variable
  1516. @code{constants-unit-system}. You can use the @code{#+STARTUP} options
  1517. @code{constSI} and @code{constcgs} to set this value for the current
  1518. buffer.}. Column names and parameters can be specified in special table
  1519. lines. These are described below, see @ref{Advanced features}. All
  1520. names must start with a letter, and further consist of letters and
  1521. numbers.
  1522. @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
  1523. @subsection Formula syntax for Calc
  1524. @cindex formula syntax, Calc
  1525. @cindex syntax, of formulas
  1526. A formula can be any algebraic expression understood by the Emacs
  1527. @file{Calc} package. @b{Note that @file{calc} has the
  1528. non-standard convention that @samp{/} has lower precedence than
  1529. @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before
  1530. evaluation by @code{calc-eval} (@pxref{Calling Calc from
  1531. Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
  1532. Emacs Calc Manual}),
  1533. @c FIXME: The link to the Calc manual in HTML does not work.
  1534. variable substitution takes place according to the rules described above.
  1535. @cindex vectors, in table calculations
  1536. The range vectors can be directly fed into the Calc vector functions
  1537. like @samp{vmean} and @samp{vsum}.
  1538. @cindex format specifier
  1539. @cindex mode, for @file{calc}
  1540. A formula can contain an optional mode string after a semicolon. This
  1541. string consists of flags to influence Calc and other modes during
  1542. execution. By default, Org uses the standard Calc modes (precision
  1543. 12, angular units degrees, fraction and symbolic modes off. The display
  1544. format, however, has been changed to @code{(float 5)} to keep tables
  1545. compact. The default settings can be configured using the variable
  1546. @code{org-calc-default-modes}.
  1547. @example
  1548. p20 @r{switch the internal precision to 20 digits}
  1549. n3 s3 e2 f4 @r{normal, scientific, engineering, or fixed display format}
  1550. D R @r{angle modes: degrees, radians}
  1551. F S @r{fraction and symbolic modes}
  1552. N @r{interpret all fields as numbers, use 0 for non-numbers}
  1553. T @r{force text interpretation}
  1554. E @r{keep empty fields in ranges}
  1555. @end example
  1556. @noindent
  1557. In addition, you may provide a @code{printf} format specifier to
  1558. reformat the final result. A few examples:
  1559. @example
  1560. $1+$2 @r{Sum of first and second field}
  1561. $1+$2;%.2f @r{Same, format result to two decimals}
  1562. exp($2)+exp($1) @r{Math functions can be used}
  1563. $0;%.1f @r{Reformat current cell to 1 decimal}
  1564. ($3-32)*5/9 @r{Degrees F -> C conversion}
  1565. $c/$1/$cm @r{Hz -> cm conversion, using @file{constants.el}}
  1566. tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1}
  1567. sin($1);Dp3%.1e @r{Same, but use printf specifier for display}
  1568. vmean($2..$7) @r{Compute column range mean, using vector function}
  1569. vmean($2..$7);EN @r{Same, but treat empty fields as 0}
  1570. taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree}
  1571. @end example
  1572. Calc also contains a complete set of logical operations. For example
  1573. @example
  1574. if($1<20,teen,string("")) @r{``teen'' if age $1 less than 20, else empty}
  1575. @end example
  1576. @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
  1577. @subsection Emacs Lisp forms as formulas
  1578. @cindex Lisp forms, as table formulas
  1579. It is also possible to write a formula in Emacs Lisp; this can be useful
  1580. for string manipulation and control structures, if the Calc's
  1581. functionality is not enough. If a formula starts with a single quote
  1582. followed by an opening parenthesis, then it is evaluated as a lisp form.
  1583. The evaluation should return either a string or a number. Just as with
  1584. @file{calc} formulas, you can specify modes and a printf format after a
  1585. semicolon. With Emacs Lisp forms, you need to be conscious about the way
  1586. field references are interpolated into the form. By default, a
  1587. reference will be interpolated as a Lisp string (in double quotes)
  1588. containing the field. If you provide the @samp{N} mode switch, all
  1589. referenced elements will be numbers (non-number fields will be zero) and
  1590. interpolated as Lisp numbers, without quotes. If you provide the
  1591. @samp{L} flag, all fields will be interpolated literally, without quotes.
  1592. I.e., if you want a reference to be interpreted as a string by the Lisp
  1593. form, enclose the reference operator itself in double quotes, like
  1594. @code{"$3"}. Ranges are inserted as space-separated fields, so you can
  1595. embed them in list or vector syntax. A few examples, note how the
  1596. @samp{N} mode is used when we do computations in lisp.
  1597. @example
  1598. @r{Swap the first two characters of the content of column 1}
  1599. '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
  1600. @r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
  1601. '(+ $1 $2);N
  1602. @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
  1603. '(apply '+ '($1..$4));N
  1604. @end example
  1605. @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
  1606. @subsection Field formulas
  1607. @cindex field formula
  1608. @cindex formula, for individual table field
  1609. To assign a formula to a particular field, type it directly into the
  1610. field, preceded by @samp{:=}, for example @samp{:=$1+$2}. When you
  1611. press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
  1612. the field, the formula will be stored as the formula for this field,
  1613. evaluated, and the current field replaced with the result.
  1614. Formulas are stored in a special line starting with @samp{#+TBLFM:}
  1615. directly below the table. If you typed the equation in the 4th field of
  1616. the 3rd data line in the table, the formula will look like
  1617. @samp{@@3$4=$1+$2}. When inserting/deleting/swapping column and rows
  1618. with the appropriate commands, @i{absolute references} (but not relative
  1619. ones) in stored formulas are modified in order to still reference the
  1620. same field. Of cause this is not true if you edit the table structure
  1621. with normal editing commands - then you must fix the equations yourself.
  1622. Instead of typing an equation into the field, you may also use the
  1623. following command
  1624. @table @kbd
  1625. @kindex C-u C-c =
  1626. @item C-u C-c =
  1627. Install a new formula for the current field. The command prompts for a
  1628. formula, with default taken from the @samp{#+TBLFM:} line, applies
  1629. it to the current field and stores it.
  1630. @end table
  1631. @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
  1632. @subsection Column formulas
  1633. @cindex column formula
  1634. @cindex formula, for table column
  1635. Often in a table, the same formula should be used for all fields in a
  1636. particular column. Instead of having to copy the formula to all fields
  1637. in that column, Org allows to assign a single formula to an entire
  1638. column. If the table contains horizontal separator hlines, everything
  1639. before the first such line is considered part of the table @emph{header}
  1640. and will not be modified by column formulas.
  1641. To assign a formula to a column, type it directly into any field in the
  1642. column, preceded by an equal sign, like @samp{=$1+$2}. When you press
  1643. @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
  1644. field, the formula will be stored as the formula for the current column,
  1645. evaluated and the current field replaced with the result. If the field
  1646. contains only @samp{=}, the previously stored formula for this column is
  1647. used. For each column, Org will only remember the most recently
  1648. used formula. In the @samp{TBLFM:} line, column formulas will look like
  1649. @samp{$4=$1+$2}.
  1650. Instead of typing an equation into the field, you may also use the
  1651. following command:
  1652. @table @kbd
  1653. @kindex C-c =
  1654. @item C-c =
  1655. Install a new formula for the current column and replace current field with
  1656. the result of the formula. The command prompts for a formula, with default
  1657. taken from the @samp{#+TBLFM} line, applies it to the current field and
  1658. stores it. With a numeric prefix argument(e.g. @kbd{C-5 C-c =}) the command
  1659. will apply it to that many consecutive fields in the current column.
  1660. @end table
  1661. @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
  1662. @subsection Editing and debugging formulas
  1663. @cindex formula editing
  1664. @cindex editing, of table formulas
  1665. You can edit individual formulas in the minibuffer or directly in the
  1666. field. Org can also prepare a special buffer with all active
  1667. formulas of a table. When offering a formula for editing, Org
  1668. converts references to the standard format (like @code{B3} or @code{D&})
  1669. if possible. If you prefer to only work with the internal format (like
  1670. @code{@@3$2} or @code{$4}), configure the variable
  1671. @code{org-table-use-standard-references}.
  1672. @table @kbd
  1673. @kindex C-c =
  1674. @kindex C-u C-c =
  1675. @item C-c =
  1676. @itemx C-u C-c =
  1677. Edit the formula associated with the current column/field in the
  1678. minibuffer. See @ref{Column formulas} and @ref{Field formulas}.
  1679. @kindex C-u C-u C-c =
  1680. @item C-u C-u C-c =
  1681. Re-insert the active formula (either a
  1682. field formula, or a column formula) into the current field, so that you
  1683. can edit it directly in the field. The advantage over editing in the
  1684. minibuffer is that you can use the command @kbd{C-c ?}.
  1685. @kindex C-c ?
  1686. @item C-c ?
  1687. While editing a formula in a table field, highlight the field(s)
  1688. referenced by the reference at the cursor position in the formula.
  1689. @kindex C-c @}
  1690. @item C-c @}
  1691. Toggle the display of row and column numbers for a table, using
  1692. overlays. These are updated each time the table is aligned, you can
  1693. force it with @kbd{C-c C-c}.
  1694. @kindex C-c @{
  1695. @item C-c @{
  1696. Toggle the formula debugger on and off. See below.
  1697. @kindex C-c '
  1698. @item C-c '
  1699. Edit all formulas for the current table in a special buffer, where the
  1700. formulas will be displayed one per line. If the current field has an
  1701. active formula, the cursor in the formula editor will mark it.
  1702. While inside the special buffer, Org will automatically highlight
  1703. any field or range reference at the cursor position. You may edit,
  1704. remove and add formulas, and use the following commands:
  1705. @table @kbd
  1706. @kindex C-c C-c
  1707. @kindex C-x C-s
  1708. @item C-c C-c
  1709. @itemx C-x C-s
  1710. Exit the formula editor and store the modified formulas. With @kbd{C-u}
  1711. prefix, also apply the new formulas to the entire table.
  1712. @kindex C-c C-q
  1713. @item C-c C-q
  1714. Exit the formula editor without installing changes.
  1715. @kindex C-c C-r
  1716. @item C-c C-r
  1717. Toggle all references in the formula editor between standard (like
  1718. @code{B3}) and internal (like @code{@@3$2}).
  1719. @kindex @key{TAB}
  1720. @item @key{TAB}
  1721. Pretty-print or indent lisp formula at point. When in a line containing
  1722. a lisp formula, format the formula according to Emacs Lisp rules.
  1723. Another @key{TAB} collapses the formula back again. In the open
  1724. formula, @key{TAB} re-indents just like in Emacs lisp mode.
  1725. @kindex M-@key{TAB}
  1726. @item M-@key{TAB}
  1727. Complete Lisp symbols, just like in Emacs lisp mode.
  1728. @kindex S-@key{up}
  1729. @kindex S-@key{down}
  1730. @kindex S-@key{left}
  1731. @kindex S-@key{right}
  1732. @item S-@key{up}/@key{down}/@key{left}/@key{right}
  1733. Shift the reference at point. For example, if the reference is
  1734. @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
  1735. This also works for relative references, and for hline references.
  1736. @kindex M-S-@key{up}
  1737. @kindex M-S-@key{down}
  1738. @item M-S-@key{up}/@key{down}
  1739. Move the test line for column formulas in the Org buffer up and
  1740. down.
  1741. @kindex M-@key{up}
  1742. @kindex M-@key{down}
  1743. @item M-@key{up}/@key{down}
  1744. Scroll the window displaying the table.
  1745. @kindex C-c @}
  1746. @item C-c @}
  1747. Turn the coordinate grid in the table on and off.
  1748. @end table
  1749. @end table
  1750. Making a table field blank does not remove the formula associated with
  1751. the field, because that is stored in a different line (the @samp{TBLFM}
  1752. line) - during the next recalculation the field will be filled again.
  1753. To remove a formula from a field, you have to give an empty reply when
  1754. prompted for the formula, or to edit the @samp{#+TBLFM} line.
  1755. @kindex C-c C-c
  1756. You may edit the @samp{#+TBLFM} directly and re-apply the changed
  1757. equations with @kbd{C-c C-c} in that line, or with the normal
  1758. recalculation commands in the table.
  1759. @subsubheading Debugging formulas
  1760. @cindex formula debugging
  1761. @cindex debugging, of table formulas
  1762. When the evaluation of a formula leads to an error, the field content
  1763. becomes the string @samp{#ERROR}. If you would like see what is going
  1764. on during variable substitution and calculation in order to find a bug,
  1765. turn on formula debugging in the @code{Tbl} menu and repeat the
  1766. calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
  1767. field. Detailed information will be displayed.
  1768. @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
  1769. @subsection Updating the table
  1770. @cindex recomputing table fields
  1771. @cindex updating, table
  1772. Recalculation of a table is normally not automatic, but needs to be
  1773. triggered by a command. See @ref{Advanced features} for a way to make
  1774. recalculation at least semi-automatically.
  1775. In order to recalculate a line of a table or the entire table, use the
  1776. following commands:
  1777. @table @kbd
  1778. @kindex C-c *
  1779. @item C-c *
  1780. Recalculate the current row by first applying the stored column formulas
  1781. from left to right, and all field formulas in the current row.
  1782. @c
  1783. @kindex C-u C-c *
  1784. @item C-u C-c *
  1785. @kindex C-u C-c C-c
  1786. @itemx C-u C-c C-c
  1787. Recompute the entire table, line by line. Any lines before the first
  1788. hline are left alone, assuming that these are part of the table header.
  1789. @c
  1790. @kindex C-u C-u C-c *
  1791. @kindex C-u C-u C-c C-c
  1792. @item C-u C-u C-c *
  1793. @itemx C-u C-u C-c C-c
  1794. Iterate the table by recomputing it until no further changes occur.
  1795. This may be necessary if some computed fields use the value of other
  1796. fields that are computed @i{later} in the calculation sequence.
  1797. @end table
  1798. @node Advanced features, , Updating the table, The spreadsheet
  1799. @subsection Advanced features
  1800. If you want the recalculation of fields to happen automatically, or if
  1801. you want to be able to assign @i{names} to fields and columns, you need
  1802. to reserve the first column of the table for special marking characters.
  1803. @table @kbd
  1804. @kindex C-#
  1805. @item C-#
  1806. Rotate the calculation mark in first column through the states @samp{},
  1807. @samp{#}, @samp{*}, @samp{!}, @samp{$}. The meaning of these characters
  1808. is discussed below. When there is an active region, change all marks in
  1809. the region.
  1810. @end table
  1811. Here is an example of a table that collects exam results of students and
  1812. makes use of these features:
  1813. @example
  1814. @group
  1815. |---+---------+--------+--------+--------+-------+------|
  1816. | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
  1817. |---+---------+--------+--------+--------+-------+------|
  1818. | ! | | P1 | P2 | P3 | Tot | |
  1819. | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
  1820. | ^ | | m1 | m2 | m3 | mt | |
  1821. |---+---------+--------+--------+--------+-------+------|
  1822. | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
  1823. | # | Sara | 6 | 14 | 19 | 39 | 7.8 |
  1824. | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
  1825. |---+---------+--------+--------+--------+-------+------|
  1826. | | Average | | | | 29.7 | |
  1827. | ^ | | | | | at | |
  1828. | $ | max=50 | | | | | |
  1829. |---+---------+--------+--------+--------+-------+------|
  1830. #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
  1831. @end group
  1832. @end example
  1833. @noindent @b{Important}: Please note that for these special tables,
  1834. recalculating the table with @kbd{C-u C-c *} will only affect rows that
  1835. are marked @samp{#} or @samp{*}, and fields that have a formula assigned
  1836. to the field itself. The column formulas are not applied in rows with
  1837. empty first field.
  1838. @cindex marking characters, tables
  1839. The marking characters have the following meaning:
  1840. @table @samp
  1841. @item !
  1842. The fields in this line define names for the columns, so that you may
  1843. refer to a column as @samp{$Tot} instead of @samp{$6}.
  1844. @item ^
  1845. This row defines names for the fields @emph{above} the row. With such
  1846. a definition, any formula in the table may use @samp{$m1} to refer to
  1847. the value @samp{10}. Also, if you assign a formula to a names field, it
  1848. will be stored as @samp{$name=...}.
  1849. @item _
  1850. Similar to @samp{^}, but defines names for the fields in the row
  1851. @emph{below}.
  1852. @item $
  1853. Fields in this row can define @emph{parameters} for formulas. For
  1854. example, if a field in a @samp{$} row contains @samp{max=50}, then
  1855. formulas in this table can refer to the value 50 using @samp{$max}.
  1856. Parameters work exactly like constants, only that they can be defined on
  1857. a per-table basis.
  1858. @item #
  1859. Fields in this row are automatically recalculated when pressing
  1860. @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row. Also, this row
  1861. is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked
  1862. lines will be left alone by this command.
  1863. @item *
  1864. Selects this line for global recalculation with @kbd{C-u C-c *}, but
  1865. not for automatic recalculation. Use this when automatic
  1866. recalculation slows down editing too much.
  1867. @item
  1868. Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
  1869. All lines that should be recalculated should be marked with @samp{#}
  1870. or @samp{*}.
  1871. @item /
  1872. Do not export this line. Useful for lines that contain the narrowing
  1873. @samp{<N>} markers.
  1874. @end table
  1875. Finally, just to whet your appetite on what can be done with the
  1876. fantastic @file{calc} package, here is a table that computes the Taylor
  1877. series of degree @code{n} at location @code{x} for a couple of
  1878. functions.
  1879. @example
  1880. @group
  1881. |---+-------------+---+-----+--------------------------------------|
  1882. | | Func | n | x | Result |
  1883. |---+-------------+---+-----+--------------------------------------|
  1884. | # | exp(x) | 1 | x | 1 + x |
  1885. | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
  1886. | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
  1887. | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
  1888. | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
  1889. | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
  1890. |---+-------------+---+-----+--------------------------------------|
  1891. #+TBLFM: $5=taylor($2,$4,$3);n3
  1892. @end group
  1893. @end example
  1894. @node Hyperlinks, TODO Items, Tables, Top
  1895. @chapter Hyperlinks
  1896. @cindex hyperlinks
  1897. Like HTML, Org provides links inside a file, external links to
  1898. other files, Usenet articles, emails, and much more.
  1899. @menu
  1900. * Link format:: How links in Org are formatted
  1901. * Internal links:: Links to other places in the current file
  1902. * External links:: URL-like links to the world
  1903. * Handling links:: Creating, inserting and following
  1904. * Using links outside Org:: Linking from my C source code?
  1905. * Link abbreviations:: Shortcuts for writing complex links
  1906. * Search options:: Linking to a specific location
  1907. * Custom searches:: When the default search is not enough
  1908. @end menu
  1909. @node Link format, Internal links, Hyperlinks, Hyperlinks
  1910. @section Link format
  1911. @cindex link format
  1912. @cindex format, of links
  1913. Org will recognize plain URL-like links and activate them as
  1914. clickable links. The general link format, however, looks like this:
  1915. @example
  1916. [[link][description]] @r{or alternatively} [[link]]
  1917. @end example
  1918. Once a link in the buffer is complete (all brackets present), Org
  1919. will change the display so that @samp{description} is displayed instead
  1920. of @samp{[[link][description]]} and @samp{link} is displayed instead of
  1921. @samp{[[link]]}. Links will be highlighted in the face @code{org-link},
  1922. which by default is an underlined face. You can directly edit the
  1923. visible part of a link. Note that this can be either the @samp{link}
  1924. part (if there is no description) or the @samp{description} part. To
  1925. edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
  1926. cursor on the link.
  1927. If you place the cursor at the beginning or just behind the end of the
  1928. displayed text and press @key{BACKSPACE}, you will remove the
  1929. (invisible) bracket at that location. This makes the link incomplete
  1930. and the internals are again displayed as plain text. Inserting the
  1931. missing bracket hides the link internals again. To show the
  1932. internal structure of all links, use the menu entry
  1933. @code{Org->Hyperlinks->Literal links}.
  1934. @node Internal links, External links, Link format, Hyperlinks
  1935. @section Internal links
  1936. @cindex internal links
  1937. @cindex links, internal
  1938. @cindex targets, for links
  1939. If the link does not look like a URL, it is considered to be internal in
  1940. the current file. Links such as @samp{[[My Target]]} or @samp{[[My
  1941. Target][Find my target]]} lead to a text search in the current file.
  1942. The link can be followed with @kbd{C-c C-o} when the cursor is on the
  1943. link, or with a mouse click (@pxref{Handling links}). The preferred
  1944. match for such a link is a dedicated target: the same string in double
  1945. angular brackets. Targets may be located anywhere; sometimes it is
  1946. convenient to put them into a comment line. For example
  1947. @example
  1948. # <<My Target>>
  1949. @end example
  1950. @noindent In HTML export (@pxref{HTML export}), such targets will become
  1951. named anchors for direct access through @samp{http} links@footnote{Note
  1952. that text before the first headline is usually not exported, so the
  1953. first such target should be after the first headline.}.
  1954. If no dedicated target exists, Org will search for the words in the
  1955. link. In the above example the search would be for @samp{my target}.
  1956. Links starting with a star like @samp{*My Target} restrict the search to
  1957. headlines. When searching, Org mode will first try an exact match, but
  1958. then move on to more and more lenient searches. For example, the link
  1959. @samp{[[*My Targets]]} will find any of the following:
  1960. @example
  1961. ** My targets
  1962. ** TODO my targets are bright
  1963. ** my 20 targets are
  1964. @end example
  1965. To insert a link targeting a headline, in-buffer completion can be used.
  1966. Just type a star followed by a few optional letters into the buffer and
  1967. press @kbd{M-@key{TAB}}. All headlines in the current buffer will be
  1968. offered as completions. @xref{Handling links}, for more commands
  1969. creating links.
  1970. Following a link pushes a mark onto Org's own mark ring. You can
  1971. return to the previous position with @kbd{C-c &}. Using this command
  1972. several times in direct succession goes back to positions recorded
  1973. earlier.
  1974. @menu
  1975. * Radio targets:: Make targets trigger links in plain text
  1976. @end menu
  1977. @node Radio targets, , Internal links, Internal links
  1978. @subsection Radio targets
  1979. @cindex radio targets
  1980. @cindex targets, radio
  1981. @cindex links, radio targets
  1982. Org can automatically turn any occurrences of certain target names
  1983. in normal text into a link. So without explicitly creating a link, the
  1984. text connects to the target radioing its position. Radio targets are
  1985. enclosed by triple angular brackets. For example, a target @samp{<<<My
  1986. Target>>>} causes each occurrence of @samp{my target} in normal text to
  1987. become activated as a link. The Org file is scanned automatically
  1988. for radio targets only when the file is first loaded into Emacs. To
  1989. update the target list during editing, press @kbd{C-c C-c} with the
  1990. cursor on or at a target.
  1991. @node External links, Handling links, Internal links, Hyperlinks
  1992. @section External links
  1993. @cindex links, external
  1994. @cindex external links
  1995. @cindex links, external
  1996. @cindex Gnus links
  1997. @cindex BBDB links
  1998. @cindex IRC links
  1999. @cindex URL links
  2000. @cindex file links
  2001. @cindex VM links
  2002. @cindex RMAIL links
  2003. @cindex WANDERLUST links
  2004. @cindex MH-E links
  2005. @cindex USENET links
  2006. @cindex SHELL links
  2007. @cindex Info links
  2008. @cindex elisp links
  2009. Org supports links to files, websites, Usenet and email messages,
  2010. BBDB database entries and links to both IRC conversations and their
  2011. logs. External links are URL-like locators. They start with a short
  2012. identifying string followed by a colon. There can be no space after
  2013. the colon. The following list shows examples for each link type.
  2014. @example
  2015. http://www.astro.uva.nl/~dominik @r{on the web}
  2016. file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
  2017. file:papers/last.pdf @r{file, relative path}
  2018. news:comp.emacs @r{Usenet link}
  2019. mailto:adent@@galaxy.net @r{Mail link}
  2020. vm:folder @r{VM folder link}
  2021. vm:folder#id @r{VM message link}
  2022. vm://myself@@some.where.org/folder#id @r{VM on remote machine}
  2023. wl:folder @r{WANDERLUST folder link}
  2024. wl:folder#id @r{WANDERLUST message link}
  2025. mhe:folder @r{MH-E folder link}
  2026. mhe:folder#id @r{MH-E message link}
  2027. rmail:folder @r{RMAIL folder link}
  2028. rmail:folder#id @r{RMAIL message link}
  2029. gnus:group @r{Gnus group link}
  2030. gnus:group#id @r{Gnus article link}
  2031. bbdb:Richard Stallman @r{BBDB link}
  2032. irc:/irc.com/#emacs/bob @r{IRC link}
  2033. shell:ls *.org @r{A shell command}
  2034. elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
  2035. @end example
  2036. A link should be enclosed in double brackets and may contain a
  2037. descriptive text to be displayed instead of the URL (@pxref{Link
  2038. format}), for example:
  2039. @example
  2040. [[http://www.gnu.org/software/emacs/][GNU Emacs]]
  2041. @end example
  2042. @noindent
  2043. If the description is a file name or URL that points to an image, HTML
  2044. export (@pxref{HTML export}) will inline the image as a clickable
  2045. button. If there is no description at all and the link points to an
  2046. image,
  2047. that image will be inlined into the exported HTML file.
  2048. @cindex angular brackets, around links
  2049. @cindex plain text external links
  2050. Org also finds external links in the normal text and activates them
  2051. as links. If spaces must be part of the link (for example in
  2052. @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
  2053. about the end of the link, enclose them in angular brackets.
  2054. @node Handling links, Using links outside Org, External links, Hyperlinks
  2055. @section Handling links
  2056. @cindex links, handling
  2057. Org provides methods to create a link in the correct syntax, to
  2058. insert it into an Org file, and to follow the link.
  2059. @table @kbd
  2060. @kindex C-c l
  2061. @cindex storing links
  2062. @item C-c l
  2063. Store a link to the current location. This is a @emph{global} command
  2064. which can be used in any buffer to create a link. The link will be
  2065. stored for later insertion into an Org buffer (see below). For
  2066. Org files, if there is a @samp{<<target>>} at the cursor, the
  2067. link points to the target. Otherwise it points to the current
  2068. headline. For VM, Rmail, Wanderlust, MH-E, Gnus and BBDB buffers, the
  2069. link will indicate the current article/entry. For W3 and W3M buffers,
  2070. the link goes to the current URL. For IRC links, if you set the
  2071. variable @code{org-irc-link-to-logs} to non-nil then @kbd{C-c l} will
  2072. store a @samp{file:/} style link to the relevant point in the logs for
  2073. the current conversation. Otherwise an @samp{irc:/} style link to the
  2074. user/channel/server under the point will be stored. For any other
  2075. files, the link will point to the file, with a search string
  2076. (@pxref{Search options}) pointing to the contents of the current line.
  2077. If there is an active region, the selected words will form the basis
  2078. of the search string. If the automatically created link is not
  2079. working correctly or accurately enough, you can write custom functions
  2080. to select the search string and to do the search for particular file
  2081. types - see @ref{Custom searches}. The key binding @kbd{C-c l} is
  2082. only a suggestion - see @ref{Installation}.
  2083. @c
  2084. @kindex C-c C-l
  2085. @cindex link completion
  2086. @cindex completion, of links
  2087. @cindex inserting links
  2088. @item C-c C-l
  2089. Insert a link. This prompts for a link to be inserted into the buffer. You
  2090. can just type a link, using text for an internal link, or one of the link
  2091. type prefixes mentioned in the examples above. All links stored during the
  2092. current session are part of the history for this prompt, so you can access
  2093. them with @key{up} and @key{down} (or @kbd{M-p/n}). Completion, on the other
  2094. hand, will help you to insert valid link prefixes like @samp{http:} or
  2095. @samp{ftp:}, including the prefixes defined through link abbreviations
  2096. (@pxref{Link abbreviations}). The link will be inserted into the
  2097. buffer@footnote{After insertion of a stored link, the link will be removed
  2098. from the list of stored links. To keep it in the list later use, use a
  2099. triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or configure the option
  2100. @code{org-keep-stored-link-after-insertion}.}, along with a descriptive text.
  2101. If some text was selected when this command is called, the selected text
  2102. becomes the default description.@* Note that you don't have to use this
  2103. command to insert a link. Links in Org are plain text, and you can type
  2104. or paste them straight into the buffer. By using this command, the links are
  2105. automatically enclosed in double brackets, and you will be asked for the
  2106. optional descriptive text.
  2107. @c
  2108. @c If the link is a @samp{file:} link and
  2109. @c the linked file is located in the same directory as the current file or
  2110. @c a subdirectory of it, the path of the file will be inserted relative to
  2111. @c the current directory.
  2112. @c
  2113. @kindex C-u C-c C-l
  2114. @cindex file name completion
  2115. @cindex completion, of file names
  2116. @item C-u C-c C-l
  2117. When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
  2118. a file will be inserted and you may use file name completion to select
  2119. the name of the file. The path to the file is inserted relative to the
  2120. directory of the current org file, if the linked file is in the current
  2121. directory or in a sub-directory of it, or if the path is written relative
  2122. to the current directory using @samp{../}. Otherwise an absolute path
  2123. is used, if possible with @samp{~/} for your home directory. You can
  2124. force an absolute path with two @kbd{C-u} prefixes.
  2125. @c
  2126. @item C-c C-l @r{(with cursor on existing link)}
  2127. When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
  2128. link and description parts of the link.
  2129. @c
  2130. @cindex following links
  2131. @kindex C-c C-o
  2132. @item C-c C-o
  2133. Open link at point. This will launch a web browser for URLs (using
  2134. @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
  2135. for the corresponding links, and execute the command in a shell link.
  2136. When the cursor is on an internal link, this commands runs the
  2137. corresponding search. When the cursor is on a TAG list in a headline,
  2138. it creates the corresponding TAGS view. If the cursor is on a time
  2139. stamp, it compiles the agenda for that date. Furthermore, it will visit
  2140. text and remote files in @samp{file:} links with Emacs and select a
  2141. suitable application for local non-text files. Classification of files
  2142. is based on file extension only. See option @code{org-file-apps}. If
  2143. you want to override the default application and visit the file with
  2144. Emacs, use a @kbd{C-u} prefix.
  2145. @c
  2146. @kindex mouse-2
  2147. @kindex mouse-1
  2148. @item mouse-2
  2149. @itemx mouse-1
  2150. On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
  2151. would. Under Emacs 22, also @kbd{mouse-1} will follow a link.
  2152. @c
  2153. @kindex mouse-3
  2154. @item mouse-3
  2155. Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
  2156. internal links to be displayed in another window@footnote{See the
  2157. variable @code{org-display-internal-link-with-indirect-buffer}}.
  2158. @c
  2159. @cindex mark ring
  2160. @kindex C-c %
  2161. @item C-c %
  2162. Push the current position onto the mark ring, to be able to return
  2163. easily. Commands following an internal link do this automatically.
  2164. @c
  2165. @cindex links, returning to
  2166. @kindex C-c &
  2167. @item C-c &
  2168. Jump back to a recorded position. A position is recorded by the
  2169. commands following internal links, and by @kbd{C-c %}. Using this
  2170. command several times in direct succession moves through a ring of
  2171. previously recorded positions.
  2172. @c
  2173. @kindex C-c C-x C-n
  2174. @kindex C-c C-x C-p
  2175. @cindex links, finding next/previous
  2176. @item C-c C-x C-n
  2177. @itemx C-c C-x C-p
  2178. Move forward/backward to the next link in the buffer. At the limit of
  2179. the buffer, the search fails once, and then wraps around. The key
  2180. bindings for this are really too long, you might want to bind this also
  2181. to @kbd{C-n} and @kbd{C-p}
  2182. @lisp
  2183. (add-hook 'org-load-hook
  2184. (lambda ()
  2185. (define-key 'org-mode-map "\C-n" 'org-next-link)
  2186. (define-key 'org-mode-map "\C-p" 'org-previous-link)))
  2187. @end lisp
  2188. @end table
  2189. @node Using links outside Org, Link abbreviations, Handling links, Hyperlinks
  2190. @section Using links outside Org
  2191. You can insert and follow links that have Org syntax not only in
  2192. Org, but in any Emacs buffer. For this, you should create two
  2193. global commands, like this (please select suitable global keys
  2194. yourself):
  2195. @lisp
  2196. (global-set-key "\C-c L" 'org-insert-link-global)
  2197. (global-set-key "\C-c o" 'org-open-at-point-global)
  2198. @end lisp
  2199. @node Link abbreviations, Search options, Using links outside Org, Hyperlinks
  2200. @section Link abbreviations
  2201. @cindex link abbreviations
  2202. @cindex abbreviation, links
  2203. Long URLs can be cumbersome to type, and often many similar links are
  2204. needed in a document. For this you can use link abbreviations. An
  2205. abbreviated link looks like this
  2206. @example
  2207. [[linkword:tag][description]]
  2208. @end example
  2209. @noindent
  2210. where the tag is optional. Such abbreviations are resolved according to
  2211. the information in the variable @code{org-link-abbrev-alist} that
  2212. relates the linkwords to replacement text. Here is an example:
  2213. @lisp
  2214. @group
  2215. (setq org-link-abbrev-alist
  2216. '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
  2217. ("google" . "http://www.google.com/search?q=")
  2218. ("ads" . "http://adsabs.harvard.edu/cgi-bin/
  2219. nph-abs_connect?author=%s&db_key=AST")))
  2220. @end group
  2221. @end lisp
  2222. If the replacement text contains the string @samp{%s}, it will be
  2223. replaced with the tag. Otherwise the tag will be appended to the string
  2224. in order to create the link. You may also specify a function that will
  2225. be called with the tag as the only argument to create the link.
  2226. With the above setting, you could link to a specific bug with
  2227. @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
  2228. @code{[[google:OrgMode]]} and find out what the Org author is
  2229. doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
  2230. If you need special abbreviations just for a single Org buffer, you
  2231. can define them in the file with
  2232. @example
  2233. #+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
  2234. #+LINK: google http://www.google.com/search?q=%s
  2235. @end example
  2236. @noindent
  2237. In-buffer completion @pxref{Completion} can be used after @samp{[} to
  2238. complete link abbreviations.
  2239. @node Search options, Custom searches, Link abbreviations, Hyperlinks
  2240. @section Search options in file links
  2241. @cindex search option in file links
  2242. @cindex file links, searching
  2243. File links can contain additional information to make Emacs jump to a
  2244. particular location in the file when following a link. This can be a
  2245. line number or a search option after a double@footnote{For backward
  2246. compatibility, line numbers can also follow a single colon.} colon. For
  2247. example, when the command @kbd{C-c l} creates a link (@pxref{Handling
  2248. links}) to a file, it encodes the words in the current line as a search
  2249. string that can be used to find this line back later when following the
  2250. link with @kbd{C-c C-o}.
  2251. Here is the syntax of the different ways to attach a search to a file
  2252. link, together with an explanation:
  2253. @example
  2254. [[file:~/code/main.c::255]]
  2255. [[file:~/xx.org::My Target]]
  2256. [[file:~/xx.org::*My Target]]
  2257. [[file:~/xx.org::/regexp/]]
  2258. @end example
  2259. @table @code
  2260. @item 255
  2261. Jump to line 255.
  2262. @item My Target
  2263. Search for a link target @samp{<<My Target>>}, or do a text search for
  2264. @samp{my target}, similar to the search in internal links, see
  2265. @ref{Internal links}. In HTML export (@pxref{HTML export}), such a file
  2266. link will become an HTML reference to the corresponding named anchor in
  2267. the linked file.
  2268. @item *My Target
  2269. In an Org file, restrict search to headlines.
  2270. @item /regexp/
  2271. Do a regular expression search for @code{regexp}. This uses the Emacs
  2272. command @code{occur} to list all matches in a separate window. If the
  2273. target file is in Org mode, @code{org-occur} is used to create a
  2274. sparse tree with the matches.
  2275. @c If the target file is a directory,
  2276. @c @code{grep} will be used to search all files in the directory.
  2277. @end table
  2278. As a degenerate case, a file link with an empty file name can be used
  2279. to search the current file. For example, @code{[[file:::find me]]} does
  2280. a search for @samp{find me} in the current file, just as
  2281. @samp{[[find me]]} would.
  2282. @node Custom searches, , Search options, Hyperlinks
  2283. @section Custom Searches
  2284. @cindex custom search strings
  2285. @cindex search strings, custom
  2286. The default mechanism for creating search strings and for doing the
  2287. actual search related to a file link may not work correctly in all
  2288. cases. For example, BibTeX database files have many entries like
  2289. @samp{year="1993"} which would not result in good search strings,
  2290. because the only unique identification for a BibTeX entry is the
  2291. citation key.
  2292. If you come across such a problem, you can write custom functions to set
  2293. the right search string for a particular file type, and to do the search
  2294. for the string in the file. Using @code{add-hook}, these functions need
  2295. to be added to the hook variables
  2296. @code{org-create-file-search-functions} and
  2297. @code{org-execute-file-search-functions}. See the docstring for these
  2298. variables for more information. Org actually uses this mechanism
  2299. for Bib@TeX{} database files, and you can use the corresponding code as
  2300. an implementation example. Search for @samp{BibTeX links} in the source
  2301. file.
  2302. @node TODO Items, Tags, Hyperlinks, Top
  2303. @chapter TODO Items
  2304. @cindex TODO items
  2305. Org mode does not maintain TODO lists as separate documents. Instead,
  2306. TODO items are an integral part of the notes file, because TODO items
  2307. usually come up while taking notes! With Org mode, simply mark any
  2308. entry in a tree as being a TODO item. In this way, information is not
  2309. duplicated, and the entire context from which the TODO item emerged is
  2310. always present.
  2311. Of course, this technique for managing TODO items scatters them
  2312. throughout your notes file. Org mode compensates for this by providing
  2313. methods to give you an overview of all the things that you have to do.
  2314. @menu
  2315. * TODO basics:: Marking and displaying TODO entries
  2316. * TODO extensions:: Workflow and assignments
  2317. * Progress logging:: Dates and notes for progress
  2318. * Priorities:: Some things are more important than others
  2319. * Breaking down tasks:: Splitting a task into manageable pieces
  2320. * Checkboxes:: Tick-off lists
  2321. @end menu
  2322. @node TODO basics, TODO extensions, TODO Items, TODO Items
  2323. @section Basic TODO functionality
  2324. Any headline becomes a TODO item when it starts with the word
  2325. @samp{TODO}, for example:
  2326. @example
  2327. *** TODO Write letter to Sam Fortune
  2328. @end example
  2329. @noindent
  2330. The most important commands to work with TODO entries are:
  2331. @table @kbd
  2332. @kindex C-c C-t
  2333. @cindex cycling, of TODO states
  2334. @item C-c C-t
  2335. Rotate the TODO state of the current item among
  2336. @example
  2337. ,-> (unmarked) -> TODO -> DONE --.
  2338. '--------------------------------'
  2339. @end example
  2340. The same rotation can also be done ``remotely'' from the timeline and
  2341. agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
  2342. @kindex C-u C-c C-t
  2343. @item C-u C-c C-t
  2344. Select a specific keyword using completion or (if it has been set up)
  2345. the fast selection interface. For the latter, you need to assign keys
  2346. to TODO states, see @ref{Per-file keywords} and @ref{Setting tags} for
  2347. more information.
  2348. @kindex S-@key{right}
  2349. @kindex S-@key{left}
  2350. @item S-@key{right}
  2351. @itemx S-@key{left}
  2352. Select the following/preceding TODO state, similar to cycling. Useful
  2353. mostly if more than two TODO states are possible (@pxref{TODO
  2354. extensions}).
  2355. @kindex C-c C-v
  2356. @kindex C-c / t
  2357. @cindex sparse tree, for TODO
  2358. @item C-c C-v
  2359. @itemx C-c / t
  2360. View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds
  2361. the entire buffer, but shows all TODO items and the headings hierarchy
  2362. above them. With a prefix argument, search for a specific TODO. You will be
  2363. prompted for the keyword, and you can also give a list of keywords like
  2364. @code{KWD1|KWD2|...}. With numeric prefix argument N, show the tree for the
  2365. Nth keyword in the variable @code{org-todo-keywords}. With two prefix
  2366. arguments, find all TODO and DONE entries.
  2367. @kindex C-c a t
  2368. @item C-c a t
  2369. Show the global TODO list. Collects the TODO items from all agenda
  2370. files (@pxref{Agenda Views}) into a single buffer. The new buffer will
  2371. be in @code{agenda-mode}, which provides commands to examine and
  2372. manipulate the TODO entries from the new buffer (@pxref{Agenda
  2373. commands}). @xref{Global TODO list}, for more information.
  2374. @kindex S-M-@key{RET}
  2375. @item S-M-@key{RET}
  2376. Insert a new TODO entry below the current one.
  2377. @end table
  2378. @node TODO extensions, Progress logging, TODO basics, TODO Items
  2379. @section Extended use of TODO keywords
  2380. @cindex extended TODO keywords
  2381. By default, marked TODO entries have one of only two states: TODO and
  2382. DONE. Org mode allows you to classify TODO items in more complex ways
  2383. with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With
  2384. special setup, the TODO keyword system can work differently in different
  2385. files.
  2386. Note that @i{tags} are another way to classify headlines in general and
  2387. TODO items in particular (@pxref{Tags}).
  2388. @menu
  2389. * Workflow states:: From TODO to DONE in steps
  2390. * TODO types:: I do this, Fred does the rest
  2391. * Multiple sets in one file:: Mixing it all, and still finding your way
  2392. * Fast access to TODO states:: Single letter selection of a state
  2393. * Per-file keywords:: Different files, different requirements
  2394. * Faces for TODO keywords:: Highlighting states
  2395. @end menu
  2396. @node Workflow states, TODO types, TODO extensions, TODO extensions
  2397. @subsection TODO keywords as workflow states
  2398. @cindex TODO workflow
  2399. @cindex workflow states as TODO keywords
  2400. You can use TODO keywords to indicate different @emph{sequential} states
  2401. in the process of working on an item, for example@footnote{Changing
  2402. this variable only becomes effective after restarting Org mode in a
  2403. buffer.}:
  2404. @lisp
  2405. (setq org-todo-keywords
  2406. '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
  2407. @end lisp
  2408. The vertical bar separates the TODO keywords (states that @emph{need
  2409. action}) from the DONE states (which need @emph{no further action}. If
  2410. you don't provide the separator bar, the last state is used as the DONE
  2411. state.
  2412. @cindex completion, of TODO keywords
  2413. With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
  2414. to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. You may
  2415. also use a numeric prefix argument to quickly select a specific state. For
  2416. example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
  2417. Or you can use @kbd{S-left} to go backward through the sequence. If you
  2418. define many keywords, you can use in-buffer completion
  2419. (@pxref{Completion}) or even a special one-key selection scheme
  2420. (@pxref{Fast access to TODO states}) to insert these words into the
  2421. buffer. Changing a TODO state can be logged with a timestamp, see
  2422. @ref{Tracking TODO state changes} for more information.
  2423. @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
  2424. @subsection TODO keywords as types
  2425. @cindex TODO types
  2426. @cindex names as TODO keywords
  2427. @cindex types as TODO keywords
  2428. The second possibility is to use TODO keywords to indicate different
  2429. @emph{types} of action items. For example, you might want to indicate
  2430. that items are for ``work'' or ``home''. Or, when you work with several
  2431. people on a single project, you might want to assign action items
  2432. directly to persons, by using their names as TODO keywords. This would
  2433. be set up like this:
  2434. @lisp
  2435. (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
  2436. @end lisp
  2437. In this case, different keywords do not indicate a sequence, but rather
  2438. different types. So the normal work flow would be to assign a task to a
  2439. person, and later to mark it DONE. Org mode supports this style by adapting
  2440. the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
  2441. @kbd{t} command in the timeline and agenda buffers.}. When used several
  2442. times in succession, it will still cycle through all names, in order to first
  2443. select the right type for a task. But when you return to the item after some
  2444. time and execute @kbd{C-c C-t} again, it will switch from any name directly
  2445. to DONE. Use prefix arguments or completion to quickly select a specific
  2446. name. You can also review the items of a specific TODO type in a sparse tree
  2447. by using a numeric prefix to @kbd{C-c C-v}. For example, to see all things
  2448. Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect Lucy's items
  2449. from all agenda files into a single buffer, you would use the numeric prefix
  2450. argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
  2451. @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
  2452. @subsection Multiple keyword sets in one file
  2453. @cindex TODO keyword sets
  2454. Sometimes you may want to use different sets of TODO keywords in
  2455. parallel. For example, you may want to have the basic
  2456. @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
  2457. separate state indicating that an item has been canceled (so it is not
  2458. DONE, but also does not require action). Your setup would then look
  2459. like this:
  2460. @lisp
  2461. (setq org-todo-keywords
  2462. '((sequence "TODO" "|" "DONE")
  2463. (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
  2464. (sequence "|" "CANCELED")))
  2465. @end lisp
  2466. The keywords should all be different, this helps Org mode to keep track
  2467. of which subsequence should be used for a given entry. In this setup,
  2468. @kbd{C-c C-t} only operates within a subsequence, so it switches from
  2469. @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
  2470. (nothing) to @code{REPORT}. Therefore you need a mechanism to initially
  2471. select the correct sequence. Besides the obvious ways like typing a
  2472. keyword or using completion, you may also apply the following commands:
  2473. @table @kbd
  2474. @kindex C-S-@key{right}
  2475. @kindex C-S-@key{left}
  2476. @item C-S-@key{right}
  2477. @itemx C-S-@key{left}
  2478. These keys jump from one TODO subset to the next. In the above example,
  2479. @kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
  2480. @code{REPORT}, and any of the words in the second row to @code{CANCELED}.
  2481. @kindex S-@key{right}
  2482. @kindex S-@key{left}
  2483. @item S-@key{right}
  2484. @itemx S-@key{left}
  2485. @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
  2486. @emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
  2487. would switch from @code{DONE} to @code{REPORT} in the example above.
  2488. @end table
  2489. @node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
  2490. @subsection Fast access to TODO states
  2491. If you would like to quickly change an entry to an arbitrary TODO state
  2492. instead of cycling through the states, you can set up keys for
  2493. single-letter access to the states. This is done by adding the section
  2494. key after each keyword, in parenthesis. For example:
  2495. @lisp
  2496. (setq org-todo-keywords
  2497. '((sequence "TODO(t)" "|" "DONE(d)")
  2498. (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
  2499. (sequence "|" "CANCELED(c)")))
  2500. @end lisp
  2501. If you then press @code{C-u C-c C-t} followed by the selection key, the
  2502. entry will be switched to this state. @key{SPC} can be used to remove
  2503. any TODO keyword from an entry. Should you like this way of selecting
  2504. TODO states a lot, you might want to set the variable
  2505. @code{org-use-fast-todo-selection} to @code{t} and make this behavior
  2506. the default. Check also the variable
  2507. @code{org-fast-tag-selection-include-todo}, it allows to change the TODO
  2508. state through the tags interface (@pxref{Setting tags}), in case you
  2509. like to mingle the two concepts.
  2510. @node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
  2511. @subsection Setting up keywords for individual files
  2512. @cindex keyword options
  2513. @cindex per-file keywords
  2514. It can be very useful to use different aspects of the TODO mechanism in
  2515. different files. For file-local settings, you need to add special lines
  2516. to the file which set the keywords and interpretation for that file
  2517. only. For example, to set one of the two examples discussed above, you
  2518. need one of the following lines, starting in column zero anywhere in the
  2519. file:
  2520. @example
  2521. #+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
  2522. @end example
  2523. or
  2524. @example
  2525. #+TYP_TODO: Fred Sara Lucy Mike | DONE
  2526. @end example
  2527. A setup for using several sets in parallel would be:
  2528. @example
  2529. #+SEQ_TODO: TODO | DONE
  2530. #+SEQ_TODO: REPORT BUG KNOWNCAUSE | FIXED
  2531. #+SEQ_TODO: | CANCELED
  2532. @end example
  2533. @cindex completion, of option keywords
  2534. @kindex M-@key{TAB}
  2535. @noindent To make sure you are using the correct keyword, type
  2536. @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
  2537. @cindex DONE, final TODO keyword
  2538. Remember that the keywords after the vertical bar (or the last keyword
  2539. if no bar is there) must always mean that the item is DONE (although you
  2540. may use a different word). After changing one of these lines, use
  2541. @kbd{C-c C-c} with the cursor still in the line to make the changes
  2542. known to Org mode@footnote{Org mode parses these lines only when
  2543. Org mode is activated after visiting a file. @kbd{C-c C-c} with the
  2544. cursor in a line starting with @samp{#+} is simply restarting Org mode
  2545. for the current buffer.}.
  2546. @node Faces for TODO keywords, , Per-file keywords, TODO extensions
  2547. @subsection Faces for TODO keywords
  2548. @cindex faces, for TODO keywords
  2549. Org mode highlights TODO keywords with special faces: @code{org-todo}
  2550. for keywords indicating that an item still has to be acted upon, and
  2551. @code{org-done} for keywords indicating that an item is finished. If
  2552. you are using more than 2 different states, you might want to use
  2553. special faces for some of them. This can be done using the variable
  2554. @code{org-todo-keyword-faces}. For example:
  2555. @lisp
  2556. (setq org-todo-keyword-faces
  2557. '(("TODO" . org-warning)
  2558. ("DEFERRED" . shadow)
  2559. ("CANCELED" . (:foreground "blue" :weight bold))))
  2560. @end lisp
  2561. While using a list with face properties as shown for CANCELED
  2562. @emph{should} work, this does not aways seem to be the case. If
  2563. necessary, define a special face and use that.
  2564. @page
  2565. @node Progress logging, Priorities, TODO extensions, TODO Items
  2566. @section Progress logging
  2567. @cindex progress logging
  2568. @cindex logging, of progress
  2569. Org mode can automatically record a time stamp and possibly a note when
  2570. you mark a TODO item as DONE, or even each time you change the state of
  2571. a TODO item. This system is highly configurable, settings can be on a
  2572. per-keyword basis and can be localized to a file or even a subtree. For
  2573. information on how to clock working time for a task, see @ref{Clocking
  2574. work time}.
  2575. @menu
  2576. * Closing items:: When was this entry marked DONE?
  2577. * Tracking TODO state changes:: When did the status change?
  2578. @end menu
  2579. @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
  2580. @subsection Closing items
  2581. The most basic logging is to keep track of @emph{when} a certain TODO
  2582. item was finished. This is achieved with@footnote{The corresponding
  2583. in-buffer setting is: @code{#+STARTUP: logdone}}.
  2584. @lisp
  2585. (setq org-log-done 'time)
  2586. @end lisp
  2587. @noindent
  2588. Then each time you turn an entry from a TODO (not-done) state into any
  2589. of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
  2590. just after the headline. If you turn the entry back into a TODO item
  2591. through further state cycling, that line will be removed again. If you
  2592. want to record a note along with the timestamp, use@footnote{The
  2593. corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
  2594. @lisp
  2595. (setq org-log-done 'note)
  2596. @end lisp
  2597. @noindent
  2598. You will then be prompted for a note, and that note will be stored below
  2599. the entry with a @samp{Closing Note} heading.
  2600. In the timeline (@pxref{Timeline}) and in the agenda
  2601. (@pxref{Weekly/daily agenda}), you can then use the @kbd{l} key to
  2602. display the TODO items with a @samp{CLOSED} timestamp on each day,
  2603. giving you an overview of what has been done.
  2604. @node Tracking TODO state changes, , Closing items, Progress logging
  2605. @subsection Tracking TODO state changes
  2606. When TODO keywords are used as workflow states (@pxref{Workflow
  2607. states}), you might want to keep track of when a state change occurred
  2608. and maybe take a note about this change. Since it is normally too much
  2609. to record a note for every state, Org mode expects configuration on a
  2610. per-keyword basis for this. This is achieved by adding special markers
  2611. @samp{!} (for a time stamp) and @samp{@@} (for a note) in parenthesis
  2612. after each keyword. For example, with the setting
  2613. @lisp
  2614. (setq org-todo-keywords
  2615. '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
  2616. @end lisp
  2617. @noindent
  2618. you not only define global TODO keywords and fast access keys, but also
  2619. request that a time is recorded when the entry is turned into
  2620. DONE@footnote{It is possible that Org mode will record two time stamps
  2621. when you are using both @code{org-log-done} and state change logging.
  2622. However, it will never prompt for two notes - if you have configured
  2623. both, the state change recording note will take precedence and cancel
  2624. the @samp{Closing Note}.}, and that a note is recorded when switching to
  2625. WAIT or CANCELED. The setting for WAIT is even more special: The
  2626. @samp{!} after the slash means that in addition to the note taken when
  2627. entering the state, a time stamp should be recorded when @i{leaving} the
  2628. WAIT state, if and only if the @i{target} state does not configure
  2629. logging for entering it. So it has no effect when switching from WAIT
  2630. to DONE, because DONE is configured to record a timestamp only. But
  2631. when switching from WAIT back to TODO, the @samp{/!} in the WAIT
  2632. setting now triggers a timestamp even though TODO has no logging
  2633. configured.
  2634. You can use the exact same syntax for setting logging preferences local
  2635. to a buffer:
  2636. @example
  2637. #+SEQ_TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
  2638. @end example
  2639. In order to define logging settings that are local to a subtree or a
  2640. single item, define a LOGGING property in this entry. Any non-empty
  2641. LOGGING property resets all logging settings to nil. You may then turn
  2642. on logging for this specific tree using STARTUP keywords like
  2643. @code{lognotedone} or @code{logrepeat}, as well as adding state specific
  2644. settings like @code{TODO(!)}. For example
  2645. @example
  2646. * TODO Log each state with only a time
  2647. :PROPERTIES:
  2648. :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
  2649. :END:
  2650. * TODO Only log when switching to WAIT, and when repeating
  2651. :PROPERTIES:
  2652. :LOGGING: WAIT(@@) logrepeat
  2653. :END:
  2654. * TODO No logging at all
  2655. :PROPERTIES:
  2656. :LOGGING: nil
  2657. :END:
  2658. @end example
  2659. @node Priorities, Breaking down tasks, Progress logging, TODO Items
  2660. @section Priorities
  2661. @cindex priorities
  2662. If you use Org mode extensively, you may end up enough TODO items that
  2663. it starts to make sense to prioritize them. Prioritizing can be done by
  2664. placing a @emph{priority cookie} into the headline of a TODO item, like
  2665. this
  2666. @example
  2667. *** TODO [#A] Write letter to Sam Fortune
  2668. @end example
  2669. @noindent
  2670. By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
  2671. @samp{C}. @samp{A} is the highest priority. An entry without a cookie
  2672. is treated as priority @samp{B}. Priorities make a difference only in
  2673. the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have
  2674. no inherent meaning to Org mode.
  2675. Priorities can be attached to any outline tree entries; they do not need
  2676. to be TODO items.
  2677. @table @kbd
  2678. @kindex @kbd{C-c ,}
  2679. @item @kbd{C-c ,}
  2680. Set the priority of the current headline. The command prompts for a
  2681. priority character @samp{A}, @samp{B} or @samp{C}. When you press
  2682. @key{SPC} instead, the priority cookie is removed from the headline.
  2683. The priorities can also be changed ``remotely'' from the timeline and
  2684. agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
  2685. @c
  2686. @kindex S-@key{up}
  2687. @kindex S-@key{down}
  2688. @item S-@key{up}
  2689. @itemx S-@key{down}
  2690. Increase/decrease priority of current headline@footnote{See also the
  2691. option @code{org-priority-start-cycle-with-default'}.}. Note that these
  2692. keys are also used to modify time stamps (@pxref{Creating timestamps}).
  2693. Furthermore, these keys are also used by CUA mode (@pxref{Conflicts}).
  2694. @end table
  2695. You can change the range of allowed priorities by setting the variables
  2696. @code{org-highest-priority}, @code{org-lowest-priority}, and
  2697. @code{org-default-priority}. For an individual buffer, you may set
  2698. these values (highest, lowest, default) like this (please make sure that
  2699. the highest priority is earlier in the alphabet than the lowest
  2700. priority):
  2701. @example
  2702. #+PRIORITIES: A C B
  2703. @end example
  2704. @node Breaking down tasks, Checkboxes, Priorities, TODO Items
  2705. @section Breaking tasks down into subtasks
  2706. @cindex tasks, breaking down
  2707. It is often advisable to break down large tasks into smaller, manageable
  2708. subtasks. You can do this by creating an outline tree below a TODO
  2709. item, with detailed subtasks on the tree@footnote{To keep subtasks out
  2710. of the global TODO list, see the
  2711. @code{org-agenda-todo-list-sublevels}.}. Another possibility is the use
  2712. of checkboxes to identify (a hierarchy of) a large number of subtasks
  2713. (@pxref{Checkboxes}).
  2714. @node Checkboxes, , Breaking down tasks, TODO Items
  2715. @section Checkboxes
  2716. @cindex checkboxes
  2717. Every item in a plain list (@pxref{Plain lists}) can be made into a
  2718. checkbox by starting it with the string @samp{[ ]}. This feature is
  2719. similar to TODO items (@pxref{TODO Items}), but is more lightweight.
  2720. Checkboxes are not included into the global TODO list, so they are often
  2721. great to split a task into a number of simple steps. Or you can use
  2722. them in a shopping list. To toggle a checkbox, use @kbd{C-c C-c}, or
  2723. use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
  2724. Here is an example of a checkbox list.
  2725. @example
  2726. * TODO Organize party [2/4]
  2727. - [-] call people [1/3]
  2728. - [ ] Peter
  2729. - [X] Sarah
  2730. - [ ] Sam
  2731. - [X] order food
  2732. - [ ] think about what music to play
  2733. - [X] talk to the neighbors
  2734. @end example
  2735. Checkboxes work hierarchically, so if a checkbox item has children that
  2736. are checkboxes, toggling one of the children checkboxes will make the
  2737. parent checkbox reflect if none, some, or all of the children are
  2738. checked.
  2739. @cindex statistics, for checkboxes
  2740. @cindex checkbox statistics
  2741. The @samp{[2/4]} and @samp{[1/3]} in the first and second line are
  2742. cookies indicating how many checkboxes present in this entry have been
  2743. checked off, and the total number of checkboxes are present. This can
  2744. give you an idea on how many checkboxes remain, even without opening a
  2745. folded entry. The cookies can be placed into a headline or into (the
  2746. first line of) a plain list item. Each cookie covers all checkboxes
  2747. structurally below the headline/item on which the cookie appear. You
  2748. have to insert the cookie yourself by typing either @samp{[/]} or
  2749. @samp{[%]}. With @samp{[/]} you get an @samp{n out of m} result, as in
  2750. the examples above. With @samp{[%]} you get information about the
  2751. percentage of checkboxes checked (in the above example, this would be
  2752. @samp{[50%]} and @samp{[33%]}, respectively).
  2753. @noindent The following commands work with checkboxes:
  2754. @table @kbd
  2755. @kindex C-c C-c
  2756. @item C-c C-c
  2757. Toggle checkbox at point. With a prefix argument, set it to @samp{[-]},
  2758. which is considered to be an intermediate state.
  2759. @kindex C-c C-x C-b
  2760. @item C-c C-x C-b
  2761. Toggle checkbox at point.
  2762. @itemize @minus
  2763. @item
  2764. If there is an active region, toggle the first checkbox in the region
  2765. and set all remaining boxes to the same status as the first. If you
  2766. want to toggle all boxes in the region independently, use a prefix
  2767. argument.
  2768. @item
  2769. If the cursor is in a headline, toggle checkboxes in the region between
  2770. this headline and the next (so @emph{not} the entire subtree).
  2771. @item
  2772. If there is no active region, just toggle the checkbox at point.
  2773. @end itemize
  2774. @kindex M-S-@key{RET}
  2775. @item M-S-@key{RET}
  2776. Insert a new item with a checkbox.
  2777. This works only if the cursor is already in a plain list item
  2778. (@pxref{Plain lists}).
  2779. @kindex C-c #
  2780. @item C-c #
  2781. Update the checkbox statistics in the current outline entry. When
  2782. called with a @kbd{C-u} prefix, update the entire file. Checkbox
  2783. statistic cookies are updated automatically if you toggle checkboxes
  2784. with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}. If you
  2785. delete boxes or add/change them by hand, use this command to get things
  2786. back into synch. Or simply toggle any checkbox twice with @kbd{C-c C-c}.
  2787. @end table
  2788. @node Tags, Properties and Columns, TODO Items, Top
  2789. @chapter Tags
  2790. @cindex tags
  2791. @cindex headline tagging
  2792. @cindex matching, tags
  2793. @cindex sparse tree, tag based
  2794. An excellent way to implement labels and contexts for cross-correlating
  2795. information is to assign @i{tags} to headlines. Org mode has extensive
  2796. support for tags.
  2797. Every headline can contain a list of tags; they occur at the end of the
  2798. headline. Tags are normal words containing letters, numbers, @samp{_},
  2799. and @samp{@@}. Tags must be preceded and followed by a single colon,
  2800. e.g., @samp{:WORK:}. Several tags can be specified, as in
  2801. @samp{:work:URGENT:}.
  2802. @menu
  2803. * Tag inheritance:: Tags use the tree structure of the outline
  2804. * Setting tags:: How to assign tags to a headline
  2805. * Tag searches:: Searching for combinations of tags
  2806. @end menu
  2807. @node Tag inheritance, Setting tags, Tags, Tags
  2808. @section Tag inheritance
  2809. @cindex tag inheritance
  2810. @cindex inheritance, of tags
  2811. @cindex sublevels, inclusion into tags match
  2812. @i{Tags} make use of the hierarchical structure of outline trees. If a
  2813. heading has a certain tag, all subheadings will inherit the tag as
  2814. well. For example, in the list
  2815. @example
  2816. * Meeting with the French group :work:
  2817. ** Summary by Frank :boss:notes:
  2818. *** TODO Prepare slides for him :action:
  2819. @end example
  2820. @noindent
  2821. the final heading will have the tags @samp{:work:}, @samp{:boss:},
  2822. @samp{:notes:}, and @samp{:action:} even though the final heading is not
  2823. explicitly marked with those tags. When executing tag searches and
  2824. Org mode finds that a certain headline matches the search criterion, it
  2825. will not check any sublevel headline, assuming that these also match and
  2826. that the list of matches could become very long because of that. If you
  2827. do want the sublevels be tested and listed as well, you may set the
  2828. variable @code{org-tags-match-list-sublevels}. To limit tag inheritance
  2829. to specific tags, or to turn it off entirely, use the variable
  2830. @code{org-use-tag-inheritance}.
  2831. @node Setting tags, Tag searches, Tag inheritance, Tags
  2832. @section Setting tags
  2833. @cindex setting tags
  2834. @cindex tags, setting
  2835. @kindex M-@key{TAB}
  2836. Tags can simply be typed into the buffer at the end of a headline.
  2837. After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
  2838. also a special command for inserting tags:
  2839. @table @kbd
  2840. @kindex C-c C-c
  2841. @item C-c C-c
  2842. @cindex completion, of tags
  2843. Enter new tags for the current headline. Org mode will either offer
  2844. completion or a special single-key interface for setting tags, see
  2845. below. After pressing @key{RET}, the tags will be inserted and aligned
  2846. to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all
  2847. tags in the current buffer will be aligned to that column, just to make
  2848. things look nice. TAGS are automatically realigned after promotion,
  2849. demotion, and TODO state changes (@pxref{TODO basics}).
  2850. @end table
  2851. Org will support tag insertion based on a @emph{list of tags}. By
  2852. default this list is constructed dynamically, containing all tags
  2853. currently used in the buffer. You may also globally specify a hard list
  2854. of tags with the variable @code{org-tag-alist}. Finally you can set
  2855. the default tags for a given file with lines like
  2856. @example
  2857. #+TAGS: @@work @@home @@tennisclub
  2858. #+TAGS: laptop car pc sailboat
  2859. @end example
  2860. If you have globally defined your preferred set of tags using the
  2861. variable @code{org-tag-alist}, but would like to use a dynamic tag list
  2862. in a specific file, add an empty TAGS option line to that file:
  2863. @example
  2864. #+TAGS:
  2865. @end example
  2866. By default Org mode uses the standard minibuffer completion facilities for
  2867. entering tags. However, it also implements another, quicker, tag selection
  2868. method called @emph{fast tag selection}. This allows you to select and
  2869. deselect tags with just a single key press. For this to work well you should
  2870. assign unique letters to most of your commonly used tags. You can do this
  2871. globally by configuring the variable @code{org-tag-alist} in your
  2872. @file{.emacs} file. For example, you may find the need to tag many items in
  2873. different files with @samp{:@@home:}. In this case you can set something
  2874. like:
  2875. @lisp
  2876. (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
  2877. @end lisp
  2878. @noindent If the tag is only relevant to the file you are working on then you
  2879. can, instead, set the TAGS option line as:
  2880. @example
  2881. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
  2882. @end example
  2883. @noindent
  2884. You can also group together tags that are mutually exclusive. By using
  2885. braces, as in:
  2886. @example
  2887. #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
  2888. @end example
  2889. @noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
  2890. and @samp{@@tennisclub} should be selected. Multiple such groups are allowed.
  2891. @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
  2892. these lines to activate any changes.
  2893. @noindent
  2894. To set these mutually exclusive groups in the variable @code{org-mode-alist}
  2895. you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
  2896. of the braces. The previous example would be set globally by the following
  2897. configuration:
  2898. @lisp
  2899. (setq org-tag-alist '((:startgroup . nil)
  2900. ("@@work" . ?w) ("@@home" . ?h)
  2901. ("@@tennisclub" . ?t)
  2902. (:endgroup . nil)
  2903. ("laptop" . ?l) ("pc" . ?p)))
  2904. @end lisp
  2905. If at least one tag has a selection key then pressing @kbd{C-c C-c} will
  2906. automatically present you with a special interface, listing inherited tags,
  2907. the tags of the current headline, and a list of all valid tags with
  2908. corresponding keys@footnote{Keys will automatically be assigned to tags which
  2909. have no configured keys.}. In this interface, you can use the following
  2910. keys:
  2911. @table @kbd
  2912. @item a-z...
  2913. Pressing keys assigned to tags will add or remove them from the list of
  2914. tags in the current line. Selecting a tag in a group of mutually
  2915. exclusive tags will turn off any other tags from that group.
  2916. @kindex @key{TAB}
  2917. @item @key{TAB}
  2918. Enter a tag in the minibuffer, even if the tag is not in the predefined
  2919. list. You will be able to complete on all tags present in the buffer.
  2920. @kindex @key{SPC}
  2921. @item @key{SPC}
  2922. Clear all tags for this line.
  2923. @kindex @key{RET}
  2924. @item @key{RET}
  2925. Accept the modified set.
  2926. @item C-g
  2927. Abort without installing changes.
  2928. @item q
  2929. If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
  2930. @item !
  2931. Turn off groups of mutually exclusive tags. Use this to (as an
  2932. exception) assign several tags from such a group.
  2933. @item C-c
  2934. Toggle auto-exit after the next change (see below).
  2935. If you are using expert mode, the first @kbd{C-c} will display the
  2936. selection window.
  2937. @end table
  2938. @noindent
  2939. This method lets you assign tags to a headline with very few keys. With
  2940. the above setup, you could clear the current tags and set @samp{@@home},
  2941. @samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
  2942. C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to
  2943. @samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
  2944. alternatively with @kbd{C-c C-c C-c w}. Adding the non-predefined tag
  2945. @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
  2946. @key{RET} @key{RET}}.
  2947. If you find that most of the time, you need only a single key press to
  2948. modify your list of tags, set the variable
  2949. @code{org-fast-tag-selection-single-key}. Then you no longer have to
  2950. press @key{RET} to exit fast tag selection - it will immediately exit
  2951. after the first change. If you then occasionally need more keys, press
  2952. @kbd{C-c} to turn off auto-exit for the current tag selection process
  2953. (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
  2954. C-c}). If you set the variable to the value @code{expert}, the special
  2955. window is not even shown for single-key tag selection, it comes up only
  2956. when you press an extra @kbd{C-c}.
  2957. @node Tag searches, , Setting tags, Tags
  2958. @section Tag searches
  2959. @cindex tag searches
  2960. @cindex searching for tags
  2961. Once a system of tags has been set up, it can be used to collect related
  2962. information into special lists.
  2963. @table @kbd
  2964. @kindex C-c \
  2965. @kindex C-c / T
  2966. @item C-c \
  2967. @itemx C-c / T
  2968. Create a sparse tree with all headlines matching a tags search. With a
  2969. @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
  2970. @kindex C-c a m
  2971. @item C-c a m
  2972. Create a global list of tag matches from all agenda files.
  2973. @xref{Matching tags and properties}.
  2974. @kindex C-c a M
  2975. @item C-c a M
  2976. Create a global list of tag matches from all agenda files, but check
  2977. only TODO items and force checking subitems (see variable
  2978. @code{org-tags-match-list-sublevels}).
  2979. @end table
  2980. @cindex Boolean logic, for tag searches
  2981. A @i{tags} search string can use Boolean operators @samp{&} for AND and
  2982. @samp{|} for OR. @samp{&} binds more strongly than @samp{|}.
  2983. Parenthesis are currently not implemented. A tag may also be preceded
  2984. by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
  2985. positive selection. The AND operator @samp{&} is optional when @samp{+}
  2986. or @samp{-} is present. Examples:
  2987. @table @samp
  2988. @item +work-boss
  2989. Select headlines tagged @samp{:work:}, but discard those also tagged
  2990. @samp{:boss:}.
  2991. @item work|laptop
  2992. Selects lines tagged @samp{:work:} or @samp{:laptop:}.
  2993. @item work|laptop&night
  2994. Like before, but require the @samp{:laptop:} lines to be tagged also
  2995. @samp{:night:}.
  2996. @end table
  2997. @cindex TODO keyword matching, with tags search
  2998. If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
  2999. can be useful to also match on the TODO keyword. This can be done by
  3000. adding a condition after a slash to a tags match. The syntax is similar
  3001. to the tag matches, but should be applied with consideration: For
  3002. example, a positive selection on several TODO keywords can not
  3003. meaningfully be combined with boolean AND. However, @emph{negative
  3004. selection} combined with AND can be meaningful. To make sure that only
  3005. lines are checked that actually have any TODO keyword, use @kbd{C-c a
  3006. M}, or equivalently start the TODO part after the slash with @samp{!}.
  3007. Examples:
  3008. @table @samp
  3009. @item work/WAITING
  3010. Select @samp{:work:}-tagged TODO lines with the specific TODO
  3011. keyword @samp{WAITING}.
  3012. @item work/!-WAITING-NEXT
  3013. Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
  3014. nor @samp{NEXT}
  3015. @item work/+WAITING|+NEXT
  3016. Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
  3017. @samp{NEXT}.
  3018. @end table
  3019. @cindex regular expressions, with tags search
  3020. Any element of the tag/todo match can be a regular expression - in this
  3021. case it must be enclosed in curly braces. For example,
  3022. @samp{work+@{^boss.*@}} matches headlines that contain the tag
  3023. @samp{:work:} and any tag @i{starting} with @samp{boss}.
  3024. @cindex level, require for tags/property match
  3025. @cindex category, require for tags/property match
  3026. You can also require a headline to be of a certain level or category, by
  3027. writing instead of any TAG an expression like @samp{LEVEL=3} or
  3028. @samp{CATEGORY="work"}, respectively. For example, a search
  3029. @samp{+LEVEL=3+boss/-DONE} lists all level three headlines that have the
  3030. tag @samp{boss} and are @emph{not} marked with the TODO keyword DONE.
  3031. @node Properties and Columns, Dates and Times, Tags, Top
  3032. @chapter Properties and Columns
  3033. @cindex properties
  3034. Properties are a set of key-value pairs associated with an entry. There
  3035. are two main applications for properties in Org mode. First, properties
  3036. are like tags, but with a value. Second, you can use properties to
  3037. implement (very basic) database capabilities in an Org buffer. For
  3038. an example of the first application, imagine maintaining a file where
  3039. you document bugs and plan releases of a piece of software. Instead of
  3040. using tags like @code{:release_1:}, @code{:release_2:}, one can use a
  3041. property, say @code{:Release:}, that in different subtrees has different
  3042. values, such as @code{1.0} or @code{2.0}. For an example of the second
  3043. application of properties, imagine keeping track of your music CD's,
  3044. where properties could be things such as the album artist, date of
  3045. release, number of tracks, and so on.
  3046. Properties can be conveniently edited and viewed in column view
  3047. (@pxref{Column view}).
  3048. Properties are like tags, but with a value. For example, in a file
  3049. where you document bugs and plan releases of a piece of software,
  3050. instead of using tags like @code{:release_1:}, @code{:release_2:}, it
  3051. can be more efficient to use a property @code{:Release:} with a value
  3052. @code{1.0} or @code{2.0}. Second, you can use properties to implement
  3053. (very basic) database capabilities in an Org buffer, for example to
  3054. create a list of Music CD's you own. You can edit and view properties
  3055. conveniently in column view (@pxref{Column view}).
  3056. @menu
  3057. * Property syntax:: How properties are spelled out
  3058. * Special properties:: Access to other Org mode features
  3059. * Property searches:: Matching property values
  3060. * Property inheritance:: Passing values down the tree
  3061. * Column view:: Tabular viewing and editing
  3062. * Property API:: Properties for Lisp programmers
  3063. @end menu
  3064. @node Property syntax, Special properties, Properties and Columns, Properties and Columns
  3065. @section Property syntax
  3066. @cindex property syntax
  3067. @cindex drawer, for properties
  3068. Properties are key-value pairs. They need to be inserted into a special
  3069. drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property
  3070. is specified on a single line, with the key (surrounded by colons)
  3071. first, and the value after it. Here is an example:
  3072. @example
  3073. * CD collection
  3074. ** Classic
  3075. *** Goldberg Variations
  3076. :PROPERTIES:
  3077. :Title: Goldberg Variations
  3078. :Composer: J.S. Bach
  3079. :Artist: Glen Gould
  3080. :Publisher: Deutsche Grammphon
  3081. :NDisks: 1
  3082. :END:
  3083. @end example
  3084. You may define the allowed values for a particular property @samp{:Xyz:}
  3085. by setting a property @samp{:Xyz_ALL:}. This special property is
  3086. @emph{inherited}, so if you set it in a level 1 entry, it will apply to
  3087. the entire tree. When allowed values are defined, setting the
  3088. corresponding property becomes easier and is less prone to typing
  3089. errors. For the example with the CD collection, we can predefine
  3090. publishers and the number of disks in a box like this:
  3091. @example
  3092. * CD collection
  3093. :PROPERTIES:
  3094. :NDisks_ALL: 1 2 3 4
  3095. :Publisher_ALL: "Deutsche Grammophon" Phillips EMI
  3096. :END:
  3097. @end example
  3098. If you want to set properties that can be inherited by any entry in a
  3099. file, use a line like
  3100. @example
  3101. #+PROPERTY: NDisks_ALL 1 2 3 4
  3102. @end example
  3103. Property values set with the global variable
  3104. @code{org-global-properties} can be inherited by all entries in all
  3105. Org files.
  3106. @noindent
  3107. The following commands help to work with properties:
  3108. @table @kbd
  3109. @kindex M-@key{TAB}
  3110. @item M-@key{TAB}
  3111. After an initial colon in a line, complete property keys. All keys used
  3112. in the current file will be offered as possible completions.
  3113. @kindex C-c C-x p
  3114. @item C-c C-x p
  3115. Set a property. This prompts for a property name and a value. If
  3116. necessary, the property drawer is created as well.
  3117. @item M-x org-insert-property-drawer
  3118. Insert a property drawer into the current entry. The drawer will be
  3119. inserted early in the entry, but after the lines with planning
  3120. information like deadlines.
  3121. @kindex C-c C-c
  3122. @item C-c C-c
  3123. With the cursor in a property drawer, this executes property commands.
  3124. @item C-c C-c s
  3125. Set a property in the current entry. Both the property and the value
  3126. can be inserted using completion.
  3127. @kindex S-@key{right}
  3128. @kindex S-@key{left}
  3129. @item S-@key{left}/@key{right}
  3130. Switch property at point to the next/previous allowed value.
  3131. @item C-c C-c d
  3132. Remove a property from the current entry.
  3133. @item C-c C-c D
  3134. Globally remove a property, from all entries in the current file.
  3135. @item C-c C-c c
  3136. Compute the property at point, using the operator and scope from the
  3137. nearest column format definition.
  3138. @end table
  3139. @node Special properties, Property searches, Property syntax, Properties and Columns
  3140. @section Special properties
  3141. @cindex properties, special
  3142. Special properties provide alternative access method to Org mode
  3143. features discussed in the previous chapters, like the TODO state or the
  3144. priority of an entry. This interface exists so that you can include
  3145. these states into columns view (@pxref{Column view}), or to use them in
  3146. queries. The following property names are special and should not be
  3147. used as keys in the properties drawer:
  3148. @example
  3149. TODO @r{The TODO keyword of the entry.}
  3150. TAGS @r{The tags defined directly in the headline.}
  3151. ALLTAGS @r{All tags, including inherited ones.}
  3152. PRIORITY @r{The priority of the entry, a string with a single letter.}
  3153. DEADLINE @r{The deadline time string, without the angular brackets.}
  3154. SCHEDULED @r{The scheduling time stamp, without the angular brackets.}
  3155. TIMESTAMP @r{The first keyword-less time stamp in the entry.}
  3156. TIMESTAMP_IA @r{The first inactive time stamp in the entry.}
  3157. CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}}
  3158. @r{must be run first to compute the values.}
  3159. @end example
  3160. @node Property searches, Property inheritance, Special properties, Properties and Columns
  3161. @section Property searches
  3162. @cindex properties, searching
  3163. @cindex searching, of properties
  3164. To create sparse trees and special lists with selection based on
  3165. properties, the same commands are used as for tag searches (@pxref{Tag
  3166. searches}), and the same logic applies. For example, a search string
  3167. @example
  3168. +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort=""+With=@{Sarah\|Denny@}
  3169. @end example
  3170. @noindent
  3171. finds entries tagged @samp{:work:} but not @samp{:boss:}, which
  3172. also have a priority value @samp{A}, a @samp{:Coffee:} property with the
  3173. value @samp{unlimited}, an @samp{Effort} property that is undefined or
  3174. empty, and a @samp{:With:} property that is matched by
  3175. the regular expression @samp{Sarah\|Denny}.
  3176. You can configure Org mode to use property inheritance during a search,
  3177. see @ref{Property inheritance} for details.
  3178. There is also a special command for creating sparse trees based on a
  3179. single property:
  3180. @table @kbd
  3181. @kindex C-c / p
  3182. @item C-c / p
  3183. Create a sparse tree based on the value of a property. This first
  3184. prompts for the name of a property, and then for a value. A sparse tree
  3185. is created with all entries that define this property with the given
  3186. value. If you enclose the value into curly braces, it is interpreted as
  3187. a regular expression and matched against the property values.
  3188. @end table
  3189. @node Property inheritance, Column view, Property searches, Properties and Columns
  3190. @section Property Inheritance
  3191. @cindex properties, inheritance
  3192. @cindex inheritance, of properties
  3193. The outline structure of Org mode documents lends itself for an
  3194. inheritance model of properties: If the parent in a tree has a certain
  3195. property, the children can inherit this property. Org mode does not
  3196. turn this on by default, because it can slow down property searches
  3197. significantly and is often not needed. However, if you find inheritance
  3198. useful, you can turn it on by setting the variable
  3199. @code{org-use-property-inheritance}. It may be set to @code{t}, to make
  3200. all properties inherited from the parent, to a list of properties
  3201. that should be inherited, or to a regular expression that matches
  3202. inherited properties.
  3203. Org mode has a few properties for which inheritance is hard-coded, at
  3204. least for the special applications for which they are used:
  3205. @table @code
  3206. @item COLUMNS
  3207. The @code{:COLUMNS:} property defines the format of column view
  3208. (@pxref{Column view}). It is inherited in the sense that the level
  3209. where a @code{:COLUMNS:} property is defined is used as the starting
  3210. point for a column view table, independently of the location in the
  3211. subtree from where columns view is turned on.
  3212. @item CATEGORY
  3213. For agenda view, a category set through a @code{:CATEGORY:} property
  3214. applies to the entire subtree.
  3215. @item ARCHIVE
  3216. For archiving, the @code{:ARCHIVE:} property may define the archive
  3217. location for the entire subtree (@pxref{Moving subtrees}).
  3218. @item LOGGING
  3219. The LOGGING property may define logging settings for an entry or a
  3220. subtree (@pxref{Tracking TODO state changes}).
  3221. @end table
  3222. @node Column view, Property API, Property inheritance, Properties and Columns
  3223. @section Column view
  3224. A great way to view and edit properties in an outline tree is
  3225. @emph{column view}. In column view, each outline item is turned into a
  3226. table row. Columns in this table provide access to properties of the
  3227. entries. Org mode implements columns by overlaying a tabular structure
  3228. over the headline of each item. While the headlines have been turned
  3229. into a table row, you can still change the visibility of the outline
  3230. tree. For example, you get a compact table by switching to CONTENTS
  3231. view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
  3232. is active), but you can still open, read, and edit the entry below each
  3233. headline. Or, you can switch to column view after executing a sparse
  3234. tree command and in this way get a table only for the selected items.
  3235. Column view also works in agenda buffers (@pxref{Agenda Views}) where
  3236. queries have collected selected items, possibly from a number of files.
  3237. @menu
  3238. * Defining columns:: The COLUMNS format property
  3239. * Using column view:: How to create and use column view
  3240. * Capturing column view:: A dynamic block for column view
  3241. @end menu
  3242. @node Defining columns, Using column view, Column view, Column view
  3243. @subsection Defining columns
  3244. @cindex column view, for properties
  3245. @cindex properties, column view
  3246. Setting up a column view first requires defining the columns. This is
  3247. done by defining a column format line.
  3248. @menu
  3249. * Scope of column definitions:: Where defined, where valid?
  3250. * Column attributes:: Appearance and content of a column
  3251. @end menu
  3252. @node Scope of column definitions, Column attributes, Defining columns, Defining columns
  3253. @subsubsection Scope of column definitions
  3254. To define a column format for an entire file, use a line like
  3255. @example
  3256. #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  3257. @end example
  3258. To specify a format that only applies to a specific tree, add a
  3259. @code{:COLUMNS:} property to the top node of that tree, for example:
  3260. @example
  3261. ** Top node for columns view
  3262. :PROPERTIES:
  3263. :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  3264. :END:
  3265. @end example
  3266. If a @code{:COLUMNS:} property is present in an entry, it defines columns
  3267. for the entry itself, and for the entire subtree below it. Since the
  3268. column definition is part of the hierarchical structure of the document,
  3269. you can define columns on level 1 that are general enough for all
  3270. sublevels, and more specific columns further down, when you edit a
  3271. deeper part of the tree.
  3272. @node Column attributes, , Scope of column definitions, Defining columns
  3273. @subsubsection Column attributes
  3274. A column definition sets the attributes of a column. The general
  3275. definition looks like this:
  3276. @example
  3277. %[width]property[(title)][@{summary-type@}]
  3278. @end example
  3279. @noindent
  3280. Except for the percent sign and the property name, all items are
  3281. optional. The individual parts have the following meaning:
  3282. @example
  3283. width @r{An integer specifying the width of the column in characters.}
  3284. @r{If omitted, the width will be determined automatically.}
  3285. property @r{The property that should be edited in this column.}
  3286. (title) @r{The header text for the column. If omitted, the}
  3287. @r{property name is used.}
  3288. @{summary-type@} @r{The summary type. If specified, the column values for}
  3289. @r{parent nodes are computed from the children.}
  3290. @r{Supported summary types are:}
  3291. @{+@} @r{Sum numbers in this column.}
  3292. @{+;%.1f@} @r{Like @samp{+}, but format result with @samp{%.1f}.}
  3293. @{$@} @r{Currency, short for @samp{+;%.2f}.}
  3294. @{:@} @r{Sum times, HH:MM:SS, plain numbers are hours.}
  3295. @{X@} @r{Checkbox status, [X] if all children are [X].}
  3296. @{X/@} @r{Checkbox status, [n/m].}
  3297. @{X%@} @r{Checkbox status, [n%].}
  3298. @end example
  3299. @noindent
  3300. Here is an example for a complete columns definition, along with allowed
  3301. values.
  3302. @example
  3303. :COLUMNS: %20ITEM %9Approved(Approved?)@{X@} %Owner %11Status \@footnote{Please note that the COLUMNS definition must be on a single line - it is wrapped here only because of formatting constraints.}
  3304. %10Time_Estimate@{:@} %CLOCKSUM
  3305. :Owner_ALL: Tammy Mark Karl Lisa Don
  3306. :Status_ALL: "In progress" "Not started yet" "Finished" ""
  3307. :Approved_ALL: "[ ]" "[X]"
  3308. @end example
  3309. The first column, @samp{%25ITEM}, means the first 25 characters of the
  3310. item itself, i.e. of the headline. You probably always should start the
  3311. column definition with the @samp{ITEM} specifier. The other specifiers
  3312. create columns @samp{Owner} with a list of names as allowed values, for
  3313. @samp{Status} with four different possible values, and for a checkbox
  3314. field @samp{Approved}. When no width is given after the @samp{%}
  3315. character, the column will be exactly as wide as it needs to be in order
  3316. to fully display all values. The @samp{Approved} column does have a
  3317. modified title (@samp{Approved?}, with a question mark). Summaries will
  3318. be created for the @samp{Time_Estimate} column by adding time duration
  3319. expressions like HH:MM, and for the @samp{Approved} column, by providing
  3320. an @samp{[X]} status if all children have been checked. The
  3321. @samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
  3322. in the subtree.
  3323. @node Using column view, Capturing column view, Defining columns, Column view
  3324. @subsection Using column view
  3325. @table @kbd
  3326. @tsubheading{Turning column view on and off}
  3327. @kindex C-c C-x C-c
  3328. @item C-c C-x C-c
  3329. Create the column view for the local environment. This command searches
  3330. the hierarchy, up from point, for a @code{:COLUMNS:} property that defines
  3331. a format. When one is found, the column view table is established for
  3332. the entire tree, starting from the entry that contains the @code{:COLUMNS:}
  3333. property. If none is found, the format is taken from the @code{#+COLUMNS}
  3334. line or from the variable @code{org-columns-default-format}, and column
  3335. view is established for the current entry and its subtree.
  3336. @kindex r
  3337. @item r
  3338. Recreate the column view, to include recent changes made in the buffer.
  3339. @kindex g
  3340. @item g
  3341. Same as @kbd{r}.
  3342. @kindex q
  3343. @item q
  3344. Exit column view.
  3345. @tsubheading{Editing values}
  3346. @item @key{left} @key{right} @key{up} @key{down}
  3347. Move through the column view from field to field.
  3348. @kindex S-@key{left}
  3349. @kindex S-@key{right}
  3350. @item S-@key{left}/@key{right}
  3351. Switch to the next/previous allowed value of the field. For this, you
  3352. have to have specified allowed values for a property.
  3353. @kindex n
  3354. @kindex p
  3355. @itemx n / p
  3356. Same as @kbd{S-@key{left}/@key{right}}
  3357. @kindex e
  3358. @item e
  3359. Edit the property at point. For the special properties, this will
  3360. invoke the same interface that you normally use to change that
  3361. property. For example, when editing a TAGS property, the tag completion
  3362. or fast selection interface will pop up.
  3363. @kindex C-c C-c
  3364. @item C-c C-c
  3365. When there is a checkbox at point, toggle it.
  3366. @kindex v
  3367. @item v
  3368. View the full value of this property. This is useful if the width of
  3369. the column is smaller than that of the value.
  3370. @kindex a
  3371. @item a
  3372. Edit the list of allowed values for this property. If the list is found
  3373. in the hierarchy, the modified values is stored there. If no list is
  3374. found, the new value is stored in the first entry that is part of the
  3375. current column view.
  3376. @tsubheading{Modifying the table structure}
  3377. @kindex <
  3378. @kindex >
  3379. @item < / >
  3380. Make the column narrower/wider by one character.
  3381. @kindex S-M-@key{right}
  3382. @item S-M-@key{right}
  3383. Insert a new column, to the right of the current column.
  3384. @kindex S-M-@key{left}
  3385. @item S-M-@key{left}
  3386. Delete the current column.
  3387. @end table
  3388. @node Capturing column view, , Using column view, Column view
  3389. @subsection Capturing column view
  3390. Since column view is just an overlay over a buffer, it cannot be
  3391. exported or printed directly. If you want to capture a column view, use
  3392. this @code{columnview} dynamic block (@pxref{Dynamic blocks}). The frame
  3393. of this block looks like this:
  3394. @example
  3395. * The column view
  3396. #+BEGIN: columnview :hlines 1 :id "label"
  3397. #+END:
  3398. @end example
  3399. @noindent This dynamic block has the following parameters:
  3400. @table @code
  3401. @item :id
  3402. This is most important parameter. Column view is a feature that is
  3403. often localized to a certain (sub)tree, and the capture block might be
  3404. in a different location in the file. To identify the tree whose view to
  3405. capture, you can use 3 values:
  3406. @example
  3407. local @r{use the tree in which the capture block is located}
  3408. global @r{make a global view, including all headings in the file}
  3409. "label" @r{call column view in the tree that has and @code{:ID:}}
  3410. @r{property with the value @i{label}}
  3411. @end example
  3412. @item :hlines
  3413. When @code{t}, insert a hline after every line. When a number N, insert
  3414. a hline before each headline with level @code{<= N}.
  3415. @item :vlines
  3416. When set to @code{t}, enforce column groups to get vertical lines.
  3417. @item :maxlevel
  3418. When set to a number, don't capture entries below this level.
  3419. @item :skip-empty-rows
  3420. When set to @code{t}, skip row where the only non-empty specifier of the
  3421. column view is @code{ITEM}.
  3422. @end table
  3423. @noindent
  3424. The following commands insert or update the dynamic block:
  3425. @table @kbd
  3426. @kindex C-c C-x r
  3427. @item C-c C-x r
  3428. Insert a dynamic block capturing a column view. You will be prompted
  3429. for the scope or id of the view.
  3430. @kindex C-c C-c
  3431. @item C-c C-c
  3432. @kindex C-c C-x C-u
  3433. @itemx C-c C-x C-u
  3434. Update dynamical block at point. The cursor needs to be in the
  3435. @code{#+BEGIN} line of the dynamic block.
  3436. @kindex C-u C-c C-x C-u
  3437. @item C-u C-c C-x C-u
  3438. Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
  3439. you have several clock table blocks in a buffer.
  3440. @end table
  3441. @node Property API, , Column view, Properties and Columns
  3442. @section The Property API
  3443. @cindex properties, API
  3444. @cindex API, for properties
  3445. There is a full API for accessing and changing properties. This API can
  3446. be used by Emacs Lisp programs to work with properties and to implement
  3447. features based on them. For more information see @ref{Using the
  3448. property API}.
  3449. @node Dates and Times, Remember, Properties and Columns, Top
  3450. @chapter Dates and Times
  3451. @cindex dates
  3452. @cindex times
  3453. @cindex time stamps
  3454. @cindex date stamps
  3455. To assist project planning, TODO items can be labeled with a date and/or
  3456. a time. The specially formatted string carrying the date and time
  3457. information is called a @emph{timestamp} in Org mode. This may be a
  3458. little confusing because timestamp is often used as indicating when
  3459. something was created or last changed. However, in Org mode this term
  3460. is used in a much wider sense.
  3461. @menu
  3462. * Timestamps:: Assigning a time to a tree entry
  3463. * Creating timestamps:: Commands which insert timestamps
  3464. * Deadlines and scheduling:: Planning your work
  3465. * Clocking work time:: Tracking how long you spend on a task
  3466. @end menu
  3467. @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
  3468. @section Timestamps, deadlines and scheduling
  3469. @cindex time stamps
  3470. @cindex ranges, time
  3471. @cindex date stamps
  3472. @cindex deadlines
  3473. @cindex scheduling
  3474. A time stamp is a specification of a date (possibly with time or a range
  3475. of times) in a special format, either @samp{<2003-09-16 Tue>} or
  3476. @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
  3477. 12:00-12:30>}@footnote{This is the standard ISO date/time format. To
  3478. use an alternative format, see @ref{Custom time format}.}. A time stamp
  3479. can appear anywhere in the headline or body of an Org tree entry. Its
  3480. presence causes entries to be shown on specific dates in the agenda
  3481. (@pxref{Weekly/daily agenda}). We distinguish:
  3482. @table @var
  3483. @item Plain time stamp; Event; Appointment
  3484. @cindex timestamp
  3485. A simple time stamp just assigns a date/time to an item. This is just
  3486. like writing down an appointment or event in a paper agenda. In the
  3487. timeline and agenda displays, the headline of an entry associated with a
  3488. plain time stamp will be shown exactly on that date.
  3489. @example
  3490. * Meet Peter at the movies <2006-11-01 Wed 19:15>
  3491. * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
  3492. @end example
  3493. @item Time stamp with repeater interval
  3494. @cindex timestamp, with repeater interval
  3495. A time stamp may contain a @emph{repeater interval}, indicating that it
  3496. applies not only on the given date, but again and again after a certain
  3497. interval of N days (d), weeks (w), months(m), or years(y). The
  3498. following will show up in the agenda every Wednesday:
  3499. @example
  3500. * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
  3501. @end example
  3502. @item Diary-style sexp entries
  3503. For more complex date specifications, Org mode supports using the
  3504. special sexp diary entries implemented in the Emacs calendar/diary
  3505. package. For example
  3506. @example
  3507. * The nerd meeting on every 2nd Thursday of the month
  3508. <%%(diary-float t 4 2)>
  3509. @end example
  3510. @item Time/Date range
  3511. @cindex timerange
  3512. @cindex date range
  3513. Two time stamps connected by @samp{--} denote a range. The headline
  3514. will be shown on the first and last day of the range, and on any dates
  3515. that are displayed and fall in the range. Here is an example:
  3516. @example
  3517. ** Meeting in Amsterdam
  3518. <2004-08-23 Mon>--<2004-08-26 Thu>
  3519. @end example
  3520. @item Inactive time stamp
  3521. @cindex timestamp, inactive
  3522. @cindex inactive timestamp
  3523. Just like a plain time stamp, but with square brackets instead of
  3524. angular ones. These time stamps are inactive in the sense that they do
  3525. @emph{not} trigger an entry to show up in the agenda.
  3526. @example
  3527. * Gillian comes late for the fifth time [2006-11-01 Wed]
  3528. @end example
  3529. @end table
  3530. @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
  3531. @section Creating timestamps
  3532. @cindex creating timestamps
  3533. @cindex timestamps, creating
  3534. For Org mode to recognize time stamps, they need to be in the specific
  3535. format. All commands listed below produce time stamps in the correct
  3536. format.
  3537. @table @kbd
  3538. @kindex C-c .
  3539. @item C-c .
  3540. Prompt for a date and insert a corresponding time stamp. When the
  3541. cursor is at a previously used time stamp, it is updated to NOW. When
  3542. this command is used twice in succession, a time range is inserted.
  3543. @c
  3544. @kindex C-u C-c .
  3545. @item C-u C-c .
  3546. Like @kbd{C-c .}, but use the alternative format which contains date
  3547. and time. The default time can be rounded to multiples of 5 minutes,
  3548. see the option @code{org-time-stamp-rounding-minutes}.
  3549. @c
  3550. @kindex C-c !
  3551. @item C-c !
  3552. Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
  3553. an agenda entry.
  3554. @c
  3555. @kindex C-c <
  3556. @item C-c <
  3557. Insert a time stamp corresponding to the cursor date in the Calendar.
  3558. @c
  3559. @kindex C-c >
  3560. @item C-c >
  3561. Access the Emacs calendar for the current date. If there is a
  3562. timestamp in the current line, go to the corresponding date
  3563. instead.
  3564. @c
  3565. @kindex C-c C-o
  3566. @item C-c C-o
  3567. Access the agenda for the date given by the time stamp or -range at
  3568. point (@pxref{Weekly/daily agenda}).
  3569. @c
  3570. @kindex S-@key{left}
  3571. @kindex S-@key{right}
  3572. @item S-@key{left}
  3573. @itemx S-@key{right}
  3574. Change date at cursor by one day. These key bindings conflict with
  3575. CUA mode (@pxref{Conflicts}).
  3576. @c
  3577. @kindex S-@key{up}
  3578. @kindex S-@key{down}
  3579. @item S-@key{up}
  3580. @itemx S-@key{down}
  3581. Change the item under the cursor in a timestamp. The cursor can be on a
  3582. year, month, day, hour or minute. Note that if the cursor is in a
  3583. headline and not at a time stamp, these same keys modify the priority of
  3584. an item. (@pxref{Priorities}). The key bindings also conflict with
  3585. CUA mode (@pxref{Conflicts}).
  3586. @c
  3587. @kindex C-c C-y
  3588. @cindex evaluate time range
  3589. @item C-c C-y
  3590. Evaluate a time range by computing the difference between start and end.
  3591. With a prefix argument, insert result after the time range (in a table: into
  3592. the following column).
  3593. @end table
  3594. @menu
  3595. * The date/time prompt:: How Org mode helps you entering date and time
  3596. * Custom time format:: Making dates look different
  3597. @end menu
  3598. @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
  3599. @subsection The date/time prompt
  3600. @cindex date, reading in minibuffer
  3601. @cindex time, reading in minibuffer
  3602. When Org mode prompts for a date/time, the default is shown as an ISO
  3603. date, and the prompt therefore seems to ask for an ISO date. But it
  3604. will in fact accept any string containing some date and/or time
  3605. information, and it is really smart about interpreting your input. You
  3606. can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
  3607. copied from an email message. Org mode will find whatever information
  3608. is in there and derive anything you have not specified from the
  3609. @emph{default date and time}. The default is usually the current date
  3610. and time, but when modifying an existing time stamp, or when entering
  3611. the second stamp of a range, it is taken from the stamp in the buffer.
  3612. When filling in information, Org mode assumes that most of the time you
  3613. will want to enter a date in the future: If you omit the month/year and
  3614. the given day/month is @i{before} today, it will assume that you mean a
  3615. future date@footnote{See the variable
  3616. @code{org-read-date-prefer-future}.}.
  3617. For example, lets assume that today is @b{June 13, 2006}. Here is how
  3618. various inputs will be interpreted, the items filled in by Org mode are
  3619. in @b{bold}.
  3620. @example
  3621. 3-2-5 --> 2003-02-05
  3622. 14 --> @b{2006}-@b{06}-14
  3623. 12 --> @b{2006}-@b{07}-12
  3624. Fri --> nearest Friday (defaultdate or later)
  3625. sep 15 --> @b{2006}-11-15
  3626. feb 15 --> @b{2007}-02-15
  3627. sep 12 9 --> 2009-09-12
  3628. 12:45 --> @b{2006}-@b{06}-@b{13} 12:45
  3629. 22 sept 0:34 --> @b{2006}-09-22 0:34
  3630. w4 --> ISO week for of the current year @b{2006}
  3631. 2012 w4 fri --> Friday of ISO week 4 in 2012
  3632. 2012-w04-5 --> Same as above
  3633. @end example
  3634. Furthermore you can specify a relative date by giving, as the
  3635. @emph{first} thing in the input: a plus/minus sign, a number and a
  3636. letter [dwmy] to indicate change in days weeks, months, years. With a
  3637. single plus or minus, the date is always relative to today. With a
  3638. double plus or minus, it is relative to the default date. If instead of
  3639. a single letter, you use the abbreviation of day name, the date will be
  3640. the nth such day. E.g.
  3641. @example
  3642. +4d --> four days from today
  3643. +4 --> same as above
  3644. +2w --> two weeks from today
  3645. ++5 --> five days from default date
  3646. +2tue --> second tuesday from now.
  3647. @end example
  3648. The function understands English month and weekday abbreviations. If
  3649. you want to use unabbreviated names and/or other languages, configure
  3650. the variables @code{parse-time-months} and @code{parse-time-weekdays}.
  3651. @cindex calendar, for selecting date
  3652. Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
  3653. you don't need/want the calendar, configure the variable
  3654. @code{org-popup-calendar-for-date-prompt}.}. When you exit the date
  3655. prompt, either by clicking on a date in the calendar, or by pressing
  3656. @key{RET}, the date selected in the calendar will be combined with the
  3657. information entered at the prompt. You can control the calendar fully
  3658. from the minibuffer:
  3659. @kindex <
  3660. @kindex >
  3661. @kindex mouse-1
  3662. @kindex S-@key{right}
  3663. @kindex S-@key{left}
  3664. @kindex S-@key{down}
  3665. @kindex S-@key{up}
  3666. @kindex M-S-@key{right}
  3667. @kindex M-S-@key{left}
  3668. @kindex @key{RET}
  3669. @example
  3670. > / < @r{Scroll calendar forward/backward by one month.}
  3671. mouse-1 @r{Select date by clicking on it.}
  3672. S-@key{right}/@key{left} @r{One day forward/backward.}
  3673. S-@key{down}/@key{up} @r{One week forward/backward.}
  3674. M-S-@key{right}/@key{left} @r{One month forward/backward.}
  3675. @key{RET} @r{Choose date in calendar.}
  3676. @end example
  3677. The actions of the date/time prompt may seem complex, but I assure you
  3678. they will grow on you. To help you understand what is going on, the
  3679. current interpretation of your input will be displayed live in the
  3680. minibuffer@footnote{If you find this distracting, turn the display of
  3681. with @code{org-read-date-display-live}.}.
  3682. @node Custom time format, , The date/time prompt, Creating timestamps
  3683. @subsection Custom time format
  3684. @cindex custom date/time format
  3685. @cindex time format, custom
  3686. @cindex date format, custom
  3687. Org mode uses the standard ISO notation for dates and times as it is
  3688. defined in ISO 8601. If you cannot get used to this and require another
  3689. representation of date and time to keep you happy, you can get it by
  3690. customizing the variables @code{org-display-custom-times} and
  3691. @code{org-time-stamp-custom-formats}.
  3692. @table @kbd
  3693. @kindex C-c C-x C-t
  3694. @item C-c C-x C-t
  3695. Toggle the display of custom formats for dates and times.
  3696. @end table
  3697. @noindent
  3698. Org mode needs the default format for scanning, so the custom date/time
  3699. format does not @emph{replace} the default format - instead it is put
  3700. @emph{over} the default format using text properties. This has the
  3701. following consequences:
  3702. @itemize @bullet
  3703. @item
  3704. You cannot place the cursor onto a time stamp anymore, only before or
  3705. after.
  3706. @item
  3707. The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
  3708. each component of a time stamp. If the cursor is at the beginning of
  3709. the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
  3710. just like @kbd{S-@key{left}/@key{right}}. At the end of the stamp, the
  3711. time will be changed by one minute.
  3712. @item
  3713. If the time stamp contains a range of clock times or a repeater, these
  3714. will not be overlayed, but remain in the buffer as they were.
  3715. @item
  3716. When you delete a time stamp character-by-character, it will only
  3717. disappear from the buffer after @emph{all} (invisible) characters
  3718. belonging to the ISO timestamp have been removed.
  3719. @item
  3720. If the custom time stamp format is longer than the default and you are
  3721. using dates in tables, table alignment will be messed up. If the custom
  3722. format is shorter, things do work as expected.
  3723. @end itemize
  3724. @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
  3725. @section Deadlines and scheduling
  3726. A time stamp may be preceded by special keywords to facilitate planning:
  3727. @table @var
  3728. @item DEADLINE
  3729. @cindex DEADLINE keyword
  3730. Meaning: the task (most likely a TODO item, though not necessarily) is supposed
  3731. to be finished on that date.
  3732. On the deadline date, the task will be listed in the agenda. In
  3733. addition, the agenda for @emph{today} will carry a warning about the
  3734. approaching or missed deadline, starting
  3735. @code{org-deadline-warning-days} before the due date, and continuing
  3736. until the entry is marked DONE. An example:
  3737. @example
  3738. *** TODO write article about the Earth for the Guide
  3739. The editor in charge is [[bbdb:Ford Prefect]]
  3740. DEADLINE: <2004-02-29 Sun>
  3741. @end example
  3742. You can specify a different lead time for warnings for a specific
  3743. deadlines using the following syntax. Here is an example with a warning
  3744. period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
  3745. @item SCHEDULED
  3746. @cindex SCHEDULED keyword
  3747. Meaning: you are planning to start working on that task on the given
  3748. date.
  3749. The headline will be listed under the given date@footnote{It will still
  3750. be listed on that date after it has been marked DONE. If you don't like
  3751. this, set the variable @code{org-agenda-skip-scheduled-if-done}.}. In
  3752. addition, a reminder that the scheduled date has passed will be present
  3753. in the compilation for @emph{today}, until the entry is marked DONE.
  3754. I.e., the task will automatically be forwarded until completed.
  3755. @example
  3756. *** TODO Call Trillian for a date on New Years Eve.
  3757. SCHEDULED: <2004-12-25 Sat>
  3758. @end example
  3759. @noindent
  3760. @b{Important:} Scheduling an item in Org mode should @i{not} be
  3761. understood in the same way that we understand @i{scheduling a meeting}.
  3762. Setting a date for a meeting is just a simple appointment, you should
  3763. mark this entry with a simple plain time stamp, to get this item shown
  3764. on the date where it applies. This is a frequent mis-understanding from
  3765. Org-users. In Org mode, @i{scheduling} means setting a date when you
  3766. want to start working on an action item.
  3767. @end table
  3768. You may use time stamps with repeaters in scheduling and deadline
  3769. entries. Org mode will issue early and late warnings based on the
  3770. assumption that the time stamp represents the @i{nearest instance} of
  3771. the repeater. However, the use of diary sexp entries like
  3772. @c
  3773. @code{<%%(diary-float t 42)>}
  3774. @c
  3775. in scheduling and deadline timestamps is limited. Org mode does not
  3776. know enough about the internals of each sexp function to issue early and
  3777. late warnings. However, it will show the item on each day where the
  3778. sexp entry matches.
  3779. @menu
  3780. * Inserting deadline/schedule:: Planning items
  3781. * Repeated tasks:: Items that show up again and again
  3782. @end menu
  3783. @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
  3784. @subsection Inserting deadlines or schedules
  3785. The following commands allow to quickly insert a deadline or to schedule
  3786. an item:
  3787. @table @kbd
  3788. @c
  3789. @kindex C-c C-d
  3790. @item C-c C-d
  3791. Insert @samp{DEADLINE} keyword along with a stamp. The insertion will
  3792. happen in the line directly following the headline. When called with a
  3793. prefix arg, an existing deadline will be removed from the entry.
  3794. @c FIXME Any CLOSED timestamp will be removed.????????
  3795. @c
  3796. @kindex C-c / d
  3797. @cindex sparse tree, for deadlines
  3798. @item C-c / d
  3799. Create a sparse tree with all deadlines that are either past-due, or
  3800. which will become due within @code{org-deadline-warning-days}.
  3801. With @kbd{C-u} prefix, show all deadlines in the file. With a numeric
  3802. prefix, check that many days. For example, @kbd{C-1 C-c / d} shows
  3803. all deadlines due tomorrow.
  3804. @c
  3805. @kindex C-c C-s
  3806. @item C-c C-s
  3807. Insert @samp{SCHEDULED} keyword along with a stamp. The insertion will
  3808. happen in the line directly following the headline. Any CLOSED
  3809. timestamp will be removed. When called with a prefix argument, remove
  3810. the scheduling date from the entry.
  3811. @end table
  3812. @node Repeated tasks, , Inserting deadline/schedule, Deadlines and scheduling
  3813. @subsection Repeated tasks
  3814. Some tasks need to be repeated again and again. Org mode helps to
  3815. organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
  3816. or plain time stamp. In the following example
  3817. @example
  3818. ** TODO Pay the rent
  3819. DEADLINE: <2005-10-01 Sat +1m>
  3820. @end example
  3821. the @code{+1m} is a repeater; the intended interpretation is that the
  3822. task has a deadline on <2005-10-01> and repeats itself every (one) month
  3823. starting from that time. If you need both a repeater and a special
  3824. warning period in a deadline entry, the repeater comes first and the
  3825. warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
  3826. Deadlines and scheduled items produce entries in the agenda when they
  3827. are over-due, so it is important to be able to mark such an entry as
  3828. completed once you have done so. When you mark a DEADLINE or a SCHEDULE
  3829. with the TODO keyword DONE, it will no longer produce entries in the
  3830. agenda. The problem with this is, however, that then also the
  3831. @emph{next} instance of the repeated entry will not be active. Org mode
  3832. deals with this in the following way: When you try to mark such an entry
  3833. DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
  3834. time stamp by the repeater interval, and immediately set the entry state
  3835. back to TODO. In the example above, setting the state to DONE would
  3836. actually switch the date like this:
  3837. @example
  3838. ** TODO Pay the rent
  3839. DEADLINE: <2005-11-01 Tue +1m>
  3840. @end example
  3841. You will also be prompted for a note@footnote{You can change this using
  3842. the option @code{org-log-repeat}, or the @code{#+STARTUP} options
  3843. @code{logrepeat}, @code{lognoterepeat}, and @code{nologrepeat}.} that
  3844. will be put under the DEADLINE line to keep a record that you actually
  3845. acted on the previous instance of this deadline.
  3846. As a consequence of shifting the base date, this entry will no longer be
  3847. visible in the agenda when checking past dates, but all future instances
  3848. will be visible.
  3849. With the @samp{+1m} cookie, the date shift will always be exactly one
  3850. month. So if you have not payed the rent for three months, marking this
  3851. entry DONE will still keep it as an overdue deadline. Depending on the
  3852. task, this may not be the best way to handle it. For example, if you
  3853. forgot to call you father for 3 weeks, it does not make sense to call
  3854. her 3 times in a single day to make up for it. Finally, there are tasks
  3855. like changing batteries which should always repeat a certain time
  3856. @i{after} the last time you did it. For these tasks, Org mode has
  3857. special repeaters markers with @samp{++} and @samp{.+}. For example:
  3858. @example
  3859. ** TODO Call Father
  3860. DEADLINE: <2008-02-10 Sun ++1w>
  3861. Marking this DONE will shift the date by at least one week,
  3862. but also by as many weeks as it takes to get this date into
  3863. the future. However, it stays on a Sunday, even if you called
  3864. and marked it done on Saturday.
  3865. ** TODO Check the batteries in the smoke detectors
  3866. DEADLINE: <2005-11-01 Tue .+1m>
  3867. Marking this DONE will shift the date to one month after
  3868. today.
  3869. @end example
  3870. You may have both scheduling and deadline information for a specific
  3871. task - just make sure that the repeater intervals on both are the same.
  3872. @node Clocking work time, , Deadlines and scheduling, Dates and Times
  3873. @section Clocking work time
  3874. Org mode allows you to clock the time you spent on specific tasks in a
  3875. project. When you start working on an item, you can start the clock.
  3876. When you stop working on that task, or when you mark the task done, the
  3877. clock is stopped and the corresponding time interval is recorded. It
  3878. also computes the total time spent on each subtree of a project.
  3879. @table @kbd
  3880. @kindex C-c C-x C-i
  3881. @item C-c C-x C-i
  3882. Start the clock on the current item (clock-in). This inserts the CLOCK
  3883. keyword together with a timestamp. If this is not the first clocking of
  3884. this item, the multiple CLOCK lines will be wrapped into a
  3885. @code{:CLOCK:} drawer (see also the variable
  3886. @code{org-clock-into-drawer}).
  3887. @kindex C-c C-x C-o
  3888. @item C-c C-x C-o
  3889. Stop the clock (clock-out). The inserts another timestamp at the same
  3890. location where the clock was last started. It also directly computes
  3891. the resulting time in inserts it after the time range as @samp{=>
  3892. HH:MM}. See the variable @code{org-log-note-clock-out} for the
  3893. possibility to record an additional note together with the clock-out
  3894. time stamp@footnote{The corresponding in-buffer setting is:
  3895. @code{#+STARTUP: lognoteclock-out}}.
  3896. @kindex C-c C-y
  3897. @item C-c C-y
  3898. Recompute the time interval after changing one of the time stamps. This
  3899. is only necessary if you edit the time stamps directly. If you change
  3900. them with @kbd{S-@key{cursor}} keys, the update is automatic.
  3901. @kindex C-c C-t
  3902. @item C-c C-t
  3903. Changing the TODO state of an item to DONE automatically stops the clock
  3904. if it is running in this same item.
  3905. @kindex C-c C-x C-x
  3906. @item C-c C-x C-x
  3907. Cancel the current clock. This is useful if a clock was started by
  3908. mistake, or if you ended up working on something else.
  3909. @kindex C-c C-x C-j
  3910. @item C-c C-x C-j
  3911. Jump to the entry that contains the currently running clock, an another
  3912. window.
  3913. @kindex C-c C-x C-d
  3914. @item C-c C-x C-d
  3915. Display time summaries for each subtree in the current buffer. This
  3916. puts overlays at the end of each headline, showing the total time
  3917. recorded under that heading, including the time of any subheadings. You
  3918. can use visibility cycling to study the tree, but the overlays disappear
  3919. when you change the buffer (see variable
  3920. @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
  3921. @kindex C-c C-x C-r
  3922. @item C-c C-x C-r
  3923. Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
  3924. report as an Org mode table into the current file. When the cursor is
  3925. at an existing clock table, just update it. When called with a prefix
  3926. argument, jump to the first clock report in the current document and
  3927. update it.
  3928. @example
  3929. #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
  3930. #+END: clocktable
  3931. @end example
  3932. @noindent
  3933. If such a block already exists at point, its content is replaced by the
  3934. new table. The @samp{BEGIN} line can specify options:
  3935. @example
  3936. :maxlevel @r{Maximum level depth to which times are listed in the table.}
  3937. :emphasize @r{When @code{t}, emphasize level one and level two items}
  3938. :scope @r{The scope to consider. This can be any of the following:}
  3939. nil @r{the current buffer or narrowed region}
  3940. file @r{the full current buffer}
  3941. subtree @r{the subtree where the clocktable is located}
  3942. treeN @r{the surrounding level N tree, for example @code{tree3}}
  3943. tree @r{the surrounding level 1 tree}
  3944. agenda @r{all agenda files}
  3945. ("file"..) @r{scan these files}
  3946. :block @r{The time block to consider. This block is specified either}
  3947. @r{absolute, or relative to the current time and may be any of}
  3948. @r{these formats:}
  3949. 2007-12-31 @r{New year eve 2007}
  3950. 2007-12 @r{December 2007}
  3951. 2007-W50 @r{ISO-week 50 in 2007}
  3952. 2007 @r{the year 2007}
  3953. today, yesterday, today-N @r{a relative day}
  3954. thisweek, lastweek, thisweek-N @r{a relative week}
  3955. thismonth, lastmonth, thismonth-N @r{a relative month}
  3956. thisyear, lastyear, thisyear-N @r{a relative year}
  3957. @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
  3958. :tstart @r{A time string specifying when to start considering times}
  3959. :tend @r{A time string specifying when to stop considering times}
  3960. :step @r{@code{week} or @code{day}, to split the table into chunks}
  3961. :link @r{Link the item headlines in the table to their origins}
  3962. @end example
  3963. So to get a clock summary of the current level 1 tree, for the current
  3964. day, you could write
  3965. @example
  3966. #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
  3967. #+END: clocktable
  3968. @end example
  3969. and to use a specific time range you could write@footnote{Note that all
  3970. parameters must be specified in a single line - the line is broken here
  3971. only to fit it onto the manual.}
  3972. @example
  3973. #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
  3974. :tend "<2006-08-10 Thu 12:00>"
  3975. #+END: clocktable
  3976. @end example
  3977. @kindex C-c C-c
  3978. @item C-c C-c
  3979. @kindex C-c C-x C-u
  3980. @itemx C-c C-x C-u
  3981. Update dynamical block at point. The cursor needs to be in the
  3982. @code{#+BEGIN} line of the dynamic block.
  3983. @kindex C-u C-c C-x C-u
  3984. @item C-u C-c C-x C-u
  3985. Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
  3986. you have several clock table blocks in a buffer.
  3987. @kindex S-@key{left}
  3988. @kindex S-@key{right}
  3989. @item S-@key{left}
  3990. @itemx S-@key{right}
  3991. Shift the current @code{:block} interval and update the table. The cursor
  3992. needs to be in the @code{#+BEGIN: clocktable} line for this command. If
  3993. @code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
  3994. @end table
  3995. The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
  3996. the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
  3997. worked on or closed during a day.
  3998. @node Remember, Agenda Views, Dates and Times, Top
  3999. @chapter Remember
  4000. @cindex @file{remember.el}
  4001. The @i{Remember} package by John Wiegley lets you store quick notes with
  4002. little interruption of your work flow. See
  4003. @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
  4004. information. It is an excellent way to add new notes and tasks to
  4005. Org files. Org significantly expands the possibilities of
  4006. @i{remember}: You may define templates for different note types, and
  4007. associate target files and headlines with specific templates. It also
  4008. allows you to select the location where a note should be stored
  4009. interactively, on the fly.
  4010. @menu
  4011. * Setting up Remember:: Some code for .emacs to get things going
  4012. * Remember templates:: Define the outline of different note types
  4013. * Storing notes:: Directly get the note to where it belongs
  4014. * Refiling notes:: Moving a note or task to a project
  4015. @end menu
  4016. @node Setting up Remember, Remember templates, Remember, Remember
  4017. @section Setting up Remember
  4018. The following customization will tell @i{remember} to use org files as
  4019. target, and to create annotations compatible with Org links.
  4020. @example
  4021. (org-remember-insinuate)
  4022. (setq org-directory "~/path/to/my/orgfiles/")
  4023. (setq org-default-notes-file (concat org-directory "/notes.org"))
  4024. (define-key global-map "\C-cr" 'org-remember)
  4025. @end example
  4026. The last line binds the command @code{org-remember} to a global
  4027. key@footnote{Please select your own key, @kbd{C-c r} is only a
  4028. suggestion.}. @code{org-remember} basically just calls @code{remember},
  4029. but it makes a few things easier: If there is an active region, it will
  4030. automatically copy the region into the remember buffer. It also allows
  4031. to jump to the buffer and location where remember notes are being
  4032. stored: Just call @code{org-remember} with a prefix argument. If you
  4033. use two prefix arguments, Org jumps to the location where the last
  4034. remember note was stored.
  4035. @node Remember templates, Storing notes, Setting up Remember, Remember
  4036. @section Remember templates
  4037. @cindex templates, for remember
  4038. In combination with Org, you can use templates to generate
  4039. different types of @i{remember} notes. For example, if you would like
  4040. to use one template to create general TODO entries, another one for
  4041. journal entries, and a third one for collecting random ideas, you could
  4042. use:
  4043. @example
  4044. (setq org-remember-templates
  4045. '(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks")
  4046. ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
  4047. ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
  4048. @end example
  4049. @noindent In these entries, the first string is just a name, and the
  4050. character specifies how to select the template. It is useful if the
  4051. character is also the first letter of the name. The next string
  4052. specifies the template. Two more (optional) strings give the file in
  4053. which, and the headline under which the new note should be stored. The
  4054. file (if not present or @code{nil}) defaults to
  4055. @code{org-default-notes-file}, the heading to
  4056. @code{org-remember-default-headline}. If the file name is not an
  4057. absolute path, it will be interpreted relative to @code{org-directory}.
  4058. An optional sixth element specifies the contexts in which the user can
  4059. select the template. This element can be either a list of major modes
  4060. or a function. @code{org-remember} will first check whether the function
  4061. returns @code{t} or if we are in any of the listed major mode, and select
  4062. the template accordingly.
  4063. So for example:
  4064. @example
  4065. (setq org-remember-templates
  4066. '(("Bug" ?b "* BUG %?\n %i\n %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
  4067. ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org" my-check)
  4068. ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
  4069. @end example
  4070. The first template will only be available when invoking @code{org-remember}
  4071. from an buffer in @code{emacs-lisp-mode}. The second template will only be
  4072. available when the function @code{my-check} returns @code{t}. The third
  4073. template will be proposed in any context.
  4074. When you call @kbd{M-x remember} (or @kbd{M-x org-remember}) to remember
  4075. something, org will prompt for a key to select the template (if you have
  4076. more than one template) and then prepare the buffer like
  4077. @example
  4078. * TODO
  4079. [[file:link to where you called remember]]
  4080. @end example
  4081. @noindent
  4082. During expansion of the template, special @kbd{%}-escapes allow dynamic
  4083. insertion of content:
  4084. @example
  4085. %^@{prompt@} @r{prompt the user for a string and replace this sequence with it.}
  4086. @r{You may specify a default value and a completion table with}
  4087. @r{%^@{prompt|default|completion2|completion3...@}}
  4088. @r{The arrow keys access a prompt-specific history.}
  4089. %t @r{time stamp, date only}
  4090. %T @r{time stamp with date and time}
  4091. %u, %U @r{like the above, but inactive time stamps}
  4092. %^t @r{like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}}
  4093. @r{You may define a prompt like @code{%^@{Birthday@}t}}
  4094. %n @r{user name (taken from @code{user-full-name})}
  4095. %a @r{annotation, normally the link created with @code{org-store-link}}
  4096. %A @r{like @code{%a}, but prompt for the description part}
  4097. %i @r{initial content, the region when remember is called with C-u.}
  4098. @r{The entire text will be indented like @code{%i} itself.}
  4099. %c @r{Current kill ring head.}
  4100. %x @r{Content of the X clipboard.}
  4101. %^C @r{Interactive selection of which kill or clip to use.}
  4102. %^L @r{Like @code{%^C}, but insert as link.}
  4103. %^g @r{prompt for tags, with completion on tags in target file.}
  4104. %^G @r{prompt for tags, with completion all tags in all agenda files.}
  4105. %:keyword @r{specific information for certain link types, see below}
  4106. %[pathname] @r{insert the contents of the file given by @code{pathname}}
  4107. %(sexp) @r{evaluate elisp @code{(sexp)} and replace with the result}
  4108. %! @r{immediately store note after completing the template}
  4109. @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
  4110. @end example
  4111. @noindent
  4112. For specific link types, the following keywords will be
  4113. defined@footnote{If you define your own link types (@pxref{Adding
  4114. hyperlink types}), any property you store with
  4115. @code{org-store-link-props} can be accessed in remember templates in a
  4116. similar way.}:
  4117. @example
  4118. Link type | Available keywords
  4119. -------------------+----------------------------------------------
  4120. bbdb | %:name %:company
  4121. bbdb | %::server %:port %:nick
  4122. vm, wl, mh, rmail | %:type %:subject %:message-id
  4123. | %:from %:fromname %:fromaddress
  4124. | %:to %:toname %:toaddress
  4125. | %:fromto @r{(either "to NAME" or "from NAME")@footnote{This will always be the other, not the user. See the variable @code{org-from-is-user-regexp}.}}
  4126. gnus | %:group, @r{for messages also all email fields}
  4127. w3, w3m | %:url
  4128. info | %:file %:node
  4129. calendar | %:date"
  4130. @end example
  4131. @noindent
  4132. To place the cursor after template expansion use:
  4133. @example
  4134. %? @r{After completing the template, position cursor here.}
  4135. @end example
  4136. @noindent
  4137. If you change your mind about which template to use, call
  4138. @code{org-remember} in the remember buffer. You may then select a new
  4139. template that will be filled with the previous context information.
  4140. @node Storing notes, Refiling notes, Remember templates, Remember
  4141. @section Storing notes
  4142. When you are finished preparing a note with @i{remember}, you have to
  4143. press @kbd{C-c C-c} to file the note away. The handler will store the
  4144. note in the file and under the headline specified in the template, or it
  4145. will use the default file and headlines. The window configuration will
  4146. be restored, sending you back to the working context before the call to
  4147. @code{remember}. To re-use the location found during the last call to
  4148. @code{remember}, exit the remember buffer with @kbd{C-u C-u C-c C-c},
  4149. i.e. specify a double prefix argument to @kbd{C-c C-c}.
  4150. If you want to store the note directly to a different place, use
  4151. @kbd{C-u C-c C-c} instead to exit remember@footnote{Configure the
  4152. variable @code{org-remember-store-without-prompt} to make this behavior
  4153. the default.}. The handler will then first prompt for a target file -
  4154. if you press @key{RET}, the value specified for the template is used.
  4155. Then the command offers the headings tree of the selected file, with the
  4156. cursor position at the default headline (if you had specified one in the
  4157. template). You can either immediately press @key{RET} to get the note
  4158. placed there. Or you can use the following keys to find a different
  4159. location:
  4160. @example
  4161. @key{TAB} @r{Cycle visibility.}
  4162. @key{down} / @key{up} @r{Next/previous visible headline.}
  4163. n / p @r{Next/previous visible headline.}
  4164. f / b @r{Next/previous headline same level.}
  4165. u @r{One level up.}
  4166. @c 0-9 @r{Digit argument.}
  4167. @end example
  4168. @noindent
  4169. Pressing @key{RET} or @key{left} or @key{right}
  4170. then leads to the following result.
  4171. @multitable @columnfractions 0.2 0.15 0.65
  4172. @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
  4173. @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor, first or last
  4174. @item @tab @tab depending on @code{org-reverse-note-order}.
  4175. @item @tab @key{left}/@key{right} @tab as same level, before/after current heading
  4176. @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
  4177. @item @tab @tab depending on @code{org-reverse-note-order}.
  4178. @item not on headline @tab @key{RET}
  4179. @tab at cursor position, level taken from context.
  4180. @end multitable
  4181. Before inserting the text into a tree, the function ensures that the
  4182. text has a headline, i.e. a first line that starts with a @samp{*}. If
  4183. not, a headline is constructed from the current date and some additional
  4184. data. If you have indented the text of the note below the headline, the
  4185. indentation will be adapted if inserting the note into the tree requires
  4186. demotion from level 1.
  4187. @node Refiling notes, , Storing notes, Remember
  4188. @section Refiling notes
  4189. @cindex refiling notes
  4190. Remember is usually used to quickly capture notes and tasks into one or
  4191. a few capture lists. When reviewing the captured data, you may want to
  4192. refile some of the entries into a different list, for example into a
  4193. project. Cutting, finding the right location and then pasting the note
  4194. is cumbersome. To simplify this process, you can use the following
  4195. special command:
  4196. @table @kbd
  4197. @kindex C-c C-w
  4198. @item C-c C-w
  4199. Refile the entry at point. This command offers possible locations for
  4200. refiling the entry and lets you select one with completion. The item is
  4201. filed below the target heading as a subitem. Depending on
  4202. @code{org-reverse-note-order}, it will be either the first of last
  4203. subitem.@* By default, all level 1 headlines in the current buffer are
  4204. considered to be targets, but you can have more complex definitions
  4205. across a number of files. See the variable @code{org-refile-targets}
  4206. for details.
  4207. @kindex C-u C-c C-w
  4208. @item C-u C-c C-w
  4209. Use the refile interface to jump to a heading.
  4210. @kindex C-u C-u C-c C-w
  4211. @item C- C-u C-c C-w
  4212. Jump to the location where @code{org-refile} last moved a tree to.
  4213. @end table
  4214. @node Agenda Views, Embedded LaTeX, Remember, Top
  4215. @chapter Agenda Views
  4216. @cindex agenda views
  4217. Due to the way Org works, TODO items, time-stamped items, and
  4218. tagged headlines can be scattered throughout a file or even a number of
  4219. files. To get an overview of open action items, or of events that are
  4220. important for a particular date, this information must be collected,
  4221. sorted and displayed in an organized way.
  4222. Org can select items based on various criteria, and display them
  4223. in a separate buffer. Seven different view types are provided:
  4224. @itemize @bullet
  4225. @item
  4226. an @emph{agenda} that is like a calendar and shows information
  4227. for specific dates,
  4228. @item
  4229. a @emph{TODO list} that covers all unfinished
  4230. action items,
  4231. @item
  4232. a @emph{tags view}, showings headlines based on
  4233. the tags associated with them,
  4234. @item
  4235. a @emph{timeline view} that shows all events in a single Org file,
  4236. in time-sorted view,
  4237. @item
  4238. a @emph{keyword search view} that shows all entries from multiple files
  4239. that contain specified keywords.
  4240. @item
  4241. a @emph{stuck projects view} showing projects that currently don't move
  4242. along, and
  4243. @item
  4244. @emph{custom views} that are special tag/keyword searches and
  4245. combinations of different views.
  4246. @end itemize
  4247. @noindent
  4248. The extracted information is displayed in a special @emph{agenda
  4249. buffer}. This buffer is read-only, but provides commands to visit the
  4250. corresponding locations in the original Org files, and even to
  4251. edit these files remotely.
  4252. Two variables control how the agenda buffer is displayed and whether the
  4253. window configuration is restored when the agenda exits:
  4254. @code{org-agenda-window-setup} and
  4255. @code{org-agenda-restore-windows-after-quit}.
  4256. @menu
  4257. * Agenda files:: Files being searched for agenda information
  4258. * Agenda dispatcher:: Keyboard access to agenda views
  4259. * Built-in agenda views:: What is available out of the box?
  4260. * Presentation and sorting:: How agenda items are prepared for display
  4261. * Agenda commands:: Remote editing of Org trees
  4262. * Custom agenda views:: Defining special searches and views
  4263. @end menu
  4264. @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
  4265. @section Agenda files
  4266. @cindex agenda files
  4267. @cindex files for agenda
  4268. The information to be shown is normally collected from all @emph{agenda
  4269. files}, the files listed in the variable
  4270. @code{org-agenda-files}@footnote{If the value of that variable is not a
  4271. list, but a single file name, then the list of agenda files will be
  4272. maintained in that external file.}. If a directory is part of this list,
  4273. all files with the extension @file{.org} in this directory will be part
  4274. of the list.
  4275. Thus even if you only work with a single Org file, this file should
  4276. be put into that list@footnote{When using the dispatcher, pressing
  4277. @kbd{<} before selecting a command will actually limit the command to
  4278. the current file, and ignore @code{org-agenda-files} until the next
  4279. dispatcher command.}. You can customize @code{org-agenda-files}, but
  4280. the easiest way to maintain it is through the following commands
  4281. @cindex files, adding to agenda list
  4282. @table @kbd
  4283. @kindex C-c [
  4284. @item C-c [
  4285. Add current file to the list of agenda files. The file is added to
  4286. the front of the list. If it was already in the list, it is moved to
  4287. the front. With a prefix argument, file is added/moved to the end.
  4288. @kindex C-c ]
  4289. @item C-c ]
  4290. Remove current file from the list of agenda files.
  4291. @kindex C-,
  4292. @kindex C-'
  4293. @item C-,
  4294. @itemx C-'
  4295. Cycle through agenda file list, visiting one file after the other.
  4296. @end table
  4297. @noindent
  4298. The Org menu contains the current list of files and can be used
  4299. to visit any of them.
  4300. If you would like to focus the agenda temporarily onto a file not in
  4301. this list, or onto just one file in the list or even only a subtree in a
  4302. file, this can be done in different ways. For a single agenda command,
  4303. you may press @kbd{<} once or several times in the dispatcher
  4304. (@pxref{Agenda dispatcher}). To restrict the agenda scope for an
  4305. extended period, use the following commands:
  4306. @table @kbd
  4307. @kindex C-c C-x <
  4308. @item C-c C-x <
  4309. Permanently restrict the agenda to the current subtree. When with a
  4310. prefix argument, or with the cursor before the first headline in a file,
  4311. the agenda scope is set to the entire file. This restriction remains in
  4312. effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
  4313. or @kbd{>} in the agenda dispatcher. If there is a window displaying an
  4314. agenda view, the new restriction takes effect immediately.
  4315. @kindex C-c C-x <
  4316. @item C-c C-x <
  4317. Remove the permanent restriction created by @kbd{C-c C-x <}.
  4318. @end table
  4319. @noindent
  4320. When working with @file{Speedbar}, you can use the following commands in
  4321. the Speedbar frame:
  4322. @table @kbd
  4323. @kindex <
  4324. @item < @r{in the speedbar frame}
  4325. Permanently restrict the agenda to the item at the cursor in the
  4326. Speedbar frame, either an Org file or a subtree in such a file.
  4327. If there is a window displaying an agenda view, the new restriction takes
  4328. effect immediately.
  4329. @kindex <
  4330. @item > @r{in the speedbar frame}
  4331. Lift the restriction again.
  4332. @end table
  4333. @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
  4334. @section The agenda dispatcher
  4335. @cindex agenda dispatcher
  4336. @cindex dispatching agenda commands
  4337. The views are created through a dispatcher that should be bound to a
  4338. global key, for example @kbd{C-c a} (@pxref{Installation}). In the
  4339. following we will assume that @kbd{C-c a} is indeed how the dispatcher
  4340. is accessed and list keyboard access to commands accordingly. After
  4341. pressing @kbd{C-c a}, an additional letter is required to execute a
  4342. command. The dispatcher offers the following default commands:
  4343. @table @kbd
  4344. @item a
  4345. Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
  4346. @item t @r{/} T
  4347. Create a list of all TODO items (@pxref{Global TODO list}).
  4348. @item m @r{/} M
  4349. Create a list of headlines matching a TAGS expression (@pxref{Matching
  4350. tags and properties}).
  4351. @item L
  4352. Create the timeline view for the current buffer (@pxref{Timeline}).
  4353. @item s
  4354. Create a list of entries selected by a boolean expression of keywords
  4355. and/or regular expressions that must or must not occur in the entry.
  4356. @item /
  4357. Search for a regular expression in all agenda files and additionally in
  4358. the files listed in @code{org-agenda-multi-occur-extra-files}. This
  4359. uses the Emacs command @code{multi-occur}. A prefix argument can be
  4360. used to specify the number of context lines for each match, default is
  4361. 1.
  4362. @item # @r{/} !
  4363. Create a list of stuck projects (@pxref{Stuck projects}).
  4364. @item <
  4365. Restrict an agenda command to the current buffer@footnote{For backward
  4366. compatibility, you can also press @kbd{1} to restrict to the current
  4367. buffer.}. After pressing @kbd{<}, you still need to press the character
  4368. selecting the command.
  4369. @item < <
  4370. If there is an active region, restrict the following agenda command to
  4371. the region. Otherwise, restrict it to the current subtree@footnote{For
  4372. backward compatibility, you can also press @kbd{0} to restrict to the
  4373. current buffer.}. After pressing @kbd{< <}, you still need to press the
  4374. character selecting the command.
  4375. @end table
  4376. You can also define custom commands that will be accessible through the
  4377. dispatcher, just like the default commands. This includes the
  4378. possibility to create extended agenda buffers that contain several
  4379. blocks together, for example the weekly agenda, the global TODO list and
  4380. a number of special tags matches. @xref{Custom agenda views}.
  4381. @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
  4382. @section The built-in agenda views
  4383. In this section we describe the built-in views.
  4384. @menu
  4385. * Weekly/daily agenda:: The calendar page with current tasks
  4386. * Global TODO list:: All unfinished action items
  4387. * Matching tags and properties:: Structured information with fine-tuned search
  4388. * Timeline:: Time-sorted view for single file
  4389. * Keyword search:: Finding entries by keyword
  4390. * Stuck projects:: Find projects you need to review
  4391. @end menu
  4392. @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
  4393. @subsection The weekly/daily agenda
  4394. @cindex agenda
  4395. @cindex weekly agenda
  4396. @cindex daily agenda
  4397. The purpose of the weekly/daily @emph{agenda} is to act like a page of a
  4398. paper agenda, showing all the tasks for the current week or day.
  4399. @table @kbd
  4400. @cindex org-agenda, command
  4401. @kindex C-c a a
  4402. @item C-c a a
  4403. Compile an agenda for the current week from a list of org files. The
  4404. agenda shows the entries for each day. With a numeric
  4405. prefix@footnote{For backward compatibility, the universal prefix
  4406. @kbd{C-u} causes all TODO entries to be listed before the agenda. This
  4407. feature is deprecated, use the dedicated TODO list, or a block agenda
  4408. instead.} (like @kbd{C-u 2 1 C-c a a}) you may set the number of days
  4409. to be displayed (see also the variable @code{org-agenda-ndays})
  4410. @end table
  4411. Remote editing from the agenda buffer means, for example, that you can
  4412. change the dates of deadlines and appointments from the agenda buffer.
  4413. The commands available in the Agenda buffer are listed in @ref{Agenda
  4414. commands}.
  4415. @subsubheading Calendar/Diary integration
  4416. @cindex calendar integration
  4417. @cindex diary integration
  4418. Emacs contains the calendar and diary by Edward M. Reingold. The
  4419. calendar displays a three-month calendar with holidays from different
  4420. countries and cultures. The diary allows you to keep track of
  4421. anniversaries, lunar phases, sunrise/set, recurrent appointments
  4422. (weekly, monthly) and more. In this way, it is quite complementary to
  4423. Org. It can be very useful to combine output from Org with
  4424. the diary.
  4425. In order to include entries from the Emacs diary into Org mode's
  4426. agenda, you only need to customize the variable
  4427. @lisp
  4428. (setq org-agenda-include-diary t)
  4429. @end lisp
  4430. @noindent After that, everything will happen automatically. All diary
  4431. entries including holidays, anniversaries etc will be included in the
  4432. agenda buffer created by Org mode. @key{SPC}, @key{TAB}, and
  4433. @key{RET} can be used from the agenda buffer to jump to the diary
  4434. file in order to edit existing diary entries. The @kbd{i} command to
  4435. insert new entries for the current date works in the agenda buffer, as
  4436. well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
  4437. Sunrise/Sunset times, show lunar phases and to convert to other
  4438. calendars, respectively. @kbd{c} can be used to switch back and forth
  4439. between calendar and agenda.
  4440. If you are using the diary only for sexp entries and holidays, it is
  4441. faster to not use the above setting, but instead to copy or even move
  4442. the entries into an Org file. Org mode evaluates diary-style sexp
  4443. entries, and does it faster because there is no overhead for first
  4444. creating the diary display. Note that the sexp entries must start at
  4445. the left margin, no white space is allowed before them. For example,
  4446. the following segment of an Org file will be processed and entries
  4447. will be made in the agenda:
  4448. @example
  4449. * Birthdays and similar stuff
  4450. #+CATEGORY: Holiday
  4451. %%(org-calendar-holiday) ; special function for holiday names
  4452. #+CATEGORY: Ann
  4453. %%(diary-anniversary 14 5 1956) Arthur Dent is %d years old
  4454. %%(diary-anniversary 2 10 1869) Mahatma Gandhi would be %d years old
  4455. @end example
  4456. @subsubheading Appointment reminders
  4457. @cindex @file{appt.el}
  4458. @cindex appointment reminders
  4459. Org can interact with Emacs appointments notification facility.
  4460. To add all the appointments of your agenda files, use the command
  4461. @code{org-agenda-to-appt}. This commands also lets you filter through
  4462. the list of your appointments and add only those belonging to a specific
  4463. category or matching a regular expression. See the docstring for
  4464. details.
  4465. @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
  4466. @subsection The global TODO list
  4467. @cindex global TODO list
  4468. @cindex TODO list, global
  4469. The global TODO list contains all unfinished TODO items, formatted and
  4470. collected into a single place.
  4471. @table @kbd
  4472. @kindex C-c a t
  4473. @item C-c a t
  4474. Show the global TODO list. This collects the TODO items from all
  4475. agenda files (@pxref{Agenda Views}) into a single buffer. The buffer is in
  4476. @code{agenda-mode}, so there are commands to examine and manipulate
  4477. the TODO entries directly from that buffer (@pxref{Agenda commands}).
  4478. @kindex C-c a T
  4479. @item C-c a T
  4480. @cindex TODO keyword matching
  4481. Like the above, but allows selection of a specific TODO keyword. You
  4482. can also do this by specifying a prefix argument to @kbd{C-c a t}. With
  4483. a @kbd{C-u} prefix you are prompted for a keyword, and you may also
  4484. specify several keywords by separating them with @samp{|} as boolean OR
  4485. operator. With a numeric prefix, the Nth keyword in
  4486. @code{org-todo-keywords} is selected.
  4487. @kindex r
  4488. The @kbd{r} key in the agenda buffer regenerates it, and you can give
  4489. a prefix argument to this command to change the selected TODO keyword,
  4490. for example @kbd{3 r}. If you often need a search for a specific
  4491. keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
  4492. Matching specific TODO keywords can also be done as part of a tags
  4493. search (@pxref{Tag searches}).
  4494. @end table
  4495. Remote editing of TODO items means that you can change the state of a
  4496. TODO entry with a single key press. The commands available in the
  4497. TODO list are described in @ref{Agenda commands}.
  4498. @cindex sublevels, inclusion into TODO list
  4499. Normally the global TODO list simply shows all headlines with TODO
  4500. keywords. This list can become very long. There are two ways to keep
  4501. it more compact:
  4502. @itemize @minus
  4503. @item
  4504. Some people view a TODO item that has been @emph{scheduled} for
  4505. execution (@pxref{Timestamps}) as no longer @emph{open}. Configure the
  4506. variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
  4507. items from the global TODO list.
  4508. @item
  4509. TODO items may have sublevels to break up the task into subtasks. In
  4510. such cases it may be enough to list only the highest level TODO headline
  4511. and omit the sublevels from the global list. Configure the variable
  4512. @code{org-agenda-todo-list-sublevels} to get this behavior.
  4513. @end itemize
  4514. @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
  4515. @subsection Matching tags and properties
  4516. @cindex matching, of tags
  4517. @cindex matching, of properties
  4518. @cindex tags view
  4519. If headlines in the agenda files are marked with @emph{tags}
  4520. (@pxref{Tags}), you can select headlines based on the tags that apply
  4521. to them and collect them into an agenda buffer.
  4522. @table @kbd
  4523. @kindex C-c a m
  4524. @item C-c a m
  4525. Produce a list of all headlines that match a given set of tags. The
  4526. command prompts for a selection criterion, which is a boolean logic
  4527. expression with tags, like @samp{+work+urgent-withboss} or
  4528. @samp{work|home} (@pxref{Tags}). If you often need a specific search,
  4529. define a custom command for it (@pxref{Agenda dispatcher}).
  4530. @kindex C-c a M
  4531. @item C-c a M
  4532. Like @kbd{C-c a m}, but only select headlines that are also TODO items
  4533. and force checking subitems (see variable
  4534. @code{org-tags-match-list-sublevels}). Matching specific TODO keywords
  4535. together with a tags match is also possible, see @ref{Tag searches}.
  4536. @end table
  4537. The commands available in the tags list are described in @ref{Agenda
  4538. commands}.
  4539. @node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
  4540. @subsection Timeline for a single file
  4541. @cindex timeline, single file
  4542. @cindex time-sorted view
  4543. The timeline summarizes all time-stamped items from a single Org mode
  4544. file in a @emph{time-sorted view}. The main purpose of this command is
  4545. to give an overview over events in a project.
  4546. @table @kbd
  4547. @kindex C-c a L
  4548. @item C-c a L
  4549. Show a time-sorted view of the org file, with all time-stamped items.
  4550. When called with a @kbd{C-u} prefix, all unfinished TODO entries
  4551. (scheduled or not) are also listed under the current date.
  4552. @end table
  4553. @noindent
  4554. The commands available in the timeline buffer are listed in
  4555. @ref{Agenda commands}.
  4556. @node Keyword search, Stuck projects, Timeline, Built-in agenda views
  4557. @subsection Keyword search
  4558. @cindex keyword search
  4559. @cindex searching, for keywords
  4560. This agenda view is a general text search facility for Org mode entries.
  4561. It is particularly useful to find notes.
  4562. @table @kbd
  4563. @kindex C-c a s
  4564. @item C-c a s
  4565. This is a special search that lets you select entries by keywords or
  4566. regular expression, using a boolean logic. For example, the search
  4567. string
  4568. @example
  4569. +computer +wifi -ethernet -@{8\.11[bg]@}
  4570. @end example
  4571. @noindent
  4572. will search for note entries that contain the keywords @code{computer}
  4573. and @code{wifi}, but not the keyword @code{ethernet}, and which are also
  4574. not matched by the regular expression @code{8\.11[bg]}, meaning to
  4575. exclude both 8.11b and 8.11g.
  4576. Note that in addition to the agenda files, this command will also search
  4577. the files listed in @code{org-agenda-text-search-extra-files}.
  4578. @end table
  4579. @node Stuck projects, , Keyword search, Built-in agenda views
  4580. @subsection Stuck projects
  4581. If you are following a system like David Allen's GTD to organize your
  4582. work, one of the ``duties'' you have is a regular review to make sure
  4583. that all projects move along. A @emph{stuck} project is a project that
  4584. has no defined next actions, so it will never show up in the TODO lists
  4585. Org mode produces. During the review, you need to identify such
  4586. projects and define next actions for them.
  4587. @table @kbd
  4588. @kindex C-c a #
  4589. @item C-c a #
  4590. List projects that are stuck.
  4591. @kindex C-c a !
  4592. @item C-c a !
  4593. Customize the variable @code{org-stuck-projects} to define what a stuck
  4594. project is and how to find it.
  4595. @end table
  4596. You almost certainly will have to configure this view before it will
  4597. work for you. The built-in default assumes that all your projects are
  4598. level-2 headlines, and that a project is not stuck if it has at least
  4599. one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
  4600. Lets assume that you, in your own way of using Org mode, identify
  4601. projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
  4602. indicate a project that should not be considered yet. Lets further
  4603. assume that the TODO keyword DONE marks finished projects, and that NEXT
  4604. and TODO indicate next actions. The tag @@SHOP indicates shopping and
  4605. is a next action even without the NEXT tag. Finally, if the project
  4606. contains the special word IGNORE anywhere, it should not be listed
  4607. either. In this case you would start by identifying eligible projects
  4608. with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
  4609. TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
  4610. are not stuck. The correct customization for this is
  4611. @lisp
  4612. (setq org-stuck-projects
  4613. '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
  4614. "\\<IGNORE\\>"))
  4615. @end lisp
  4616. @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
  4617. @section Presentation and sorting
  4618. @cindex presentation, of agenda items
  4619. Before displaying items in an agenda view, Org mode visually prepares
  4620. the items and sorts them. Each item occupies a single line. The line
  4621. starts with a @emph{prefix} that contains the @emph{category}
  4622. (@pxref{Categories}) of the item and other important information. You can
  4623. customize the prefix using the option @code{org-agenda-prefix-format}.
  4624. The prefix is followed by a cleaned-up version of the outline headline
  4625. associated with the item.
  4626. @menu
  4627. * Categories:: Not all tasks are equal
  4628. * Time-of-day specifications:: How the agenda knows the time
  4629. * Sorting of agenda items:: The order of things
  4630. @end menu
  4631. @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
  4632. @subsection Categories
  4633. @cindex category
  4634. The category is a broad label assigned to each agenda item. By default,
  4635. the category is simply derived from the file name, but you can also
  4636. specify it with a special line in the buffer, like this@footnote{For
  4637. backward compatibility, the following also works: If there are several
  4638. such lines in a file, each specifies the category for the text below it.
  4639. The first category also applies to any text before the first CATEGORY
  4640. line. However, using this method is @emph{strongly} deprecated as it is
  4641. incompatible with the outline structure of the document. The correct
  4642. method for setting multiple categories in a buffer is using a
  4643. property.}:
  4644. @example
  4645. #+CATEGORY: Thesis
  4646. @end example
  4647. @noindent
  4648. If you would like to have a special CATEGORY for a single entry or a
  4649. (sub)tree, give the entry a @code{:CATEGORY:} property with the location
  4650. as the value (@pxref{Properties and Columns}).
  4651. @noindent
  4652. The display in the agenda buffer looks best if the category is not
  4653. longer than 10 characters.
  4654. @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
  4655. @subsection Time-of-day specifications
  4656. @cindex time-of-day specification
  4657. Org mode checks each agenda item for a time-of-day specification. The
  4658. time can be part of the time stamp that triggered inclusion into the
  4659. agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time
  4660. ranges can be specified with two time stamps, like
  4661. @c
  4662. @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
  4663. In the headline of the entry itself, a time(range) may also appear as
  4664. plain text (like @samp{12:45} or a @samp{8:30-1pm}. If the agenda
  4665. integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
  4666. specifications in diary entries are recognized as well.
  4667. For agenda display, Org mode extracts the time and displays it in a
  4668. standard 24 hour format as part of the prefix. The example times in
  4669. the previous paragraphs would end up in the agenda like this:
  4670. @example
  4671. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  4672. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  4673. 19:00...... The Vogon reads his poem
  4674. 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
  4675. @end example
  4676. @cindex time grid
  4677. If the agenda is in single-day mode, or for the display of today, the
  4678. timed entries are embedded in a time grid, like
  4679. @example
  4680. 8:00...... ------------------
  4681. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  4682. 10:00...... ------------------
  4683. 12:00...... ------------------
  4684. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  4685. 14:00...... ------------------
  4686. 16:00...... ------------------
  4687. 18:00...... ------------------
  4688. 19:00...... The Vogon reads his poem
  4689. 20:00...... ------------------
  4690. 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
  4691. @end example
  4692. The time grid can be turned on and off with the variable
  4693. @code{org-agenda-use-time-grid}, and can be configured with
  4694. @code{org-agenda-time-grid}.
  4695. @node Sorting of agenda items, , Time-of-day specifications, Presentation and sorting
  4696. @subsection Sorting of agenda items
  4697. @cindex sorting, of agenda items
  4698. @cindex priorities, of agenda items
  4699. Before being inserted into a view, the items are sorted. How this is
  4700. done depends on the type of view.
  4701. @itemize @bullet
  4702. @item
  4703. For the daily/weekly agenda, the items for each day are sorted. The
  4704. default order is to first collect all items containing an explicit
  4705. time-of-day specification. These entries will be shown at the beginning
  4706. of the list, as a @emph{schedule} for the day. After that, items remain
  4707. grouped in categories, in the sequence given by @code{org-agenda-files}.
  4708. Within each category, items are sorted by priority (@pxref{Priorities}),
  4709. which is composed of the base priority (2000 for priority @samp{A}, 1000
  4710. for @samp{B}, and 0 for @samp{C}), plus additional increments for
  4711. overdue scheduled or deadline items.
  4712. @item
  4713. For the TODO list, items remain in the order of categories, but within
  4714. each category, sorting takes place according to priority
  4715. (@pxref{Priorities}).
  4716. @item
  4717. For tags matches, items are not sorted at all, but just appear in the
  4718. sequence in which they are found in the agenda files.
  4719. @end itemize
  4720. Sorting can be customized using the variable
  4721. @code{org-agenda-sorting-strategy}.
  4722. @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
  4723. @section Commands in the agenda buffer
  4724. @cindex commands, in agenda buffer
  4725. Entries in the agenda buffer are linked back to the org file or diary
  4726. file where they originate. You are not allowed to edit the agenda
  4727. buffer itself, but commands are provided to show and jump to the
  4728. original entry location, and to edit the org-files ``remotely'' from
  4729. the agenda buffer. In this way, all information is stored only once,
  4730. removing the risk that your agenda and note files may diverge.
  4731. Some commands can be executed with mouse clicks on agenda lines. For
  4732. the other commands, the cursor needs to be in the desired line.
  4733. @table @kbd
  4734. @tsubheading{Motion}
  4735. @cindex motion commands in agenda
  4736. @kindex n
  4737. @item n
  4738. Next line (same as @key{up} and @kbd{C-p}).
  4739. @kindex p
  4740. @item p
  4741. Previous line (same as @key{down} and @kbd{C-n}).
  4742. @tsubheading{View/Go to org file}
  4743. @kindex mouse-3
  4744. @kindex @key{SPC}
  4745. @item mouse-3
  4746. @itemx @key{SPC}
  4747. Display the original location of the item in another window.
  4748. @c
  4749. @kindex L
  4750. @item L
  4751. Display original location and recenter that window.
  4752. @c
  4753. @kindex mouse-2
  4754. @kindex mouse-1
  4755. @kindex @key{TAB}
  4756. @item mouse-2
  4757. @itemx mouse-1
  4758. @itemx @key{TAB}
  4759. Go to the original location of the item in another window. Under Emacs
  4760. 22, @kbd{mouse-1} will also works for this.
  4761. @c
  4762. @kindex @key{RET}
  4763. @itemx @key{RET}
  4764. Go to the original location of the item and delete other windows.
  4765. @c
  4766. @kindex f
  4767. @item f
  4768. Toggle Follow mode. In Follow mode, as you move the cursor through
  4769. the agenda buffer, the other window always shows the corresponding
  4770. location in the org file. The initial setting for this mode in new
  4771. agenda buffers can be set with the variable
  4772. @code{org-agenda-start-with-follow-mode}.
  4773. @c
  4774. @kindex b
  4775. @item b
  4776. Display the entire subtree of the current item in an indirect buffer. With a
  4777. numeric prefix argument N, go up to level N and then take that tree. If N is
  4778. negative, go up that many levels. With a @kbd{C-u} prefix, do not remove the
  4779. previously used indirect buffer.
  4780. @c
  4781. @kindex l
  4782. @item l
  4783. Toggle Logbook mode. In Logbook mode, entries that where marked DONE while
  4784. logging was on (variable @code{org-log-done}) are shown in the agenda,
  4785. as are entries that have been clocked on that day.
  4786. @c
  4787. @kindex R
  4788. @item R
  4789. Toggle Clockreport mode. In clockreport mode, the daily/weekly agenda will
  4790. always show a table with the clocked times for the timespan and file scope
  4791. covered by the current agenda view. The initial setting for this mode in new
  4792. agenda buffers can be set with the variable
  4793. @code{org-agenda-start-with-follow-mode}.
  4794. @tsubheading{Change display}
  4795. @cindex display changing, in agenda
  4796. @kindex o
  4797. @item o
  4798. Delete other windows.
  4799. @c
  4800. @kindex d
  4801. @kindex w
  4802. @kindex m
  4803. @kindex y
  4804. @item d w m y
  4805. Switch to day/week/month/year view. When switching to day or week view,
  4806. this setting becomes the default for subsequent agenda commands. Since
  4807. month and year views are slow to create, they do not become the default.
  4808. A numeric prefix argument may be used to jump directly to a specific day
  4809. of the year, ISO week, month, or year, respectively. For example,
  4810. @kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9. When
  4811. setting day, week, or month view, a year may be encoded in the prefix
  4812. argument as well. For example, @kbd{200712 w} will jump to week 12 in
  4813. 2007. If such a year specification has only one or two digits, it will
  4814. be mapped to the interval 1938-2037.
  4815. @c
  4816. @kindex D
  4817. @item D
  4818. Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
  4819. @c
  4820. @kindex G
  4821. @item G
  4822. Toggle the time grid on and off. See also the variables
  4823. @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
  4824. @c
  4825. @kindex r
  4826. @item r
  4827. Recreate the agenda buffer, for example to reflect the changes
  4828. after modification of the time stamps of items with S-@key{left} and
  4829. S-@key{right}. When the buffer is the global TODO list, a prefix
  4830. argument is interpreted to create a selective list for a specific TODO
  4831. keyword.
  4832. @kindex g
  4833. @item g
  4834. Same as @kbd{r}.
  4835. @c
  4836. @kindex s
  4837. @kindex C-x C-s
  4838. @item s
  4839. @itemx C-x C-s
  4840. Save all Org buffers in the current Emacs session.
  4841. @c
  4842. @kindex @key{right}
  4843. @item @key{right}
  4844. Display the following @code{org-agenda-ndays} days. For example, if
  4845. the display covers a week, switch to the following week. With prefix
  4846. arg, go forward that many times @code{org-agenda-ndays} days.
  4847. @c
  4848. @kindex @key{left}
  4849. @item @key{left}
  4850. Display the previous dates.
  4851. @c
  4852. @kindex .
  4853. @item .
  4854. Go to today.
  4855. @c
  4856. @kindex C-c C-x C-c
  4857. @item C-c C-x C-c
  4858. Invoke column view (@pxref{Column view}) in the agenda buffer. The column
  4859. view format is taken from the entry at point, or (if there is no entry at
  4860. point), from the first entry in the agenda view. So whatever the format for
  4861. that entry would be in the original buffer (taken from a property, from a
  4862. @code{#+COLUMNS} line, or from the default variable
  4863. @code{org-columns-default-format}), will be used in the agenda.
  4864. @tsubheading{Query editing}
  4865. @cindex query editing, in agenda
  4866. @kindex [
  4867. @kindex ]
  4868. @kindex @{
  4869. @kindex @}
  4870. @item [ ] @{ @}
  4871. In the @i{search view} (@pxref{Keyword search}), these keys add new
  4872. search words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{}
  4873. and @kbd{@}}) to the query string. The opening bracket/brace will add a
  4874. positive search term prefixed by @samp{+}, indicating that this search
  4875. term @i{must} occur/match in the entry. Closing bracket/brace add a
  4876. negative search term which @i{must not} occur/match in the entry for it
  4877. to be selected.
  4878. @tsubheading{Remote editing}
  4879. @cindex remote editing, from agenda
  4880. @item 0-9
  4881. Digit argument.
  4882. @c
  4883. @cindex undoing remote-editing events
  4884. @cindex remote editing, undo
  4885. @kindex C-_
  4886. @item C-_
  4887. Undo a change due to a remote editing command. The change is undone
  4888. both in the agenda buffer and in the remote buffer.
  4889. @c
  4890. @kindex t
  4891. @item t
  4892. Change the TODO state of the item, both in the agenda and in the
  4893. original org file.
  4894. @c
  4895. @kindex C-k
  4896. @item C-k
  4897. Delete the current agenda item along with the entire subtree belonging
  4898. to it in the original Org file. If the text to be deleted remotely
  4899. is longer than one line, the kill needs to be confirmed by the user. See
  4900. variable @code{org-agenda-confirm-kill}.
  4901. @c
  4902. @kindex a
  4903. @item a
  4904. Toggle the ARCHIVE tag for the current headline.
  4905. @c
  4906. @kindex A
  4907. @item A
  4908. Move the subtree correspoding to the current entry to its @emph{Archive
  4909. Sibling}.
  4910. @c
  4911. @kindex $
  4912. @item $
  4913. Archive the subtree corresponding to the current headline. This means the
  4914. entry will be moved to the configured archive locatin, most likely a
  4915. different file.
  4916. @c
  4917. @kindex T
  4918. @item T
  4919. Show all tags associated with the current item. Because of
  4920. inheritance, this may be more than the tags listed in the line itself.
  4921. @c
  4922. @kindex :
  4923. @item :
  4924. Set tags for the current headline. If there is an active region in the
  4925. agenda, change a tag for all headings in the region.
  4926. @c
  4927. @kindex ,
  4928. @item ,
  4929. Set the priority for the current item. Org mode prompts for the
  4930. priority character. If you reply with @key{SPC}, the priority cookie
  4931. is removed from the entry.
  4932. @c
  4933. @kindex P
  4934. @item P
  4935. Display weighted priority of current item.
  4936. @c
  4937. @kindex +
  4938. @kindex S-@key{up}
  4939. @item +
  4940. @itemx S-@key{up}
  4941. Increase the priority of the current item. The priority is changed in
  4942. the original buffer, but the agenda is not resorted. Use the @kbd{r}
  4943. key for this.
  4944. @c
  4945. @kindex -
  4946. @kindex S-@key{down}
  4947. @item -
  4948. @itemx S-@key{down}
  4949. Decrease the priority of the current item.
  4950. @c
  4951. @kindex C-c C-s
  4952. @item C-c C-s
  4953. Schedule this item
  4954. @c
  4955. @kindex C-c C-d
  4956. @item C-c C-d
  4957. Set a deadline for this item.
  4958. @c
  4959. @kindex S-@key{right}
  4960. @item S-@key{right}
  4961. Change the time stamp associated with the current line by one day into the
  4962. future. With a numeric prefix argument, change it by that many days. For
  4963. example, @kbd{3 6 5 S-@key{right}} will change it by a year. The stamp is
  4964. changed in the original org file, but the change is not directly reflected in
  4965. the agenda buffer. Use the @kbd{r} key to update the buffer.
  4966. @c
  4967. @kindex S-@key{left}
  4968. @item S-@key{left}
  4969. Change the time stamp associated with the current line by one day
  4970. into the past.
  4971. @c
  4972. @kindex >
  4973. @item >
  4974. Change the time stamp associated with the current line to today.
  4975. The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
  4976. on my keyboard.
  4977. @c
  4978. @kindex I
  4979. @item I
  4980. Start the clock on the current item. If a clock is running already, it
  4981. is stopped first.
  4982. @c
  4983. @kindex O
  4984. @item O
  4985. Stop the previously started clock.
  4986. @c
  4987. @kindex X
  4988. @item X
  4989. Cancel the currently running clock.
  4990. @kindex J
  4991. @item J
  4992. Jump to the running clock in another window.
  4993. @tsubheading{Calendar commands}
  4994. @cindex calendar commands, from agenda
  4995. @kindex c
  4996. @item c
  4997. Open the Emacs calendar and move to the date at the agenda cursor.
  4998. @c
  4999. @item c
  5000. When in the calendar, compute and show the Org mode agenda for the
  5001. date at the cursor.
  5002. @c
  5003. @cindex diary entries, creating from agenda
  5004. @kindex i
  5005. @item i
  5006. Insert a new entry into the diary. Prompts for the type of entry
  5007. (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
  5008. entry in the diary, just as @kbd{i d} etc. would do in the calendar.
  5009. The date is taken from the cursor position.
  5010. @c
  5011. @kindex M
  5012. @item M
  5013. Show the phases of the moon for the three months around current date.
  5014. @c
  5015. @kindex S
  5016. @item S
  5017. Show sunrise and sunset times. The geographical location must be set
  5018. with calendar variables, see documentation of the Emacs calendar.
  5019. @c
  5020. @kindex C
  5021. @item C
  5022. Convert the date at cursor into many other cultural and historic
  5023. calendars.
  5024. @c
  5025. @kindex H
  5026. @item H
  5027. Show holidays for three month around the cursor date.
  5028. @item M-x org-export-icalendar-combine-agenda-files
  5029. Export a single iCalendar file containing entries from all agenda files.
  5030. This is a globally available command, and also available in the agenda menu.
  5031. @tsubheading{Exporting to a file}
  5032. @kindex C-x C-w
  5033. @item C-x C-w
  5034. @cindex exporting agenda views
  5035. @cindex agenda views, exporting
  5036. Write the agenda view to a file. Depending on the extension of the
  5037. selected file name, the view will be exported as HTML (extension
  5038. @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
  5039. plain text (any other extension). Use the variable
  5040. @code{org-agenda-exporter-settings} to set options for @file{ps-print}
  5041. and for @file{htmlize} to be used during export.
  5042. @tsubheading{Quit and Exit}
  5043. @kindex q
  5044. @item q
  5045. Quit agenda, remove the agenda buffer.
  5046. @c
  5047. @kindex x
  5048. @cindex agenda files, removing buffers
  5049. @item x
  5050. Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
  5051. for the compilation of the agenda. Buffers created by the user to
  5052. visit org files will not be removed.
  5053. @end table
  5054. @node Custom agenda views, , Agenda commands, Agenda Views
  5055. @section Custom agenda views
  5056. @cindex custom agenda views
  5057. @cindex agenda views, custom
  5058. Custom agenda commands serve two purposes: to store and quickly access
  5059. frequently used TODO and tags searches, and to create special composite
  5060. agenda buffers. Custom agenda commands will be accessible through the
  5061. dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
  5062. @menu
  5063. * Storing searches:: Type once, use often
  5064. * Block agenda:: All the stuff you need in a single buffer
  5065. * Setting Options:: Changing the rules
  5066. * Exporting Agenda Views:: Writing agendas to files
  5067. * Using the agenda elsewhere:: Using agenda information in other programs
  5068. @end menu
  5069. @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
  5070. @subsection Storing searches
  5071. The first application of custom searches is the definition of keyboard
  5072. shortcuts for frequently used searches, either creating an agenda
  5073. buffer, or a sparse tree (the latter covering of course only the current
  5074. buffer).
  5075. @kindex C-c a C
  5076. Custom commands are configured in the variable
  5077. @code{org-agenda-custom-commands}. You can customize this variable, for
  5078. example by pressing @kbd{C-c a C}. You can also directly set it with
  5079. Emacs Lisp in @file{.emacs}. The following example contains all valid
  5080. search types:
  5081. @lisp
  5082. @group
  5083. (setq org-agenda-custom-commands
  5084. '(("w" todo "WAITING")
  5085. ("W" todo-tree "WAITING")
  5086. ("u" tags "+boss-urgent")
  5087. ("v" tags-todo "+boss-urgent")
  5088. ("U" tags-tree "+boss-urgent")
  5089. ("f" occur-tree "\\<FIXME\\>")
  5090. ("h" . "HOME+Name tags searches") ; description for "h" prefix
  5091. ("hl" tags "+home+Lisa")
  5092. ("hp" tags "+home+Peter")
  5093. ("hk" tags "+home+Kim")))
  5094. @end group
  5095. @end lisp
  5096. @noindent
  5097. The initial string in each entry defines the keys you have to press
  5098. after the dispatcher command @kbd{C-c a} in order to access the command.
  5099. Usually this will be just a single character, but if you have many
  5100. similar commands, you can also define two-letter combinations where the
  5101. first character is the same in several combinations and serves as a
  5102. prefix key@footnote{You can provide a description for a prefix key by
  5103. inserting a cons cell with the prefix and the description.}. The second
  5104. parameter is the search type, followed by the string or regular
  5105. expression to be used for the matching. The example above will
  5106. therefore define:
  5107. @table @kbd
  5108. @item C-c a w
  5109. as a global search for TODO entries with @samp{WAITING} as the TODO
  5110. keyword
  5111. @item C-c a W
  5112. as the same search, but only in the current buffer and displaying the
  5113. results as a sparse tree
  5114. @item C-c a u
  5115. as a global tags search for headlines marked @samp{:boss:} but not
  5116. @samp{:urgent:}
  5117. @item C-c a v
  5118. as the same search as @kbd{C-c a u}, but limiting the search to
  5119. headlines that are also TODO items
  5120. @item C-c a U
  5121. as the same search as @kbd{C-c a u}, but only in the current buffer and
  5122. displaying the result as a sparse tree
  5123. @item C-c a f
  5124. to create a sparse tree (again: current buffer only) with all entries
  5125. containing the word @samp{FIXME}
  5126. @item C-c a h
  5127. as a prefix command for a HOME tags search where you have to press an
  5128. additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
  5129. Peter, or Kim) as additional tag to match.
  5130. @end table
  5131. @node Block agenda, Setting Options, Storing searches, Custom agenda views
  5132. @subsection Block agenda
  5133. @cindex block agenda
  5134. @cindex agenda, with block views
  5135. Another possibility is the construction of agenda views that comprise
  5136. the results of @emph{several} commands, each of which creates a block in
  5137. the agenda buffer. The available commands include @code{agenda} for the
  5138. daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
  5139. for the global TODO list (as constructed with @kbd{C-c a t}), and the
  5140. matching commands discussed above: @code{todo}, @code{tags}, and
  5141. @code{tags-todo}. Here are two examples:
  5142. @lisp
  5143. @group
  5144. (setq org-agenda-custom-commands
  5145. '(("h" "Agenda and Home-related tasks"
  5146. ((agenda "")
  5147. (tags-todo "home")
  5148. (tags "garden")))
  5149. ("o" "Agenda and Office-related tasks"
  5150. ((agenda "")
  5151. (tags-todo "work")
  5152. (tags "office")))))
  5153. @end group
  5154. @end lisp
  5155. @noindent
  5156. This will define @kbd{C-c a h} to create a multi-block view for stuff
  5157. you need to attend to at home. The resulting agenda buffer will contain
  5158. your agenda for the current week, all TODO items that carry the tag
  5159. @samp{home}, and also all lines tagged with @samp{garden}. Finally the
  5160. command @kbd{C-c a o} provides a similar view for office tasks.
  5161. @node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
  5162. @subsection Setting options for custom commands
  5163. @cindex options, for custom agenda views
  5164. Org mode contains a number of variables regulating agenda construction
  5165. and display. The global variables define the behavior for all agenda
  5166. commands, including the custom commands. However, if you want to change
  5167. some settings just for a single custom view, you can do so. Setting
  5168. options requires inserting a list of variable names and values at the
  5169. right spot in @code{org-agenda-custom-commands}. For example:
  5170. @lisp
  5171. @group
  5172. (setq org-agenda-custom-commands
  5173. '(("w" todo "WAITING"
  5174. ((org-agenda-sorting-strategy '(priority-down))
  5175. (org-agenda-prefix-format " Mixed: ")))
  5176. ("U" tags-tree "+boss-urgent"
  5177. ((org-show-following-heading nil)
  5178. (org-show-hierarchy-above nil)))
  5179. ("N" search ""
  5180. ((org-agenda-files '("~org/notes.org"))
  5181. (org-agenda-text-search-extra-files nil)))))
  5182. @end group
  5183. @end lisp
  5184. @noindent
  5185. Now the @kbd{C-c a w} command will sort the collected entries only by
  5186. priority, and the prefix format is modified to just say @samp{ Mixed: }
  5187. instead of giving the category of the entry. The sparse tags tree of
  5188. @kbd{C-c a U} will now turn out ultra-compact, because neither the
  5189. headline hierarchy above the match, nor the headline following the match
  5190. will be shown. The command @kbd{C-c a N} will do a text search limited
  5191. to only a single file.
  5192. For command sets creating a block agenda,
  5193. @code{org-agenda-custom-commands} has two separate spots for setting
  5194. options. You can add options that should be valid for just a single
  5195. command in the set, and options that should be valid for all commands in
  5196. the set. The former are just added to the command entry, the latter
  5197. must come after the list of command entries. Going back to the block
  5198. agenda example (@pxref{Block agenda}), let's change the sorting strategy
  5199. for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
  5200. the results for GARDEN tags query in the opposite order,
  5201. @code{priority-up}. This would look like this:
  5202. @lisp
  5203. @group
  5204. (setq org-agenda-custom-commands
  5205. '(("h" "Agenda and Home-related tasks"
  5206. ((agenda)
  5207. (tags-todo "home")
  5208. (tags "garden"
  5209. ((org-agenda-sorting-strategy '(priority-up)))))
  5210. ((org-agenda-sorting-strategy '(priority-down))))
  5211. ("o" "Agenda and Office-related tasks"
  5212. ((agenda)
  5213. (tags-todo "work")
  5214. (tags "office")))))
  5215. @end group
  5216. @end lisp
  5217. As you see, the values and parenthesis setting is a little complex.
  5218. When in doubt, use the customize interface to set this variable - it
  5219. fully supports its structure. Just one caveat: When setting options in
  5220. this interface, the @emph{values} are just lisp expressions. So if the
  5221. value is a string, you need to add the double quotes around the value
  5222. yourself.
  5223. @node Exporting Agenda Views, Using the agenda elsewhere, Setting Options, Custom agenda views
  5224. @subsection Exporting Agenda Views
  5225. @cindex agenda views, exporting
  5226. If you are away from your computer, it can be very useful to have a
  5227. printed version of some agenda views to carry around. Org mode can
  5228. export custom agenda views as plain text, HTML@footnote{You need to
  5229. install Hrvoje Niksic' @file{htmlize.el}.} postscript, and iCalendar
  5230. files. If you want to do this only occasionally, use the command
  5231. @table @kbd
  5232. @kindex C-x C-w
  5233. @item C-x C-w
  5234. @cindex exporting agenda views
  5235. @cindex agenda views, exporting
  5236. Write the agenda view to a file. Depending on the extension of the
  5237. selected file name, the view will be exported as HTML (extension
  5238. @file{.html} or @file{.htm}), Postscript (extension @file{.ps}),
  5239. iCalendar (extension @file{.ics}), or plain text (any other extension).
  5240. Use the variable @code{org-agenda-exporter-settings} to
  5241. set options for @file{ps-print} and for @file{htmlize} to be used during
  5242. export, for example
  5243. @lisp
  5244. (setq org-agenda-exporter-settings
  5245. '((ps-number-of-columns 2)
  5246. (ps-landscape-mode t)
  5247. (htmlize-output-type 'css)))
  5248. @end lisp
  5249. @end table
  5250. If you need to export certain agenda views frequently, you can associate
  5251. any custom agenda command with a list of output file names
  5252. @footnote{If you want to store standard views like the weekly agenda
  5253. or the global TODO list as well, you need to define custom commands for
  5254. them in order to be able to specify file names.}. Here is an example
  5255. that first does define custom commands for the agenda and the global
  5256. todo list, together with a number of files to which to export them.
  5257. Then we define two block agenda commands and specify file names for them
  5258. as well. File names can be relative to the current working directory,
  5259. or absolute.
  5260. @lisp
  5261. @group
  5262. (setq org-agenda-custom-commands
  5263. '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  5264. ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  5265. ("h" "Agenda and Home-related tasks"
  5266. ((agenda "")
  5267. (tags-todo "home")
  5268. (tags "garden"))
  5269. nil
  5270. ("~/views/home.html"))
  5271. ("o" "Agenda and Office-related tasks"
  5272. ((agenda)
  5273. (tags-todo "work")
  5274. (tags "office"))
  5275. nil
  5276. ("~/views/office.ps" "~/calendars/office.ics"))))
  5277. @end group
  5278. @end lisp
  5279. The extension of the file name determines the type of export. If it is
  5280. @file{.html}, Org mode will use the @file{htmlize.el} package to convert
  5281. the buffer to HTML and save it to this file name. If the extension is
  5282. @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
  5283. postscript output. If the extension is @file{.ics}, iCalendar export is
  5284. run export over all files that were used to construct the agenda, and
  5285. limit the export to entries listed in the agenda now. Any other
  5286. extension produces a plain ASCII file.
  5287. The export files are @emph{not} created when you use one of those
  5288. commands interactively because this might use too much overhead.
  5289. Instead, there is a special command to produce @emph{all} specified
  5290. files in one step:
  5291. @table @kbd
  5292. @kindex C-c a e
  5293. @item C-c a e
  5294. Export all agenda views that have export file names associated with
  5295. them.
  5296. @end table
  5297. You can use the options section of the custom agenda commands to also
  5298. set options for the export commands. For example:
  5299. @lisp
  5300. (setq org-agenda-custom-commands
  5301. '(("X" agenda ""
  5302. ((ps-number-of-columns 2)
  5303. (ps-landscape-mode t)
  5304. (org-agenda-prefix-format " [ ] ")
  5305. (org-agenda-with-colors nil)
  5306. (org-agenda-remove-tags t))
  5307. ("theagenda.ps"))))
  5308. @end lisp
  5309. @noindent
  5310. This command sets two options for the postscript exporter, to make it
  5311. print in two columns in landscape format - the resulting page can be cut
  5312. in two and then used in a paper agenda. The remaining settings modify
  5313. the agenda prefix to omit category and scheduling information, and
  5314. instead include a checkbox to check off items. We also remove the tags
  5315. to make the lines compact, and we don't want to use colors for the
  5316. black-and-white printer. Settings specified in
  5317. @code{org-agenda-exporter-settings} will also apply, but the settings
  5318. in @code{org-agenda-custom-commands} take precedence.
  5319. @noindent
  5320. From the command line you may also use
  5321. @example
  5322. emacs -f org-batch-store-agenda-views -kill
  5323. @end example
  5324. @noindent
  5325. or, if you need to modify some parameters
  5326. @example
  5327. emacs -eval '(org-batch-store-agenda-views \
  5328. org-agenda-ndays 30 \
  5329. org-agenda-start-day "2007-11-01" \
  5330. org-agenda-include-diary nil \
  5331. org-agenda-files (quote ("~/org/project.org")))' \
  5332. -kill
  5333. @end example
  5334. @noindent
  5335. which will create the agenda views restricted to the file
  5336. @file{~/org/project.org}, without diary entries and with 30 days
  5337. extent.
  5338. @node Using the agenda elsewhere, , Exporting Agenda Views, Custom agenda views
  5339. @subsection Using agenda information outside of Org
  5340. @cindex agenda, pipe
  5341. @cindex Scripts, for agenda processing
  5342. Org provides commands to access agenda information for the command
  5343. line in emacs batch mode. This extracted information can be sent
  5344. directly to a printer, or it can be read by a program that does further
  5345. processing of the data. The first of these commands is the function
  5346. @code{org-batch-agenda}, that produces an agenda view and sends it as
  5347. ASCII text to STDOUT. The command takes a single string as parameter.
  5348. If the string has length 1, it is used as a key to one of the commands
  5349. you have configured in @code{org-agenda-custom-commands}, basically any
  5350. key you can use after @kbd{C-c a}. For example, to directly print the
  5351. current TODO list, you could use
  5352. @example
  5353. emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  5354. @end example
  5355. If the parameter is a string with 2 or more characters, it is used as a
  5356. tags/todo match string. For example, to print your local shopping list
  5357. (all items with the tag @samp{shop}, but excluding the tag
  5358. @samp{NewYork}), you could use
  5359. @example
  5360. emacs -batch -l ~/.emacs \
  5361. -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  5362. @end example
  5363. @noindent
  5364. You may also modify parameters on the fly like this:
  5365. @example
  5366. emacs -batch -l ~/.emacs \
  5367. -eval '(org-batch-agenda "a" \
  5368. org-agenda-ndays 30 \
  5369. org-agenda-include-diary nil \
  5370. org-agenda-files (quote ("~/org/project.org")))' \
  5371. | lpr
  5372. @end example
  5373. @noindent
  5374. which will produce a 30 day agenda, fully restricted to the Org file
  5375. @file{~/org/projects.org}, not even including the diary.
  5376. If you want to process the agenda data in more sophisticated ways, you
  5377. can use the command @code{org-batch-agenda-csv} to get a comma-separated
  5378. list of values for each agenda item. Each line in the output will
  5379. contain a number of fields separated by commas. The fields in a line
  5380. are:
  5381. @example
  5382. category @r{The category of the item}
  5383. head @r{The headline, without TODO kwd, TAGS and PRIORITY}
  5384. type @r{The type of the agenda entry, can be}
  5385. todo @r{selected in TODO match}
  5386. tagsmatch @r{selected in tags match}
  5387. diary @r{imported from diary}
  5388. deadline @r{a deadline}
  5389. scheduled @r{scheduled}
  5390. timestamp @r{appointment, selected by timestamp}
  5391. closed @r{entry was closed on date}
  5392. upcoming-deadline @r{warning about nearing deadline}
  5393. past-scheduled @r{forwarded scheduled item}
  5394. block @r{entry has date block including date}
  5395. todo @r{The TODO keyword, if any}
  5396. tags @r{All tags including inherited ones, separated by colons}
  5397. date @r{The relevant date, like 2007-2-14}
  5398. time @r{The time, like 15:00-16:50}
  5399. extra @r{String with extra planning info}
  5400. priority-l @r{The priority letter if any was given}
  5401. priority-n @r{The computed numerical priority}
  5402. @end example
  5403. @noindent
  5404. Time and date will only be given if a timestamp (or deadline/scheduled)
  5405. lead to the selection of the item.
  5406. A CSV list like this is very easy to use in a post processing script.
  5407. For example, here is a Perl program that gets the TODO list from
  5408. Emacs/Org and prints all the items, preceded by a checkbox:
  5409. @example
  5410. @group
  5411. #!/usr/bin/perl
  5412. # define the Emacs command to run
  5413. $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  5414. # run it and capture the output
  5415. $agenda = qx@{$cmd 2>/dev/null@};
  5416. # loop over all lines
  5417. foreach $line (split(/\n/,$agenda)) @{
  5418. # get the individual values
  5419. ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  5420. $priority_l,$priority_n) = split(/,/,$line);
  5421. # proccess and print
  5422. print "[ ] $head\n";
  5423. @}
  5424. @end group
  5425. @end example
  5426. @node Embedded LaTeX, Exporting, Agenda Views, Top
  5427. @chapter Embedded LaTeX
  5428. @cindex @TeX{} interpretation
  5429. @cindex La@TeX{} interpretation
  5430. Plain ASCII is normally sufficient for almost all note taking. One
  5431. exception, however, are scientific notes which need to be able to contain
  5432. mathematical symbols and the occasional formula. La@TeX{}@footnote{La@TeX{}
  5433. is a macro system based on Donald E. Knuth's @TeX{} system. Many of the
  5434. features described here as ``La@TeX{}'' are really from @TeX{}, but for
  5435. simplicity I am blurring this distinction.} is widely used to typeset
  5436. scientific documents. Org mode supports embedding La@TeX{} code into its
  5437. files, because many academics are used to reading La@TeX{} source code, and
  5438. because it can be readily processed into images for HTML production.
  5439. It is not necessary to mark La@TeX{} macros and code in any special way.
  5440. If you observe a few conventions, Org mode knows how to find it and what
  5441. to do with it.
  5442. @menu
  5443. * Math symbols:: TeX macros for symbols and Greek letters
  5444. * Subscripts and superscripts:: Simple syntax for raising/lowering text
  5445. * LaTeX fragments:: Complex formulas made easy
  5446. * Processing LaTeX fragments:: Previewing LaTeX processing
  5447. * CDLaTeX mode:: Speed up entering of formulas
  5448. @end menu
  5449. @node Math symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
  5450. @section Math symbols
  5451. @cindex math symbols
  5452. @cindex TeX macros
  5453. You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
  5454. to indicate the Greek letter, or @samp{\to} to indicate an arrow.
  5455. Completion for these macros is available, just type @samp{\} and maybe a
  5456. few letters, and press @kbd{M-@key{TAB}} to see possible completions.
  5457. Unlike La@TeX{} code, Org mode allows these macros to be present
  5458. without surrounding math delimiters, for example:
  5459. @example
  5460. Angles are written as Greek letters \alpha, \beta and \gamma.
  5461. @end example
  5462. During HTML export (@pxref{HTML export}), these symbols are translated
  5463. into the proper syntax for HTML, for the above examples this is
  5464. @samp{&alpha;} and @samp{&rarr;}, respectively.
  5465. @node Subscripts and superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
  5466. @section Subscripts and superscripts
  5467. @cindex subscript
  5468. @cindex superscript
  5469. Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
  5470. and subscripts. Again, these can be used without embedding them in
  5471. math-mode delimiters. To increase the readability of ASCII text, it is
  5472. not necessary (but OK) to surround multi-character sub- and superscripts
  5473. with curly braces. For example
  5474. @example
  5475. The mass if the sun is M_sun = 1.989 x 10^30 kg. The radius of
  5476. the sun is R_@{sun@} = 6.96 x 10^8 m.
  5477. @end example
  5478. To avoid interpretation as raised or lowered text, you can quote
  5479. @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
  5480. During HTML export (@pxref{HTML export}), subscript and superscripts
  5481. are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
  5482. @node LaTeX fragments, Processing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
  5483. @section LaTeX fragments
  5484. @cindex LaTeX fragments
  5485. With symbols, sub- and superscripts, HTML is pretty much at its end when
  5486. it comes to representing mathematical formulas@footnote{Yes, there is
  5487. MathML, but that is not yet fully supported by many browsers, and there
  5488. is no decent converter for turning La@TeX{} or ASCII representations of
  5489. formulas into MathML. So for the time being, converting formulas into
  5490. images seems the way to go.}. More complex expressions need a dedicated
  5491. formula processor. To this end, Org mode can contain arbitrary La@TeX{}
  5492. fragments. It provides commands to preview the typeset result of these
  5493. fragments, and upon export to HTML, all fragments will be converted to
  5494. images and inlined into the HTML document@footnote{The La@TeX{} export
  5495. will not use images for displaying La@TeX{} fragments but include these
  5496. fragments directly into the La@TeX{} code.}. For this to work you
  5497. need to be on a system with a working La@TeX{} installation. You also
  5498. need the @file{dvipng} program, available at
  5499. @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
  5500. will be used when processing a fragment can be configured with the
  5501. variable @code{org-format-latex-header}.
  5502. La@TeX{} fragments don't need any special marking at all. The following
  5503. snippets will be identified as La@TeX{} source code:
  5504. @itemize @bullet
  5505. @item
  5506. Environments of any kind. The only requirement is that the
  5507. @code{\begin} statement appears on a new line, preceded by only
  5508. whitespace.
  5509. @item
  5510. Text within the usual La@TeX{} math delimiters. To avoid conflicts with
  5511. currency specifications, single @samp{$} characters are only recognized
  5512. as math delimiters if the enclosed text contains at most two line breaks,
  5513. is directly attached to the @samp{$} characters with no whitespace in
  5514. between, and if the closing @samp{$} is followed by whitespace or
  5515. punctuation. For the other delimiters, there is no such restriction, so
  5516. when in doubt, use @samp{\(...\)} as inline math delimiters.
  5517. @end itemize
  5518. @noindent For example:
  5519. @example
  5520. \begin@{equation@} % arbitrary environments,
  5521. x=\sqrt@{b@} % even tables, figures
  5522. \end@{equation@} % etc
  5523. If $a^2=b$ and \( b=2 \), then the solution must be
  5524. either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
  5525. @end example
  5526. @noindent
  5527. If you need any of the delimiter ASCII sequences for other purposes, you
  5528. can configure the option @code{org-format-latex-options} to deselect the
  5529. ones you do not wish to have interpreted by the La@TeX{} converter.
  5530. @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
  5531. @section Processing LaTeX fragments
  5532. @cindex LaTeX fragments, preview
  5533. La@TeX{} fragments can be processed to produce a preview images of the
  5534. typeset expressions:
  5535. @table @kbd
  5536. @kindex C-c C-x C-l
  5537. @item C-c C-x C-l
  5538. Produce a preview image of the La@TeX{} fragment at point and overlay it
  5539. over the source code. If there is no fragment at point, process all
  5540. fragments in the current entry (between two headlines). When called
  5541. with a prefix argument, process the entire subtree. When called with
  5542. two prefix arguments, or when the cursor is before the first headline,
  5543. process the entire buffer.
  5544. @kindex C-c C-c
  5545. @item C-c C-c
  5546. Remove the overlay preview images.
  5547. @end table
  5548. During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
  5549. converted into images and inlined into the document if the following
  5550. setting is active:
  5551. @lisp
  5552. (setq org-export-with-LaTeX-fragments t)
  5553. @end lisp
  5554. @node CDLaTeX mode, , Processing LaTeX fragments, Embedded LaTeX
  5555. @section Using CDLaTeX to enter math
  5556. @cindex CDLaTeX
  5557. CDLaTeX mode is a minor mode that is normally used in combination with a
  5558. major La@TeX{} mode like AUCTeX in order to speed-up insertion of
  5559. environments and math templates. Inside Org mode, you can make use of
  5560. some of the features of CDLaTeX mode. You need to install
  5561. @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
  5562. AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
  5563. Don't turn CDLaTeX mode itself under Org mode, but use the light
  5564. version @code{org-cdlatex-mode} that comes as part of Org mode. Turn it
  5565. on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
  5566. Org files with
  5567. @lisp
  5568. (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
  5569. @end lisp
  5570. When this mode is enabled, the following features are present (for more
  5571. details see the documentation of CDLaTeX mode):
  5572. @itemize @bullet
  5573. @kindex C-c @{
  5574. @item
  5575. Environment templates can be inserted with @kbd{C-c @{}.
  5576. @item
  5577. @kindex @key{TAB}
  5578. The @key{TAB} key will do template expansion if the cursor is inside a
  5579. La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
  5580. inside such a fragment, see the documentation of the function
  5581. @code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will
  5582. expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
  5583. correctly inside the first brace. Another @key{TAB} will get you into
  5584. the second brace. Even outside fragments, @key{TAB} will expand
  5585. environment abbreviations at the beginning of a line. For example, if
  5586. you write @samp{equ} at the beginning of a line and press @key{TAB},
  5587. this abbreviation will be expanded to an @code{equation} environment.
  5588. To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
  5589. @item
  5590. @kindex _
  5591. @kindex ^
  5592. Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
  5593. characters together with a pair of braces. If you use @key{TAB} to move
  5594. out of the braces, and if the braces surround only a single character or
  5595. macro, they are removed again (depending on the variable
  5596. @code{cdlatex-simplify-sub-super-scripts}).
  5597. @item
  5598. @kindex `
  5599. Pressing the backquote @kbd{`} followed by a character inserts math
  5600. macros, also outside La@TeX{} fragments. If you wait more than 1.5 seconds
  5601. after the backquote, a help window will pop up.
  5602. @item
  5603. @kindex '
  5604. Pressing the normal quote @kbd{'} followed by another character modifies
  5605. the symbol before point with an accent or a font. If you wait more than
  5606. 1.5 seconds after the backquote, a help window will pop up. Character
  5607. modification will work only inside La@TeX{} fragments, outside the quote
  5608. is normal.
  5609. @end itemize
  5610. @node Exporting, Publishing, Embedded LaTeX, Top
  5611. @chapter Exporting
  5612. @cindex exporting
  5613. Org mode documents can be exported into a variety of other formats. For
  5614. printing and sharing of notes, ASCII export produces a readable and
  5615. simple version of an Org file. HTML export allows you to publish a
  5616. notes file on the web, while the XOXO format provides a solid base for
  5617. exchange with a broad range of other applications. La@TeX{} export lets
  5618. you use Org mode and its structured editing functions to easily create
  5619. La@TeX{} files. To incorporate entries with associated times like
  5620. deadlines or appointments into a desktop calendar program like iCal,
  5621. Org mode can also produce extracts in the iCalendar format. Currently
  5622. Org mode only supports export, not import of these different formats.
  5623. When exporting, Org mode uses special conventions to enrich the output
  5624. produced. @xref{Text interpretation}, for more details.
  5625. @table @kbd
  5626. @kindex C-c C-e
  5627. @item C-c C-e
  5628. Dispatcher for export and publishing commands. Displays a help-window
  5629. listing the additional key(s) needed to launch an export or publishing
  5630. command.
  5631. @end table
  5632. @menu
  5633. * ASCII export:: Exporting to plain ASCII
  5634. * HTML export:: Exporting to HTML
  5635. * LaTeX export:: Exporting to LaTeX
  5636. * XOXO export:: Exporting to XOXO
  5637. * iCalendar export:: Exporting in iCalendar format
  5638. * Text interpretation:: How the exporter looks at the file
  5639. @end menu
  5640. @node ASCII export, HTML export, Exporting, Exporting
  5641. @section ASCII export
  5642. @cindex ASCII export
  5643. ASCII export produces a simple and very readable version of an Org mode
  5644. file.
  5645. @cindex region, active
  5646. @cindex active region
  5647. @cindex Transient mark mode
  5648. @table @kbd
  5649. @kindex C-c C-e a
  5650. @item C-c C-e a
  5651. Export as ASCII file. For an org file @file{myfile.org}, the ASCII file
  5652. will be @file{myfile.txt}. The file will be overwritten without
  5653. warning. If there is an active region, only the region will be
  5654. exported. If the selected region is a single tree, the tree head will
  5655. become the document title. If the tree head entry has or inherits an
  5656. @code{:EXPORT_FILE_NAME:} property, that name will be used for the
  5657. export.
  5658. @kindex C-c C-e v a
  5659. @item C-c C-e v a
  5660. Export only the visible part of the document.
  5661. @end table
  5662. @cindex headline levels, for exporting
  5663. In the exported version, the first 3 outline levels will become
  5664. headlines, defining a general document structure. Additional levels
  5665. will be exported as itemized lists. If you want that transition to occur
  5666. at a different level, specify it with a prefix argument. For example,
  5667. @example
  5668. @kbd{C-1 C-c C-e a}
  5669. @end example
  5670. @noindent
  5671. creates only top level headlines and does the rest as items. When
  5672. headlines are converted to items, the indentation of the text following
  5673. the headline is changed to fit nicely under the item. This is done with
  5674. the assumption that the first body line indicates the base indentation of
  5675. the body text. Any indentation larger than this is adjusted to preserve
  5676. the layout relative to the first line. Should there be lines with less
  5677. indentation than the first, these are left alone.
  5678. @node HTML export, LaTeX export, ASCII export, Exporting
  5679. @section HTML export
  5680. @cindex HTML export
  5681. Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
  5682. HTML formatting, in ways similar to John Grubers @emph{markdown}
  5683. language, but with additional support for tables.
  5684. @menu
  5685. * HTML Export commands:: How to invoke LaTeX export
  5686. * Quoting HTML tags:: Using direct HTML in Org mode
  5687. * Links:: Transformation of links for HTML
  5688. * Images:: How to include images
  5689. * CSS support:: Changing the appearance of the output
  5690. * Javascript support:: Info and Folding in a web browser
  5691. @end menu
  5692. @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
  5693. @subsection HTML export commands
  5694. @cindex region, active
  5695. @cindex active region
  5696. @cindex Transient mark mode
  5697. @table @kbd
  5698. @kindex C-c C-e h
  5699. @item C-c C-e h
  5700. Export as HTML file @file{myfile.html}. For an org file
  5701. @file{myfile.org}, the ASCII file will be @file{myfile.html}. The file
  5702. will be overwritten without warning. If there is an active region, only
  5703. the region will be exported. If the selected region is a single tree,
  5704. the tree head will become the document title. If the tree head entry
  5705. has or inherits an @code{:EXPORT_FILE_NAME:} property, that name will be
  5706. used for the export.
  5707. @kindex C-c C-e b
  5708. @item C-c C-e b
  5709. Export as HTML file and immediately open it with a browser.
  5710. @kindex C-c C-e H
  5711. @item C-c C-e H
  5712. Export to a temporary buffer, do not create a file.
  5713. @kindex C-c C-e R
  5714. @item C-c C-e R
  5715. Export the active region to a temporary buffer. With a prefix argument, do
  5716. not produce the file header and footer, but just the plain HTML section for
  5717. the region. This is good for cut-and-paste operations.
  5718. @kindex C-c C-e v h
  5719. @kindex C-c C-e v b
  5720. @kindex C-c C-e v H
  5721. @kindex C-c C-e v R
  5722. @item C-c C-e v h
  5723. @item C-c C-e v b
  5724. @item C-c C-e v H
  5725. @item C-c C-e v R
  5726. Export only the visible part of the document.
  5727. @item M-x org-export-region-as-html
  5728. Convert the region to HTML under the assumption that it was Org mode
  5729. syntax before. This is a global command that can be invoked in any
  5730. buffer.
  5731. @item M-x org-replace-region-by-HTML
  5732. Replace the active region (assumed to be in Org mode syntax) by HTML
  5733. code.
  5734. @end table
  5735. @cindex headline levels, for exporting
  5736. In the exported version, the first 3 outline levels will become headlines,
  5737. defining a general document structure. Additional levels will be exported as
  5738. itemized lists. If you want that transition to occur at a different level,
  5739. specify it with a numeric prefix argument. For example,
  5740. @example
  5741. @kbd{C-2 C-c C-e b}
  5742. @end example
  5743. @noindent
  5744. creates two levels of headings and does the rest as items.
  5745. @node Quoting HTML tags, Links, HTML Export commands, HTML export
  5746. @subsection Quoting HTML tags
  5747. Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
  5748. @samp{&gt;} in HTML export. If you want to include simple HTML tags
  5749. which should be interpreted as such, mark them with @samp{@@} as in
  5750. @samp{@@<b>bold text@@</b>}. Note that this really works only for
  5751. simple tags. For more extensive HTML that should be copied verbatim to
  5752. the exported file use either
  5753. @example
  5754. #+HTML: Literal HTML code for export
  5755. @end example
  5756. @noindent or
  5757. @example
  5758. #+BEGIN_HTML
  5759. All lines between these markers are exported literally
  5760. #+END_HTML
  5761. @end example
  5762. @node Links, Images, Quoting HTML tags, HTML export
  5763. @subsection Links
  5764. @cindex links, in HTML export
  5765. @cindex internal links, in HTML export
  5766. @cindex external links, in HTML export
  5767. Internal links (@pxref{Internal links}) will continue to work in HTML
  5768. files only if they match a dedicated @samp{<<target>>}. Automatic links
  5769. created by radio targets (@pxref{Radio targets}) will also work in the
  5770. HTML file. Links to external files will still work if the HTML file is
  5771. in the same directory as the Org file. Links to other @file{.org}
  5772. files will be translated into HTML links under the assumption that an
  5773. HTML version also exists of the linked file. For information related to
  5774. linking files while publishing them to a publishing directory see
  5775. @ref{Publishing links}.
  5776. @node Images, CSS support, Links, HTML export
  5777. @subsection Images
  5778. @cindex images, inline in HTML
  5779. @cindex inlining images in HTML
  5780. HTML export can inline images given as links in the Org file, and
  5781. it can make an image the clickable part of a link. By
  5782. default@footnote{but see the variable
  5783. @code{org-export-html-inline-images}}, images are inlined if a link does
  5784. not have a description. So @samp{[[file:myimg.jpg]]} will be inlined,
  5785. while @samp{[[file:myimg.jpg][the image]]} will just produce a link
  5786. @samp{the image} that points to the image. If the description part
  5787. itself is a @code{file:} link or a @code{http:} URL pointing to an
  5788. image, this image will be inlined and activated so that clicking on the
  5789. image will activate the link. For example, to include a thumbnail that
  5790. will link to a high resolution version of the image, you could use:
  5791. @example
  5792. [[file:highres.jpg][file:thumb.jpg]]
  5793. @end example
  5794. @noindent
  5795. and you could use @code{http} addresses just as well.
  5796. @node CSS support, Javascript support, Images, HTML export
  5797. @subsection CSS support
  5798. @cindex CSS, for HTML export
  5799. @cindex HTML export, CSS
  5800. You can also give style information for the exported file. The HTML
  5801. exporter assigns the following CSS classes to appropriate parts of the
  5802. document - your style specifications may change these:
  5803. @example
  5804. .todo @r{TODO keywords}
  5805. .done @r{the DONE keyword}
  5806. .timestamp @r{time stamp}
  5807. .timestamp-kwd @r{keyword associated with a time stamp, like SCHEDULED}
  5808. .tag @r{tag in a headline}
  5809. .target @r{target for links}
  5810. @end example
  5811. The default style specification can be configured through the option
  5812. @code{org-export-html-style}. If you want to use a file-local style,
  5813. you may use file variables, best wrapped into a COMMENT section at the
  5814. end of the outline tree. For example@footnote{Under Emacs 21, the
  5815. continuation lines for a variable value should have no @samp{#} at the
  5816. start of the line.}:
  5817. @example
  5818. * COMMENT html style specifications
  5819. # Local Variables:
  5820. # org-export-html-style: " <style type=\"text/css\">
  5821. # p @{font-weight: normal; color: gray; @}
  5822. # h1 @{color: black; @}
  5823. # </style>"
  5824. # End:
  5825. @end example
  5826. Remember to execute @kbd{M-x normal-mode} after changing this to make
  5827. the new style visible to Emacs. This command restarts Org mode for the
  5828. current buffer and forces Emacs to re-evaluate the local variables
  5829. section in the buffer.
  5830. @c FIXME: More about header and footer styles
  5831. @c FIXME: Talk about links and targets.
  5832. @node Javascript support, , CSS support, HTML export
  5833. @subsection Javascript supported display of web pages
  5834. @emph{Sebastian Rose} has written a JavaScript program especially designed to
  5835. enhance the web viewing experience of HTML files created with Org. This
  5836. program allows to view large files in two different ways. The first one is
  5837. an @emph{Info}-like mode where each section is displayed separately and
  5838. navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
  5839. as well, press @kbd{?} for an overview of the available keys). The second
  5840. view type is a @emph{folding} view much like Org provides it inside Emacs.
  5841. The script is available at @url{http://orgmode.org/org-info.js} and you can
  5842. find the documentation for it at @url{http://orgmode.org/org-infojs.html}.
  5843. We are serving the script from our site, but if you use it a lot, you might
  5844. not want to be dependent on @url{orgmode.org} and prefer to install a local
  5845. copy on your own web server.
  5846. To use the script, you need to make sure that the @file{org-infojs.el} module
  5847. gets loaded. It should be loaded by default, try @kbd{M-x customize-variable
  5848. @key{RET} org-modules @key{RET}} to convince yourself that this is indeed the
  5849. case. All it then takes to make use of the program is adding a single line
  5850. to the Org file:
  5851. @example
  5852. #+INFOSJ_OPT: view:info toc:nil
  5853. @end example
  5854. @noindent
  5855. If this line is found, the HTML header will automatically contain the code
  5856. needed to invoke the script. Using the line above, you can set the following
  5857. viewing options:
  5858. @example
  5859. view: @r{Initial view when website is first shown. Possible values are}
  5860. info @r{Info-like interface with one section per page.}
  5861. overview @r{Folding interface, initially showing only top-level.}
  5862. content @r{Folding interface, starting with all headlines visible.}
  5863. showall @r{Folding interface, all headlines and text visible.}
  5864. toc: @r{Should the table of content be visible as the first section?}
  5865. @r{Even when @code{nil}, you can always get to the toc with @kbd{i}.}
  5866. ltoc: @r{Should there be short contents in each section?}
  5867. path: @r{The path to the script. The default is to grab the script from}
  5868. @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
  5869. @r{a local copy use a path like @samp{../scripts/org-info.js}.}
  5870. mouse: @r{Headings are highlighted when the mouse is over the. Should be}
  5871. @r{@samp{underline} (default) or a background color like @samp{#cccccc}.}
  5872. buttons: @r{Should view-toggle buttons be everywhere? When @code{nil} (the}
  5873. @r{default), only one such button will be present.}
  5874. @end example
  5875. You can choose default values for these options by customizing the variable
  5876. @code{org-infojs-options}. If you always want to apply the script to your
  5877. pages, configure the variable @code{org-export-html-use-infojs}.
  5878. @node LaTeX export, XOXO export, HTML export, Exporting
  5879. @section LaTeX export
  5880. @cindex LaTeX export
  5881. Org mode contains a La@TeX{} exporter written by Bastien Guerry.
  5882. @menu
  5883. * LaTeX export commands:: How to invoke LaTeX export
  5884. * Quoting LaTeX code:: Incorporating literal LaTeX code
  5885. * Sectioning structure:: Changing sectioning in LaTeX output
  5886. @end menu
  5887. @node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export
  5888. @subsection LaTeX export commands
  5889. @table @kbd
  5890. @kindex C-c C-e l
  5891. @item C-c C-e l
  5892. Export as La@TeX{} file @file{myfile.tex}.
  5893. @kindex C-c C-e L
  5894. @item C-c C-e L
  5895. Export to a temporary buffer, do not create a file.
  5896. @kindex C-c C-e v l
  5897. @kindex C-c C-e v L
  5898. @item C-c C-e v l
  5899. @item C-c C-e v L
  5900. Export only the visible part of the document.
  5901. @item M-x org-export-region-as-latex
  5902. Convert the region to La@TeX{} under the assumption that it was Org mode
  5903. syntax before. This is a global command that can be invoked in any
  5904. buffer.
  5905. @item M-x org-replace-region-by-latex
  5906. Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
  5907. code.
  5908. @end table
  5909. @cindex headline levels, for exporting
  5910. In the exported version, the first 3 outline levels will become
  5911. headlines, defining a general document structure. Additional levels
  5912. will be exported as description lists. The exporter can ignore them or
  5913. convert them to a custom string depending on
  5914. @code{org-latex-low-levels}.
  5915. If you want that transition to occur at a different level, specify it
  5916. with a numeric prefix argument. For example,
  5917. @example
  5918. @kbd{C-2 C-c C-e l}
  5919. @end example
  5920. @noindent
  5921. creates two levels of headings and does the rest as items.
  5922. @node Quoting LaTeX code, Sectioning structure, LaTeX export commands, LaTeX export
  5923. @subsection Quoting LaTeX code
  5924. Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly
  5925. inserted into the La@TeX{} file. Furthermore, you can add special code
  5926. that should only be present in La@TeX{} export with the following
  5927. constructs:
  5928. @example
  5929. #+LaTeX: Literal LaTeX code for export
  5930. @end example
  5931. @noindent or
  5932. @example
  5933. #+BEGIN_LaTeX
  5934. All lines between these markers are exported literally
  5935. #+END_LaTeX
  5936. @end example
  5937. @node Sectioning structure, , Quoting LaTeX code, LaTeX export
  5938. @subsection Sectioning structure
  5939. @cindex LaTeX class
  5940. @cindex LaTeX sectioning structure
  5941. By default, the La@TeX{} output uses the class @code{article}.
  5942. You can change this globally by setting a different value for
  5943. @code{org-export-latex-default-class} or locally by adding an option
  5944. like @code{#+LaTeX_CLASS: myclass} in your file. The class should be
  5945. listed in @code{org-export-latex-classes}, where you can also define the
  5946. sectioning structure for each class.
  5947. @node XOXO export, iCalendar export, LaTeX export, Exporting
  5948. @section XOXO export
  5949. @cindex XOXO export
  5950. Org mode contains an exporter that produces XOXO-style output.
  5951. Currently, this exporter only handles the general outline structure and
  5952. does not interpret any additional Org mode features.
  5953. @table @kbd
  5954. @kindex C-c C-e x
  5955. @item C-c C-e x
  5956. Export as XOXO file @file{myfile.html}.
  5957. @kindex C-c C-e v
  5958. @item C-c C-e v x
  5959. Export only the visible part of the document.
  5960. @end table
  5961. @node iCalendar export, Text interpretation, XOXO export, Exporting
  5962. @section iCalendar export
  5963. @cindex iCalendar export
  5964. Some people like to use Org mode for keeping track of projects, but
  5965. still prefer a standard calendar application for anniversaries and
  5966. appointments. In this case it can be useful to have deadlines and
  5967. other time-stamped items in Org files show up in the calendar
  5968. application. Org mode can export calendar information in the standard
  5969. iCalendar format. If you also want to have TODO entries included in the
  5970. export, configure the variable @code{org-icalendar-include-todo}.
  5971. @table @kbd
  5972. @kindex C-c C-e i
  5973. @item C-c C-e i
  5974. Create iCalendar entries for the current file and store them in the same
  5975. directory, using a file extension @file{.ics}.
  5976. @kindex C-c C-e I
  5977. @item C-c C-e I
  5978. Like @kbd{C-c C-e i}, but do this for all files in
  5979. @code{org-agenda-files}. For each of these files, a separate iCalendar
  5980. file will be written.
  5981. @kindex C-c C-e c
  5982. @item C-c C-e c
  5983. Create a single large iCalendar file from all files in
  5984. @code{org-agenda-files} and write it to the file given by
  5985. @code{org-combined-agenda-icalendar-file}.
  5986. @end table
  5987. The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
  5988. the selected entries have them. If not, the summary will be derived
  5989. from the headline, and the description from the body (limited to
  5990. @code{org-icalendar-include-body} characters).
  5991. How this calendar is best read and updated, depends on the application
  5992. you are using. The FAQ covers this issue.
  5993. @node Text interpretation, , iCalendar export, Exporting
  5994. @section Text interpretation by the exporter
  5995. The exporter backends interpret additional structure in the Org file
  5996. in order to produce better output.
  5997. @menu
  5998. * Comment lines:: Some lines will not be exported
  5999. * Initial text:: Text before the first headline
  6000. * Footnotes:: Numbers like [1]
  6001. * Quoted examples:: Inserting quoted chunks of text
  6002. * Enhancing text:: Subscripts, symbols and more
  6003. * Export options:: How to influence the export settings
  6004. @end menu
  6005. @node Comment lines, Initial text, Text interpretation, Text interpretation
  6006. @subsection Comment lines
  6007. @cindex comment lines
  6008. @cindex exporting, not
  6009. Lines starting with @samp{#} in column zero are treated as comments
  6010. and will never be exported. Also entire subtrees starting with the
  6011. word @samp{COMMENT} will never be exported.
  6012. @table @kbd
  6013. @kindex C-c ;
  6014. @item C-c ;
  6015. Toggle the COMMENT keyword at the beginning of an entry.
  6016. @end table
  6017. @node Initial text, Footnotes, Comment lines, Text interpretation
  6018. @subsection Text before the first headline
  6019. Org mode normally ignores any text before the first headline when
  6020. exporting, leaving this region for internal links to speed up navigation
  6021. etc. However, in publishing-oriented files, you might want to have some
  6022. text before the first headline, like a small introduction, special HTML
  6023. code with a navigation bar, etc. You can ask to have this part of the
  6024. file exported as well by setting the variable
  6025. @code{org-export-skip-text-before-1st-heading} to @code{nil}. On a
  6026. per-file basis, you can get the same effect with
  6027. @example
  6028. #+OPTIONS: skip:nil
  6029. @end example
  6030. The text before the first headline will be fully processed
  6031. (@pxref{Enhancing text}), and the first non-comment line becomes the
  6032. title of the exported document. If you need to include literal HTML,
  6033. use the special constructs described in @ref{Quoting HTML tags}. The
  6034. table of contents is normally inserted directly before the first
  6035. headline of the file. If you would like to get it to a different
  6036. location, insert the string @code{[TABLE-OF-CONTENTS]} on a line by
  6037. itself at the desired location.
  6038. Finally, if you want to use the space before the first headline for
  6039. internal purposes, but @emph{still} want to place something before the
  6040. first headline when exporting the file, you can use the @code{#+TEXT}
  6041. construct:
  6042. @example
  6043. #+OPTIONS: skip:t
  6044. #+TEXT: This text will go before the *first* headline.
  6045. #+TEXT: We place the table of contents here:
  6046. #+TEXT: [TABLE-OF-CONTENTS]
  6047. #+TEXT: This goes between the table of contents and the first headline
  6048. @end example
  6049. @node Footnotes, Quoted examples, Initial text, Text interpretation
  6050. @subsection Footnotes
  6051. @cindex footnotes
  6052. @cindex @file{footnote.el}
  6053. Numbers in square brackets are treated as footnotes, so that you can use
  6054. the Emacs package @file{footnote.el} to create footnotes. For example:
  6055. @example
  6056. The Org homepage[1] clearly needs help from
  6057. a good web designer.
  6058. [1] The link is: http://orgmode.org
  6059. @end example
  6060. @noindent
  6061. @kindex C-c !
  6062. Note that the @file{footnote} package uses @kbd{C-c !} to invoke its
  6063. commands. This binding conflicts with the Org mode command for
  6064. inserting inactive time stamps. You could use the variable
  6065. @code{footnote-prefix} to switch footnotes commands to another key. Or,
  6066. if you are too used to this binding, you could use
  6067. @code{org-replace-disputed-keys} and @code{org-disputed-keys} to change
  6068. the settings in Org.
  6069. @node Quoted examples, Enhancing text, Footnotes, Text interpretation
  6070. @subsection Quoted examples
  6071. @cindex quoted examples
  6072. @cindex examples, quoted
  6073. @cindex text, fixed width
  6074. @cindex fixed width text
  6075. When writing technical documents, you often need to insert examples that
  6076. are not further interpreted by Org mode. For historical reasons, there
  6077. are several ways to do this:
  6078. @itemize @bullet
  6079. @item
  6080. If a headline starts with the word @samp{QUOTE}, the text below the
  6081. headline will be typeset as fixed-width, to allow quoting of computer
  6082. codes etc.
  6083. @item
  6084. Lines starting with @samp{:} are also typeset in fixed-width font.
  6085. @table @kbd
  6086. @kindex C-c :
  6087. @item C-c :
  6088. Toggle fixed-width for entry (QUOTE) or region, see below.
  6089. @end table
  6090. @item
  6091. Finally, text between
  6092. @example
  6093. #+BEGIN_EXAMPLE
  6094. quoted text
  6095. #+END_EXAMPLE
  6096. @end example
  6097. will also be exported in this way.
  6098. @end itemize
  6099. @node Enhancing text, Export options, Quoted examples, Text interpretation
  6100. @subsection Enhancing text for export
  6101. @cindex enhancing text
  6102. @cindex richer text
  6103. Some of the export backends of Org mode allow for sophisticated text
  6104. formatting, this is true in particular for the HTML and La@TeX{}
  6105. backends. Org mode has a number of typing conventions that allow to
  6106. produce a richly formatted output.
  6107. @itemize @bullet
  6108. @cindex hand-formatted lists
  6109. @cindex lists, hand-formatted
  6110. @item
  6111. Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
  6112. or @samp{2)} as enumerator will be recognized and transformed if the
  6113. backend supports lists. See @xref{Plain lists}.
  6114. @cindex underlined text
  6115. @cindex bold text
  6116. @cindex italic text
  6117. @cindex verbatim text
  6118. @item
  6119. You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
  6120. and @code{~verbatim~}, and, if you must, @samp{+strikethrough+}. Text
  6121. in the code and verbatim string is not processed for Org mode specific
  6122. syntax, it is exported verbatim.
  6123. @cindex horizontal rules, in exported files
  6124. @item
  6125. A line consisting of only dashes, and at least 5 of them, will be
  6126. exported as a horizontal line (@samp{<hr/>} in HTML).
  6127. @cindex LaTeX fragments, export
  6128. @cindex TeX macros, export
  6129. @item
  6130. Many @TeX{} macros and entire La@TeX{} fragments are converted into HTML
  6131. entities or images (@pxref{Embedded LaTeX}).
  6132. @cindex tables, export
  6133. @item
  6134. Tables are transformed into native tables under the exporter, if the
  6135. export backend supports this. Data fields before the first horizontal
  6136. separator line will be formatted as table header fields.
  6137. @cindex fixed width
  6138. @item
  6139. If a headline starts with the word @samp{QUOTE}, the text below the
  6140. headline will be typeset as fixed-width, to allow quoting of computer
  6141. codes etc. Lines starting with @samp{:} are also typeset in fixed-width
  6142. font.
  6143. @table @kbd
  6144. @kindex C-c :
  6145. @item C-c :
  6146. Toggle fixed-width for entry (QUOTE) or region, see below.
  6147. @end table
  6148. Finally, text between
  6149. @example
  6150. #+BEGIN_EXAMPLE
  6151. quoted text
  6152. #+END_EXAMPLE
  6153. @end example
  6154. will also be exported in this way.
  6155. @cindex linebreak, forced
  6156. @item
  6157. A double backslash @emph{at the end of a line} enforces a line break at
  6158. this position.
  6159. @cindex HTML entities, LaTeX entities
  6160. @item
  6161. Strings like @code{\alpha} will be exported as @code{&alpha;}, in the
  6162. HTML output. These strings are exported as @code{$\alpha$} in the
  6163. La@TeX{} output. Similarly, @code{\nbsp} will become @code{&nbsp;} in
  6164. HTML and in La@TeX{}. This applies for a long list of entities, see
  6165. the variable @code{org-html-entities} for the complete list.
  6166. @c FIXME
  6167. @end itemize
  6168. If these conversions conflict with your habits of typing ASCII text,
  6169. they can all be turned off with corresponding variables. See the
  6170. customization group @code{org-export-general}, and the following section
  6171. which explains how to set export options with special lines in a
  6172. buffer.
  6173. @node Export options, , Enhancing text, Text interpretation
  6174. @subsection Export options
  6175. @cindex options, for export
  6176. @cindex completion, of option keywords
  6177. The exporter recognizes special lines in the buffer which provide
  6178. additional information. These lines may be put anywhere in the file.
  6179. The whole set of lines can be inserted into the buffer with @kbd{C-c
  6180. C-e t}. For individual lines, a good way to make sure the keyword is
  6181. correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
  6182. (@pxref{Completion}).
  6183. @table @kbd
  6184. @kindex C-c C-e t
  6185. @item C-c C-e t
  6186. Insert template with export options, see example below.
  6187. @end table
  6188. @example
  6189. #+TITLE: the title to be shown (default is the buffer name)
  6190. #+AUTHOR: the author (default taken from @code{user-full-name})
  6191. #+DATE: A date, fixed, of a format string for @code{format-time-string}
  6192. #+EMAIL: his/her email address (default from @code{user-mail-address})
  6193. #+LANGUAGE: language for HTML, e.g. @samp{en} (@code{org-export-default-language})
  6194. #+TEXT: Some descriptive text to be inserted at the beginning.
  6195. #+TEXT: Several lines may be given.
  6196. #+OPTIONS: H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
  6197. @end example
  6198. @noindent
  6199. The OPTIONS line is a compact form to specify export settings. Here
  6200. you can:
  6201. @cindex headline levels
  6202. @cindex section-numbers
  6203. @cindex table of contents
  6204. @cindex linebreak preservation
  6205. @cindex quoted HTML tags
  6206. @cindex fixed-width sections
  6207. @cindex tables
  6208. @cindex @TeX{}-like syntax for sub- and superscripts
  6209. @cindex footnotes
  6210. @cindex special strings
  6211. @cindex emphasized text
  6212. @cindex @TeX{} macros
  6213. @cindex La@TeX{} fragments
  6214. @cindex author info, in export
  6215. @cindex time info, in export
  6216. @example
  6217. H: @r{set the number of headline levels for export}
  6218. num: @r{turn on/off section-numbers}
  6219. toc: @r{turn on/off table of contents, or set level limit (integer)}
  6220. \n: @r{turn on/off linebreak-preservation}
  6221. @@: @r{turn on/off quoted HTML tags}
  6222. :: @r{turn on/off fixed-width sections}
  6223. |: @r{turn on/off tables}
  6224. ^: @r{turn on/off @TeX{}-like syntax for sub- and superscripts. If}
  6225. @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
  6226. @r{the simple @code{a_b} will be left as it is.}
  6227. -: @r{turn on/off conversion of special strings.}
  6228. f: @r{turn on/off foototes like this[1].}
  6229. *: @r{turn on/off emphasized text (bold, italic, underlined)}
  6230. TeX: @r{turn on/off simple @TeX{} macros in plain text}
  6231. LaTeX: @r{turn on/off La@TeX{} fragments}
  6232. skip: @r{turn on/off skipping the text before the first heading}
  6233. author: @r{turn on/off inclusion of author name/email into exported file}
  6234. timestamp: @r{turn on/off inclusion creation time into exported file}
  6235. d: @r{turn on/off inclusion of drawers}
  6236. @end example
  6237. These options take effect in both the HTML and La@TeX{} export, except
  6238. for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
  6239. @code{nil} for the La@TeX{} export.
  6240. @node Publishing, Miscellaneous, Exporting, Top
  6241. @chapter Publishing
  6242. @cindex publishing
  6243. Org includes@footnote{@file{org-publish.el} is not distributed with
  6244. Emacs 21, if you are still using Emacs 21, you need you need to download
  6245. this file separately.} a publishing management system that allows you to
  6246. configure automatic HTML conversion of @emph{projects} composed of
  6247. interlinked org files. This system is called @emph{org-publish}. You can
  6248. also configure org-publish to automatically upload your exported HTML
  6249. pages and related attachments, such as images and source code files, to
  6250. a web server. Org-publish turns Org into a web-site authoring tool.
  6251. You can also use Org-publish to convert files into La@TeX{}, or even
  6252. combine HTML and La@TeX{} conversion so that files are available in both
  6253. formats on the server@footnote{Since La@TeX{} files on a server are not
  6254. that helpful, you surely want to perform further conversion on them --
  6255. e.g. convert them to @code{PDF} format.}.
  6256. Org-publish has been contributed to Org by David O'Toole.
  6257. @menu
  6258. * Configuration:: Defining projects
  6259. * Sample configuration:: Example projects
  6260. * Triggering publication:: Publication commands
  6261. @end menu
  6262. @node Configuration, Sample configuration, Publishing, Publishing
  6263. @section Configuration
  6264. Publishing needs significant configuration to specify files, destination
  6265. and many other properties of a project.
  6266. @menu
  6267. * Project alist:: The central configuration variable
  6268. * Sources and destinations:: From here to there
  6269. * Selecting files:: What files are part of the project?
  6270. * Publishing action:: Setting the function doing the publishing
  6271. * Publishing options:: Tweaking HTML export
  6272. * Publishing links:: Which links keep working after publishing?
  6273. * Project page index:: Publishing a list of project files
  6274. @end menu
  6275. @node Project alist, Sources and destinations, Configuration, Configuration
  6276. @subsection The variable @code{org-publish-project-alist}
  6277. @cindex org-publish-project-alist
  6278. @cindex projects, for publishing
  6279. Org-publish is configured almost entirely through setting the value of
  6280. one variable, called @code{org-publish-project-alist}.
  6281. Each element of the list configures one project, and may be in one of
  6282. the two following forms:
  6283. @lisp
  6284. ("project-name" :property value :property value ...)
  6285. @r{or}
  6286. ("project-name" :components ("project-name" "project-name" ...))
  6287. @end lisp
  6288. In both cases, projects are configured by specifying property values.
  6289. A project defines the set of files that will be published, as well as
  6290. the publishing configuration to use when publishing those files. When
  6291. a project takes the second form listed above, the individual members
  6292. of the ``components'' property are taken to be components of the
  6293. project, which group together files requiring different publishing
  6294. options. When you publish such a ``meta-project'' all the components
  6295. will also publish.
  6296. @node Sources and destinations, Selecting files, Project alist, Configuration
  6297. @subsection Sources and destinations for files
  6298. @cindex directories, for publishing
  6299. Most properties are optional, but some should always be set. In
  6300. particular, org-publish needs to know where to look for source files,
  6301. and where to put published files.
  6302. @multitable @columnfractions 0.3 0.7
  6303. @item @code{:base-directory}
  6304. @tab Directory containing publishing source files
  6305. @item @code{:publishing-directory}
  6306. @tab Directory (possibly remote) where output files will be published.
  6307. @item @code{:preparation-function}
  6308. @tab Function called before starting publishing process, for example to
  6309. run @code{make} for updating files to be published.
  6310. @end multitable
  6311. @noindent
  6312. @node Selecting files, Publishing action, Sources and destinations, Configuration
  6313. @subsection Selecting files
  6314. @cindex files, selecting for publishing
  6315. By default, all files with extension @file{.org} in the base directory
  6316. are considered part of the project. This can be modified by setting the
  6317. properties
  6318. @multitable @columnfractions 0.25 0.75
  6319. @item @code{:base-extension}
  6320. @tab Extension (without the dot!) of source files. This actually is a
  6321. regular expression.
  6322. @item @code{:exclude}
  6323. @tab Regular expression to match file names that should not be
  6324. published, even though they have been selected on the basis of their
  6325. extension.
  6326. @item @code{:include}
  6327. @tab List of files to be included regardless of @code{:base-extension}
  6328. and @code{:exclude}.
  6329. @end multitable
  6330. @node Publishing action, Publishing options, Selecting files, Configuration
  6331. @subsection Publishing action
  6332. @cindex action, for publishing
  6333. Publishing means that a file is copied to the destination directory and
  6334. possibly transformed in the process. The default transformation is to
  6335. export Org files as HTML files, and this is done by the function
  6336. @code{org-publish-org-to-html} which calls the HTML exporter
  6337. (@pxref{HTML export}). But you also can publish your files in La@TeX{} by
  6338. using the function @code{org-publish-org-to-latex} instead. Other files
  6339. like images only need to be copied to the publishing destination. For
  6340. non-Org files, you need to specify the publishing function.
  6341. @multitable @columnfractions 0.3 0.7
  6342. @item @code{:publishing-function}
  6343. @tab Function executing the publication of a file. This may also be a
  6344. list of functions, which will all be called in turn.
  6345. @end multitable
  6346. The function must accept two arguments: a property list containing at
  6347. least a @code{:publishing-directory} property, and the name of the file
  6348. to be published. It should take the specified file, make the necessary
  6349. transformation (if any) and place the result into the destination folder.
  6350. You can write your own publishing function, but @code{org-publish}
  6351. provides one for attachments (files that only need to be copied):
  6352. @code{org-publish-attachment}.
  6353. @node Publishing options, Publishing links, Publishing action, Configuration
  6354. @subsection Options for the HTML/LaTeX exporters
  6355. @cindex options, for publishing
  6356. The property list can be used to set many export options for the HTML
  6357. and La@TeX{} exporters. In most cases, these properties correspond to user
  6358. variables in Org. The table below lists these properties along
  6359. with the variable they belong to. See the documentation string for the
  6360. respective variable for details.
  6361. @multitable @columnfractions 0.3 0.7
  6362. @item @code{:language} @tab @code{org-export-default-language}
  6363. @item @code{:headline-levels} @tab @code{org-export-headline-levels}
  6364. @item @code{:section-numbers} @tab @code{org-export-with-section-numbers}
  6365. @item @code{:table-of-contents} @tab @code{org-export-with-toc}
  6366. @item @code{:archived-trees} @tab @code{org-export-with-archived-trees}
  6367. @item @code{:emphasize} @tab @code{org-export-with-emphasize}
  6368. @item @code{:sub-superscript} @tab @code{org-export-with-sub-superscripts}
  6369. @item @code{:special-strings} @tab @code{org-export-with-special-strings}
  6370. @item @code{:TeX-macros} @tab @code{org-export-with-TeX-macros}
  6371. @item @code{:LaTeX-fragments} @tab @code{org-export-with-LaTeX-fragments}
  6372. @item @code{:fixed-width} @tab @code{org-export-with-fixed-width}
  6373. @item @code{:timestamps} .@tab @code{org-export-with-timestamps}
  6374. @item @code{:tags} .@tab @code{org-export-with-tags}
  6375. @item @code{:tables} @tab @code{org-export-with-tables}
  6376. @item @code{:table-auto-headline} @tab @code{org-export-highlight-first-table-line}
  6377. @item @code{:style} @tab @code{org-export-html-style}
  6378. @item @code{:convert-org-links} @tab @code{org-export-html-link-org-files-as-html}
  6379. @item @code{:inline-images} @tab @code{org-export-html-inline-images}
  6380. @item @code{:expand-quoted-html} @tab @code{org-export-html-expand}
  6381. @item @code{:timestamp} @tab @code{org-export-html-with-timestamp}
  6382. @item @code{:publishing-directory} @tab @code{org-export-publishing-directory}
  6383. @item @code{:preamble} @tab @code{org-export-html-preamble}
  6384. @item @code{:postamble} @tab @code{org-export-html-postamble}
  6385. @item @code{:auto-preamble} @tab @code{org-export-html-auto-preamble}
  6386. @item @code{:auto-postamble} @tab @code{org-export-html-auto-postamble}
  6387. @item @code{:author} @tab @code{user-full-name}
  6388. @item @code{:email} @tab @code{user-mail-address}
  6389. @end multitable
  6390. If you use several email addresses, separate them by a semi-column.
  6391. Most of the @code{org-export-with-*} variables have the same effect in
  6392. both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
  6393. @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
  6394. La@TeX{} export.
  6395. When a property is given a value in @code{org-publish-project-alist},
  6396. its setting overrides the value of the corresponding user variable (if
  6397. any) during publishing. Options set within a file (@pxref{Export
  6398. options}), however, override everything.
  6399. @node Publishing links, Project page index, Publishing options, Configuration
  6400. @subsection Links between published files
  6401. @cindex links, publishing
  6402. To create a link from one Org file to another, you would use
  6403. something like @samp{[[file:foo.org][The foo]]} or simply
  6404. @samp{file:foo.org.} (@pxref{Hyperlinks}). Upon publishing this link
  6405. becomes a link to @file{foo.html}. In this way, you can interlink the
  6406. pages of your "org web" project and the links will work as expected when
  6407. you publish them to HTML.
  6408. You may also link to related files, such as images. Provided you are
  6409. careful with relative pathnames, and provided you have also configured
  6410. @code{org-publish} to upload the related files, these links will work
  6411. too. @ref{Complex example} for an example of this usage.
  6412. Sometime an Org file to be published may contain links that are
  6413. only valid in your production environment, but not in the publishing
  6414. location. In this case, use the property
  6415. @multitable @columnfractions 0.4 0.6
  6416. @item @code{:link-validation-function}
  6417. @tab Function to validate links
  6418. @end multitable
  6419. @noindent
  6420. to define a function for checking link validity. This function must
  6421. accept two arguments, the file name and a directory relative to which
  6422. the file name is interpreted in the production environment. If this
  6423. function returns @code{nil}, then the HTML generator will only insert a
  6424. description into the HTML file, but no link. One option for this
  6425. function is @code{org-publish-validate-link} which checks if the given
  6426. file is part of any project in @code{org-publish-project-alist}.
  6427. @node Project page index, , Publishing links, Configuration
  6428. @subsection Project page index
  6429. @cindex index, of published pages
  6430. The following properties may be used to control publishing of an
  6431. index of files or summary page for a given project.
  6432. @multitable @columnfractions 0.25 0.75
  6433. @item @code{:auto-index}
  6434. @tab When non-nil, publish an index during org-publish-current-project or
  6435. org-publish-all.
  6436. @item @code{:index-filename}
  6437. @tab Filename for output of index. Defaults to @file{index.org} (which
  6438. becomes @file{index.html}).
  6439. @item @code{:index-title}
  6440. @tab Title of index page. Defaults to name of file.
  6441. @item @code{:index-function}
  6442. @tab Plug-in function to use for generation of index.
  6443. Defaults to @code{org-publish-org-index}, which generates a plain list
  6444. of links to all files in the project.
  6445. @end multitable
  6446. @node Sample configuration, Triggering publication, Configuration, Publishing
  6447. @section Sample configuration
  6448. Below we provide two example configurations. The first one is a simple
  6449. project publishing only a set of Org files. The second example is
  6450. more complex, with a multi-component project.
  6451. @menu
  6452. * Simple example:: One-component publishing
  6453. * Complex example:: A multi-component publishing example
  6454. @end menu
  6455. @node Simple example, Complex example, Sample configuration, Sample configuration
  6456. @subsection Example: simple publishing configuration
  6457. This example publishes a set of Org files to the @file{public_html}
  6458. directory on the local machine.
  6459. @lisp
  6460. (setq org-publish-project-alist
  6461. '(("org"
  6462. :base-directory "~/org/"
  6463. :publishing-directory "~/public_html"
  6464. :section-numbers nil
  6465. :table-of-contents nil
  6466. :style "<link rel=stylesheet
  6467. href=\"../other/mystyle.css\"
  6468. type=\"text/css\">")))
  6469. @end lisp
  6470. @node Complex example, , Simple example, Sample configuration
  6471. @subsection Example: complex publishing configuration
  6472. This more complicated example publishes an entire website, including
  6473. org files converted to HTML, image files, emacs lisp source code, and
  6474. style sheets. The publishing-directory is remote and private files are
  6475. excluded.
  6476. To ensure that links are preserved, care should be taken to replicate
  6477. your directory structure on the web server, and to use relative file
  6478. paths. For example, if your org files are kept in @file{~/org} and your
  6479. publishable images in @file{~/images}, you'd link to an image with
  6480. @c
  6481. @example
  6482. file:../images/myimage.png
  6483. @end example
  6484. @c
  6485. On the web server, the relative path to the image should be the
  6486. same. You can accomplish this by setting up an "images" folder in the
  6487. right place on the web server, and publishing images to it.
  6488. @lisp
  6489. (setq org-publish-project-alist
  6490. '(("orgfiles"
  6491. :base-directory "~/org/"
  6492. :base-extension "org"
  6493. :publishing-directory "/ssh:user@@host:~/html/notebook/"
  6494. :publishing-function org-publish-org-to-html
  6495. :exclude "PrivatePage.org" ;; regexp
  6496. :headline-levels 3
  6497. :section-numbers nil
  6498. :table-of-contents nil
  6499. :style "<link rel=stylesheet
  6500. href=\"../other/mystyle.css\" type=\"text/css\">"
  6501. :auto-preamble t
  6502. :auto-postamble nil)
  6503. ("images"
  6504. :base-directory "~/images/"
  6505. :base-extension "jpg\\|gif\\|png"
  6506. :publishing-directory "/ssh:user@@host:~/html/images/"
  6507. :publishing-function org-publish-attachment)
  6508. ("other"
  6509. :base-directory "~/other/"
  6510. :base-extension "css\\|el"
  6511. :publishing-directory "/ssh:user@@host:~/html/other/"
  6512. :publishing-function org-publish-attachment)
  6513. ("website" :components ("orgfiles" "images" "other"))))
  6514. @end lisp
  6515. @node Triggering publication, , Sample configuration, Publishing
  6516. @section Triggering publication
  6517. Once org-publish is properly configured, you can publish with the
  6518. following functions:
  6519. @table @kbd
  6520. @item C-c C-e C
  6521. Prompt for a specific project and publish all files that belong to it.
  6522. @item C-c C-e P
  6523. Publish the project containing the current file.
  6524. @item C-c C-e F
  6525. Publish only the current file.
  6526. @item C-c C-e A
  6527. Publish all projects.
  6528. @end table
  6529. Org uses timestamps to track when a file has changed. The above
  6530. functions normally only publish changed files. You can override this and
  6531. force publishing of all files by giving a prefix argument.
  6532. @node Miscellaneous, Extensions and Hacking, Publishing, Top
  6533. @chapter Miscellaneous
  6534. @menu
  6535. * Completion:: M-TAB knows what you need
  6536. * Customization:: Adapting Org to your taste
  6537. * In-buffer settings:: Overview of the #+KEYWORDS
  6538. * The very busy C-c C-c key:: When in doubt, press C-c C-c
  6539. * Clean view:: Getting rid of leading stars in the outline
  6540. * TTY keys:: Using Org on a tty
  6541. * Interaction:: Other Emacs packages
  6542. * Bugs:: Things which do not work perfectly
  6543. @end menu
  6544. @node Completion, Customization, Miscellaneous, Miscellaneous
  6545. @section Completion
  6546. @cindex completion, of @TeX{} symbols
  6547. @cindex completion, of TODO keywords
  6548. @cindex completion, of dictionary words
  6549. @cindex completion, of option keywords
  6550. @cindex completion, of tags
  6551. @cindex completion, of property keys
  6552. @cindex completion, of link abbreviations
  6553. @cindex @TeX{} symbol completion
  6554. @cindex TODO keywords completion
  6555. @cindex dictionary word completion
  6556. @cindex option keyword completion
  6557. @cindex tag completion
  6558. @cindex link abbreviations, completion of
  6559. Org supports in-buffer completion. This type of completion does
  6560. not make use of the minibuffer. You simply type a few letters into
  6561. the buffer and use the key to complete text right there.
  6562. @table @kbd
  6563. @kindex M-@key{TAB}
  6564. @item M-@key{TAB}
  6565. Complete word at point
  6566. @itemize @bullet
  6567. @item
  6568. At the beginning of a headline, complete TODO keywords.
  6569. @item
  6570. After @samp{\}, complete @TeX{} symbols supported by the exporter.
  6571. @item
  6572. After @samp{*}, complete headlines in the current buffer so that they
  6573. can be used in search links like @samp{[[*find this headline]]}.
  6574. @item
  6575. After @samp{:} in a headline, complete tags. The list of tags is taken
  6576. from the variable @code{org-tag-alist} (possibly set through the
  6577. @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
  6578. dynamically from all tags used in the current buffer.
  6579. @item
  6580. After @samp{:} and not in a headline, complete property keys. The list
  6581. of keys is constructed dynamically from all keys used in the current
  6582. buffer.
  6583. @item
  6584. After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
  6585. @item
  6586. After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
  6587. @samp{OPTIONS} which set file-specific options for Org mode. When the
  6588. option keyword is already complete, pressing @kbd{M-@key{TAB}} again
  6589. will insert example settings for this keyword.
  6590. @item
  6591. In the line after @samp{#+STARTUP: }, complete startup keywords,
  6592. i.e. valid keys for this line.
  6593. @item
  6594. Elsewhere, complete dictionary words using Ispell.
  6595. @end itemize
  6596. @end table
  6597. @node Customization, In-buffer settings, Completion, Miscellaneous
  6598. @section Customization
  6599. @cindex customization
  6600. @cindex options, for customization
  6601. @cindex variables, for customization
  6602. There are more than 180 variables that can be used to customize
  6603. Org. For the sake of compactness of the manual, I am not
  6604. describing the variables here. A structured overview of customization
  6605. variables is available with @kbd{M-x org-customize}. Or select
  6606. @code{Browse Org Group} from the @code{Org->Customization} menu. Many
  6607. settings can also be activated on a per-file basis, by putting special
  6608. lines into the buffer (@pxref{In-buffer settings}).
  6609. @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
  6610. @section Summary of in-buffer settings
  6611. @cindex in-buffer settings
  6612. @cindex special keywords
  6613. Org mode uses special lines in the buffer to define settings on a
  6614. per-file basis. These lines start with a @samp{#+} followed by a
  6615. keyword, a colon, and then individual words defining a setting. Several
  6616. setting words can be in the same line, but you can also have multiple
  6617. lines for the keyword. While these settings are described throughout
  6618. the manual, here is a summary. After changing any of those lines in the
  6619. buffer, press @kbd{C-c C-c} with the cursor still in the line to
  6620. activate the changes immediately. Otherwise they become effective only
  6621. when the file is visited again in a new Emacs session.
  6622. @table @kbd
  6623. @item #+ARCHIVE: %s_done::
  6624. This line sets the archive location for the agenda file. It applies for
  6625. all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
  6626. of the file. The first such line also applies to any entries before it.
  6627. The corresponding variable is @code{org-archive-location}.
  6628. @item #+CATEGORY:
  6629. This line sets the category for the agenda file. The category applies
  6630. for all subsequent lines until the next @samp{#+CATEGORY} line, or the
  6631. end of the file. The first such line also applies to any entries before it.
  6632. @item #+COLUMNS: %25ITEM .....
  6633. Set the default format for columns view. This format applies when
  6634. columns view is invoked in location where no @code{COLUMNS} property
  6635. applies.
  6636. @item #+CONSTANTS: name1=value1 ...
  6637. Set file-local values for constants to be used in table formulas. This
  6638. line set the local variable @code{org-table-formula-constants-local}.
  6639. The global version of this variable is
  6640. @code{org-table-formula-constants}.
  6641. @item #+DRAWERS: NAME1 .....
  6642. Set the file-local set of drawers. The corresponding global variable is
  6643. @code{org-drawers}.
  6644. @item #+LINK: linkword replace
  6645. These lines (several are allowed) specify link abbreviations.
  6646. @xref{Link abbreviations}. The corresponding variable is
  6647. @code{org-link-abbrev-alist}.
  6648. @item #+PRIORITIES: highest lowest default
  6649. This line sets the limits and the default for the priorities. All three
  6650. must be either letters A-Z or numbers 0-9. The highest priority must
  6651. have a lower ASCII number that the lowest priority.
  6652. @item #+PROPERTY: Property_Name Value
  6653. This line sets a default inheritance value for entries in the current
  6654. buffer, most useful for specifying the allowed values of a property.
  6655. @item #+STARTUP:
  6656. This line sets options to be used at startup of Org mode, when an
  6657. Org file is being visited. The first set of options deals with the
  6658. initial visibility of the outline tree. The corresponding variable for
  6659. global default settings is @code{org-startup-folded}, with a default
  6660. value @code{t}, which means @code{overview}.
  6661. @cindex @code{overview}, STARTUP keyword
  6662. @cindex @code{content}, STARTUP keyword
  6663. @cindex @code{showall}, STARTUP keyword
  6664. @example
  6665. overview @r{top-level headlines only}
  6666. content @r{all headlines}
  6667. showall @r{no folding at all, show everything}
  6668. @end example
  6669. Then there are options for aligning tables upon visiting a file. This
  6670. is useful in files containing narrowed table columns. The corresponding
  6671. variable is @code{org-startup-align-all-tables}, with a default value
  6672. @code{nil}.
  6673. @cindex @code{align}, STARTUP keyword
  6674. @cindex @code{noalign}, STARTUP keyword
  6675. @example
  6676. align @r{align all tables}
  6677. noalign @r{don't align tables on startup}
  6678. @end example
  6679. Logging closing and reinstating TODO items, and clock intervals
  6680. (variables @code{org-log-done}, @code{org-log-note-clock-out}, and
  6681. @code{org-log-repeat}) can be configured using these options.
  6682. @cindex @code{logdone}, STARTUP keyword
  6683. @cindex @code{lognotedone}, STARTUP keyword
  6684. @cindex @code{nologdone}, STARTUP keyword
  6685. @cindex @code{lognoteclock-out}, STARTUP keyword
  6686. @cindex @code{nolognoteclock-out}, STARTUP keyword
  6687. @cindex @code{logrepeat}, STARTUP keyword
  6688. @cindex @code{lognoterepeat}, STARTUP keyword
  6689. @cindex @code{nologrepeat}, STARTUP keyword
  6690. @example
  6691. logdone @r{record a timestamp when an item is marked DONE}
  6692. lognotedone @r{record timestamp and a note when DONE}
  6693. nologdone @r{don't record when items are marked DONE}
  6694. logrepeat @r{record a time when reinstating a repeating item}
  6695. lognoterepeat @r{record a note when reinstating a repeating item}
  6696. nologrepeat @r{do not record when reinstating repeating item}
  6697. lognoteclock-out @r{record a note when clocking out}
  6698. nolognoteclock-out @r{don't record a note when clocking out}
  6699. @end example
  6700. Here are the options for hiding leading stars in outline headings. The
  6701. corresponding variables are @code{org-hide-leading-stars} and
  6702. @code{org-odd-levels-only}, both with a default setting @code{nil}
  6703. (meaning @code{showstars} and @code{oddeven}).
  6704. @cindex @code{hidestars}, STARTUP keyword
  6705. @cindex @code{showstars}, STARTUP keyword
  6706. @cindex @code{odd}, STARTUP keyword
  6707. @cindex @code{even}, STARTUP keyword
  6708. @example
  6709. hidestars @r{make all but one of the stars starting a headline invisible.}
  6710. showstars @r{show all stars starting a headline}
  6711. odd @r{allow only odd outline levels (1,3,...)}
  6712. oddeven @r{allow all outline levels}
  6713. @end example
  6714. To turn on custom format overlays over time stamps (variables
  6715. @code{org-put-time-stamp-overlays} and
  6716. @code{org-time-stamp-overlay-formats}), use
  6717. @cindex @code{customtime}, STARTUP keyword
  6718. @example
  6719. customtime @r{overlay custom time format}
  6720. @end example
  6721. The following options influence the table spreadsheet (variable
  6722. @code{constants-unit-system}).
  6723. @cindex @code{constcgs}, STARTUP keyword
  6724. @cindex @code{constSI}, STARTUP keyword
  6725. @example
  6726. constcgs @r{@file{constants.el} should use the c-g-s unit system}
  6727. constSI @r{@file{constants.el} should use the SI unit system}
  6728. @end example
  6729. @item #+TAGS: TAG1(c1) TAG2(c2)
  6730. These lines (several such lines are allowed) specify the valid tags in
  6731. this file, and (potentially) the corresponding @emph{fast tag selection}
  6732. keys. The corresponding variable is @code{org-tag-alist}.
  6733. @item #+TBLFM:
  6734. This line contains the formulas for the table directly above the line.
  6735. @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:
  6736. These lines provide settings for exporting files. For more details see
  6737. @ref{Export options}.
  6738. @item #+SEQ_TODO: #+TYP_TODO:
  6739. These lines set the TODO keywords and their interpretation in the
  6740. current file. The corresponding variables are @code{org-todo-keywords}
  6741. and @code{org-todo-interpretation}.
  6742. @end table
  6743. @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
  6744. @section The very busy C-c C-c key
  6745. @kindex C-c C-c
  6746. @cindex C-c C-c, overview
  6747. The key @kbd{C-c C-c} has many purposes in Org, which are all
  6748. mentioned scattered throughout this manual. One specific function of
  6749. this key is to add @emph{tags} to a headline (@pxref{Tags}). In many
  6750. other circumstances it means something like @emph{Hey Org, look
  6751. here and update according to what you see here}. Here is a summary of
  6752. what this means in different contexts.
  6753. @itemize @minus
  6754. @item
  6755. If there are highlights in the buffer from the creation of a sparse
  6756. tree, or from clock display, remove these highlights.
  6757. @item
  6758. If the cursor is in one of the special @code{#+KEYWORD} lines, this
  6759. triggers scanning the buffer for these lines and updating the
  6760. information.
  6761. @item
  6762. If the cursor is inside a table, realign the table. This command
  6763. works even if the automatic table editor has been turned off.
  6764. @item
  6765. If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
  6766. the entire table.
  6767. @item
  6768. If the cursor is inside a table created by the @file{table.el} package,
  6769. activate that table.
  6770. @item
  6771. If the current buffer is a remember buffer, close the note and file it.
  6772. With a prefix argument, file it, without further interaction, to the
  6773. default location.
  6774. @item
  6775. If the cursor is on a @code{<<<target>>>}, update radio targets and
  6776. corresponding links in this buffer.
  6777. @item
  6778. If the cursor is in a property line or at the start or end of a property
  6779. drawer, offer property commands.
  6780. @item
  6781. If the cursor is in a plain list item with a checkbox, toggle the status
  6782. of the checkbox.
  6783. @item
  6784. If the cursor is on a numbered item in a plain list, renumber the
  6785. ordered list.
  6786. @item
  6787. If the cursor is on the @code{#+BEGIN} line of a dynamical block, the
  6788. block is updated.
  6789. @end itemize
  6790. @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
  6791. @section A cleaner outline view
  6792. @cindex hiding leading stars
  6793. @cindex clean outline view
  6794. Some people find it noisy and distracting that the Org headlines
  6795. are starting with a potentially large number of stars. For example
  6796. the tree from @ref{Headlines}:
  6797. @example
  6798. * Top level headline
  6799. ** Second level
  6800. *** 3rd level
  6801. some text
  6802. *** 3rd level
  6803. more text
  6804. * Another top level headline
  6805. @end example
  6806. @noindent
  6807. Unfortunately this is deeply ingrained into the code of Org and
  6808. cannot be easily changed. You can, however, modify the display in such
  6809. a way that all leading stars become invisible and the outline more easy
  6810. to read. To do this, customize the variable
  6811. @code{org-hide-leading-stars} like this:
  6812. @lisp
  6813. (setq org-hide-leading-stars t)
  6814. @end lisp
  6815. @noindent
  6816. or change this on a per-file basis with one of the lines (anywhere in
  6817. the buffer)
  6818. @example
  6819. #+STARTUP: showstars
  6820. #+STARTUP: hidestars
  6821. @end example
  6822. @noindent
  6823. Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
  6824. the modifications.
  6825. With stars hidden, the tree becomes:
  6826. @example
  6827. * Top level headline
  6828. * Second level
  6829. * 3rd level
  6830. some text
  6831. * 3rd level
  6832. more text
  6833. * Another top level headline
  6834. @end example
  6835. @noindent
  6836. Note that the leading stars are not truly replaced by whitespace, they
  6837. are only fontified with the face @code{org-hide} that uses the
  6838. background color as font color. If you are not using either white or
  6839. black background, you may have to customize this face to get the wanted
  6840. effect. Another possibility is to set this font such that the extra
  6841. stars are @i{almost} invisible, for example using the color
  6842. @code{grey90} on a white background.
  6843. Things become cleaner still if you skip all the even levels and use only
  6844. odd levels 1, 3, 5..., effectively adding two stars to go from one
  6845. outline level to the next:
  6846. @example
  6847. * Top level headline
  6848. * Second level
  6849. * 3rd level
  6850. some text
  6851. * 3rd level
  6852. more text
  6853. * Another top level headline
  6854. @end example
  6855. @noindent
  6856. In order to make the structure editing and export commands handle this
  6857. convention correctly, use
  6858. @lisp
  6859. (setq org-odd-levels-only t)
  6860. @end lisp
  6861. @noindent
  6862. or set this on a per-file basis with one of the following lines (don't
  6863. forget to press @kbd{C-c C-c} with the cursor in the startup line to
  6864. activate changes immediately).
  6865. @example
  6866. #+STARTUP: odd
  6867. #+STARTUP: oddeven
  6868. @end example
  6869. You can convert an Org file from single-star-per-level to the
  6870. double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
  6871. RET} in that file. The reverse operation is @kbd{M-x
  6872. org-convert-to-oddeven-levels}.
  6873. @node TTY keys, Interaction, Clean view, Miscellaneous
  6874. @section Using Org on a tty
  6875. @cindex tty key bindings
  6876. Because Org contains a large number of commands, by default much of
  6877. Org's core commands are bound to keys that are generally not
  6878. accessible on a tty, such as the cursor keys (@key{left}, @key{right},
  6879. @key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
  6880. together with modifiers like @key{Meta} and/or @key{Shift}. To access
  6881. these commands on a tty when special keys are unavailable, the following
  6882. alternative bindings can be used. The tty bindings below will likely be
  6883. more cumbersome; you may find for some of the bindings below that a
  6884. customized work-around suits you better. For example, changing a time
  6885. stamp is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
  6886. tty you would rather use @kbd{C-c .} to re-insert the timestamp.
  6887. @multitable @columnfractions 0.15 0.2 0.2
  6888. @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
  6889. @item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab
  6890. @item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{@key{Esc} @key{left}}
  6891. @item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab
  6892. @item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{@key{Esc} @key{right}}
  6893. @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab
  6894. @item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{@key{Esc} @key{up}}
  6895. @item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab
  6896. @item @kbd{M-@key{down}} @tab @kbd{C-c C-x d} @tab @kbd{@key{Esc} @key{down}}
  6897. @item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab
  6898. @item @kbd{S-@key{RET}} @tab @kbd{C-c C-x c} @tab
  6899. @item @kbd{M-@key{RET}} @tab @kbd{C-c C-x m} @tab @kbd{@key{Esc} @key{RET}}
  6900. @item @kbd{M-S-@key{RET}} @tab @kbd{C-c C-x M} @tab
  6901. @item @kbd{S-@key{left}} @tab @kbd{C-c @key{left}} @tab
  6902. @item @kbd{S-@key{right}} @tab @kbd{C-c @key{right}} @tab
  6903. @item @kbd{S-@key{up}} @tab @kbd{C-c @key{up}} @tab
  6904. @item @kbd{S-@key{down}} @tab @kbd{C-c @key{down}} @tab
  6905. @item @kbd{C-S-@key{left}} @tab @kbd{C-c C-x @key{left}} @tab
  6906. @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
  6907. @end multitable
  6908. @node Interaction, Bugs, TTY keys, Miscellaneous
  6909. @section Interaction with other packages
  6910. @cindex packages, interaction with other
  6911. Org lives in the world of GNU Emacs and interacts in various ways
  6912. with other code out there.
  6913. @menu
  6914. * Cooperation:: Packages Org cooperates with
  6915. * Conflicts:: Packages that lead to conflicts
  6916. @end menu
  6917. @node Cooperation, Conflicts, Interaction, Interaction
  6918. @subsection Packages that Org cooperates with
  6919. @table @asis
  6920. @cindex @file{calc.el}
  6921. @item @file{calc.el} by Dave Gillespie
  6922. Org uses the Calc package for implementing spreadsheet
  6923. functionality in its tables (@pxref{The spreadsheet}). Org
  6924. checks for the availability of Calc by looking for the function
  6925. @code{calc-eval} which should be autoloaded in your setup if Calc has
  6926. been installed properly. As of Emacs 22, Calc is part of the Emacs
  6927. distribution. Another possibility for interaction between the two
  6928. packages is using Calc for embedded calculations. @xref{Embedded Mode,
  6929. , Embedded Mode, Calc, GNU Emacs Calc Manual}.
  6930. @cindex @file{constants.el}
  6931. @item @file{constants.el} by Carsten Dominik
  6932. In a table formula (@pxref{The spreadsheet}), it is possible to use
  6933. names for natural constants or units. Instead of defining your own
  6934. constants in the variable @code{org-table-formula-constants}, install
  6935. the @file{constants} package which defines a large number of constants
  6936. and units, and lets you use unit prefixes like @samp{M} for
  6937. @samp{Mega} etc. You will need version 2.0 of this package, available
  6938. at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
  6939. the function @code{constants-get}, which has to be autoloaded in your
  6940. setup. See the installation instructions in the file
  6941. @file{constants.el}.
  6942. @item @file{cdlatex.el} by Carsten Dominik
  6943. @cindex @file{cdlatex.el}
  6944. Org mode can make use of the CDLaTeX package to efficiently enter
  6945. La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}.
  6946. @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
  6947. @cindex @file{imenu.el}
  6948. Imenu allows menu access to an index of items in a file. Org mode
  6949. supports Imenu - all you need to do to get the index is the following:
  6950. @lisp
  6951. (add-hook 'org-mode-hook
  6952. (lambda () (imenu-add-to-menubar "Imenu")))
  6953. @end lisp
  6954. By default the index is two levels deep - you can modify the depth using
  6955. the option @code{org-imenu-depth}.
  6956. @item @file{remember.el} by John Wiegley
  6957. @cindex @file{remember.el}
  6958. Org cooperates with remember, see @ref{Remember}.
  6959. @file{Remember.el} is not part of Emacs, find it on the web.
  6960. @item @file{speedbar.el} by Eric M. Ludlam
  6961. @cindex @file{speedbar.el}
  6962. Speedbar is a package that creates a special frame displaying files and
  6963. index items in files. Org mode supports Speedbar and allows you to
  6964. drill into Org files directly from the Speedbar. It also allows to
  6965. restrict the scope of agenda commands to a file or a subtree by using
  6966. the command @kbd{<} in the Speedbar frame.
  6967. @cindex @file{table.el}
  6968. @item @file{table.el} by Takaaki Ota
  6969. @kindex C-c C-c
  6970. @cindex table editor, @file{table.el}
  6971. @cindex @file{table.el}
  6972. Complex ASCII tables with automatic line wrapping, column- and
  6973. row-spanning, and alignment can be created using the Emacs table
  6974. package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
  6975. and also part of Emacs 22).
  6976. When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
  6977. will call @command{table-recognize-table} and move the cursor into the
  6978. table. Inside a table, the keymap of Org mode is inactive. In order
  6979. to execute Org mode-related commands, leave the table.
  6980. @table @kbd
  6981. @kindex C-c C-c
  6982. @item C-c C-c
  6983. Recognize @file{table.el} table. Works when the cursor is in a
  6984. table.el table.
  6985. @c
  6986. @kindex C-c ~
  6987. @item C-c ~
  6988. Insert a table.el table. If there is already a table at point, this
  6989. command converts it between the table.el format and the Org mode
  6990. format. See the documentation string of the command
  6991. @code{org-convert-table} for the restrictions under which this is
  6992. possible.
  6993. @end table
  6994. @file{table.el} is part of Emacs 22.
  6995. @cindex @file{footnote.el}
  6996. @item @file{footnote.el} by Steven L. Baur
  6997. Org mode recognizes numerical footnotes as provided by this package
  6998. (@pxref{Footnotes}).
  6999. @end table
  7000. @node Conflicts, , Cooperation, Interaction
  7001. @subsection Packages that lead to conflicts with Org mode
  7002. @table @asis
  7003. @cindex @file{allout.el}
  7004. @item @file{allout.el} by Ken Manheimer
  7005. Startup of Org may fail with the error message
  7006. @code{(wrong-type-argument keymapp nil)} when there is an outdated
  7007. version @file{allout.el} on the load path, for example the version
  7008. distributed with Emacs 21.x. Upgrade to Emacs 22 and this problem will
  7009. disappear. If for some reason you cannot do this, make sure that org.el
  7010. is loaded @emph{before} @file{allout.el}, for example by putting
  7011. @code{(require 'org)} early enough into your @file{.emacs} file.
  7012. @cindex @file{CUA.el}
  7013. @item @file{CUA.el} by Kim. F. Storm
  7014. Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by
  7015. CUA mode (as well as pc-select-mode and s-region-mode) to select and
  7016. extend the region. If you want to use one of these packages along with
  7017. Org, configure the variable @code{org-replace-disputed-keys}. When
  7018. set, Org will move the following key bindings in Org files, and
  7019. in the agenda buffer (but not during date selection).
  7020. @example
  7021. S-UP -> M-p S-DOWN -> M-n
  7022. S-LEFT -> M-- S-RIGHT -> M-+
  7023. @end example
  7024. Yes, these are unfortunately more difficult to remember. If you want
  7025. to have other replacement keys, look at the variable
  7026. @code{org-disputed-keys}.
  7027. @item @file{windmove.el} by Hovav Shacham
  7028. @cindex @file{windmove.el}
  7029. Also this package uses the @kbd{S-<cursor>} keys, so everything written
  7030. in the paragraph above about CUA mode also applies here.
  7031. @cindex @file{footnote.el}
  7032. @item @file{footnote.el} by Steven L. Baur
  7033. Org supports the syntax of the footnote package, but only the
  7034. numerical footnote markers. Also, the default key for footnote
  7035. commands, @kbd{C-c !} is already used by Org. You could use the
  7036. variable @code{footnote-prefix} to switch footnotes commands to another
  7037. key. Or, you could use @code{org-replace-disputed-keys} and
  7038. @code{org-disputed-keys} to change the settings in Org.
  7039. @end table
  7040. @node Bugs, , Interaction, Miscellaneous
  7041. @section Bugs
  7042. @cindex bugs
  7043. Here is a list of things that should work differently, but which I
  7044. have found too hard to fix.
  7045. @itemize @bullet
  7046. @item
  7047. If a table field starts with a link, and if the corresponding table
  7048. column is narrowed (@pxref{Narrow columns}) to a width too small to
  7049. display the link, the field would look entirely empty even though it is
  7050. not. To prevent this, Org throws an error. The work-around is to
  7051. make the column wide enough to fit the link, or to add some text (at
  7052. least 2 characters) before the link in the same field.
  7053. @item
  7054. Narrowing table columns does not work on XEmacs, because the
  7055. @code{format} function does not transport text properties.
  7056. @item
  7057. Text in an entry protected with the @samp{QUOTE} keyword should not
  7058. autowrap.
  7059. @item
  7060. When the application called by @kbd{C-c C-o} to open a file link fails
  7061. (for example because the application does not exist or refuses to open
  7062. the file), it does so silently. No error message is displayed.
  7063. @item
  7064. Recalculating a table line applies the formulas from left to right.
  7065. If a formula uses @emph{calculated} fields further down the row,
  7066. multiple recalculation may be needed to get all fields consistent. You
  7067. may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
  7068. recalculate until convergence.
  7069. @item
  7070. A single letter cannot be made bold, for example @samp{*a*}.
  7071. @item
  7072. The exporters work well, but could be made more efficient.
  7073. @end itemize
  7074. @node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top
  7075. @appendix Extensions, Hooks and Hacking
  7076. This appendix lists extensions for Org written by other authors.
  7077. It also covers some aspects where users can extend the functionality of
  7078. Org.
  7079. @menu
  7080. * Extensions:: Existing 3rd-party extensions
  7081. * Adding hyperlink types:: New custom link types
  7082. * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
  7083. * Dynamic blocks:: Automatically filled blocks
  7084. * Special agenda views:: Customized views
  7085. * Using the property API:: Writing programs that use entry properties
  7086. @end menu
  7087. @node Extensions, Adding hyperlink types, Extensions and Hacking, Extensions and Hacking
  7088. @section Third-party extensions for Org
  7089. @cindex extension, third-party
  7090. The following extensions for Org have been written by other people:
  7091. @table @asis
  7092. @cindex @file{org-publish.el}
  7093. @item @file{org-publish.el} by David O'Toole
  7094. This package provides facilities for publishing related sets of Org
  7095. files together with linked files like images as web pages. It is
  7096. highly configurable and can be used for other publishing purposes as
  7097. well. As of Org version 4.30, @file{org-publish.el} is part of the
  7098. Org distribution. It is not yet part of Emacs, however, a delay
  7099. caused by the preparations for the 22.1 release. In the mean time,
  7100. @file{org-publish.el} can be downloaded from David's site:
  7101. @url{http://dto.freeshell.org/e/org-publish.el}.
  7102. @cindex @file{org-mouse.el}
  7103. @item @file{org-mouse.el} by Piotr Zielinski
  7104. This package implements extended mouse functionality for Org. It
  7105. allows you to cycle visibility and to edit the document structure with
  7106. the mouse. Best of all, it provides a context-sensitive menu on
  7107. @key{mouse-3} that changes depending on the context of a mouse-click.
  7108. As of Org version 4.53, @file{org-mouse.el} is part of the
  7109. Org distribution. It is not yet part of Emacs, however, a delay
  7110. caused by the preparations for the 22.1 release. In the mean time,
  7111. @file{org-mouse.el} can be downloaded from Piotr's site:
  7112. @url{http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el}.
  7113. @cindex @file{org-blog.el}
  7114. @item @file{org-blog.el} by David O'Toole
  7115. A blogging plug-in for @file{org-publish.el}.@*
  7116. @url{http://dto.freeshell.org/notebook/OrgMode.html}.
  7117. @cindex @file{blorg.el}
  7118. @item @file{blorg.el} by Bastien Guerry
  7119. Publish Org files as
  7120. blogs. @url{http://www.cognition.ens.fr/~guerry/blorg.html}.
  7121. @cindex @file{org2rem.el}
  7122. @item @file{org2rem.el} by Bastien Guerry
  7123. Translates Org files into something readable by
  7124. Remind. @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}.
  7125. @item @file{org-toc.el} by Bastien Guerry
  7126. Produces a simple table of contents of an Org file, for easy
  7127. navigation. @url{http://www.cognition.ens.fr/~guerry/u/org-registry.el}.
  7128. @item @file{org-registry.el} by Bastien Guerry
  7129. Find which Org-file link to a certain document.
  7130. @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}.
  7131. @end table
  7132. @page
  7133. @node Adding hyperlink types, Tables in arbitrary syntax, Extensions, Extensions and Hacking
  7134. @section Adding hyperlink types
  7135. @cindex hyperlinks, adding new types
  7136. Org has a large number of hyperlink types built-in
  7137. (@pxref{Hyperlinks}). If you would like to add new link types, it
  7138. provides an interface for doing so. Lets look at an example file
  7139. @file{org-man.el} that will add support for creating links like
  7140. @samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
  7141. emacs:
  7142. @lisp
  7143. ;;; org-man.el - Support for links to manpages in Org
  7144. (require 'org)
  7145. (org-add-link-type "man" 'org-man-open)
  7146. (add-hook 'org-store-link-functions 'org-man-store-link)
  7147. (defcustom org-man-command 'man
  7148. "The Emacs command to be used to display a man page."
  7149. :group 'org-link
  7150. :type '(choice (const man) (const woman)))
  7151. (defun org-man-open (path)
  7152. "Visit the manpage on PATH.
  7153. PATH should be a topic that can be thrown at the man command."
  7154. (funcall org-man-command path))
  7155. (defun org-man-store-link ()
  7156. "Store a link to a manpage."
  7157. (when (memq major-mode '(Man-mode woman-mode))
  7158. ;; This is a man page, we do make this link
  7159. (let* ((page (org-man-get-page-name))
  7160. (link (concat "man:" page))
  7161. (description (format "Manpage for %s" page)))
  7162. (org-store-link-props
  7163. :type "man"
  7164. :link link
  7165. :description description))))
  7166. (defun org-man-get-page-name ()
  7167. "Extract the page name from the buffer name."
  7168. ;; This works for both `Man-mode' and `woman-mode'.
  7169. (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  7170. (match-string 1 (buffer-name))
  7171. (error "Cannot create link to this man page")))
  7172. (provide 'org-man)
  7173. ;;; org-man.el ends here
  7174. @end lisp
  7175. @noindent
  7176. You would activate this new link type in @file{.emacs} with
  7177. @lisp
  7178. (require 'org-man)
  7179. @end lisp
  7180. @noindent
  7181. Lets go through the file and see what it does.
  7182. @enumerate
  7183. @item
  7184. It does @code{(require 'org)} to make sure that @file{org.el} has been
  7185. loaded.
  7186. @item
  7187. The next line calls @code{org-add-link-type} to define a new link type
  7188. with prefix @samp{man}. The call also contains the name of a function
  7189. that will be called to follow such a link.
  7190. @item
  7191. The next line adds a function to @code{org-store-link-functions}, in
  7192. order to allow the command @kbd{C-c l} to record a useful link in a
  7193. buffer displaying a man page.
  7194. @end enumerate
  7195. The rest of the file defines the necessary variables and functions.
  7196. First there is a customization variable that determines which emacs
  7197. command should be used to display man pages. There are two options,
  7198. @code{man} and @code{woman}. Then the function to follow a link is
  7199. defined. It gets the link path as an argument - in this case the link
  7200. path is just a topic for the manual command. The function calls the
  7201. value of @code{org-man-command} to display the man page.
  7202. Finally the function @code{org-man-store-link} is defined. When you try
  7203. to store a link with @kbd{C-c l}, also this function will be called to
  7204. try to make a link. The function must first decide if it is supposed to
  7205. create the link for this buffer type, we do this by checking the value
  7206. of the variable @code{major-mode}. If not, the function must exit and
  7207. return the value @code{nil}. If yes, the link is created by getting the
  7208. manual topic from the buffer name and prefixing it with the string
  7209. @samp{man:}. Then it must call the command @code{org-store-link-props}
  7210. and set the @code{:type} and @code{:link} properties. Optionally you
  7211. can also set the @code{:description} property to provide a default for
  7212. the link description when the link is later inserted into an Org
  7213. buffer with @kbd{C-c C-l}.
  7214. @node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Extensions and Hacking
  7215. @section Tables and lists in arbitrary syntax
  7216. @cindex tables, in other modes
  7217. @cindex lists, in other modes
  7218. @cindex Orgtbl mode
  7219. Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
  7220. frequent feature request has been to make it work with native tables in
  7221. specific languages, for example La@TeX{}. However, this is extremely
  7222. hard to do in a general way, would lead to a customization nightmare,
  7223. and would take away much of the simplicity of the Orgtbl mode table
  7224. editor.
  7225. This appendix describes a different approach. We keep the Orgtbl mode
  7226. table in its native format (the @i{source table}), and use a custom
  7227. function to @i{translate} the table to the correct syntax, and to
  7228. @i{install} it in the right location (the @i{target table}). This puts
  7229. the burden of writing conversion functions on the user, but it allows
  7230. for a very flexible system.
  7231. Bastien added the ability to do the same with lists. You can use Org's
  7232. facilities to edit and structure lists by turning @code{orgstruct-mode}
  7233. on, then locally exporting such lists in another format (HTML, La@TeX{}
  7234. or Texinfo.)
  7235. @menu
  7236. * Radio tables:: Sending and receiving
  7237. * A LaTeX example:: Step by step, almost a tutorial
  7238. * Translator functions:: Copy and modify
  7239. * Radio lists:: Doing the same for lists
  7240. @end menu
  7241. @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
  7242. @subsection Radio tables
  7243. @cindex radio tables
  7244. To define the location of the target table, you first need to create two
  7245. lines that are comments in the current mode, but contain magic words for
  7246. Orgtbl mode to find. Orgtbl mode will insert the translated table
  7247. between these lines, replacing whatever was there before. For example:
  7248. @example
  7249. /* BEGIN RECEIVE ORGTBL table_name */
  7250. /* END RECEIVE ORGTBL table_name */
  7251. @end example
  7252. @noindent
  7253. Just above the source table, we put a special line that tells
  7254. Orgtbl mode how to translate this table and where to install it. For
  7255. example:
  7256. @example
  7257. #+ORGTBL: SEND table_name translation_function arguments....
  7258. @end example
  7259. @noindent
  7260. @code{table_name} is the reference name for the table that is also used
  7261. in the receiver lines. @code{translation_function} is the Lisp function
  7262. that does the translation. Furthermore, the line can contain a list of
  7263. arguments (alternating key and value) at the end. The arguments will be
  7264. passed as a property list to the translation function for
  7265. interpretation. A few standard parameters are already recognized and
  7266. acted upon before the translation function is called:
  7267. @table @code
  7268. @item :skip N
  7269. Skip the first N lines of the table. Hlines do count!
  7270. @item :skipcols (n1 n2 ...)
  7271. List of columns that should be skipped. If the table has a column with
  7272. calculation marks, that column is automatically discarded as well.
  7273. Please note that the translator function sees the table @emph{after} the
  7274. removal of these columns, the function never knows that there have been
  7275. additional columns.
  7276. @end table
  7277. @noindent
  7278. The one problem remaining is how to keep the source table in the buffer
  7279. without disturbing the normal workings of the file, for example during
  7280. compilation of a C file or processing of a La@TeX{} file. There are a
  7281. number of different solutions:
  7282. @itemize @bullet
  7283. @item
  7284. The table could be placed in a block comment if that is supported by the
  7285. language. For example, in C mode you could wrap the table between
  7286. @samp{/*} and @samp{*/} lines.
  7287. @item
  7288. Sometimes it is possible to put the table after some kind of @i{END}
  7289. statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
  7290. in La@TeX{}.
  7291. @item
  7292. You can just comment the table line by line whenever you want to process
  7293. the file, and uncomment it whenever you need to edit the table. This
  7294. only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
  7295. make this comment-toggling very easy, in particular if you bind it to a
  7296. key.
  7297. @end itemize
  7298. @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
  7299. @subsection A LaTeX example of radio tables
  7300. @cindex LaTeX, and Orgtbl mode
  7301. The best way to wrap the source table in La@TeX{} is to use the
  7302. @code{comment} environment provided by @file{comment.sty}. It has to be
  7303. activated by placing @code{\usepackage@{comment@}} into the document
  7304. header. Orgtbl mode can insert a radio table skeleton@footnote{By
  7305. default this works only for La@TeX{}, HTML, and Texinfo. Configure the
  7306. variable @code{orgtbl-radio-tables} to install templates for other
  7307. modes.} with the command @kbd{M-x orgtbl-insert-radio-table}. You will
  7308. be prompted for a table name, lets say we use @samp{salesfigures}. You
  7309. will then get the following template:
  7310. @example
  7311. % BEGIN RECEIVE ORGTBL salesfigures
  7312. % END RECEIVE ORGTBL salesfigures
  7313. \begin@{comment@}
  7314. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  7315. | | |
  7316. \end@{comment@}
  7317. @end example
  7318. @noindent
  7319. The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
  7320. @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
  7321. into the receiver location with name @code{salesfigures}. You may now
  7322. fill in the table, feel free to use the spreadsheet features@footnote{If
  7323. the @samp{#+TBLFM} line contains an odd number of dollar characters,
  7324. this may cause problems with font-lock in LaTeX mode. As shown in the
  7325. example you can fix this by adding an extra line inside the
  7326. @code{comment} environment that is used to balance the dollar
  7327. expressions. If you are using AUCTeX with the font-latex library, a
  7328. much better solution is to add the @code{comment} environment to the
  7329. variable @code{LaTeX-verbatim-environments}.}:
  7330. @example
  7331. % BEGIN RECEIVE ORGTBL salesfigures
  7332. % END RECEIVE ORGTBL salesfigures
  7333. \begin@{comment@}
  7334. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  7335. | Month | Days | Nr sold | per day |
  7336. |-------+------+---------+---------|
  7337. | Jan | 23 | 55 | 2.4 |
  7338. | Feb | 21 | 16 | 0.8 |
  7339. | March | 22 | 278 | 12.6 |
  7340. #+TBLFM: $4=$3/$2;%.1f
  7341. % $ (optional extra dollar to keep font-lock happy, see footnote)
  7342. \end@{comment@}
  7343. @end example
  7344. @noindent
  7345. When you are done, press @kbd{C-c C-c} in the table to get the converted
  7346. table inserted between the two marker lines.
  7347. Now lets assume you want to make the table header by hand, because you
  7348. want to control how columns are aligned etc. In this case we make sure
  7349. that the table translator does skip the first 2 lines of the source
  7350. table, and tell the command to work as a @i{splice}, i.e. to not produce
  7351. header and footer commands of the target table:
  7352. @example
  7353. \begin@{tabular@}@{lrrr@}
  7354. Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
  7355. % BEGIN RECEIVE ORGTBL salesfigures
  7356. % END RECEIVE ORGTBL salesfigures
  7357. \end@{tabular@}
  7358. %
  7359. \begin@{comment@}
  7360. #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  7361. | Month | Days | Nr sold | per day |
  7362. |-------+------+---------+---------|
  7363. | Jan | 23 | 55 | 2.4 |
  7364. | Feb | 21 | 16 | 0.8 |
  7365. | March | 22 | 278 | 12.6 |
  7366. #+TBLFM: $4=$3/$2;%.1f
  7367. \end@{comment@}
  7368. @end example
  7369. The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
  7370. Orgtbl mode. It uses a @code{tabular} environment to typeset the table
  7371. and marks horizontal lines with @code{\hline}. Furthermore, it
  7372. interprets the following parameters:
  7373. @table @code
  7374. @item :splice nil/t
  7375. When set to t, return only table body lines, don't wrap them into a
  7376. tabular environment. Default is nil.
  7377. @item :fmt fmt
  7378. A format to be used to wrap each field, should contain @code{%s} for the
  7379. original field value. For example, to wrap each field value in dollars,
  7380. you could use @code{:fmt "$%s$"}. This may also be a property list with
  7381. column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
  7382. @item :efmt efmt
  7383. Use this format to print numbers with exponentials. The format should
  7384. have @code{%s} twice for inserting mantissa and exponent, for example
  7385. @code{"%s\\times10^@{%s@}"}. The default is @code{"%s\\,(%s)"}. This
  7386. may also be a property list with column numbers and formats, for example
  7387. @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
  7388. @code{efmt} has been applied to a value, @code{fmt} will also be
  7389. applied.
  7390. @end table
  7391. @node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
  7392. @subsection Translator functions
  7393. @cindex HTML, and Orgtbl mode
  7394. @cindex translator function
  7395. Orgtbl mode has several translator functions built-in:
  7396. @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and
  7397. @code{orgtbl-to-texinfo}. Except for @code{orgtbl-to-html}@footnote{The
  7398. HTML translator uses the same code that produces tables during HTML
  7399. export.}, these all use a generic translator, @code{orgtbl-to-generic}.
  7400. For example, @code{orgtbl-to-latex} itself is a very short function that
  7401. computes the column definitions for the @code{tabular} environment,
  7402. defines a few field and line separators and then hands over to the
  7403. generic translator. Here is the entire code:
  7404. @lisp
  7405. @group
  7406. (defun orgtbl-to-latex (table params)
  7407. "Convert the Orgtbl mode TABLE to LaTeX."
  7408. (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
  7409. org-table-last-alignment ""))
  7410. (params2
  7411. (list
  7412. :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
  7413. :tend "\\end@{tabular@}"
  7414. :lstart "" :lend " \\\\" :sep " & "
  7415. :efmt "%s\\,(%s)" :hline "\\hline")))
  7416. (orgtbl-to-generic table (org-combine-plists params2 params))))
  7417. @end group
  7418. @end lisp
  7419. As you can see, the properties passed into the function (variable
  7420. @var{PARAMS}) are combined with the ones newly defined in the function
  7421. (variable @var{PARAMS2}). The ones passed into the function (i.e. the
  7422. ones set by the @samp{ORGTBL SEND} line) take precedence. So if you
  7423. would like to use the La@TeX{} translator, but wanted the line endings to
  7424. be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
  7425. overrule the default with
  7426. @example
  7427. #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  7428. @end example
  7429. For a new language, you can either write your own converter function in
  7430. analogy with the La@TeX{} translator, or you can use the generic function
  7431. directly. For example, if you have a language where a table is started
  7432. with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
  7433. started with @samp{!BL!}, ended with @samp{!EL!} and where the field
  7434. separator is a TAB, you could call the generic translator like this (on
  7435. a single line!):
  7436. @example
  7437. #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
  7438. :lstart "!BL! " :lend " !EL!" :sep "\t"
  7439. @end example
  7440. @noindent
  7441. Please check the documentation string of the function
  7442. @code{orgtbl-to-generic} for a full list of parameters understood by
  7443. that function and remember that you can pass each of them into
  7444. @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
  7445. using the generic function.
  7446. Of course you can also write a completely new function doing complicated
  7447. things the generic translator cannot do. A translator function takes
  7448. two arguments. The first argument is the table, a list of lines, each
  7449. line either the symbol @code{hline} or a list of fields. The second
  7450. argument is the property list containing all parameters specified in the
  7451. @samp{#+ORGTBL: SEND} line. The function must return a single string
  7452. containing the formatted table. If you write a generally useful
  7453. translator, please post it on @code{emacs-orgmode@@gnu.org} so that
  7454. others can benefit from your work.
  7455. @node Radio lists, , Translator functions, Tables in arbitrary syntax
  7456. @subsection Radio lists
  7457. @cindex radio lists
  7458. @cindex org-list-insert-radio-list
  7459. Sending and receiving radio lists works exactly the same way than
  7460. sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
  7461. need to load the @code{org-export-latex.el} package to use radio lists
  7462. since the relevant code is there for now.}. As for radio tables, you
  7463. can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by
  7464. calling @code{org-list-insert-radio-list}.
  7465. Here are the differences with radio tables:
  7466. @itemize @minus
  7467. @item
  7468. Use @code{ORGLST} instead of @code{ORGTBL}.
  7469. @item
  7470. The available translation functions for radio lists don't take
  7471. parameters.
  7472. @item
  7473. `C-c C-c' will work when pressed on the first item of the list.
  7474. @end itemize
  7475. Here is a La@TeX{} example. Let's say that you have this in your
  7476. La@TeX{} file:
  7477. @example
  7478. % BEGIN RECEIVE ORGLST to-buy
  7479. % END RECEIVE ORGLST to-buy
  7480. \begin@{comment@}
  7481. #+ORGLIST: SEND to-buy orgtbl-to-latex
  7482. - a new house
  7483. - a new computer
  7484. + a new keyboard
  7485. + a new mouse
  7486. - a new life
  7487. \end@{comment@}
  7488. @end example
  7489. Pressing `C-c C-c' on @code{a new house} and will insert the converted
  7490. La@TeX{} list between the two marker lines.
  7491. @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Extensions and Hacking
  7492. @section Dynamic blocks
  7493. @cindex dynamic blocks
  7494. Org documents can contain @emph{dynamic blocks}. These are
  7495. specially marked regions that are updated by some user-written function.
  7496. A good example for such a block is the clock table inserted by the
  7497. command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
  7498. Dynamic block are enclosed by a BEGIN-END structure that assigns a name
  7499. to the block and can also specify parameters for the function producing
  7500. the content of the block.
  7501. @example
  7502. #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  7503. #+END:
  7504. @end example
  7505. Dynamic blocks are updated with the following commands
  7506. @table @kbd
  7507. @kindex C-c C-x C-u
  7508. @item C-c C-x C-u
  7509. Update dynamic block at point.
  7510. @kindex C-u C-c C-x C-u
  7511. @item C-u C-c C-x C-u
  7512. Update all dynamic blocks in the current file.
  7513. @end table
  7514. Updating a dynamic block means to remove all the text between BEGIN and
  7515. END, parse the BEGIN line for parameters and then call the specific
  7516. writer function for this block to insert the new content. If you want
  7517. to use the original content in the writer function, you can use the
  7518. extra parameter @code{:content}.
  7519. For a block with name @code{myblock}, the writer function is
  7520. @code{org-dblock-write:myblock} with as only parameter a property list
  7521. with the parameters given in the begin line. Here is a trivial example
  7522. of a block that keeps track of when the block update function was last
  7523. run:
  7524. @example
  7525. #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  7526. #+END:
  7527. @end example
  7528. @noindent
  7529. The corresponding block writer function could look like this:
  7530. @lisp
  7531. (defun org-dblock-write:block-update-time (params)
  7532. (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  7533. (insert "Last block update at: "
  7534. (format-time-string fmt (current-time)))))
  7535. @end lisp
  7536. If you want to make sure that all dynamic blocks are always up-to-date,
  7537. you could add the function @code{org-update-all-dblocks} to a hook, for
  7538. example @code{before-save-hook}. @code{org-update-all-dblocks} is
  7539. written in a way that is does nothing in buffers that are not in Org.
  7540. @node Special agenda views, Using the property API, Dynamic blocks, Extensions and Hacking
  7541. @section Special agenda views
  7542. @cindex agenda views, user-defined
  7543. Org provides a special hook that can be used to narrow down the
  7544. selection made by any of the agenda views. You may specify a function
  7545. that is used at each match to verify if the match should indeed be part
  7546. of the agenda view, and if not, how much should be skipped.
  7547. Let's say you want to produce a list of projects that contain a WAITING
  7548. tag anywhere in the project tree. Let's further assume that you have
  7549. marked all tree headings that define a project with the TODO keyword
  7550. PROJECT. In this case you would run a TODO search for the keyword
  7551. PROJECT, but skip the match unless there is a WAITING tag anywhere in
  7552. the subtree belonging to the project line.
  7553. To achieve this, you must write a function that searches the subtree for
  7554. the tag. If the tag is found, the function must return @code{nil} to
  7555. indicate that this match should not be skipped. If there is no such
  7556. tag, return the location of the end of the subtree, to indicate that
  7557. search should continue from there.
  7558. @lisp
  7559. (defun my-skip-unless-waiting ()
  7560. "Skip trees that are not waiting"
  7561. (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  7562. (if (re-search-forward ":waiting:" subtree-end t)
  7563. nil ; tag found, do not skip
  7564. subtree-end))) ; tag not found, continue after end of subtree
  7565. @end lisp
  7566. Now you may use this function in an agenda custom command, for example
  7567. like this:
  7568. @lisp
  7569. (org-add-agenda-custom-command
  7570. '("b" todo "PROJECT"
  7571. ((org-agenda-skip-function 'my-org-waiting-projects)
  7572. (org-agenda-overriding-header "Projects waiting for something: "))))
  7573. @end lisp
  7574. Note that this also binds @code{org-agenda-overriding-header} to get a
  7575. meaningful header in the agenda view.
  7576. You may also put a Lisp form into @code{org-agenda-skip-function}. In
  7577. particular, you may use the functions @code{org-agenda-skip-entry-if}
  7578. and @code{org-agenda-skip-subtree-if} in this form, for example:
  7579. @table @code
  7580. @item '(org-agenda-skip-entry-if 'scheduled)
  7581. Skip current entry if it has been scheduled.
  7582. @item '(org-agenda-skip-entry-if 'notscheduled)
  7583. Skip current entry if it has not been scheduled.
  7584. @item '(org-agenda-skip-entry-if 'deadline)
  7585. Skip current entry if it has a deadline.
  7586. @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
  7587. Skip current entry if it has a deadline, or if it is scheduled.
  7588. @item '(org-agenda-skip-entry 'regexp "regular expression")
  7589. Skip current entry if the regular expression matches in the entry.
  7590. @item '(org-agenda-skip-entry 'notregexp "regular expression")
  7591. Skip current entry unless the regular expression matches.
  7592. @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
  7593. Same as above, but check and skip the entire subtree.
  7594. @end table
  7595. Therefore we could also have written the search for WAITING projects
  7596. like this, even without defining a special function:
  7597. @lisp
  7598. (org-add-agenda-custom-command
  7599. '("b" todo "PROJECT"
  7600. ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  7601. 'regexp ":waiting:"))
  7602. (org-agenda-overriding-header "Projects waiting for something: "))))
  7603. @end lisp
  7604. @node Using the property API, , Special agenda views, Extensions and Hacking
  7605. @section Using the property API
  7606. @cindex API, for properties
  7607. @cindex properties, API
  7608. Here is a description of the functions that can be used to work with
  7609. properties.
  7610. @defun org-entry-properties &optional pom which
  7611. Get all properties of the entry at point-or-marker POM.
  7612. This includes the TODO keyword, the tags, time strings for deadline,
  7613. scheduled, and clocking, and any additional properties defined in the
  7614. entry. The return value is an alist, keys may occur multiple times
  7615. if the property key was used several times.
  7616. POM may also be nil, in which case the current entry is used.
  7617. If WHICH is nil or `all', get all properties. If WHICH is
  7618. `special' or `standard', only get that subclass.
  7619. @end defun
  7620. @defun org-entry-get pom property &optional inherit
  7621. Get value of PROPERTY for entry at point-or-marker POM. By default,
  7622. this only looks at properties defined locally in the entry. If INHERIT
  7623. is non-nil and the entry does not have the property, then also check
  7624. higher levels of the hierarchy. If INHERIT is the symbol
  7625. @code{selective}, use inheritance if and only if the setting of
  7626. @code{org-use-property-inheritance} selects PROPERTY for inheritance.
  7627. @end defun
  7628. @defun org-entry-delete pom property
  7629. Delete the property PROPERTY from entry at point-or-marker POM.
  7630. @end defun
  7631. @defun org-entry-put pom property value
  7632. Set PROPERTY to VALUE for entry at point-or-marker POM.
  7633. @end defun
  7634. @defun org-buffer-property-keys &optional include-specials
  7635. Get all property keys in the current buffer.
  7636. @end defun
  7637. @defun org-insert-property-drawer
  7638. Insert a property drawer at point.
  7639. @end defun
  7640. @defun org-entry-add-to-multivalued-property pom property value
  7641. Treat the value of the property PROPERTY as a whitespace-separated list of
  7642. values and make sure that VALUE is in this list.
  7643. @end defun
  7644. @defun org-entry-remove-from-multivalued-property pom property value
  7645. Treat the value of the property PROPERTY as a whitespace-separated list of
  7646. values and make sure that VALUE is @emph{not} in this list.
  7647. @end defun
  7648. @defun org-entry-member-in-multivalued-property pom property value
  7649. Treat the value of the property PROPERTY as a whitespace-separated list of
  7650. values and check if VALUE is in this list.
  7651. @end defun
  7652. @node History and Acknowledgments, Main Index, Extensions and Hacking, Top
  7653. @appendix History and Acknowledgments
  7654. @cindex acknowledgments
  7655. @cindex history
  7656. @cindex thanks
  7657. Org was borne in 2003, out of frustration over the user interface
  7658. of the Emacs Outline mode. I was trying to organize my notes and
  7659. projects, and using Emacs seemed to be the natural way to go. However,
  7660. having to remember eleven different commands with two or three keys per
  7661. command, only to hide and show parts of the outline tree, that seemed
  7662. entirely unacceptable to me. Also, when using outlines to take notes, I
  7663. constantly want to restructure the tree, organizing it parallel to my
  7664. thoughts and plans. @emph{Visibility cycling} and @emph{structure
  7665. editing} were originally implemented in the package
  7666. @file{outline-magic.el}, but quickly moved to the more general
  7667. @file{org.el}. As this environment became comfortable for project
  7668. planning, the next step was adding @emph{TODO entries}, basic @emph{time
  7669. stamps}, and @emph{table support}. These areas highlight the two main
  7670. goals that Org still has today: To create a new, outline-based,
  7671. plain text mode with innovative and intuitive editing features, and to
  7672. incorporate project planning functionality directly into a notes file.
  7673. A special thanks goes to @i{Bastien Guerry} who has not only writen a large
  7674. number of extensions to Org (most of them integrated into the core by now),
  7675. but has also helep the development and maintenance of Org so much that e
  7676. should be considered co-author of this package.
  7677. Since the first release, literally thousands of emails to me or on
  7678. @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
  7679. reports, feedback, new ideas, and sometimes patches and add-on code.
  7680. Many thanks to everyone who has helped to improve this package. I am
  7681. trying to keep here a list of the people who had significant influence
  7682. in shaping one or more aspects of Org. The list may not be
  7683. complete, if I have forgotten someone, please accept my apologies and
  7684. let me know.
  7685. @itemize @bullet
  7686. @item
  7687. @i{Russel Adams} came up with the idea for drawers.
  7688. @item
  7689. @i{Thomas Baumann} contributed the code for links to the MH-E email
  7690. system.
  7691. @item
  7692. @i{Alex Bochannek} provided a patch for rounding time stamps.
  7693. @item
  7694. @i{Charles Cave}'s suggestion sparked the implementation of templates
  7695. for Remember.
  7696. @item
  7697. @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
  7698. specified time.
  7699. @item
  7700. @i{Gregory Chernov} patched support for lisp forms into table
  7701. calculations and improved XEmacs compatibility, in particular by porting
  7702. @file{nouline.el} to XEmacs.
  7703. @item
  7704. @i{Sacha Chua} suggested to copy some linking code from Planner.
  7705. @item
  7706. @i{Eddward DeVilla} proposed and tested checkbox statistics. He also
  7707. came up with the idea of properties, and that there should be an API for
  7708. them.
  7709. @item
  7710. @i{Kees Dullemond} used to edit projects lists directly in HTML and so
  7711. inspired some of the early development, including HTML export. He also
  7712. asked for a way to narrow wide table columns.
  7713. @item
  7714. @i{Christian Egli} converted the documentation into Texinfo format,
  7715. patched CSS formatting into the HTML exporter, and inspired the agenda.
  7716. @item
  7717. @i{David Emery} provided a patch for custom CSS support in exported
  7718. HTML agendas.
  7719. @item
  7720. @i{Nic Ferrier} contributed mailcap and XOXO support.
  7721. @item
  7722. @i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
  7723. @item
  7724. @i{John Foerch} figured out how to make incremental search show context
  7725. around a match in a hidden outline tree.
  7726. @item
  7727. @i{Niels Giesen} had the idea to automatically archive DONE trees.
  7728. @item
  7729. @i{Bastien Guerry} wrote the La@TeX{} exporter and has been prolific
  7730. with patches, ideas, and bug reports.
  7731. @item
  7732. @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
  7733. @item
  7734. @i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
  7735. task state change logging, and the clocktable. His clear explanations have
  7736. been critical when we started to adopt the GIT version control system.
  7737. @item
  7738. @i{Scott Jaderholm} proposed footnotes, control over whitespace between
  7739. folded entries, and column view for properties.
  7740. @item
  7741. @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it. He also
  7742. provided frequent feedback and some patches.
  7743. @item
  7744. @i{Jason F. McBrayer} suggested agenda export to CSV format.
  7745. @item
  7746. @i{Max Mikhanosha} came up with the idea of refiling.
  7747. @item
  7748. @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
  7749. basis.
  7750. @item
  7751. @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
  7752. happy.
  7753. @item
  7754. @i{Rick Moynihan} proposed to allow multiple TODO sequences in a file
  7755. and to be able to quickly restrict the agenda to a subtree.
  7756. @item
  7757. @i{Todd Neal} provided patches for links to Info files and elisp forms.
  7758. @item
  7759. @i{Tim O'Callaghan} suggested in-file links, search options for general
  7760. file links, and TAGS.
  7761. @item
  7762. @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
  7763. into Japanese.
  7764. @item
  7765. @i{Oliver Oppitz} suggested multi-state TODO items.
  7766. @item
  7767. @i{Scott Otterson} sparked the introduction of descriptive text for
  7768. links, among other things.
  7769. @item
  7770. @i{Pete Phillips} helped during the development of the TAGS feature, and
  7771. provided frequent feedback.
  7772. @item
  7773. @i{T.V. Raman} reported bugs and suggested improvements.
  7774. @item
  7775. @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
  7776. control.
  7777. @item
  7778. @i{Kevin Rogers} contributed code to access VM files on remote hosts.
  7779. @item
  7780. @i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
  7781. webpages derived from Org using an Info-like, or a folding interface with
  7782. single key navigation.
  7783. @item
  7784. @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
  7785. conflict with @file{allout.el}.
  7786. @item
  7787. @i{Jason Riedy} sent a patch to fix a bug with export of TODO keywords.
  7788. @item
  7789. @i{Philip Rooke} created the Org reference card and provided lots
  7790. of feedback.
  7791. @item
  7792. @i{Christian Schlauer} proposed angular brackets around links, among
  7793. other things.
  7794. @item
  7795. Linking to VM/BBDB/Gnus was inspired by @i{Tom Shannon}'s
  7796. @file{organizer-mode.el}.
  7797. @item
  7798. @i{Ilya Shlyakhter} proposed the Archive Sibling.
  7799. @item
  7800. @i{Daniel Sinder} came up with the idea of internal archiving by locking
  7801. subtrees.
  7802. @item
  7803. @i{Dale Smith} proposed link abbreviations.
  7804. @item
  7805. @i{Adam Spiers} asked for global linking commands and inspired the link
  7806. extension system. support mairix.
  7807. @item
  7808. @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
  7809. chapter about publishing.
  7810. @item
  7811. @i{J@"urgen Vollmer} contributed code generating the table of contents
  7812. in HTML output.
  7813. @item
  7814. @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
  7815. keyword.
  7816. @item
  7817. @i{David Wainberg} suggested archiving, and improvements to the linking
  7818. system.
  7819. @item
  7820. @i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}. The
  7821. development of Org was fully independent, and both systems are
  7822. really different beasts in their basic ideas and implementation details.
  7823. I later looked at John's code, however, and learned from his
  7824. implementation of (i) links where the link itself is hidden and only a
  7825. description is shown, and (ii) popping up a calendar to select a date.
  7826. John has also contributed a number of great ideas directly to Org.
  7827. @item
  7828. @i{Carsten Wimmer} suggested some changes and helped fix a bug in
  7829. linking to Gnus.
  7830. @item
  7831. @i{Roland Winkler} requested additional key bindings to make Org
  7832. work on a tty.
  7833. @item
  7834. @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
  7835. and contributed various ideas and code snippets.
  7836. @end itemize
  7837. @node Main Index, Key Index, History and Acknowledgments, Top
  7838. @unnumbered The Main Index
  7839. @printindex cp
  7840. @node Key Index, , Main Index, Top
  7841. @unnumbered Key Index
  7842. @printindex ky
  7843. @bye
  7844. @ignore
  7845. arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
  7846. @end ignore
  7847. @c Local variables:
  7848. @c ispell-local-dictionary: "en_US-w_accents"
  7849. @c ispell-local-pdict: "./.aspell.org.pws"
  7850. @c fill-column: 77
  7851. @c End: