org.texi 364 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258
  1. \input texinfo
  2. @c %**start of header
  3. @setfilename ../../info/org
  4. @settitle The Org Manual
  5. @set VERSION 6.03pre01
  6. @set DATE May 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. * Effort estimates:: Planning work effort in advance
  169. Creating timestamps
  170. * The date/time prompt:: How Org mode helps you entering date and time
  171. * Custom time format:: Making dates look different
  172. Deadlines and scheduling
  173. * Inserting deadline/schedule:: Planning items
  174. * Repeated tasks:: Items that show up again and again
  175. Remember
  176. * Setting up Remember:: Some code for .emacs to get things going
  177. * Remember templates:: Define the outline of different note types
  178. * Storing notes:: Directly get the note to where it belongs
  179. * Refiling notes:: Moving a note or task to a project
  180. Agenda Views
  181. * Agenda files:: Files being searched for agenda information
  182. * Agenda dispatcher:: Keyboard access to agenda views
  183. * Built-in agenda views:: What is available out of the box?
  184. * Presentation and sorting:: How agenda items are prepared for display
  185. * Agenda commands:: Remote editing of Org trees
  186. * Custom agenda views:: Defining special searches and views
  187. * Agenda column view:: Using column view for collected entries
  188. The built-in agenda views
  189. * Weekly/daily agenda:: The calendar page with current tasks
  190. * Global TODO list:: All unfinished action items
  191. * Matching tags and properties:: Structured information with fine-tuned search
  192. * Timeline:: Time-sorted view for single file
  193. * Keyword search:: Finding entries by keyword
  194. * Stuck projects:: Find projects you need to review
  195. Presentation and sorting
  196. * Categories:: Not all tasks are equal
  197. * Time-of-day specifications:: How the agenda knows the time
  198. * Sorting of agenda items:: The order of things
  199. Custom agenda views
  200. * Storing searches:: Type once, use often
  201. * Block agenda:: All the stuff you need in a single buffer
  202. * Setting Options:: Changing the rules
  203. * Exporting Agenda Views:: Writing agendas to files
  204. * Using the agenda elsewhere:: Using agenda information in other programs
  205. Embedded LaTeX
  206. * Math symbols:: TeX macros for symbols and Greek letters
  207. * Subscripts and superscripts:: Simple syntax for raising/lowering text
  208. * LaTeX fragments:: Complex formulas made easy
  209. * Processing LaTeX fragments:: Previewing LaTeX processing
  210. * CDLaTeX mode:: Speed up entering of formulas
  211. Exporting
  212. * Markup rules:: Which structures are recognized?
  213. * Export options:: Per-file export settings
  214. * The export dispatcher:: How to access exporter commands
  215. * ASCII export:: Exporting to plain ASCII
  216. * HTML export:: Exporting to HTML
  217. * LaTeX export:: Exporting to LaTeX
  218. * XOXO export:: Exporting to XOXO
  219. * iCalendar export:: Exporting in iCalendar format
  220. Markup rules
  221. * Document title:: How the document title is determined
  222. * Headings and sections:: The main structure of the exported document
  223. * Table of contents:: If, where, how to create a table of contents
  224. * Initial text:: Text before the first headline
  225. * Lists:: Plain lists are exported
  226. * Paragraphs:: What determines beginning and ending
  227. * Literal examples:: Source code and other examples
  228. * Include files:: Include the contents of a file during export
  229. * Tables exported:: Tables are exported richly
  230. * Footnotes:: Numbers like [1]
  231. * Emphasis and monospace:: To bold or not to bold
  232. * TeX macros and LaTeX fragments:: Create special, rich export.
  233. * Horizontal rules:: A line across the page
  234. * Comment lines:: Some lines will not be exported
  235. HTML export
  236. * HTML Export commands:: How to invoke HTML export
  237. * Quoting HTML tags:: Using direct HTML in Org mode
  238. * Links:: Transformation of links for HTML
  239. * Images:: How to include images
  240. * CSS support:: Changing the appearance of the output
  241. * Javascript support:: Info and Folding in a web browser
  242. LaTeX export
  243. * LaTeX export commands:: How to invoke LaTeX export
  244. * Quoting LaTeX code:: Incorporating literal LaTeX code
  245. * Sectioning structure:: Changing sectioning in LaTeX output
  246. Publishing
  247. * Configuration:: Defining projects
  248. * Sample configuration:: Example projects
  249. * Triggering publication:: Publication commands
  250. Configuration
  251. * Project alist:: The central configuration variable
  252. * Sources and destinations:: From here to there
  253. * Selecting files:: What files are part of the project?
  254. * Publishing action:: Setting the function doing the publishing
  255. * Publishing options:: Tweaking HTML export
  256. * Publishing links:: Which links keep working after publishing?
  257. * Project page index:: Publishing a list of project files
  258. Sample configuration
  259. * Simple example:: One-component publishing
  260. * Complex example:: A multi-component publishing example
  261. Miscellaneous
  262. * Completion:: M-TAB knows what you need
  263. * Customization:: Adapting Org to your taste
  264. * In-buffer settings:: Overview of the #+KEYWORDS
  265. * The very busy C-c C-c key:: When in doubt, press C-c C-c
  266. * Clean view:: Getting rid of leading stars in the outline
  267. * TTY keys:: Using Org on a tty
  268. * Interaction:: Other Emacs packages
  269. * Bugs:: Things which do not work perfectly
  270. Interaction with other packages
  271. * Cooperation:: Packages Org cooperates with
  272. * Conflicts:: Packages that lead to conflicts
  273. Extensions, Hooks and Hacking
  274. * Extensions:: Existing 3rd-party extensions
  275. * Adding hyperlink types:: New custom link types
  276. * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
  277. * Dynamic blocks:: Automatically filled blocks
  278. * Special agenda views:: Customized views
  279. * Using the property API:: Writing programs that use entry properties
  280. Tables and lists in arbitrary syntax
  281. * Radio tables:: Sending and receiving
  282. * A LaTeX example:: Step by step, almost a tutorial
  283. * Translator functions:: Copy and modify
  284. * Radio lists:: Doing the same for lists
  285. @end detailmenu
  286. @end menu
  287. @node Introduction, Document Structure, Top, Top
  288. @chapter Introduction
  289. @cindex introduction
  290. @menu
  291. * Summary:: Brief summary of what Org does
  292. * Installation:: How to install a downloaded version of Org
  293. * Activation:: How to activate Org for certain buffers
  294. * Feedback:: Bug reports, ideas, patches etc.
  295. * Conventions:: Type-setting conventions in the manual
  296. @end menu
  297. @node Summary, Installation, Introduction, Introduction
  298. @section Summary
  299. @cindex summary
  300. Org is a mode for keeping notes, maintaining TODO lists, and doing
  301. project planning with a fast and effective plain-text system.
  302. Org develops organizational tasks around NOTES files that contain
  303. lists or information about projects as plain text. Org is
  304. implemented on top of Outline mode, which makes it possible to keep the
  305. content of large files well structured. Visibility cycling and
  306. structure editing help to work with the tree. Tables are easily created
  307. with a built-in table editor. Org supports TODO items, deadlines,
  308. time stamps, and scheduling. It dynamically compiles entries into an
  309. agenda that utilizes and smoothly integrates much of the Emacs calendar
  310. and diary. Plain text URL-like links connect to websites, emails,
  311. Usenet messages, BBDB entries, and any files related to the projects.
  312. For printing and sharing of notes, an Org file can be exported as a
  313. structured ASCII file, as HTML, or (TODO and agenda items only) as an
  314. iCalendar file. It can also serve as a publishing tool for a set of
  315. linked web pages.
  316. An important design aspect that distinguishes Org from for example
  317. Planner/Muse is that it encourages to store every piece of information
  318. only once. In Planner, you have project pages, day pages and possibly
  319. other files, duplicating some information such as tasks. In Org,
  320. you only have notes files. In your notes you mark entries as tasks,
  321. label them with tags and timestamps. All necessary lists like a
  322. schedule for the day, the agenda for a meeting, tasks lists selected by
  323. tags etc are created dynamically when you need them.
  324. Org keeps simple things simple. When first fired up, it should
  325. feel like a straightforward, easy to use outliner. Complexity is not
  326. imposed, but a large amount of functionality is available when you need
  327. it. Org is a toolbox and can be used in different ways, for
  328. example as:
  329. @example
  330. @r{@bullet{} outline extension with visibility cycling and structure editing}
  331. @r{@bullet{} ASCII system and table editor for taking structured notes}
  332. @r{@bullet{} ASCII table editor with spreadsheet-like capabilities}
  333. @r{@bullet{} TODO list editor}
  334. @r{@bullet{} full agenda and planner with deadlines and work scheduling}
  335. @r{@bullet{} environment to implement David Allen's GTD system}
  336. @r{@bullet{} a basic database application}
  337. @r{@bullet{} simple hypertext system, with HTML and LaTeX export}
  338. @r{@bullet{} publishing tool to create a set of interlinked webpages}
  339. @end example
  340. Org's automatic, context sensitive table editor with spreadsheet
  341. capabilities can be integrated into any major mode by activating the
  342. minor Orgtbl mode. Using a translation step, it can be used to maintain
  343. tables in arbitrary file types, for example in La@TeX{}. The structure
  344. editing and list creation capabilities can be used outside Org with
  345. the minor Orgstruct mode.
  346. @cindex FAQ
  347. There is a website for Org which provides links to the newest
  348. version of Org, as well as additional information, frequently asked
  349. questions (FAQ), links to tutorials etc. This page is located at
  350. @uref{http://orgmode.org}.
  351. @page
  352. @node Installation, Activation, Summary, Introduction
  353. @section Installation
  354. @cindex installation
  355. @cindex XEmacs
  356. @b{Important:} @i{If Org is part of the Emacs distribution or an
  357. XEmacs package, please skip this section and go directly to
  358. @ref{Activation}.}
  359. If you have downloaded Org from the Web, either as a distribution @file{.zip}
  360. or @file{.tar} file, or as a GIT archive, you must take the following steps
  361. to install it: Go into the unpacked Org distribution directory and edit the
  362. top section of the file @file{Makefile}. You must set the name of the Emacs
  363. binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
  364. directories where local Lisp and Info files are kept. If you don't have
  365. access to the system-wide directories, you can simply run Org directly from
  366. the distribution directory by adding the @file{lisp} subdirectory to the
  367. Emacs load path. To do this, add the following line to @file{.emacs}:
  368. @example
  369. (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
  370. @end example
  371. @noindent
  372. If you plan to use code from the @file{contrib} subdirectory, do a similar
  373. step for this directory:
  374. @example
  375. (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
  376. @end example
  377. @b{XEmacs users now need to install the file @file{noutline.el} from
  378. the @file{xemacs} sub-directory of the Org distribution. Use the
  379. command:}
  380. @example
  381. @b{make install-noutline}
  382. @end example
  383. @noindent Now byte-compile the Lisp files with the shell command:
  384. @example
  385. make
  386. @end example
  387. @noindent If you are running Org from the distribution directory, this is
  388. all. If you want to install into the system directories, use
  389. @example
  390. make install
  391. make install-info
  392. @end example
  393. @noindent Then add to @file{.emacs}:
  394. @lisp
  395. ;; This line only if Org is not part of the X/Emacs distribution.
  396. (require 'org-install)
  397. @end lisp
  398. @node Activation, Feedback, Installation, Introduction
  399. @section Activation
  400. @cindex activation
  401. @cindex autoload
  402. @cindex global key bindings
  403. @cindex key bindings, global
  404. @iftex
  405. @b{Important:} @i{If you use copy-and-paste to copy lisp code from the
  406. PDF documentation as viewed by Acrobat reader to your .emacs file, the
  407. single quote character comes out incorrectly and the code will not work.
  408. You need to fix the single quotes by hand, or copy from Info
  409. documentation.}
  410. @end iftex
  411. Add the following lines to your @file{.emacs} file. The last two lines
  412. define @emph{global} keys for the commands @command{org-store-link},
  413. @command{org-agenda}, and @command{org-iswitchb} - please choose suitable
  414. keys yourself.
  415. @lisp
  416. ;; The following lines are always needed. Choose your own keys.
  417. (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
  418. (global-set-key "\C-cl" 'org-store-link)
  419. (global-set-key "\C-ca" 'org-agenda)
  420. (global-set-key "\C-cb" 'org-iswitchb)
  421. @end lisp
  422. Furthermore, you must activate @code{font-lock-mode} in Org
  423. buffers, because significant functionality depends on font-locking being
  424. active. You can do this with either one of the following two lines
  425. (XEmacs user must use the second option):
  426. @lisp
  427. (global-font-lock-mode 1) ; for all buffers
  428. (add-hook 'org-mode-hook 'turn-on-font-lock) ; Org buffers only
  429. @end lisp
  430. @cindex Org mode, turning on
  431. With this setup, all files with extension @samp{.org} will be put
  432. into Org mode. As an alternative, make the first line of a file look
  433. like this:
  434. @example
  435. MY PROJECTS -*- mode: org; -*-
  436. @end example
  437. @noindent which will select Org mode for this buffer no matter what
  438. the file's name is. See also the variable
  439. @code{org-insert-mode-line-in-empty-file}.
  440. @node Feedback, Conventions, Activation, Introduction
  441. @section Feedback
  442. @cindex feedback
  443. @cindex bug reports
  444. @cindex maintainer
  445. @cindex author
  446. If you find problems with Org, or if you have questions, remarks,
  447. or ideas about it, please contact the maintainer @value{MAINTAINER} at
  448. @value{MAINTAINEREMAIL}.
  449. For bug reports, please provide as much information as possible,
  450. including the version information of Emacs (@kbd{C-h v emacs-version
  451. @key{RET}}) and Org (@kbd{C-h v org-version @key{RET}}), as well as
  452. the Org related setup in @file{.emacs}. If an error occurs, a
  453. backtrace can be very useful (see below on how to create one). Often a
  454. small example file helps, along with clear information about:
  455. @enumerate
  456. @item What exactly did you do?
  457. @item What did you expect to happen?
  458. @item What happened instead?
  459. @end enumerate
  460. @noindent Thank you for helping to improve this mode.
  461. @subsubheading How to create a useful backtrace
  462. @cindex backtrace of an error
  463. If working with Org produces an error with a message you don't
  464. understand, you may have hit a bug. The best way to report this is by
  465. providing, in addition to what was mentioned above, a @emph{Backtrace}.
  466. This is information from the built-in debugger about where and how the
  467. error occurred. Here is how to produce a useful backtrace:
  468. @enumerate
  469. @item
  470. Start a fresh Emacs or XEmacs, and make sure that it will load the
  471. original Lisp code in @file{org.el} instead of the compiled version in
  472. @file{org.elc}. The backtrace contains much more information if it is
  473. produced with uncompiled code. To do this, either rename @file{org.elc}
  474. to something else before starting Emacs, or ask Emacs explicitly to load
  475. @file{org.el} by using the command line
  476. @example
  477. emacs -l /path/to/org.el
  478. @end example
  479. @item
  480. Go to the @code{Options} menu and select @code{Enter Debugger on Error}
  481. (XEmacs has this option in the @code{Troubleshooting} sub-menu).
  482. @item
  483. Do whatever you have to do to hit the error. Don't forget to
  484. document the steps you take.
  485. @item
  486. When you hit the error, a @file{*Backtrace*} buffer will appear on the
  487. screen. Save this buffer to a file (for example using @kbd{C-x C-w}) and
  488. attach it to your bug report.
  489. @end enumerate
  490. @node Conventions, , Feedback, Introduction
  491. @section Typesetting conventions used in this manual
  492. Org uses three types of keywords: TODO keywords, tags, and property
  493. names. In this manual we use the following conventions:
  494. @table @code
  495. @item TODO
  496. @itemx WAITING
  497. TODO keywords are written with all capitals, even if they are
  498. user-defined.
  499. @item boss
  500. @itemx ARCHIVE
  501. User-defined tags are written in lowercase; built-in tags with special
  502. meaning are written with all capitals.
  503. @item Release
  504. @itemx PRIORITY
  505. User-defined properties are capitalized; built-in properties with
  506. special meaning are written with all capitals.
  507. @end table
  508. @node Document Structure, Tables, Introduction, Top
  509. @chapter Document Structure
  510. @cindex document structure
  511. @cindex structure of document
  512. Org is based on outline mode and provides flexible commands to
  513. edit the structure of the document.
  514. @menu
  515. * Outlines:: Org is based on Outline mode
  516. * Headlines:: How to typeset Org tree headlines
  517. * Visibility cycling:: Show and hide, much simplified
  518. * Motion:: Jumping to other headlines
  519. * Structure editing:: Changing sequence and level of headlines
  520. * Archiving:: Move done task trees to a different place
  521. * Sparse trees:: Matches embedded in context
  522. * Plain lists:: Additional structure within an entry
  523. * Drawers:: Tucking stuff away
  524. * Orgstruct mode:: Structure editing outside Org
  525. @end menu
  526. @node Outlines, Headlines, Document Structure, Document Structure
  527. @section Outlines
  528. @cindex outlines
  529. @cindex Outline mode
  530. Org is implemented on top of Outline mode. Outlines allow a
  531. document to be organized in a hierarchical structure, which (at least
  532. for me) is the best representation of notes and thoughts. An overview
  533. of this structure is achieved by folding (hiding) large parts of the
  534. document to show only the general document structure and the parts
  535. currently being worked on. Org greatly simplifies the use of
  536. outlines by compressing the entire show/hide functionality into a single
  537. command @command{org-cycle}, which is bound to the @key{TAB} key.
  538. @node Headlines, Visibility cycling, Outlines, Document Structure
  539. @section Headlines
  540. @cindex headlines
  541. @cindex outline tree
  542. Headlines define the structure of an outline tree. The headlines in
  543. Org start with one or more stars, on the left margin@footnote{See
  544. the variable @code{org-special-ctrl-a/e} to configure special behavior
  545. of @kbd{C-a} and @kbd{C-e} in headlines.}. For example:
  546. @example
  547. * Top level headline
  548. ** Second level
  549. *** 3rd level
  550. some text
  551. *** 3rd level
  552. more text
  553. * Another top level headline
  554. @end example
  555. @noindent Some people find the many stars too noisy and would prefer an
  556. outline that has whitespace followed by a single star as headline
  557. starters. @ref{Clean view} describes a setup to realize this.
  558. An empty line after the end of a subtree is considered part of it and
  559. will be hidden when the subtree is folded. However, if you leave at
  560. least two empty lines, one empty line will remain visible after folding
  561. the subtree, in order to structure the collapsed view. See the
  562. variable @code{org-cycle-separator-lines} to modify this behavior.
  563. @node Visibility cycling, Motion, Headlines, Document Structure
  564. @section Visibility cycling
  565. @cindex cycling, visibility
  566. @cindex visibility cycling
  567. @cindex trees, visibility
  568. @cindex show hidden text
  569. @cindex hide text
  570. Outlines make it possible to hide parts of the text in the buffer.
  571. Org uses just two commands, bound to @key{TAB} and
  572. @kbd{S-@key{TAB}} to change the visibility in the buffer.
  573. @cindex subtree visibility states
  574. @cindex subtree cycling
  575. @cindex folded, subtree visibility state
  576. @cindex children, subtree visibility state
  577. @cindex subtree, subtree visibility state
  578. @table @kbd
  579. @kindex @key{TAB}
  580. @item @key{TAB}
  581. @emph{Subtree cycling}: Rotate current subtree among the states
  582. @example
  583. ,-> FOLDED -> CHILDREN -> SUBTREE --.
  584. '-----------------------------------'
  585. @end example
  586. The cursor must be on a headline for this to work@footnote{see, however,
  587. the option @code{org-cycle-emulate-tab}.}. When the cursor is at the
  588. beginning of the buffer and the first line is not a headline, then
  589. @key{TAB} actually runs global cycling (see below)@footnote{see the
  590. option @code{org-cycle-global-at-bob}.}. Also when called with a prefix
  591. argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
  592. @cindex global visibility states
  593. @cindex global cycling
  594. @cindex overview, global visibility state
  595. @cindex contents, global visibility state
  596. @cindex show all, global visibility state
  597. @kindex S-@key{TAB}
  598. @item S-@key{TAB}
  599. @itemx C-u @key{TAB}
  600. @emph{Global cycling}: Rotate the entire buffer among the states
  601. @example
  602. ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
  603. '--------------------------------------'
  604. @end example
  605. When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
  606. CONTENTS view up to headlines of level N will be shown. Note that inside
  607. tables, @kbd{S-@key{TAB}} jumps to the previous field.
  608. @cindex show all, command
  609. @kindex C-c C-a
  610. @item C-c C-a
  611. Show all.
  612. @kindex C-c C-r
  613. @item C-c C-r
  614. Reveal context around point, showing the current entry, the following heading
  615. and the hierarchy above. Useful for working near a location that has been
  616. exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
  617. (@pxref{Agenda commands}). With a prefix argument show, on each
  618. level, all sibling headings.
  619. @kindex C-c C-x b
  620. @item C-c C-x b
  621. Show the current subtree in an indirect buffer@footnote{The indirect
  622. buffer
  623. @ifinfo
  624. (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
  625. @end ifinfo
  626. @ifnotinfo
  627. (see the Emacs manual for more information about indirect buffers)
  628. @end ifnotinfo
  629. will contain the entire buffer, but will be narrowed to the current
  630. tree. Editing the indirect buffer will also change the original buffer,
  631. but without affecting visibility in that buffer.}. With a numeric
  632. prefix argument N, go up to level N and then take that tree. If N is
  633. negative then go up that many levels. With a @kbd{C-u} prefix, do not remove
  634. the previously used indirect buffer.
  635. @end table
  636. When Emacs first visits an Org file, the global state is set to
  637. OVERVIEW, i.e. only the top level headlines are visible. This can be
  638. configured through the variable @code{org-startup-folded}, or on a
  639. per-file basis by adding one of the following lines anywhere in the
  640. buffer:
  641. @example
  642. #+STARTUP: overview
  643. #+STARTUP: content
  644. #+STARTUP: showall
  645. @end example
  646. @noindent
  647. Forthermore, any entries with a @samp{VISIBILITY} property (@pxref{Properties
  648. and Columns}) will get their visibility adapted accordingly. Allowed values
  649. for this property are @code{folded}, @code{children}, @code{content}, and
  650. @code{all}.
  651. @table @kbd
  652. @kindex C-u C-u @key{TAB}
  653. @item C-u C-u @key{TAB}
  654. Switch back to the startup visibility of the buffer, i.e. whatever is
  655. requested by startup options and @samp{VISIBILITY} properties in individual
  656. entries.
  657. @end table
  658. @node Motion, Structure editing, Visibility cycling, Document Structure
  659. @section Motion
  660. @cindex motion, between headlines
  661. @cindex jumping, to headlines
  662. @cindex headline navigation
  663. The following commands jump to other headlines in the buffer.
  664. @table @kbd
  665. @kindex C-c C-n
  666. @item C-c C-n
  667. Next heading.
  668. @kindex C-c C-p
  669. @item C-c C-p
  670. Previous heading.
  671. @kindex C-c C-f
  672. @item C-c C-f
  673. Next heading same level.
  674. @kindex C-c C-b
  675. @item C-c C-b
  676. Previous heading same level.
  677. @kindex C-c C-u
  678. @item C-c C-u
  679. Backward to higher level heading.
  680. @kindex C-c C-j
  681. @item C-c C-j
  682. Jump to a different place without changing the current outline
  683. visibility. Shows the document structure in a temporary buffer, where
  684. you can use the following keys to find your destination:
  685. @example
  686. @key{TAB} @r{Cycle visibility.}
  687. @key{down} / @key{up} @r{Next/previous visible headline.}
  688. n / p @r{Next/previous visible headline.}
  689. f / b @r{Next/previous headline same level.}
  690. u @r{One level up.}
  691. 0-9 @r{Digit argument.}
  692. @key{RET} @r{Select this location.}
  693. @end example
  694. @end table
  695. @node Structure editing, Archiving, Motion, Document Structure
  696. @section Structure editing
  697. @cindex structure editing
  698. @cindex headline, promotion and demotion
  699. @cindex promotion, of subtrees
  700. @cindex demotion, of subtrees
  701. @cindex subtree, cut and paste
  702. @cindex pasting, of subtrees
  703. @cindex cutting, of subtrees
  704. @cindex copying, of subtrees
  705. @cindex subtrees, cut and paste
  706. @table @kbd
  707. @kindex M-@key{RET}
  708. @item M-@key{RET}
  709. Insert new heading with same level as current. If the cursor is in a
  710. plain list item, a new item is created (@pxref{Plain lists}). To force
  711. creation of a new headline, use a prefix argument, or first press @key{RET}
  712. to get to the beginning of the next line. When this command is used in
  713. the middle of a line, the line is split and the rest of the line becomes
  714. the new headline@footnote{If you do not want the line to be split,
  715. customize the variable @code{org-M-RET-may-split-line}.}. If the
  716. command is used at the beginning of a headline, the new headline is
  717. created before the current line. If at the beginning of any other line,
  718. the content of that line is made the new heading. If the command is
  719. used at the end of a folded subtree (i.e. behind the ellipses at the end
  720. of a headline), then a headline like the current one will be inserted
  721. after the end of the subtree.
  722. @kindex C-@key{RET}
  723. @item C-@key{RET}
  724. Insert a new heading after the current subtree, same level as the
  725. current headline. This command works from anywhere in the entry.
  726. @kindex M-S-@key{RET}
  727. @item M-S-@key{RET}
  728. Insert new TODO entry with same level as current heading.
  729. @kindex M-@key{left}
  730. @item M-@key{left}
  731. Promote current heading by one level.
  732. @kindex M-@key{right}
  733. @item M-@key{right}
  734. Demote current heading by one level.
  735. @kindex M-S-@key{left}
  736. @item M-S-@key{left}
  737. Promote the current subtree by one level.
  738. @kindex M-S-@key{right}
  739. @item M-S-@key{right}
  740. Demote the current subtree by one level.
  741. @kindex M-S-@key{up}
  742. @item M-S-@key{up}
  743. Move subtree up (swap with previous subtree of same
  744. level).
  745. @kindex M-S-@key{down}
  746. @item M-S-@key{down}
  747. Move subtree down (swap with next subtree of same level).
  748. @kindex C-c C-x C-w
  749. @kindex C-c C-x C-k
  750. @item C-c C-x C-w
  751. @itemx C-c C-x C-k
  752. Kill subtree, i.e. remove it from buffer but save in kill ring.
  753. With a numeric prefix argument N, kill N sequential subtrees.
  754. @kindex C-c C-x M-w
  755. @item C-c C-x M-w
  756. Copy subtree to kill ring. With a numeric prefix argument N, copy the N
  757. sequential subtrees.
  758. @kindex C-c C-x C-y
  759. @item C-c C-x C-y
  760. Yank subtree from kill ring. This does modify the level of the subtree to
  761. make sure the tree fits in nicely at the yank position. The yank level can
  762. also be specified with a numeric prefix argument, or by yanking after a
  763. headline marker like @samp{****}.
  764. @kindex C-c C-w
  765. @item C-c C-w
  766. Refile entry to a different location. @xref{Refiling notes}.
  767. @kindex C-c ^
  768. @item C-c ^
  769. Sort same-level entries. When there is an active region, all entries in the
  770. region will be sorted. Otherwise the children of the current headline are
  771. sorted. The command prompts for the sorting method, which can be
  772. alphabetically, numerically, by time (using the first time stamp in each
  773. entry), by priority, or by TODO keyword (in the sequence the keywords have
  774. been defined in the setup). Reverse sorting is possible as well. You can
  775. also supply your own function to extract the sorting key. With a @kbd{C-u}
  776. prefix, sorting will be case-sensitive. With two @kbd{C-u C-u} prefixes,
  777. duplicate entries will also be removed.
  778. @kindex C-c *
  779. @item C-c *
  780. Turn a normal line or plain list item into a headline (so that it
  781. becomes a subheading at its location). Also turn a headline into a
  782. normal line by removing the stars. If there is an active region, turn
  783. all lines in the region into headlines. Or, if the first line is a
  784. headline, remove the stars from all headlines in the region.
  785. @end table
  786. @cindex region, active
  787. @cindex active region
  788. @cindex Transient mark mode
  789. When there is an active region (Transient mark mode), promotion and
  790. demotion work on all headlines in the region. To select a region of
  791. headlines, it is best to place both point and mark at the beginning of a
  792. line, mark at the beginning of the first headline, and point at the line
  793. just after the last headline to change. Note that when the cursor is
  794. inside a table (@pxref{Tables}), the Meta-Cursor keys have different
  795. functionality.
  796. @node Archiving, Sparse trees, Structure editing, Document Structure
  797. @section Archiving
  798. @cindex archiving
  799. When a project represented by a (sub)tree is finished, you may want
  800. to move the tree out of the way and to stop it from contributing to the
  801. agenda. Org mode knows two ways of archiving. You can mark a tree with
  802. the ARCHIVE tag, or you can move an entire (sub)tree to a different
  803. location.
  804. @menu
  805. * ARCHIVE tag:: Marking a tree as inactive
  806. * Moving subtrees:: Moving a tree to an archive file
  807. @end menu
  808. @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
  809. @subsection The ARCHIVE tag
  810. @cindex internal archiving
  811. A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
  812. its location in the outline tree, but behaves in the following way:
  813. @itemize @minus
  814. @item
  815. It does not open when you attempt to do so with a visibility cycling
  816. command (@pxref{Visibility cycling}). You can force cycling archived
  817. subtrees with @kbd{C-@key{TAB}}, or by setting the option
  818. @code{org-cycle-open-archived-trees}. Also normal outline commands like
  819. @code{show-all} will open archived subtrees.
  820. @item
  821. During sparse tree construction (@pxref{Sparse trees}), matches in
  822. archived subtrees are not exposed, unless you configure the option
  823. @code{org-sparse-tree-open-archived-trees}.
  824. @item
  825. During agenda view construction (@pxref{Agenda Views}), the content of
  826. archived trees is ignored unless you configure the option
  827. @code{org-agenda-skip-archived-trees}.
  828. @item
  829. Archived trees are not exported (@pxref{Exporting}), only the headline
  830. is. Configure the details using the variable
  831. @code{org-export-with-archived-trees}.
  832. @end itemize
  833. The following commands help managing the ARCHIVE tag:
  834. @table @kbd
  835. @kindex C-c C-x a
  836. @item C-c C-x a
  837. Toggle the ARCHIVE tag for the current headline. When the tag is set,
  838. the headline changes to a shadowed face, and the subtree below it is
  839. hidden.
  840. @kindex C-u C-c C-x a
  841. @item C-u C-c C-x a
  842. Check if any direct children of the current headline should be archived.
  843. To do this, each subtree is checked for open TODO entries. If none are
  844. found, the command offers to set the ARCHIVE tag for the child. If the
  845. cursor is @emph{not} on a headline when this command is invoked, the
  846. level 1 trees will be checked.
  847. @kindex C-@kbd{TAB}
  848. @item C-@kbd{TAB}
  849. Cycle a tree even if it is tagged with ARCHIVE.
  850. @end table
  851. @node Moving subtrees, , ARCHIVE tag, Archiving
  852. @subsection Moving subtrees
  853. @cindex external archiving
  854. Once an entire project is finished, you may want to move it to a different
  855. location. Org can move it to an @emph{Attic Sibling} in the same tree, to a
  856. different tree in the current file, or to a different file, the archive file.
  857. @table @kbd
  858. @kindex C-c C-x A
  859. @item C-c C-x A
  860. Move the current entry to the @emph{Attic Sibling}. This is a sibling of the
  861. entry with the heading @samp{Attic} and the tag @samp{ARCHIVE}
  862. (@pxref{ARCHIVE tag}). The entry becomes a child of that sibling and in this
  863. way retains a lot of its original context, including inherited tags and
  864. approximate position in the outline.
  865. @kindex C-c C-x C-s
  866. @item C-c C-x C-s
  867. Archive the subtree starting at the cursor position to the location
  868. given by @code{org-archive-location}. Context information that could be
  869. lost like the file name, the category, inherited tags, and the TODO
  870. state will be store as properties in the entry.
  871. @kindex C-u C-c C-x C-s
  872. @item C-u C-c C-x C-s
  873. Check if any direct children of the current headline could be moved to
  874. the archive. To do this, each subtree is checked for open TODO entries.
  875. If none are found, the command offers to move it to the archive
  876. location. If the cursor is @emph{not} on a headline when this command
  877. is invoked, the level 1 trees will be checked.
  878. @end table
  879. @cindex archive locations
  880. The default archive location is a file in the same directory as the
  881. current file, with the name derived by appending @file{_archive} to the
  882. current file name. For information and examples on how to change this,
  883. see the documentation string of the variable
  884. @code{org-archive-location}. There is also an in-buffer option for
  885. setting this variable, for example@footnote{For backward compatibility,
  886. the following also works: If there are several such lines in a file,
  887. each specifies the archive location for the text below it. The first
  888. such line also applies to any text before its definition. However,
  889. using this method is @emph{strongly} deprecated as it is incompatible
  890. with the outline structure of the document. The correct method for
  891. setting multiple archive locations in a buffer is using a property.}:
  892. @example
  893. #+ARCHIVE: %s_done::
  894. @end example
  895. @noindent
  896. If you would like to have a special ARCHIVE location for a single entry
  897. or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
  898. location as the value (@pxref{Properties and Columns}).
  899. When a subtree is moved, it receives a number of special properties that
  900. record context information like the file from where the entry came, it's
  901. outline path the archiving time etc. Configure the variable
  902. @code{org-archive-save-context-info} to adjust the amount of information
  903. added.
  904. @node Sparse trees, Plain lists, Archiving, Document Structure
  905. @section Sparse trees
  906. @cindex sparse trees
  907. @cindex trees, sparse
  908. @cindex folding, sparse trees
  909. @cindex occur, command
  910. An important feature of Org mode is the ability to construct
  911. @emph{sparse trees} for selected information in an outline tree, so that
  912. the entire document is folded as much as possible, but the selected
  913. information is made visible along with the headline structure above
  914. it@footnote{See also the variables @code{org-show-hierarchy-above},
  915. @code{org-show-following-heading}, and @code{org-show-siblings} for
  916. detailed control on how much context is shown around each match.}. Just
  917. try it out and you will see immediately how it works.
  918. Org mode contains several commands creating such trees, all these
  919. commands can be accessed through a dispatcher:
  920. @table @kbd
  921. @kindex C-c /
  922. @item C-c /
  923. This prompts for an extra key to select a sparse-tree creating command.
  924. @kindex C-c / r
  925. @item C-c / r
  926. Occur. Prompts for a regexp and shows a sparse tree with all matches.
  927. If the match is in a headline, the headline is made visible. If the
  928. match is in the body of an entry, headline and body are made visible.
  929. In order to provide minimal context, also the full hierarchy of
  930. headlines above the match is shown, as well as the headline following
  931. the match. Each match is also highlighted; the highlights disappear
  932. when the buffer is changed by an editing command, or by pressing
  933. @kbd{C-c C-c}. When called with a @kbd{C-u} prefix argument, previous
  934. highlights are kept, so several calls to this command can be stacked.
  935. @end table
  936. @noindent
  937. For frequently used sparse trees of specific search strings, you can
  938. use the variable @code{org-agenda-custom-commands} to define fast
  939. keyboard access to specific sparse trees. These commands will then be
  940. accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
  941. For example:
  942. @lisp
  943. (setq org-agenda-custom-commands
  944. '(("f" occur-tree "FIXME")))
  945. @end lisp
  946. @noindent will define the key @kbd{C-c a f} as a shortcut for creating
  947. a sparse tree matching the string @samp{FIXME}.
  948. The other sparse tree commands select headings based on TODO keywords,
  949. tags, or properties and will be discussed later in this manual.
  950. @kindex C-c C-e v
  951. @cindex printing sparse trees
  952. @cindex visible text, printing
  953. To print a sparse tree, you can use the Emacs command
  954. @code{ps-print-buffer-with-faces} which does not print invisible parts
  955. of the document @footnote{This does not work under XEmacs, because
  956. XEmacs uses selective display for outlining, not text properties.}.
  957. Or you can use the command @kbd{C-c C-e v} to export only the visible
  958. part of the document and print the resulting file.
  959. @node Plain lists, Drawers, Sparse trees, Document Structure
  960. @section Plain lists
  961. @cindex plain lists
  962. @cindex lists, plain
  963. @cindex lists, ordered
  964. @cindex ordered lists
  965. Within an entry of the outline tree, hand-formatted lists can provide
  966. additional structure. They also provide a way to create lists of
  967. checkboxes (@pxref{Checkboxes}). Org supports editing such lists,
  968. and the HTML exporter (@pxref{Exporting}) parses and formats them.
  969. Org knows ordered lists, unordered lists, and description lists.
  970. @itemize @bullet
  971. @item
  972. @emph{Unordered} list items start with @samp{-}, @samp{+}, or
  973. @samp{*}@footnote{When using @samp{*} as a bullet, lines must be indented or
  974. they will be seen as top-level headlines. Also, when you are hiding leading
  975. stars to get a clean outline view, plain list items starting with a star are
  976. visually indistinguishable from true headlines. In short: even though
  977. @samp{*} is supported, it may be better to not use it for plain list items.}
  978. as bullets.
  979. @item
  980. @emph{Ordered} list items start with a numeral followed by either a period or
  981. a right parenthesis, such as @samp{1.} or @samp{1)}.
  982. @item
  983. @emph{Description} list items are like unordered list items, but contain the
  984. separator @samp{ :: } to separate the description @emph{term} from the
  985. desciption.
  986. @end itemize
  987. Items belonging to the same list must have the same indentation on the first
  988. line. In particular, if an ordered list reaches number @samp{10.}, then the
  989. 2--digit numbers must be written left-aligned with the other numbers in the
  990. list. Indentation also determines the end of a list item. It ends before
  991. the next line that is indented like the bullet/number, or less. Empty lines
  992. are part of the previous item, so you can have several paragraphs in one
  993. item. If you would like an empty line to terminate all currently open plain
  994. lists, configure the variable @code{org-empty-line-terminates-plain-lists}.
  995. Here is an example:
  996. @example
  997. @group
  998. ** Lord of the Rings
  999. My favorite scenes are (in this order)
  1000. 1. The attack of the Rohirrim
  1001. 2. Eowyns fight with the witch king
  1002. + this was already my favorite scene in the book
  1003. + I really like Miranda Otto.
  1004. 3. Peter Jackson being shot by Legolas
  1005. - on DVD only
  1006. He makes a really funny face when it happens.
  1007. But in the end, not individual scenes matter but the film as a whole.
  1008. Important actors in this film are:
  1009. - @b{Elijah Wood} :: He plays the Frodo
  1010. - @b{Sean Austin} :: He plays the Sam, Frodos friend. I still remember
  1011. him very well from his role as Mikey Walsh a in the Goonies.
  1012. @end group
  1013. @end example
  1014. Org supports these lists by tuning filling and wrapping commands to
  1015. deal with them correctly@footnote{Org only changes the filling
  1016. settings for Emacs. For XEmacs, you should use Kyle E. Jones'
  1017. @file{filladapt.el}. To turn this on, put into @file{.emacs}:
  1018. @code{(require 'filladapt)}}, and by exporting them properly
  1019. (@pxref{Exporting}).
  1020. The following commands act on items when the cursor is in the first line
  1021. of an item (the line with the bullet or number).
  1022. @table @kbd
  1023. @kindex @key{TAB}
  1024. @item @key{TAB}
  1025. Items can be folded just like headline levels if you set the variable
  1026. @code{org-cycle-include-plain-lists}. The level of an item is then
  1027. given by the indentation of the bullet/number. Items are always
  1028. subordinate to real headlines, however; the hierarchies remain
  1029. completely separated.
  1030. If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
  1031. fixes the indentation of the current line in a heuristic way.
  1032. @kindex M-@key{RET}
  1033. @item M-@key{RET}
  1034. Insert new item at current level. With a prefix argument, force a new
  1035. heading (@pxref{Structure editing}). If this command is used in the middle
  1036. of a line, the line is @emph{split} and the rest of the line becomes the new
  1037. item@footnote{If you do not want the line to be split, customize the variable
  1038. @code{org-M-RET-may-split-line}.}. If this command is executed in the
  1039. @emph{whitespace before a bullet or number}, the new item is created
  1040. @emph{before} the current item. If the command is executed in the white
  1041. space before the text that is part of an item but does not contain the
  1042. bullet, a bullet is added to the current line.
  1043. @kindex M-S-@key{RET}
  1044. @item M-S-@key{RET}
  1045. Insert a new item with a checkbox (@pxref{Checkboxes}).
  1046. @kindex S-@key{up}
  1047. @kindex S-@key{down}
  1048. @item S-@key{up}
  1049. @itemx S-@key{down}
  1050. Jump to the previous/next item in the current list.
  1051. @kindex M-S-@key{up}
  1052. @kindex M-S-@key{down}
  1053. @item M-S-@key{up}
  1054. @itemx M-S-@key{down}
  1055. Move the item including subitems up/down (swap with previous/next item
  1056. of same indentation). If the list is ordered, renumbering is
  1057. automatic.
  1058. @kindex M-S-@key{left}
  1059. @kindex M-S-@key{right}
  1060. @item M-S-@key{left}
  1061. @itemx M-S-@key{right}
  1062. Decrease/increase the indentation of the item, including subitems.
  1063. Initially, the item tree is selected based on current indentation.
  1064. When these commands are executed several times in direct succession,
  1065. the initially selected region is used, even if the new indentation
  1066. would imply a different hierarchy. To use the new hierarchy, break
  1067. the command chain with a cursor motion or so.
  1068. @kindex C-c C-c
  1069. @item C-c C-c
  1070. If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
  1071. state of the checkbox. If not, this command makes sure that all the
  1072. items on this list level use the same bullet. Furthermore, if this is
  1073. an ordered list, make sure the numbering is OK.
  1074. @kindex C-c -
  1075. @item C-c -
  1076. Cycle the entire list level through the different itemize/enumerate bullets
  1077. (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}). With a numeric prefix
  1078. argument N, select the Nth bullet from this list. If there is an active
  1079. region when calling this, all lines will be converted to list items. If the
  1080. first line already was a list item, any item markers will be removed from the
  1081. list. Finally, even without an active region, a normal line will be
  1082. converted into a list item.
  1083. @end table
  1084. @node Drawers, Orgstruct mode, Plain lists, Document Structure
  1085. @section Drawers
  1086. @cindex drawers
  1087. @cindex visibility cycling, drawers
  1088. Sometimes you want to keep information associated with an entry, but you
  1089. normally don't want to see it. For this, Org mode has @emph{drawers}.
  1090. Drawers need to be configured with the variable
  1091. @code{org-drawers}@footnote{You can define drawers on a per-file basis
  1092. with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}. Drawers
  1093. look like this:
  1094. @example
  1095. ** This is a headline
  1096. Still outside the drawer
  1097. :DRAWERNAME:
  1098. This is inside the drawer.
  1099. :END:
  1100. After the drawer.
  1101. @end example
  1102. Visibility cycling (@pxref{Visibility cycling}) on the headline will
  1103. hide and show the entry, but keep the drawer collapsed to a single line.
  1104. In order to look inside the drawer, you need to move the cursor to the
  1105. drawer line and press @key{TAB} there. Org mode uses a drawer for
  1106. storing properties (@pxref{Properties and Columns}), and another one for
  1107. storing clock times (@pxref{Clocking work time}).
  1108. @node Orgstruct mode, , Drawers, Document Structure
  1109. @section The Orgstruct minor mode
  1110. @cindex Orgstruct mode
  1111. @cindex minor mode for structure editing
  1112. If you like the intuitive way the Org mode structure editing and list
  1113. formatting works, you might want to use these commands in other modes
  1114. like Text mode or Mail mode as well. The minor mode Orgstruct mode
  1115. makes this possible. You can always toggle the mode with @kbd{M-x
  1116. orgstruct-mode}. To turn it on by default, for example in Mail mode,
  1117. use
  1118. @lisp
  1119. (add-hook 'mail-mode-hook 'turn-on-orgstruct)
  1120. @end lisp
  1121. When this mode is active and the cursor is on a line that looks to
  1122. Org like a headline of the first line of a list item, most
  1123. structure editing commands will work, even if the same keys normally
  1124. have different functionality in the major mode you are using. If the
  1125. cursor is not in one of those special lines, Orgstruct mode lurks
  1126. silently in the shadow.
  1127. @node Tables, Hyperlinks, Document Structure, Top
  1128. @chapter Tables
  1129. @cindex tables
  1130. @cindex editing tables
  1131. Org comes with a fast and intuitive table editor. Spreadsheet-like
  1132. calculations are supported in connection with the Emacs @file{calc}
  1133. package
  1134. @ifinfo
  1135. (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
  1136. @end ifinfo
  1137. @ifnotinfo
  1138. (see the Emacs Calculator manual for more information about the Emacs
  1139. calculator).
  1140. @end ifnotinfo
  1141. @menu
  1142. * Built-in table editor:: Simple tables
  1143. * Narrow columns:: Stop wasting space in tables
  1144. * Column groups:: Grouping to trigger vertical lines
  1145. * Orgtbl mode:: The table editor as minor mode
  1146. * The spreadsheet:: The table editor has spreadsheet capabilities
  1147. @end menu
  1148. @node Built-in table editor, Narrow columns, Tables, Tables
  1149. @section The built-in table editor
  1150. @cindex table editor, built-in
  1151. Org makes it easy to format tables in plain ASCII. Any line with
  1152. @samp{|} as the first non-whitespace character is considered part of a
  1153. table. @samp{|} is also the column separator. A table might look like
  1154. this:
  1155. @example
  1156. | Name | Phone | Age |
  1157. |-------+-------+-----|
  1158. | Peter | 1234 | 17 |
  1159. | Anna | 4321 | 25 |
  1160. @end example
  1161. A table is re-aligned automatically each time you press @key{TAB} or
  1162. @key{RET} or @kbd{C-c C-c} inside the table. @key{TAB} also moves to
  1163. the next field (@key{RET} to the next row) and creates new table rows
  1164. at the end of the table or before horizontal lines. The indentation
  1165. of the table is set by the first line. Any line starting with
  1166. @samp{|-} is considered as a horizontal separator line and will be
  1167. expanded on the next re-align to span the whole table width. So, to
  1168. create the above table, you would only type
  1169. @example
  1170. |Name|Phone|Age|
  1171. |-
  1172. @end example
  1173. @noindent and then press @key{TAB} to align the table and start filling in
  1174. fields.
  1175. When typing text into a field, Org treats @key{DEL},
  1176. @key{Backspace}, and all character keys in a special way, so that
  1177. inserting and deleting avoids shifting other fields. Also, when
  1178. typing @emph{immediately after the cursor was moved into a new field
  1179. with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
  1180. field is automatically made blank. If this behavior is too
  1181. unpredictable for you, configure the variables
  1182. @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
  1183. @table @kbd
  1184. @tsubheading{Creation and conversion}
  1185. @kindex C-c |
  1186. @item C-c |
  1187. Convert the active region to table. If every line contains at least one
  1188. TAB character, the function assumes that the material is tab separated.
  1189. If every line contains a comma, comma-separated values (CSV) are assumed.
  1190. If not, lines are split at whitespace into fields. You can use a prefix
  1191. argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
  1192. C-u} forces TAB, and a numeric argument N indicates that at least N
  1193. consecutive spaces, or alternatively a TAB will be the separator.
  1194. @*
  1195. If there is no active region, this command creates an empty Org
  1196. table. But it's easier just to start typing, like
  1197. @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
  1198. @tsubheading{Re-aligning and field motion}
  1199. @kindex C-c C-c
  1200. @item C-c C-c
  1201. Re-align the table without moving the cursor.
  1202. @c
  1203. @kindex @key{TAB}
  1204. @item @key{TAB}
  1205. Re-align the table, move to the next field. Creates a new row if
  1206. necessary.
  1207. @c
  1208. @kindex S-@key{TAB}
  1209. @item S-@key{TAB}
  1210. Re-align, move to previous field.
  1211. @c
  1212. @kindex @key{RET}
  1213. @item @key{RET}
  1214. Re-align the table and move down to next row. Creates a new row if
  1215. necessary. At the beginning or end of a line, @key{RET} still does
  1216. NEWLINE, so it can be used to split a table.
  1217. @tsubheading{Column and row editing}
  1218. @kindex M-@key{left}
  1219. @kindex M-@key{right}
  1220. @item M-@key{left}
  1221. @itemx M-@key{right}
  1222. Move the current column left/right.
  1223. @c
  1224. @kindex M-S-@key{left}
  1225. @item M-S-@key{left}
  1226. Kill the current column.
  1227. @c
  1228. @kindex M-S-@key{right}
  1229. @item M-S-@key{right}
  1230. Insert a new column to the left of the cursor position.
  1231. @c
  1232. @kindex M-@key{up}
  1233. @kindex M-@key{down}
  1234. @item M-@key{up}
  1235. @itemx M-@key{down}
  1236. Move the current row up/down.
  1237. @c
  1238. @kindex M-S-@key{up}
  1239. @item M-S-@key{up}
  1240. Kill the current row or horizontal line.
  1241. @c
  1242. @kindex M-S-@key{down}
  1243. @item M-S-@key{down}
  1244. Insert a new row above the current row. With a prefix argument, the line is
  1245. created below the current one.
  1246. @c
  1247. @kindex C-c -
  1248. @item C-c -
  1249. Insert a horizontal line below current row. With a prefix argument, the line
  1250. is created above the current line.
  1251. @c
  1252. @kindex C-c ^
  1253. @item C-c ^
  1254. Sort the table lines in the region. The position of point indicates the
  1255. column to be used for sorting, and the range of lines is the range
  1256. between the nearest horizontal separator lines, or the entire table. If
  1257. point is before the first column, you will be prompted for the sorting
  1258. column. If there is an active region, the mark specifies the first line
  1259. and the sorting column, while point should be in the last line to be
  1260. included into the sorting. The command prompts for the sorting type
  1261. (alphabetically, numerically, or by time). When called with a prefix
  1262. argument, alphabetic sorting will be case-sensitive.
  1263. @tsubheading{Regions}
  1264. @kindex C-c C-x M-w
  1265. @item C-c C-x M-w
  1266. Copy a rectangular region from a table to a special clipboard. Point
  1267. and mark determine edge fields of the rectangle. The process ignores
  1268. horizontal separator lines.
  1269. @c
  1270. @kindex C-c C-x C-w
  1271. @item C-c C-x C-w
  1272. Copy a rectangular region from a table to a special clipboard, and
  1273. blank all fields in the rectangle. So this is the ``cut'' operation.
  1274. @c
  1275. @kindex C-c C-x C-y
  1276. @item C-c C-x C-y
  1277. Paste a rectangular region into a table.
  1278. The upper right corner ends up in the current field. All involved fields
  1279. will be overwritten. If the rectangle does not fit into the present table,
  1280. the table is enlarged as needed. The process ignores horizontal separator
  1281. lines.
  1282. @c
  1283. @kindex C-c C-q
  1284. @kindex M-@key{RET}
  1285. @item C-c C-q
  1286. @itemx M-@kbd{RET}
  1287. Wrap several fields in a column like a paragraph. If there is an active
  1288. region, and both point and mark are in the same column, the text in the
  1289. column is wrapped to minimum width for the given number of lines. A numeric
  1290. prefix argument may be used to change the number of desired lines. If there
  1291. is no region, the current field is split at the cursor position and the text
  1292. fragment to the right of the cursor is prepended to the field one line
  1293. down. If there is no region, but you specify a prefix argument, the current
  1294. field is made blank, and the content is appended to the field above.
  1295. @tsubheading{Calculations}
  1296. @cindex formula, in tables
  1297. @cindex calculations, in tables
  1298. @cindex region, active
  1299. @cindex active region
  1300. @cindex Transient mark mode
  1301. @kindex C-c +
  1302. @item C-c +
  1303. Sum the numbers in the current column, or in the rectangle defined by
  1304. the active region. The result is shown in the echo area and can
  1305. be inserted with @kbd{C-y}.
  1306. @c
  1307. @kindex S-@key{RET}
  1308. @item S-@key{RET}
  1309. When current field is empty, copy from first non-empty field above.
  1310. When not empty, copy current field down to next row and move cursor
  1311. along with it. Depending on the variable
  1312. @code{org-table-copy-increment}, integer field values will be
  1313. incremented during copy. This key is also used by CUA mode
  1314. (@pxref{Cooperation}).
  1315. @tsubheading{Miscellaneous}
  1316. @kindex C-c `
  1317. @item C-c `
  1318. Edit the current field in a separate window. This is useful for fields
  1319. that are not fully visible (@pxref{Narrow columns}). When called with a
  1320. @kbd{C-u} prefix, just make the full field visible, so that it can be
  1321. edited in place.
  1322. @c
  1323. @item M-x org-table-import
  1324. Import a file as a table. The table should be TAB- or whitespace
  1325. separated. Useful, for example, to import a spreadsheet table or data
  1326. from a database, because these programs generally can write
  1327. TAB-separated text files. This command works by inserting the file into
  1328. the buffer and then converting the region to a table. Any prefix
  1329. argument is passed on to the converter, which uses it to determine the
  1330. separator.
  1331. @item C-c |
  1332. Tables can also be imported by pasting tabular text into the Org
  1333. buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
  1334. @kbd{C-c |} command (see above under @i{Creation and conversion}.
  1335. @c
  1336. @item M-x org-table-export
  1337. Export the table, by default as a TAB-separated file. Useful for data
  1338. exchange with, for example, spreadsheet or database programs. The format
  1339. used to export the file can be configured in the variable
  1340. @code{org-table-export-default-format}. You may also use properties
  1341. @code{TABLE_EXPORT_FILE} and @code{TABLE_EXPORT_FORMAT} to specify the file
  1342. name and the format for table export in a subtree. For the possible export
  1343. transformations, see @ref{Translator functions}.
  1344. @end table
  1345. If you don't like the automatic table editor because it gets in your
  1346. way on lines which you would like to start with @samp{|}, you can turn
  1347. it off with
  1348. @lisp
  1349. (setq org-enable-table-editor nil)
  1350. @end lisp
  1351. @noindent Then the only table command that still works is
  1352. @kbd{C-c C-c} to do a manual re-align.
  1353. @node Narrow columns, Column groups, Built-in table editor, Tables
  1354. @section Narrow columns
  1355. @cindex narrow columns in tables
  1356. The width of columns is automatically determined by the table editor.
  1357. Sometimes a single field or a few fields need to carry more text,
  1358. leading to inconveniently wide columns. To limit@footnote{This feature
  1359. does not work on XEmacs.} the width of a column, one field anywhere in
  1360. the column may contain just the string @samp{<N>} where @samp{N} is an
  1361. integer specifying the width of the column in characters. The next
  1362. re-align will then set the width of this column to no more than this
  1363. value.
  1364. @example
  1365. @group
  1366. |---+------------------------------| |---+--------|
  1367. | | | | | <6> |
  1368. | 1 | one | | 1 | one |
  1369. | 2 | two | ----\ | 2 | two |
  1370. | 3 | This is a long chunk of text | ----/ | 3 | This=> |
  1371. | 4 | four | | 4 | four |
  1372. |---+------------------------------| |---+--------|
  1373. @end group
  1374. @end example
  1375. @noindent
  1376. Fields that are wider become clipped and end in the string @samp{=>}.
  1377. Note that the full text is still in the buffer, it is only invisible.
  1378. To see the full text, hold the mouse over the field - a tool-tip window
  1379. will show the full content. To edit such a field, use the command
  1380. @kbd{C-c `} (that is @kbd{C-c} followed by the backquote). This will
  1381. open a new window with the full field. Edit it and finish with @kbd{C-c
  1382. C-c}.
  1383. When visiting a file containing a table with narrowed columns, the
  1384. necessary character hiding has not yet happened, and the table needs to
  1385. be aligned before it looks nice. Setting the option
  1386. @code{org-startup-align-all-tables} will realign all tables in a file
  1387. upon visiting, but also slow down startup. You can also set this option
  1388. on a per-file basis with:
  1389. @example
  1390. #+STARTUP: align
  1391. #+STARTUP: noalign
  1392. @end example
  1393. @node Column groups, Orgtbl mode, Narrow columns, Tables
  1394. @section Column groups
  1395. @cindex grouping columns in tables
  1396. When Org exports tables, it does so by default without vertical
  1397. lines because that is visually more satisfying in general. Occasionally
  1398. however, vertical lines can be useful to structure a table into groups
  1399. of columns, much like horizontal lines can do for groups of rows. In
  1400. order to specify column groups, you can use a special row where the
  1401. first field contains only @samp{/}. The further fields can either
  1402. contain @samp{<} to indicate that this column should start a group,
  1403. @samp{>} to indicate the end of a column, or @samp{<>} to make a column
  1404. a group of its own. Boundaries between column groups will upon export be
  1405. marked with vertical lines. Here is an example:
  1406. @example
  1407. | | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1408. |---+----+-----+-----+-----+---------+------------|
  1409. | / | <> | < | | > | < | > |
  1410. | # | 1 | 1 | 1 | 1 | 1 | 1 |
  1411. | # | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
  1412. | # | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
  1413. |---+----+-----+-----+-----+---------+------------|
  1414. #+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))
  1415. @end example
  1416. It is also sufficient to just insert the column group starters after
  1417. every vertical line you'd like to have:
  1418. @example
  1419. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1420. |----+-----+-----+-----+---------+------------|
  1421. | / | < | | | < | |
  1422. @end example
  1423. @node Orgtbl mode, The spreadsheet, Column groups, Tables
  1424. @section The Orgtbl minor mode
  1425. @cindex Orgtbl mode
  1426. @cindex minor mode for tables
  1427. If you like the intuitive way the Org table editor works, you
  1428. might also want to use it in other modes like Text mode or Mail mode.
  1429. The minor mode Orgtbl mode makes this possible. You can always toggle
  1430. the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
  1431. example in mail mode, use
  1432. @lisp
  1433. (add-hook 'mail-mode-hook 'turn-on-orgtbl)
  1434. @end lisp
  1435. Furthermore, with some special setup, it is possible to maintain tables
  1436. in arbitrary syntax with Orgtbl mode. For example, it is possible to
  1437. construct La@TeX{} tables with the underlying ease and power of
  1438. Orgtbl mode, including spreadsheet capabilities. For details, see
  1439. @ref{Tables in arbitrary syntax}.
  1440. @node The spreadsheet, , Orgtbl mode, Tables
  1441. @section The spreadsheet
  1442. @cindex calculations, in tables
  1443. @cindex spreadsheet capabilities
  1444. @cindex @file{calc} package
  1445. The table editor makes use of the Emacs @file{calc} package to implement
  1446. spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to
  1447. derive fields from other fields. While fully featured, Org's
  1448. implementation is not identical to other spreadsheets. For example,
  1449. Org knows the concept of a @emph{column formula} that will be
  1450. applied to all non-header fields in a column without having to copy the
  1451. formula to each relevant field.
  1452. @menu
  1453. * References:: How to refer to another field or range
  1454. * Formula syntax for Calc:: Using Calc to compute stuff
  1455. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
  1456. * Field formulas:: Formulas valid for a single field
  1457. * Column formulas:: Formulas valid for an entire column
  1458. * Editing and debugging formulas:: Fixing formulas
  1459. * Updating the table:: Recomputing all dependent fields
  1460. * Advanced features:: Field names, parameters and automatic recalc
  1461. @end menu
  1462. @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
  1463. @subsection References
  1464. @cindex references
  1465. To compute fields in the table from other fields, formulas must
  1466. reference other fields or ranges. In Org, fields can be referenced
  1467. by name, by absolute coordinates, and by relative coordinates. To find
  1468. out what the coordinates of a field are, press @kbd{C-c ?} in that
  1469. field, or press @kbd{C-c @}} to toggle the display of a grid.
  1470. @subsubheading Field references
  1471. @cindex field references
  1472. @cindex references, to fields
  1473. Formulas can reference the value of another field in two ways. Like in
  1474. any other spreadsheet, you may reference fields with a letter/number
  1475. combination like @code{B3}, meaning the 2nd field in the 3rd row.
  1476. @c Such references are always fixed to that field, they don't change
  1477. @c when you copy and paste a formula to a different field. So
  1478. @c Org's @code{B3} behaves like @code{$B$3} in other spreadsheets.
  1479. @noindent
  1480. Org also uses another, more general operator that looks like this:
  1481. @example
  1482. @@row$column
  1483. @end example
  1484. @noindent
  1485. Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
  1486. or relative to the current column like @samp{+1} or @samp{-2}.
  1487. The row specification only counts data lines and ignores horizontal
  1488. separator lines (hlines). You can use absolute row numbers
  1489. @samp{1}...@samp{N}, and row numbers relative to the current row like
  1490. @samp{+3} or @samp{-1}. Or specify the row relative to one of the
  1491. hlines: @samp{I} refers to the first hline@footnote{Note that only
  1492. hlines are counted that @emph{separate} table lines. If the table
  1493. starts with a hline above the header, it does not count.}, @samp{II} to
  1494. the second etc. @samp{-I} refers to the first such line above the
  1495. current line, @samp{+I} to the first such line below the current line.
  1496. You can also write @samp{III+2} which is the second data line after the
  1497. third hline in the table. Relative row numbers like @samp{-3} will not
  1498. cross hlines if the current line is too close to the hline. Instead,
  1499. the value directly at the hline is used.
  1500. @samp{0} refers to the current row and column. Also, if you omit
  1501. either the column or the row part of the reference, the current
  1502. row/column is implied.
  1503. Org's references with @emph{unsigned} numbers are fixed references
  1504. in the sense that if you use the same reference in the formula for two
  1505. different fields, the same field will be referenced each time.
  1506. Org's references with @emph{signed} numbers are floating
  1507. references because the same reference operator can reference different
  1508. fields depending on the field being calculated by the formula.
  1509. Here are a few examples:
  1510. @example
  1511. @@2$3 @r{2nd row, 3rd column}
  1512. C2 @r{same as previous}
  1513. $5 @r{column 5 in the current row}
  1514. E& @r{same as previous}
  1515. @@2 @r{current column, row 2}
  1516. @@-1$-3 @r{the field one row up, three columns to the left}
  1517. @@-I$2 @r{field just under hline above current row, column 2}
  1518. @end example
  1519. @subsubheading Range references
  1520. @cindex range references
  1521. @cindex references, to ranges
  1522. You may reference a rectangular range of fields by specifying two field
  1523. references connected by two dots @samp{..}. If both fields are in the
  1524. current row, you may simply use @samp{$2..$7}, but if at least one field
  1525. is in a different row, you need to use the general @code{@@row$column}
  1526. format at least for the first field (i.e the reference must start with
  1527. @samp{@@} in order to be interpreted correctly). Examples:
  1528. @example
  1529. $1..$3 @r{First three fields in the current row.}
  1530. $P..$Q @r{Range, using column names (see under Advanced)}
  1531. @@2$1..@@4$3 @r{6 fields between these two fields.}
  1532. A2..C4 @r{Same as above.}
  1533. @@-1$-2..@@-1 @r{3 numbers from the column to the left, 2 up to current row}
  1534. @end example
  1535. @noindent Range references return a vector of values that can be fed
  1536. into Calc vector functions. Empty fields in ranges are normally
  1537. suppressed, so that the vector contains only the non-empty fields (but
  1538. see the @samp{E} mode switch below). If there are no non-empty fields,
  1539. @samp{[0]} is returned to avoid syntax errors in formulas.
  1540. @subsubheading Named references
  1541. @cindex named references
  1542. @cindex references, named
  1543. @cindex name, of column or field
  1544. @cindex constants, in calculations
  1545. @samp{$name} is interpreted as the name of a column, parameter or
  1546. constant. Constants are defined globally through the variable
  1547. @code{org-table-formula-constants}, and locally (for the file) through a
  1548. line like
  1549. @example
  1550. #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
  1551. @end example
  1552. @noindent
  1553. Also properties (@pxref{Properties and Columns}) can be used as
  1554. constants in table formulas: For a property @samp{:Xyz:} use the name
  1555. @samp{$PROP_Xyz}, and the property will be searched in the current
  1556. outline entry and in the hierarchy above it. If you have the
  1557. @file{constants.el} package, it will also be used to resolve constants,
  1558. including natural constants like @samp{$h} for Planck's constant, and
  1559. units like @samp{$km} for kilometers@footnote{@file{Constant.el} can
  1560. supply the values of constants in two different unit systems, @code{SI}
  1561. and @code{cgs}. Which one is used depends on the value of the variable
  1562. @code{constants-unit-system}. You can use the @code{#+STARTUP} options
  1563. @code{constSI} and @code{constcgs} to set this value for the current
  1564. buffer.}. Column names and parameters can be specified in special table
  1565. lines. These are described below, see @ref{Advanced features}. All
  1566. names must start with a letter, and further consist of letters and
  1567. numbers.
  1568. @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
  1569. @subsection Formula syntax for Calc
  1570. @cindex formula syntax, Calc
  1571. @cindex syntax, of formulas
  1572. A formula can be any algebraic expression understood by the Emacs
  1573. @file{Calc} package. @b{Note that @file{calc} has the
  1574. non-standard convention that @samp{/} has lower precedence than
  1575. @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before
  1576. evaluation by @code{calc-eval} (@pxref{Calling Calc from
  1577. Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
  1578. Emacs Calc Manual}),
  1579. @c FIXME: The link to the Calc manual in HTML does not work.
  1580. variable substitution takes place according to the rules described above.
  1581. @cindex vectors, in table calculations
  1582. The range vectors can be directly fed into the Calc vector functions
  1583. like @samp{vmean} and @samp{vsum}.
  1584. @cindex format specifier
  1585. @cindex mode, for @file{calc}
  1586. A formula can contain an optional mode string after a semicolon. This
  1587. string consists of flags to influence Calc and other modes during
  1588. execution. By default, Org uses the standard Calc modes (precision
  1589. 12, angular units degrees, fraction and symbolic modes off. The display
  1590. format, however, has been changed to @code{(float 5)} to keep tables
  1591. compact. The default settings can be configured using the variable
  1592. @code{org-calc-default-modes}.
  1593. @example
  1594. p20 @r{switch the internal precision to 20 digits}
  1595. n3 s3 e2 f4 @r{normal, scientific, engineering, or fixed display format}
  1596. D R @r{angle modes: degrees, radians}
  1597. F S @r{fraction and symbolic modes}
  1598. N @r{interpret all fields as numbers, use 0 for non-numbers}
  1599. T @r{force text interpretation}
  1600. E @r{keep empty fields in ranges}
  1601. @end example
  1602. @noindent
  1603. In addition, you may provide a @code{printf} format specifier to
  1604. reformat the final result. A few examples:
  1605. @example
  1606. $1+$2 @r{Sum of first and second field}
  1607. $1+$2;%.2f @r{Same, format result to two decimals}
  1608. exp($2)+exp($1) @r{Math functions can be used}
  1609. $0;%.1f @r{Reformat current cell to 1 decimal}
  1610. ($3-32)*5/9 @r{Degrees F -> C conversion}
  1611. $c/$1/$cm @r{Hz -> cm conversion, using @file{constants.el}}
  1612. tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1}
  1613. sin($1);Dp3%.1e @r{Same, but use printf specifier for display}
  1614. vmean($2..$7) @r{Compute column range mean, using vector function}
  1615. vmean($2..$7);EN @r{Same, but treat empty fields as 0}
  1616. taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree}
  1617. @end example
  1618. Calc also contains a complete set of logical operations. For example
  1619. @example
  1620. if($1<20,teen,string("")) @r{``teen'' if age $1 less than 20, else empty}
  1621. @end example
  1622. @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
  1623. @subsection Emacs Lisp forms as formulas
  1624. @cindex Lisp forms, as table formulas
  1625. It is also possible to write a formula in Emacs Lisp; this can be useful
  1626. for string manipulation and control structures, if the Calc's
  1627. functionality is not enough. If a formula starts with a single quote
  1628. followed by an opening parenthesis, then it is evaluated as a lisp form.
  1629. The evaluation should return either a string or a number. Just as with
  1630. @file{calc} formulas, you can specify modes and a printf format after a
  1631. semicolon. With Emacs Lisp forms, you need to be conscious about the way
  1632. field references are interpolated into the form. By default, a
  1633. reference will be interpolated as a Lisp string (in double quotes)
  1634. containing the field. If you provide the @samp{N} mode switch, all
  1635. referenced elements will be numbers (non-number fields will be zero) and
  1636. interpolated as Lisp numbers, without quotes. If you provide the
  1637. @samp{L} flag, all fields will be interpolated literally, without quotes.
  1638. I.e., if you want a reference to be interpreted as a string by the Lisp
  1639. form, enclose the reference operator itself in double quotes, like
  1640. @code{"$3"}. Ranges are inserted as space-separated fields, so you can
  1641. embed them in list or vector syntax. A few examples, note how the
  1642. @samp{N} mode is used when we do computations in lisp.
  1643. @example
  1644. @r{Swap the first two characters of the content of column 1}
  1645. '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
  1646. @r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
  1647. '(+ $1 $2);N
  1648. @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
  1649. '(apply '+ '($1..$4));N
  1650. @end example
  1651. @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
  1652. @subsection Field formulas
  1653. @cindex field formula
  1654. @cindex formula, for individual table field
  1655. To assign a formula to a particular field, type it directly into the
  1656. field, preceded by @samp{:=}, for example @samp{:=$1+$2}. When you
  1657. press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
  1658. the field, the formula will be stored as the formula for this field,
  1659. evaluated, and the current field replaced with the result.
  1660. Formulas are stored in a special line starting with @samp{#+TBLFM:}
  1661. directly below the table. If you typed the equation in the 4th field of
  1662. the 3rd data line in the table, the formula will look like
  1663. @samp{@@3$4=$1+$2}. When inserting/deleting/swapping column and rows
  1664. with the appropriate commands, @i{absolute references} (but not relative
  1665. ones) in stored formulas are modified in order to still reference the
  1666. same field. Of cause this is not true if you edit the table structure
  1667. with normal editing commands - then you must fix the equations yourself.
  1668. Instead of typing an equation into the field, you may also use the
  1669. following command
  1670. @table @kbd
  1671. @kindex C-u C-c =
  1672. @item C-u C-c =
  1673. Install a new formula for the current field. The command prompts for a
  1674. formula, with default taken from the @samp{#+TBLFM:} line, applies
  1675. it to the current field and stores it.
  1676. @end table
  1677. @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
  1678. @subsection Column formulas
  1679. @cindex column formula
  1680. @cindex formula, for table column
  1681. Often in a table, the same formula should be used for all fields in a
  1682. particular column. Instead of having to copy the formula to all fields
  1683. in that column, Org allows to assign a single formula to an entire
  1684. column. If the table contains horizontal separator hlines, everything
  1685. before the first such line is considered part of the table @emph{header}
  1686. and will not be modified by column formulas.
  1687. To assign a formula to a column, type it directly into any field in the
  1688. column, preceded by an equal sign, like @samp{=$1+$2}. When you press
  1689. @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
  1690. field, the formula will be stored as the formula for the current column,
  1691. evaluated and the current field replaced with the result. If the field
  1692. contains only @samp{=}, the previously stored formula for this column is
  1693. used. For each column, Org will only remember the most recently
  1694. used formula. In the @samp{TBLFM:} line, column formulas will look like
  1695. @samp{$4=$1+$2}.
  1696. Instead of typing an equation into the field, you may also use the
  1697. following command:
  1698. @table @kbd
  1699. @kindex C-c =
  1700. @item C-c =
  1701. Install a new formula for the current column and replace current field with
  1702. the result of the formula. The command prompts for a formula, with default
  1703. taken from the @samp{#+TBLFM} line, applies it to the current field and
  1704. stores it. With a numeric prefix argument(e.g. @kbd{C-5 C-c =}) the command
  1705. will apply it to that many consecutive fields in the current column.
  1706. @end table
  1707. @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
  1708. @subsection Editing and debugging formulas
  1709. @cindex formula editing
  1710. @cindex editing, of table formulas
  1711. You can edit individual formulas in the minibuffer or directly in the
  1712. field. Org can also prepare a special buffer with all active
  1713. formulas of a table. When offering a formula for editing, Org
  1714. converts references to the standard format (like @code{B3} or @code{D&})
  1715. if possible. If you prefer to only work with the internal format (like
  1716. @code{@@3$2} or @code{$4}), configure the variable
  1717. @code{org-table-use-standard-references}.
  1718. @table @kbd
  1719. @kindex C-c =
  1720. @kindex C-u C-c =
  1721. @item C-c =
  1722. @itemx C-u C-c =
  1723. Edit the formula associated with the current column/field in the
  1724. minibuffer. See @ref{Column formulas} and @ref{Field formulas}.
  1725. @kindex C-u C-u C-c =
  1726. @item C-u C-u C-c =
  1727. Re-insert the active formula (either a
  1728. field formula, or a column formula) into the current field, so that you
  1729. can edit it directly in the field. The advantage over editing in the
  1730. minibuffer is that you can use the command @kbd{C-c ?}.
  1731. @kindex C-c ?
  1732. @item C-c ?
  1733. While editing a formula in a table field, highlight the field(s)
  1734. referenced by the reference at the cursor position in the formula.
  1735. @kindex C-c @}
  1736. @item C-c @}
  1737. Toggle the display of row and column numbers for a table, using
  1738. overlays. These are updated each time the table is aligned, you can
  1739. force it with @kbd{C-c C-c}.
  1740. @kindex C-c @{
  1741. @item C-c @{
  1742. Toggle the formula debugger on and off. See below.
  1743. @kindex C-c '
  1744. @item C-c '
  1745. Edit all formulas for the current table in a special buffer, where the
  1746. formulas will be displayed one per line. If the current field has an
  1747. active formula, the cursor in the formula editor will mark it.
  1748. While inside the special buffer, Org will automatically highlight
  1749. any field or range reference at the cursor position. You may edit,
  1750. remove and add formulas, and use the following commands:
  1751. @table @kbd
  1752. @kindex C-c C-c
  1753. @kindex C-x C-s
  1754. @item C-c C-c
  1755. @itemx C-x C-s
  1756. Exit the formula editor and store the modified formulas. With @kbd{C-u}
  1757. prefix, also apply the new formulas to the entire table.
  1758. @kindex C-c C-q
  1759. @item C-c C-q
  1760. Exit the formula editor without installing changes.
  1761. @kindex C-c C-r
  1762. @item C-c C-r
  1763. Toggle all references in the formula editor between standard (like
  1764. @code{B3}) and internal (like @code{@@3$2}).
  1765. @kindex @key{TAB}
  1766. @item @key{TAB}
  1767. Pretty-print or indent lisp formula at point. When in a line containing
  1768. a lisp formula, format the formula according to Emacs Lisp rules.
  1769. Another @key{TAB} collapses the formula back again. In the open
  1770. formula, @key{TAB} re-indents just like in Emacs lisp mode.
  1771. @kindex M-@key{TAB}
  1772. @item M-@key{TAB}
  1773. Complete Lisp symbols, just like in Emacs lisp mode.
  1774. @kindex S-@key{up}
  1775. @kindex S-@key{down}
  1776. @kindex S-@key{left}
  1777. @kindex S-@key{right}
  1778. @item S-@key{up}/@key{down}/@key{left}/@key{right}
  1779. Shift the reference at point. For example, if the reference is
  1780. @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
  1781. This also works for relative references, and for hline references.
  1782. @kindex M-S-@key{up}
  1783. @kindex M-S-@key{down}
  1784. @item M-S-@key{up}/@key{down}
  1785. Move the test line for column formulas in the Org buffer up and
  1786. down.
  1787. @kindex M-@key{up}
  1788. @kindex M-@key{down}
  1789. @item M-@key{up}/@key{down}
  1790. Scroll the window displaying the table.
  1791. @kindex C-c @}
  1792. @item C-c @}
  1793. Turn the coordinate grid in the table on and off.
  1794. @end table
  1795. @end table
  1796. Making a table field blank does not remove the formula associated with
  1797. the field, because that is stored in a different line (the @samp{TBLFM}
  1798. line) - during the next recalculation the field will be filled again.
  1799. To remove a formula from a field, you have to give an empty reply when
  1800. prompted for the formula, or to edit the @samp{#+TBLFM} line.
  1801. @kindex C-c C-c
  1802. You may edit the @samp{#+TBLFM} directly and re-apply the changed
  1803. equations with @kbd{C-c C-c} in that line, or with the normal
  1804. recalculation commands in the table.
  1805. @subsubheading Debugging formulas
  1806. @cindex formula debugging
  1807. @cindex debugging, of table formulas
  1808. When the evaluation of a formula leads to an error, the field content
  1809. becomes the string @samp{#ERROR}. If you would like see what is going
  1810. on during variable substitution and calculation in order to find a bug,
  1811. turn on formula debugging in the @code{Tbl} menu and repeat the
  1812. calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
  1813. field. Detailed information will be displayed.
  1814. @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
  1815. @subsection Updating the table
  1816. @cindex recomputing table fields
  1817. @cindex updating, table
  1818. Recalculation of a table is normally not automatic, but needs to be
  1819. triggered by a command. See @ref{Advanced features} for a way to make
  1820. recalculation at least semi-automatically.
  1821. In order to recalculate a line of a table or the entire table, use the
  1822. following commands:
  1823. @table @kbd
  1824. @kindex C-c *
  1825. @item C-c *
  1826. Recalculate the current row by first applying the stored column formulas
  1827. from left to right, and all field formulas in the current row.
  1828. @c
  1829. @kindex C-u C-c *
  1830. @item C-u C-c *
  1831. @kindex C-u C-c C-c
  1832. @itemx C-u C-c C-c
  1833. Recompute the entire table, line by line. Any lines before the first
  1834. hline are left alone, assuming that these are part of the table header.
  1835. @c
  1836. @kindex C-u C-u C-c *
  1837. @kindex C-u C-u C-c C-c
  1838. @item C-u C-u C-c *
  1839. @itemx C-u C-u C-c C-c
  1840. Iterate the table by recomputing it until no further changes occur.
  1841. This may be necessary if some computed fields use the value of other
  1842. fields that are computed @i{later} in the calculation sequence.
  1843. @end table
  1844. @node Advanced features, , Updating the table, The spreadsheet
  1845. @subsection Advanced features
  1846. If you want the recalculation of fields to happen automatically, or if
  1847. you want to be able to assign @i{names} to fields and columns, you need
  1848. to reserve the first column of the table for special marking characters.
  1849. @table @kbd
  1850. @kindex C-#
  1851. @item C-#
  1852. Rotate the calculation mark in first column through the states @samp{},
  1853. @samp{#}, @samp{*}, @samp{!}, @samp{$}. The meaning of these characters
  1854. is discussed below. When there is an active region, change all marks in
  1855. the region.
  1856. @end table
  1857. Here is an example of a table that collects exam results of students and
  1858. makes use of these features:
  1859. @example
  1860. @group
  1861. |---+---------+--------+--------+--------+-------+------|
  1862. | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
  1863. |---+---------+--------+--------+--------+-------+------|
  1864. | ! | | P1 | P2 | P3 | Tot | |
  1865. | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
  1866. | ^ | | m1 | m2 | m3 | mt | |
  1867. |---+---------+--------+--------+--------+-------+------|
  1868. | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
  1869. | # | Sara | 6 | 14 | 19 | 39 | 7.8 |
  1870. | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
  1871. |---+---------+--------+--------+--------+-------+------|
  1872. | | Average | | | | 29.7 | |
  1873. | ^ | | | | | at | |
  1874. | $ | max=50 | | | | | |
  1875. |---+---------+--------+--------+--------+-------+------|
  1876. #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
  1877. @end group
  1878. @end example
  1879. @noindent @b{Important}: Please note that for these special tables,
  1880. recalculating the table with @kbd{C-u C-c *} will only affect rows that
  1881. are marked @samp{#} or @samp{*}, and fields that have a formula assigned
  1882. to the field itself. The column formulas are not applied in rows with
  1883. empty first field.
  1884. @cindex marking characters, tables
  1885. The marking characters have the following meaning:
  1886. @table @samp
  1887. @item !
  1888. The fields in this line define names for the columns, so that you may
  1889. refer to a column as @samp{$Tot} instead of @samp{$6}.
  1890. @item ^
  1891. This row defines names for the fields @emph{above} the row. With such
  1892. a definition, any formula in the table may use @samp{$m1} to refer to
  1893. the value @samp{10}. Also, if you assign a formula to a names field, it
  1894. will be stored as @samp{$name=...}.
  1895. @item _
  1896. Similar to @samp{^}, but defines names for the fields in the row
  1897. @emph{below}.
  1898. @item $
  1899. Fields in this row can define @emph{parameters} for formulas. For
  1900. example, if a field in a @samp{$} row contains @samp{max=50}, then
  1901. formulas in this table can refer to the value 50 using @samp{$max}.
  1902. Parameters work exactly like constants, only that they can be defined on
  1903. a per-table basis.
  1904. @item #
  1905. Fields in this row are automatically recalculated when pressing
  1906. @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row. Also, this row
  1907. is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked
  1908. lines will be left alone by this command.
  1909. @item *
  1910. Selects this line for global recalculation with @kbd{C-u C-c *}, but
  1911. not for automatic recalculation. Use this when automatic
  1912. recalculation slows down editing too much.
  1913. @item
  1914. Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
  1915. All lines that should be recalculated should be marked with @samp{#}
  1916. or @samp{*}.
  1917. @item /
  1918. Do not export this line. Useful for lines that contain the narrowing
  1919. @samp{<N>} markers.
  1920. @end table
  1921. Finally, just to whet your appetite on what can be done with the
  1922. fantastic @file{calc} package, here is a table that computes the Taylor
  1923. series of degree @code{n} at location @code{x} for a couple of
  1924. functions.
  1925. @example
  1926. @group
  1927. |---+-------------+---+-----+--------------------------------------|
  1928. | | Func | n | x | Result |
  1929. |---+-------------+---+-----+--------------------------------------|
  1930. | # | exp(x) | 1 | x | 1 + x |
  1931. | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
  1932. | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
  1933. | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
  1934. | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
  1935. | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
  1936. |---+-------------+---+-----+--------------------------------------|
  1937. #+TBLFM: $5=taylor($2,$4,$3);n3
  1938. @end group
  1939. @end example
  1940. @node Hyperlinks, TODO Items, Tables, Top
  1941. @chapter Hyperlinks
  1942. @cindex hyperlinks
  1943. Like HTML, Org provides links inside a file, external links to
  1944. other files, Usenet articles, emails, and much more.
  1945. @menu
  1946. * Link format:: How links in Org are formatted
  1947. * Internal links:: Links to other places in the current file
  1948. * External links:: URL-like links to the world
  1949. * Handling links:: Creating, inserting and following
  1950. * Using links outside Org:: Linking from my C source code?
  1951. * Link abbreviations:: Shortcuts for writing complex links
  1952. * Search options:: Linking to a specific location
  1953. * Custom searches:: When the default search is not enough
  1954. @end menu
  1955. @node Link format, Internal links, Hyperlinks, Hyperlinks
  1956. @section Link format
  1957. @cindex link format
  1958. @cindex format, of links
  1959. Org will recognize plain URL-like links and activate them as
  1960. clickable links. The general link format, however, looks like this:
  1961. @example
  1962. [[link][description]] @r{or alternatively} [[link]]
  1963. @end example
  1964. Once a link in the buffer is complete (all brackets present), Org
  1965. will change the display so that @samp{description} is displayed instead
  1966. of @samp{[[link][description]]} and @samp{link} is displayed instead of
  1967. @samp{[[link]]}. Links will be highlighted in the face @code{org-link},
  1968. which by default is an underlined face. You can directly edit the
  1969. visible part of a link. Note that this can be either the @samp{link}
  1970. part (if there is no description) or the @samp{description} part. To
  1971. edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
  1972. cursor on the link.
  1973. If you place the cursor at the beginning or just behind the end of the
  1974. displayed text and press @key{BACKSPACE}, you will remove the
  1975. (invisible) bracket at that location. This makes the link incomplete
  1976. and the internals are again displayed as plain text. Inserting the
  1977. missing bracket hides the link internals again. To show the
  1978. internal structure of all links, use the menu entry
  1979. @code{Org->Hyperlinks->Literal links}.
  1980. @node Internal links, External links, Link format, Hyperlinks
  1981. @section Internal links
  1982. @cindex internal links
  1983. @cindex links, internal
  1984. @cindex targets, for links
  1985. If the link does not look like a URL, it is considered to be internal in
  1986. the current file. Links such as @samp{[[My Target]]} or @samp{[[My
  1987. Target][Find my target]]} lead to a text search in the current file.
  1988. The link can be followed with @kbd{C-c C-o} when the cursor is on the
  1989. link, or with a mouse click (@pxref{Handling links}). The preferred
  1990. match for such a link is a dedicated target: the same string in double
  1991. angular brackets. Targets may be located anywhere; sometimes it is
  1992. convenient to put them into a comment line. For example
  1993. @example
  1994. # <<My Target>>
  1995. @end example
  1996. @noindent In HTML export (@pxref{HTML export}), such targets will become
  1997. named anchors for direct access through @samp{http} links@footnote{Note
  1998. that text before the first headline is usually not exported, so the
  1999. first such target should be after the first headline.}.
  2000. If no dedicated target exists, Org will search for the words in the
  2001. link. In the above example the search would be for @samp{my target}.
  2002. Links starting with a star like @samp{*My Target} restrict the search to
  2003. headlines. When searching, Org mode will first try an exact match, but
  2004. then move on to more and more lenient searches. For example, the link
  2005. @samp{[[*My Targets]]} will find any of the following:
  2006. @example
  2007. ** My targets
  2008. ** TODO my targets are bright
  2009. ** my 20 targets are
  2010. @end example
  2011. To insert a link targeting a headline, in-buffer completion can be used.
  2012. Just type a star followed by a few optional letters into the buffer and
  2013. press @kbd{M-@key{TAB}}. All headlines in the current buffer will be
  2014. offered as completions. @xref{Handling links}, for more commands
  2015. creating links.
  2016. Following a link pushes a mark onto Org's own mark ring. You can
  2017. return to the previous position with @kbd{C-c &}. Using this command
  2018. several times in direct succession goes back to positions recorded
  2019. earlier.
  2020. @menu
  2021. * Radio targets:: Make targets trigger links in plain text
  2022. @end menu
  2023. @node Radio targets, , Internal links, Internal links
  2024. @subsection Radio targets
  2025. @cindex radio targets
  2026. @cindex targets, radio
  2027. @cindex links, radio targets
  2028. Org can automatically turn any occurrences of certain target names
  2029. in normal text into a link. So without explicitly creating a link, the
  2030. text connects to the target radioing its position. Radio targets are
  2031. enclosed by triple angular brackets. For example, a target @samp{<<<My
  2032. Target>>>} causes each occurrence of @samp{my target} in normal text to
  2033. become activated as a link. The Org file is scanned automatically
  2034. for radio targets only when the file is first loaded into Emacs. To
  2035. update the target list during editing, press @kbd{C-c C-c} with the
  2036. cursor on or at a target.
  2037. @node External links, Handling links, Internal links, Hyperlinks
  2038. @section External links
  2039. @cindex links, external
  2040. @cindex external links
  2041. @cindex links, external
  2042. @cindex Gnus links
  2043. @cindex BBDB links
  2044. @cindex IRC links
  2045. @cindex URL links
  2046. @cindex file links
  2047. @cindex VM links
  2048. @cindex RMAIL links
  2049. @cindex WANDERLUST links
  2050. @cindex MH-E links
  2051. @cindex USENET links
  2052. @cindex SHELL links
  2053. @cindex Info links
  2054. @cindex elisp links
  2055. Org supports links to files, websites, Usenet and email messages,
  2056. BBDB database entries and links to both IRC conversations and their
  2057. logs. External links are URL-like locators. They start with a short
  2058. identifying string followed by a colon. There can be no space after
  2059. the colon. The following list shows examples for each link type.
  2060. @example
  2061. http://www.astro.uva.nl/~dominik @r{on the web}
  2062. file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
  2063. file:papers/last.pdf @r{file, relative path}
  2064. news:comp.emacs @r{Usenet link}
  2065. mailto:adent@@galaxy.net @r{Mail link}
  2066. vm:folder @r{VM folder link}
  2067. vm:folder#id @r{VM message link}
  2068. vm://myself@@some.where.org/folder#id @r{VM on remote machine}
  2069. wl:folder @r{WANDERLUST folder link}
  2070. wl:folder#id @r{WANDERLUST message link}
  2071. mhe:folder @r{MH-E folder link}
  2072. mhe:folder#id @r{MH-E message link}
  2073. rmail:folder @r{RMAIL folder link}
  2074. rmail:folder#id @r{RMAIL message link}
  2075. gnus:group @r{Gnus group link}
  2076. gnus:group#id @r{Gnus article link}
  2077. bbdb:Richard Stallman @r{BBDB link}
  2078. irc:/irc.com/#emacs/bob @r{IRC link}
  2079. shell:ls *.org @r{A shell command}
  2080. elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
  2081. @end example
  2082. A link should be enclosed in double brackets and may contain a
  2083. descriptive text to be displayed instead of the URL (@pxref{Link
  2084. format}), for example:
  2085. @example
  2086. [[http://www.gnu.org/software/emacs/][GNU Emacs]]
  2087. @end example
  2088. @noindent
  2089. If the description is a file name or URL that points to an image, HTML
  2090. export (@pxref{HTML export}) will inline the image as a clickable
  2091. button. If there is no description at all and the link points to an
  2092. image,
  2093. that image will be inlined into the exported HTML file.
  2094. @cindex angular brackets, around links
  2095. @cindex plain text external links
  2096. Org also finds external links in the normal text and activates them
  2097. as links. If spaces must be part of the link (for example in
  2098. @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
  2099. about the end of the link, enclose them in angular brackets.
  2100. @node Handling links, Using links outside Org, External links, Hyperlinks
  2101. @section Handling links
  2102. @cindex links, handling
  2103. Org provides methods to create a link in the correct syntax, to
  2104. insert it into an Org file, and to follow the link.
  2105. @table @kbd
  2106. @kindex C-c l
  2107. @cindex storing links
  2108. @item C-c l
  2109. Store a link to the current location. This is a @emph{global} command
  2110. which can be used in any buffer to create a link. The link will be
  2111. stored for later insertion into an Org buffer (see below). For
  2112. Org files, if there is a @samp{<<target>>} at the cursor, the
  2113. link points to the target. Otherwise it points to the current
  2114. headline. For VM, Rmail, Wanderlust, MH-E, Gnus and BBDB buffers, the
  2115. link will indicate the current article/entry. For W3 and W3M buffers,
  2116. the link goes to the current URL. For IRC links, if you set the
  2117. variable @code{org-irc-link-to-logs} to non-nil then @kbd{C-c l} will
  2118. store a @samp{file:/} style link to the relevant point in the logs for
  2119. the current conversation. Otherwise an @samp{irc:/} style link to the
  2120. user/channel/server under the point will be stored. For any other
  2121. files, the link will point to the file, with a search string
  2122. (@pxref{Search options}) pointing to the contents of the current line.
  2123. If there is an active region, the selected words will form the basis
  2124. of the search string. If the automatically created link is not
  2125. working correctly or accurately enough, you can write custom functions
  2126. to select the search string and to do the search for particular file
  2127. types - see @ref{Custom searches}. The key binding @kbd{C-c l} is
  2128. only a suggestion - see @ref{Installation}.
  2129. @c
  2130. @kindex C-c C-l
  2131. @cindex link completion
  2132. @cindex completion, of links
  2133. @cindex inserting links
  2134. @item C-c C-l
  2135. Insert a link. This prompts for a link to be inserted into the buffer. You
  2136. can just type a link, using text for an internal link, or one of the link
  2137. type prefixes mentioned in the examples above. All links stored during the
  2138. current session are part of the history for this prompt, so you can access
  2139. them with @key{up} and @key{down} (or @kbd{M-p/n}). Completion, on the other
  2140. hand, will help you to insert valid link prefixes like @samp{http:} or
  2141. @samp{ftp:}, including the prefixes defined through link abbreviations
  2142. (@pxref{Link abbreviations}). The link will be inserted into the
  2143. buffer@footnote{After insertion of a stored link, the link will be removed
  2144. from the list of stored links. To keep it in the list later use, use a
  2145. triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or configure the option
  2146. @code{org-keep-stored-link-after-insertion}.}, along with a descriptive text.
  2147. If some text was selected when this command is called, the selected text
  2148. becomes the default description.@* Note that you don't have to use this
  2149. command to insert a link. Links in Org are plain text, and you can type
  2150. or paste them straight into the buffer. By using this command, the links are
  2151. automatically enclosed in double brackets, and you will be asked for the
  2152. optional descriptive text.
  2153. @c
  2154. @c If the link is a @samp{file:} link and
  2155. @c the linked file is located in the same directory as the current file or
  2156. @c a subdirectory of it, the path of the file will be inserted relative to
  2157. @c the current directory.
  2158. @c
  2159. @kindex C-u C-c C-l
  2160. @cindex file name completion
  2161. @cindex completion, of file names
  2162. @item C-u C-c C-l
  2163. When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
  2164. a file will be inserted and you may use file name completion to select
  2165. the name of the file. The path to the file is inserted relative to the
  2166. directory of the current org file, if the linked file is in the current
  2167. directory or in a sub-directory of it, or if the path is written relative
  2168. to the current directory using @samp{../}. Otherwise an absolute path
  2169. is used, if possible with @samp{~/} for your home directory. You can
  2170. force an absolute path with two @kbd{C-u} prefixes.
  2171. @c
  2172. @item C-c C-l @r{(with cursor on existing link)}
  2173. When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
  2174. link and description parts of the link.
  2175. @c
  2176. @cindex following links
  2177. @kindex C-c C-o
  2178. @item C-c C-o
  2179. Open link at point. This will launch a web browser for URLs (using
  2180. @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
  2181. for the corresponding links, and execute the command in a shell link.
  2182. When the cursor is on an internal link, this commands runs the
  2183. corresponding search. When the cursor is on a TAG list in a headline,
  2184. it creates the corresponding TAGS view. If the cursor is on a time
  2185. stamp, it compiles the agenda for that date. Furthermore, it will visit
  2186. text and remote files in @samp{file:} links with Emacs and select a
  2187. suitable application for local non-text files. Classification of files
  2188. is based on file extension only. See option @code{org-file-apps}. If
  2189. you want to override the default application and visit the file with
  2190. Emacs, use a @kbd{C-u} prefix.
  2191. @c
  2192. @kindex mouse-2
  2193. @kindex mouse-1
  2194. @item mouse-2
  2195. @itemx mouse-1
  2196. On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
  2197. would. Under Emacs 22, also @kbd{mouse-1} will follow a link.
  2198. @c
  2199. @kindex mouse-3
  2200. @item mouse-3
  2201. Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
  2202. internal links to be displayed in another window@footnote{See the
  2203. variable @code{org-display-internal-link-with-indirect-buffer}}.
  2204. @c
  2205. @cindex mark ring
  2206. @kindex C-c %
  2207. @item C-c %
  2208. Push the current position onto the mark ring, to be able to return
  2209. easily. Commands following an internal link do this automatically.
  2210. @c
  2211. @cindex links, returning to
  2212. @kindex C-c &
  2213. @item C-c &
  2214. Jump back to a recorded position. A position is recorded by the
  2215. commands following internal links, and by @kbd{C-c %}. Using this
  2216. command several times in direct succession moves through a ring of
  2217. previously recorded positions.
  2218. @c
  2219. @kindex C-c C-x C-n
  2220. @kindex C-c C-x C-p
  2221. @cindex links, finding next/previous
  2222. @item C-c C-x C-n
  2223. @itemx C-c C-x C-p
  2224. Move forward/backward to the next link in the buffer. At the limit of
  2225. the buffer, the search fails once, and then wraps around. The key
  2226. bindings for this are really too long, you might want to bind this also
  2227. to @kbd{C-n} and @kbd{C-p}
  2228. @lisp
  2229. (add-hook 'org-load-hook
  2230. (lambda ()
  2231. (define-key 'org-mode-map "\C-n" 'org-next-link)
  2232. (define-key 'org-mode-map "\C-p" 'org-previous-link)))
  2233. @end lisp
  2234. @end table
  2235. @node Using links outside Org, Link abbreviations, Handling links, Hyperlinks
  2236. @section Using links outside Org
  2237. You can insert and follow links that have Org syntax not only in
  2238. Org, but in any Emacs buffer. For this, you should create two
  2239. global commands, like this (please select suitable global keys
  2240. yourself):
  2241. @lisp
  2242. (global-set-key "\C-c L" 'org-insert-link-global)
  2243. (global-set-key "\C-c o" 'org-open-at-point-global)
  2244. @end lisp
  2245. @node Link abbreviations, Search options, Using links outside Org, Hyperlinks
  2246. @section Link abbreviations
  2247. @cindex link abbreviations
  2248. @cindex abbreviation, links
  2249. Long URLs can be cumbersome to type, and often many similar links are
  2250. needed in a document. For this you can use link abbreviations. An
  2251. abbreviated link looks like this
  2252. @example
  2253. [[linkword:tag][description]]
  2254. @end example
  2255. @noindent
  2256. where the tag is optional. Such abbreviations are resolved according to
  2257. the information in the variable @code{org-link-abbrev-alist} that
  2258. relates the linkwords to replacement text. Here is an example:
  2259. @lisp
  2260. @group
  2261. (setq org-link-abbrev-alist
  2262. '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
  2263. ("google" . "http://www.google.com/search?q=")
  2264. ("ads" . "http://adsabs.harvard.edu/cgi-bin/
  2265. nph-abs_connect?author=%s&db_key=AST")))
  2266. @end group
  2267. @end lisp
  2268. If the replacement text contains the string @samp{%s}, it will be
  2269. replaced with the tag. Otherwise the tag will be appended to the string
  2270. in order to create the link. You may also specify a function that will
  2271. be called with the tag as the only argument to create the link.
  2272. With the above setting, you could link to a specific bug with
  2273. @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
  2274. @code{[[google:OrgMode]]} and find out what the Org author is
  2275. doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
  2276. If you need special abbreviations just for a single Org buffer, you
  2277. can define them in the file with
  2278. @example
  2279. #+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
  2280. #+LINK: google http://www.google.com/search?q=%s
  2281. @end example
  2282. @noindent
  2283. In-buffer completion @pxref{Completion} can be used after @samp{[} to
  2284. complete link abbreviations.
  2285. @node Search options, Custom searches, Link abbreviations, Hyperlinks
  2286. @section Search options in file links
  2287. @cindex search option in file links
  2288. @cindex file links, searching
  2289. File links can contain additional information to make Emacs jump to a
  2290. particular location in the file when following a link. This can be a
  2291. line number or a search option after a double@footnote{For backward
  2292. compatibility, line numbers can also follow a single colon.} colon. For
  2293. example, when the command @kbd{C-c l} creates a link (@pxref{Handling
  2294. links}) to a file, it encodes the words in the current line as a search
  2295. string that can be used to find this line back later when following the
  2296. link with @kbd{C-c C-o}.
  2297. Here is the syntax of the different ways to attach a search to a file
  2298. link, together with an explanation:
  2299. @example
  2300. [[file:~/code/main.c::255]]
  2301. [[file:~/xx.org::My Target]]
  2302. [[file:~/xx.org::*My Target]]
  2303. [[file:~/xx.org::/regexp/]]
  2304. @end example
  2305. @table @code
  2306. @item 255
  2307. Jump to line 255.
  2308. @item My Target
  2309. Search for a link target @samp{<<My Target>>}, or do a text search for
  2310. @samp{my target}, similar to the search in internal links, see
  2311. @ref{Internal links}. In HTML export (@pxref{HTML export}), such a file
  2312. link will become an HTML reference to the corresponding named anchor in
  2313. the linked file.
  2314. @item *My Target
  2315. In an Org file, restrict search to headlines.
  2316. @item /regexp/
  2317. Do a regular expression search for @code{regexp}. This uses the Emacs
  2318. command @code{occur} to list all matches in a separate window. If the
  2319. target file is in Org mode, @code{org-occur} is used to create a
  2320. sparse tree with the matches.
  2321. @c If the target file is a directory,
  2322. @c @code{grep} will be used to search all files in the directory.
  2323. @end table
  2324. As a degenerate case, a file link with an empty file name can be used
  2325. to search the current file. For example, @code{[[file:::find me]]} does
  2326. a search for @samp{find me} in the current file, just as
  2327. @samp{[[find me]]} would.
  2328. @node Custom searches, , Search options, Hyperlinks
  2329. @section Custom Searches
  2330. @cindex custom search strings
  2331. @cindex search strings, custom
  2332. The default mechanism for creating search strings and for doing the
  2333. actual search related to a file link may not work correctly in all
  2334. cases. For example, BibTeX database files have many entries like
  2335. @samp{year="1993"} which would not result in good search strings,
  2336. because the only unique identification for a BibTeX entry is the
  2337. citation key.
  2338. If you come across such a problem, you can write custom functions to set
  2339. the right search string for a particular file type, and to do the search
  2340. for the string in the file. Using @code{add-hook}, these functions need
  2341. to be added to the hook variables
  2342. @code{org-create-file-search-functions} and
  2343. @code{org-execute-file-search-functions}. See the docstring for these
  2344. variables for more information. Org actually uses this mechanism
  2345. for Bib@TeX{} database files, and you can use the corresponding code as
  2346. an implementation example. Search for @samp{BibTeX links} in the source
  2347. file.
  2348. @node TODO Items, Tags, Hyperlinks, Top
  2349. @chapter TODO Items
  2350. @cindex TODO items
  2351. Org mode does not maintain TODO lists as separate documents. Instead,
  2352. TODO items are an integral part of the notes file, because TODO items
  2353. usually come up while taking notes! With Org mode, simply mark any
  2354. entry in a tree as being a TODO item. In this way, information is not
  2355. duplicated, and the entire context from which the TODO item emerged is
  2356. always present.
  2357. Of course, this technique for managing TODO items scatters them
  2358. throughout your notes file. Org mode compensates for this by providing
  2359. methods to give you an overview of all the things that you have to do.
  2360. @menu
  2361. * TODO basics:: Marking and displaying TODO entries
  2362. * TODO extensions:: Workflow and assignments
  2363. * Progress logging:: Dates and notes for progress
  2364. * Priorities:: Some things are more important than others
  2365. * Breaking down tasks:: Splitting a task into manageable pieces
  2366. * Checkboxes:: Tick-off lists
  2367. @end menu
  2368. @node TODO basics, TODO extensions, TODO Items, TODO Items
  2369. @section Basic TODO functionality
  2370. Any headline becomes a TODO item when it starts with the word
  2371. @samp{TODO}, for example:
  2372. @example
  2373. *** TODO Write letter to Sam Fortune
  2374. @end example
  2375. @noindent
  2376. The most important commands to work with TODO entries are:
  2377. @table @kbd
  2378. @kindex C-c C-t
  2379. @cindex cycling, of TODO states
  2380. @item C-c C-t
  2381. Rotate the TODO state of the current item among
  2382. @example
  2383. ,-> (unmarked) -> TODO -> DONE --.
  2384. '--------------------------------'
  2385. @end example
  2386. The same rotation can also be done ``remotely'' from the timeline and
  2387. agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
  2388. @kindex C-u C-c C-t
  2389. @item C-u C-c C-t
  2390. Select a specific keyword using completion or (if it has been set up)
  2391. the fast selection interface. For the latter, you need to assign keys
  2392. to TODO states, see @ref{Per-file keywords} and @ref{Setting tags} for
  2393. more information.
  2394. @kindex S-@key{right}
  2395. @kindex S-@key{left}
  2396. @item S-@key{right}
  2397. @itemx S-@key{left}
  2398. Select the following/preceding TODO state, similar to cycling. Useful
  2399. mostly if more than two TODO states are possible (@pxref{TODO
  2400. extensions}).
  2401. @kindex C-c C-v
  2402. @kindex C-c / t
  2403. @cindex sparse tree, for TODO
  2404. @item C-c C-v
  2405. @itemx C-c / t
  2406. View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds
  2407. the entire buffer, but shows all TODO items and the headings hierarchy
  2408. above them. With a prefix argument, search for a specific TODO. You will be
  2409. prompted for the keyword, and you can also give a list of keywords like
  2410. @code{KWD1|KWD2|...}. With numeric prefix argument N, show the tree for the
  2411. Nth keyword in the variable @code{org-todo-keywords}. With two prefix
  2412. arguments, find all TODO and DONE entries.
  2413. @kindex C-c a t
  2414. @item C-c a t
  2415. Show the global TODO list. Collects the TODO items from all agenda
  2416. files (@pxref{Agenda Views}) into a single buffer. The new buffer will
  2417. be in @code{agenda-mode}, which provides commands to examine and
  2418. manipulate the TODO entries from the new buffer (@pxref{Agenda
  2419. commands}). @xref{Global TODO list}, for more information.
  2420. @kindex S-M-@key{RET}
  2421. @item S-M-@key{RET}
  2422. Insert a new TODO entry below the current one.
  2423. @end table
  2424. @node TODO extensions, Progress logging, TODO basics, TODO Items
  2425. @section Extended use of TODO keywords
  2426. @cindex extended TODO keywords
  2427. By default, marked TODO entries have one of only two states: TODO and
  2428. DONE. Org mode allows you to classify TODO items in more complex ways
  2429. with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With
  2430. special setup, the TODO keyword system can work differently in different
  2431. files.
  2432. Note that @i{tags} are another way to classify headlines in general and
  2433. TODO items in particular (@pxref{Tags}).
  2434. @menu
  2435. * Workflow states:: From TODO to DONE in steps
  2436. * TODO types:: I do this, Fred does the rest
  2437. * Multiple sets in one file:: Mixing it all, and still finding your way
  2438. * Fast access to TODO states:: Single letter selection of a state
  2439. * Per-file keywords:: Different files, different requirements
  2440. * Faces for TODO keywords:: Highlighting states
  2441. @end menu
  2442. @node Workflow states, TODO types, TODO extensions, TODO extensions
  2443. @subsection TODO keywords as workflow states
  2444. @cindex TODO workflow
  2445. @cindex workflow states as TODO keywords
  2446. You can use TODO keywords to indicate different @emph{sequential} states
  2447. in the process of working on an item, for example@footnote{Changing
  2448. this variable only becomes effective after restarting Org mode in a
  2449. buffer.}:
  2450. @lisp
  2451. (setq org-todo-keywords
  2452. '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
  2453. @end lisp
  2454. The vertical bar separates the TODO keywords (states that @emph{need
  2455. action}) from the DONE states (which need @emph{no further action}. If
  2456. you don't provide the separator bar, the last state is used as the DONE
  2457. state.
  2458. @cindex completion, of TODO keywords
  2459. With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
  2460. to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. You may
  2461. also use a numeric prefix argument to quickly select a specific state. For
  2462. example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
  2463. Or you can use @kbd{S-left} to go backward through the sequence. If you
  2464. define many keywords, you can use in-buffer completion
  2465. (@pxref{Completion}) or even a special one-key selection scheme
  2466. (@pxref{Fast access to TODO states}) to insert these words into the
  2467. buffer. Changing a TODO state can be logged with a timestamp, see
  2468. @ref{Tracking TODO state changes} for more information.
  2469. @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
  2470. @subsection TODO keywords as types
  2471. @cindex TODO types
  2472. @cindex names as TODO keywords
  2473. @cindex types as TODO keywords
  2474. The second possibility is to use TODO keywords to indicate different
  2475. @emph{types} of action items. For example, you might want to indicate
  2476. that items are for ``work'' or ``home''. Or, when you work with several
  2477. people on a single project, you might want to assign action items
  2478. directly to persons, by using their names as TODO keywords. This would
  2479. be set up like this:
  2480. @lisp
  2481. (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
  2482. @end lisp
  2483. In this case, different keywords do not indicate a sequence, but rather
  2484. different types. So the normal work flow would be to assign a task to a
  2485. person, and later to mark it DONE. Org mode supports this style by adapting
  2486. the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
  2487. @kbd{t} command in the timeline and agenda buffers.}. When used several
  2488. times in succession, it will still cycle through all names, in order to first
  2489. select the right type for a task. But when you return to the item after some
  2490. time and execute @kbd{C-c C-t} again, it will switch from any name directly
  2491. to DONE. Use prefix arguments or completion to quickly select a specific
  2492. name. You can also review the items of a specific TODO type in a sparse tree
  2493. by using a numeric prefix to @kbd{C-c C-v}. For example, to see all things
  2494. Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect Lucy's items
  2495. from all agenda files into a single buffer, you would use the numeric prefix
  2496. argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
  2497. @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
  2498. @subsection Multiple keyword sets in one file
  2499. @cindex TODO keyword sets
  2500. Sometimes you may want to use different sets of TODO keywords in
  2501. parallel. For example, you may want to have the basic
  2502. @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
  2503. separate state indicating that an item has been canceled (so it is not
  2504. DONE, but also does not require action). Your setup would then look
  2505. like this:
  2506. @lisp
  2507. (setq org-todo-keywords
  2508. '((sequence "TODO" "|" "DONE")
  2509. (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
  2510. (sequence "|" "CANCELED")))
  2511. @end lisp
  2512. The keywords should all be different, this helps Org mode to keep track
  2513. of which subsequence should be used for a given entry. In this setup,
  2514. @kbd{C-c C-t} only operates within a subsequence, so it switches from
  2515. @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
  2516. (nothing) to @code{REPORT}. Therefore you need a mechanism to initially
  2517. select the correct sequence. Besides the obvious ways like typing a
  2518. keyword or using completion, you may also apply the following commands:
  2519. @table @kbd
  2520. @kindex C-S-@key{right}
  2521. @kindex C-S-@key{left}
  2522. @item C-S-@key{right}
  2523. @itemx C-S-@key{left}
  2524. These keys jump from one TODO subset to the next. In the above example,
  2525. @kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
  2526. @code{REPORT}, and any of the words in the second row to @code{CANCELED}.
  2527. @kindex S-@key{right}
  2528. @kindex S-@key{left}
  2529. @item S-@key{right}
  2530. @itemx S-@key{left}
  2531. @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
  2532. @emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
  2533. would switch from @code{DONE} to @code{REPORT} in the example above.
  2534. @end table
  2535. @node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
  2536. @subsection Fast access to TODO states
  2537. If you would like to quickly change an entry to an arbitrary TODO state
  2538. instead of cycling through the states, you can set up keys for
  2539. single-letter access to the states. This is done by adding the section
  2540. key after each keyword, in parenthesis. For example:
  2541. @lisp
  2542. (setq org-todo-keywords
  2543. '((sequence "TODO(t)" "|" "DONE(d)")
  2544. (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
  2545. (sequence "|" "CANCELED(c)")))
  2546. @end lisp
  2547. If you then press @code{C-u C-c C-t} followed by the selection key, the
  2548. entry will be switched to this state. @key{SPC} can be used to remove
  2549. any TODO keyword from an entry. Should you like this way of selecting
  2550. TODO states a lot, you might want to set the variable
  2551. @code{org-use-fast-todo-selection} to @code{t} and make this behavior
  2552. the default. Check also the variable
  2553. @code{org-fast-tag-selection-include-todo}, it allows to change the TODO
  2554. state through the tags interface (@pxref{Setting tags}), in case you
  2555. like to mingle the two concepts.
  2556. @node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
  2557. @subsection Setting up keywords for individual files
  2558. @cindex keyword options
  2559. @cindex per-file keywords
  2560. It can be very useful to use different aspects of the TODO mechanism in
  2561. different files. For file-local settings, you need to add special lines
  2562. to the file which set the keywords and interpretation for that file
  2563. only. For example, to set one of the two examples discussed above, you
  2564. need one of the following lines, starting in column zero anywhere in the
  2565. file:
  2566. @example
  2567. #+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
  2568. @end example
  2569. or
  2570. @example
  2571. #+TYP_TODO: Fred Sara Lucy Mike | DONE
  2572. @end example
  2573. A setup for using several sets in parallel would be:
  2574. @example
  2575. #+SEQ_TODO: TODO | DONE
  2576. #+SEQ_TODO: REPORT BUG KNOWNCAUSE | FIXED
  2577. #+SEQ_TODO: | CANCELED
  2578. @end example
  2579. @cindex completion, of option keywords
  2580. @kindex M-@key{TAB}
  2581. @noindent To make sure you are using the correct keyword, type
  2582. @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
  2583. @cindex DONE, final TODO keyword
  2584. Remember that the keywords after the vertical bar (or the last keyword
  2585. if no bar is there) must always mean that the item is DONE (although you
  2586. may use a different word). After changing one of these lines, use
  2587. @kbd{C-c C-c} with the cursor still in the line to make the changes
  2588. known to Org mode@footnote{Org mode parses these lines only when
  2589. Org mode is activated after visiting a file. @kbd{C-c C-c} with the
  2590. cursor in a line starting with @samp{#+} is simply restarting Org mode
  2591. for the current buffer.}.
  2592. @node Faces for TODO keywords, , Per-file keywords, TODO extensions
  2593. @subsection Faces for TODO keywords
  2594. @cindex faces, for TODO keywords
  2595. Org mode highlights TODO keywords with special faces: @code{org-todo}
  2596. for keywords indicating that an item still has to be acted upon, and
  2597. @code{org-done} for keywords indicating that an item is finished. If
  2598. you are using more than 2 different states, you might want to use
  2599. special faces for some of them. This can be done using the variable
  2600. @code{org-todo-keyword-faces}. For example:
  2601. @lisp
  2602. (setq org-todo-keyword-faces
  2603. '(("TODO" . org-warning)
  2604. ("DEFERRED" . shadow)
  2605. ("CANCELED" . (:foreground "blue" :weight bold))))
  2606. @end lisp
  2607. While using a list with face properties as shown for CANCELED
  2608. @emph{should} work, this does not aways seem to be the case. If
  2609. necessary, define a special face and use that.
  2610. @page
  2611. @node Progress logging, Priorities, TODO extensions, TODO Items
  2612. @section Progress logging
  2613. @cindex progress logging
  2614. @cindex logging, of progress
  2615. Org mode can automatically record a time stamp and possibly a note when
  2616. you mark a TODO item as DONE, or even each time you change the state of
  2617. a TODO item. This system is highly configurable, settings can be on a
  2618. per-keyword basis and can be localized to a file or even a subtree. For
  2619. information on how to clock working time for a task, see @ref{Clocking
  2620. work time}.
  2621. @menu
  2622. * Closing items:: When was this entry marked DONE?
  2623. * Tracking TODO state changes:: When did the status change?
  2624. @end menu
  2625. @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
  2626. @subsection Closing items
  2627. The most basic logging is to keep track of @emph{when} a certain TODO
  2628. item was finished. This is achieved with@footnote{The corresponding
  2629. in-buffer setting is: @code{#+STARTUP: logdone}}.
  2630. @lisp
  2631. (setq org-log-done 'time)
  2632. @end lisp
  2633. @noindent
  2634. Then each time you turn an entry from a TODO (not-done) state into any
  2635. of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
  2636. just after the headline. If you turn the entry back into a TODO item
  2637. through further state cycling, that line will be removed again. If you
  2638. want to record a note along with the timestamp, use@footnote{The
  2639. corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
  2640. @lisp
  2641. (setq org-log-done 'note)
  2642. @end lisp
  2643. @noindent
  2644. You will then be prompted for a note, and that note will be stored below
  2645. the entry with a @samp{Closing Note} heading.
  2646. In the timeline (@pxref{Timeline}) and in the agenda
  2647. (@pxref{Weekly/daily agenda}), you can then use the @kbd{l} key to
  2648. display the TODO items with a @samp{CLOSED} timestamp on each day,
  2649. giving you an overview of what has been done.
  2650. @node Tracking TODO state changes, , Closing items, Progress logging
  2651. @subsection Tracking TODO state changes
  2652. When TODO keywords are used as workflow states (@pxref{Workflow
  2653. states}), you might want to keep track of when a state change occurred
  2654. and maybe take a note about this change. Since it is normally too much
  2655. to record a note for every state, Org mode expects configuration on a
  2656. per-keyword basis for this. This is achieved by adding special markers
  2657. @samp{!} (for a time stamp) and @samp{@@} (for a note) in parenthesis
  2658. after each keyword. For example, with the setting
  2659. @lisp
  2660. (setq org-todo-keywords
  2661. '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
  2662. @end lisp
  2663. @noindent
  2664. you not only define global TODO keywords and fast access keys, but also
  2665. request that a time is recorded when the entry is turned into
  2666. DONE@footnote{It is possible that Org mode will record two time stamps
  2667. when you are using both @code{org-log-done} and state change logging.
  2668. However, it will never prompt for two notes - if you have configured
  2669. both, the state change recording note will take precedence and cancel
  2670. the @samp{Closing Note}.}, and that a note is recorded when switching to
  2671. WAIT or CANCELED. The setting for WAIT is even more special: The
  2672. @samp{!} after the slash means that in addition to the note taken when
  2673. entering the state, a time stamp should be recorded when @i{leaving} the
  2674. WAIT state, if and only if the @i{target} state does not configure
  2675. logging for entering it. So it has no effect when switching from WAIT
  2676. to DONE, because DONE is configured to record a timestamp only. But
  2677. when switching from WAIT back to TODO, the @samp{/!} in the WAIT
  2678. setting now triggers a timestamp even though TODO has no logging
  2679. configured.
  2680. You can use the exact same syntax for setting logging preferences local
  2681. to a buffer:
  2682. @example
  2683. #+SEQ_TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
  2684. @end example
  2685. In order to define logging settings that are local to a subtree or a
  2686. single item, define a LOGGING property in this entry. Any non-empty
  2687. LOGGING property resets all logging settings to nil. You may then turn
  2688. on logging for this specific tree using STARTUP keywords like
  2689. @code{lognotedone} or @code{logrepeat}, as well as adding state specific
  2690. settings like @code{TODO(!)}. For example
  2691. @example
  2692. * TODO Log each state with only a time
  2693. :PROPERTIES:
  2694. :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
  2695. :END:
  2696. * TODO Only log when switching to WAIT, and when repeating
  2697. :PROPERTIES:
  2698. :LOGGING: WAIT(@@) logrepeat
  2699. :END:
  2700. * TODO No logging at all
  2701. :PROPERTIES:
  2702. :LOGGING: nil
  2703. :END:
  2704. @end example
  2705. @node Priorities, Breaking down tasks, Progress logging, TODO Items
  2706. @section Priorities
  2707. @cindex priorities
  2708. If you use Org mode extensively, you may end up enough TODO items that
  2709. it starts to make sense to prioritize them. Prioritizing can be done by
  2710. placing a @emph{priority cookie} into the headline of a TODO item, like
  2711. this
  2712. @example
  2713. *** TODO [#A] Write letter to Sam Fortune
  2714. @end example
  2715. @noindent
  2716. By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
  2717. @samp{C}. @samp{A} is the highest priority. An entry without a cookie
  2718. is treated as priority @samp{B}. Priorities make a difference only in
  2719. the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have
  2720. no inherent meaning to Org mode.
  2721. Priorities can be attached to any outline tree entries; they do not need
  2722. to be TODO items.
  2723. @table @kbd
  2724. @kindex @kbd{C-c ,}
  2725. @item @kbd{C-c ,}
  2726. Set the priority of the current headline. The command prompts for a
  2727. priority character @samp{A}, @samp{B} or @samp{C}. When you press
  2728. @key{SPC} instead, the priority cookie is removed from the headline.
  2729. The priorities can also be changed ``remotely'' from the timeline and
  2730. agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
  2731. @c
  2732. @kindex S-@key{up}
  2733. @kindex S-@key{down}
  2734. @item S-@key{up}
  2735. @itemx S-@key{down}
  2736. Increase/decrease priority of current headline@footnote{See also the
  2737. option @code{org-priority-start-cycle-with-default'}.}. Note that these
  2738. keys are also used to modify time stamps (@pxref{Creating timestamps}).
  2739. Furthermore, these keys are also used by CUA mode (@pxref{Conflicts}).
  2740. @end table
  2741. You can change the range of allowed priorities by setting the variables
  2742. @code{org-highest-priority}, @code{org-lowest-priority}, and
  2743. @code{org-default-priority}. For an individual buffer, you may set
  2744. these values (highest, lowest, default) like this (please make sure that
  2745. the highest priority is earlier in the alphabet than the lowest
  2746. priority):
  2747. @example
  2748. #+PRIORITIES: A C B
  2749. @end example
  2750. @node Breaking down tasks, Checkboxes, Priorities, TODO Items
  2751. @section Breaking tasks down into subtasks
  2752. @cindex tasks, breaking down
  2753. It is often advisable to break down large tasks into smaller, manageable
  2754. subtasks. You can do this by creating an outline tree below a TODO
  2755. item, with detailed subtasks on the tree@footnote{To keep subtasks out
  2756. of the global TODO list, see the
  2757. @code{org-agenda-todo-list-sublevels}.}. Another possibility is the use
  2758. of checkboxes to identify (a hierarchy of) a large number of subtasks
  2759. (@pxref{Checkboxes}).
  2760. @node Checkboxes, , Breaking down tasks, TODO Items
  2761. @section Checkboxes
  2762. @cindex checkboxes
  2763. Every item in a plain list (@pxref{Plain lists}) can be made into a
  2764. checkbox by starting it with the string @samp{[ ]}. This feature is
  2765. similar to TODO items (@pxref{TODO Items}), but is more lightweight.
  2766. Checkboxes are not included into the global TODO list, so they are often
  2767. great to split a task into a number of simple steps. Or you can use
  2768. them in a shopping list. To toggle a checkbox, use @kbd{C-c C-c}, or
  2769. use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
  2770. Here is an example of a checkbox list.
  2771. @example
  2772. * TODO Organize party [2/4]
  2773. - [-] call people [1/3]
  2774. - [ ] Peter
  2775. - [X] Sarah
  2776. - [ ] Sam
  2777. - [X] order food
  2778. - [ ] think about what music to play
  2779. - [X] talk to the neighbors
  2780. @end example
  2781. Checkboxes work hierarchically, so if a checkbox item has children that
  2782. are checkboxes, toggling one of the children checkboxes will make the
  2783. parent checkbox reflect if none, some, or all of the children are
  2784. checked.
  2785. @cindex statistics, for checkboxes
  2786. @cindex checkbox statistics
  2787. The @samp{[2/4]} and @samp{[1/3]} in the first and second line are
  2788. cookies indicating how many checkboxes present in this entry have been
  2789. checked off, and the total number of checkboxes are present. This can
  2790. give you an idea on how many checkboxes remain, even without opening a
  2791. folded entry. The cookies can be placed into a headline or into (the
  2792. first line of) a plain list item. Each cookie covers all checkboxes
  2793. structurally below the headline/item on which the cookie appear. You
  2794. have to insert the cookie yourself by typing either @samp{[/]} or
  2795. @samp{[%]}. With @samp{[/]} you get an @samp{n out of m} result, as in
  2796. the examples above. With @samp{[%]} you get information about the
  2797. percentage of checkboxes checked (in the above example, this would be
  2798. @samp{[50%]} and @samp{[33%]}, respectively).
  2799. @noindent The following commands work with checkboxes:
  2800. @table @kbd
  2801. @kindex C-c C-c
  2802. @item C-c C-c
  2803. Toggle checkbox at point. With a prefix argument, set it to @samp{[-]},
  2804. which is considered to be an intermediate state.
  2805. @kindex C-c C-x C-b
  2806. @item C-c C-x C-b
  2807. Toggle checkbox at point.
  2808. @itemize @minus
  2809. @item
  2810. If there is an active region, toggle the first checkbox in the region
  2811. and set all remaining boxes to the same status as the first. If you
  2812. want to toggle all boxes in the region independently, use a prefix
  2813. argument.
  2814. @item
  2815. If the cursor is in a headline, toggle checkboxes in the region between
  2816. this headline and the next (so @emph{not} the entire subtree).
  2817. @item
  2818. If there is no active region, just toggle the checkbox at point.
  2819. @end itemize
  2820. @kindex M-S-@key{RET}
  2821. @item M-S-@key{RET}
  2822. Insert a new item with a checkbox.
  2823. This works only if the cursor is already in a plain list item
  2824. (@pxref{Plain lists}).
  2825. @kindex C-c #
  2826. @item C-c #
  2827. Update the checkbox statistics in the current outline entry. When
  2828. called with a @kbd{C-u} prefix, update the entire file. Checkbox
  2829. statistic cookies are updated automatically if you toggle checkboxes
  2830. with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}. If you
  2831. delete boxes or add/change them by hand, use this command to get things
  2832. back into synch. Or simply toggle any checkbox twice with @kbd{C-c C-c}.
  2833. @end table
  2834. @node Tags, Properties and Columns, TODO Items, Top
  2835. @chapter Tags
  2836. @cindex tags
  2837. @cindex headline tagging
  2838. @cindex matching, tags
  2839. @cindex sparse tree, tag based
  2840. An excellent way to implement labels and contexts for cross-correlating
  2841. information is to assign @i{tags} to headlines. Org mode has extensive
  2842. support for tags.
  2843. Every headline can contain a list of tags; they occur at the end of the
  2844. headline. Tags are normal words containing letters, numbers, @samp{_},
  2845. and @samp{@@}. Tags must be preceded and followed by a single colon,
  2846. e.g., @samp{:WORK:}. Several tags can be specified, as in
  2847. @samp{:work:URGENT:}.
  2848. @menu
  2849. * Tag inheritance:: Tags use the tree structure of the outline
  2850. * Setting tags:: How to assign tags to a headline
  2851. * Tag searches:: Searching for combinations of tags
  2852. @end menu
  2853. @node Tag inheritance, Setting tags, Tags, Tags
  2854. @section Tag inheritance
  2855. @cindex tag inheritance
  2856. @cindex inheritance, of tags
  2857. @cindex sublevels, inclusion into tags match
  2858. @i{Tags} make use of the hierarchical structure of outline trees. If a
  2859. heading has a certain tag, all subheadings will inherit the tag as
  2860. well. For example, in the list
  2861. @example
  2862. * Meeting with the French group :work:
  2863. ** Summary by Frank :boss:notes:
  2864. *** TODO Prepare slides for him :action:
  2865. @end example
  2866. @noindent
  2867. the final heading will have the tags @samp{:work:}, @samp{:boss:},
  2868. @samp{:notes:}, and @samp{:action:} even though the final heading is not
  2869. explicitly marked with those tags. When executing tag searches and
  2870. Org mode finds that a certain headline matches the search criterion, it
  2871. will not check any sublevel headline, assuming that these also match and
  2872. that the list of matches could become very long because of that. If you
  2873. do want the sublevels be tested and listed as well, you may set the
  2874. variable @code{org-tags-match-list-sublevels}. To limit tag inheritance
  2875. to specific tags, or to turn it off entirely, use the variable
  2876. @code{org-use-tag-inheritance}.
  2877. @node Setting tags, Tag searches, Tag inheritance, Tags
  2878. @section Setting tags
  2879. @cindex setting tags
  2880. @cindex tags, setting
  2881. @kindex M-@key{TAB}
  2882. Tags can simply be typed into the buffer at the end of a headline.
  2883. After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
  2884. also a special command for inserting tags:
  2885. @table @kbd
  2886. @kindex C-c C-c
  2887. @item C-c C-c
  2888. @cindex completion, of tags
  2889. Enter new tags for the current headline. Org mode will either offer
  2890. completion or a special single-key interface for setting tags, see
  2891. below. After pressing @key{RET}, the tags will be inserted and aligned
  2892. to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all
  2893. tags in the current buffer will be aligned to that column, just to make
  2894. things look nice. TAGS are automatically realigned after promotion,
  2895. demotion, and TODO state changes (@pxref{TODO basics}).
  2896. @end table
  2897. Org will support tag insertion based on a @emph{list of tags}. By
  2898. default this list is constructed dynamically, containing all tags
  2899. currently used in the buffer. You may also globally specify a hard list
  2900. of tags with the variable @code{org-tag-alist}. Finally you can set
  2901. the default tags for a given file with lines like
  2902. @example
  2903. #+TAGS: @@work @@home @@tennisclub
  2904. #+TAGS: laptop car pc sailboat
  2905. @end example
  2906. If you have globally defined your preferred set of tags using the
  2907. variable @code{org-tag-alist}, but would like to use a dynamic tag list
  2908. in a specific file, add an empty TAGS option line to that file:
  2909. @example
  2910. #+TAGS:
  2911. @end example
  2912. By default Org mode uses the standard minibuffer completion facilities for
  2913. entering tags. However, it also implements another, quicker, tag selection
  2914. method called @emph{fast tag selection}. This allows you to select and
  2915. deselect tags with just a single key press. For this to work well you should
  2916. assign unique letters to most of your commonly used tags. You can do this
  2917. globally by configuring the variable @code{org-tag-alist} in your
  2918. @file{.emacs} file. For example, you may find the need to tag many items in
  2919. different files with @samp{:@@home:}. In this case you can set something
  2920. like:
  2921. @lisp
  2922. (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
  2923. @end lisp
  2924. @noindent If the tag is only relevant to the file you are working on then you
  2925. can, instead, set the TAGS option line as:
  2926. @example
  2927. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
  2928. @end example
  2929. @noindent
  2930. You can also group together tags that are mutually exclusive. By using
  2931. braces, as in:
  2932. @example
  2933. #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
  2934. @end example
  2935. @noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
  2936. and @samp{@@tennisclub} should be selected. Multiple such groups are allowed.
  2937. @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
  2938. these lines to activate any changes.
  2939. @noindent
  2940. To set these mutually exclusive groups in the variable @code{org-mode-alist}
  2941. you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
  2942. of the braces. The previous example would be set globally by the following
  2943. configuration:
  2944. @lisp
  2945. (setq org-tag-alist '((:startgroup . nil)
  2946. ("@@work" . ?w) ("@@home" . ?h)
  2947. ("@@tennisclub" . ?t)
  2948. (:endgroup . nil)
  2949. ("laptop" . ?l) ("pc" . ?p)))
  2950. @end lisp
  2951. If at least one tag has a selection key then pressing @kbd{C-c C-c} will
  2952. automatically present you with a special interface, listing inherited tags,
  2953. the tags of the current headline, and a list of all valid tags with
  2954. corresponding keys@footnote{Keys will automatically be assigned to tags which
  2955. have no configured keys.}. In this interface, you can use the following
  2956. keys:
  2957. @table @kbd
  2958. @item a-z...
  2959. Pressing keys assigned to tags will add or remove them from the list of
  2960. tags in the current line. Selecting a tag in a group of mutually
  2961. exclusive tags will turn off any other tags from that group.
  2962. @kindex @key{TAB}
  2963. @item @key{TAB}
  2964. Enter a tag in the minibuffer, even if the tag is not in the predefined
  2965. list. You will be able to complete on all tags present in the buffer.
  2966. @kindex @key{SPC}
  2967. @item @key{SPC}
  2968. Clear all tags for this line.
  2969. @kindex @key{RET}
  2970. @item @key{RET}
  2971. Accept the modified set.
  2972. @item C-g
  2973. Abort without installing changes.
  2974. @item q
  2975. If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
  2976. @item !
  2977. Turn off groups of mutually exclusive tags. Use this to (as an
  2978. exception) assign several tags from such a group.
  2979. @item C-c
  2980. Toggle auto-exit after the next change (see below).
  2981. If you are using expert mode, the first @kbd{C-c} will display the
  2982. selection window.
  2983. @end table
  2984. @noindent
  2985. This method lets you assign tags to a headline with very few keys. With
  2986. the above setup, you could clear the current tags and set @samp{@@home},
  2987. @samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
  2988. C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to
  2989. @samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
  2990. alternatively with @kbd{C-c C-c C-c w}. Adding the non-predefined tag
  2991. @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
  2992. @key{RET} @key{RET}}.
  2993. If you find that most of the time, you need only a single key press to
  2994. modify your list of tags, set the variable
  2995. @code{org-fast-tag-selection-single-key}. Then you no longer have to
  2996. press @key{RET} to exit fast tag selection - it will immediately exit
  2997. after the first change. If you then occasionally need more keys, press
  2998. @kbd{C-c} to turn off auto-exit for the current tag selection process
  2999. (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
  3000. C-c}). If you set the variable to the value @code{expert}, the special
  3001. window is not even shown for single-key tag selection, it comes up only
  3002. when you press an extra @kbd{C-c}.
  3003. @node Tag searches, , Setting tags, Tags
  3004. @section Tag searches
  3005. @cindex tag searches
  3006. @cindex searching for tags
  3007. Once a system of tags has been set up, it can be used to collect related
  3008. information into special lists.
  3009. @table @kbd
  3010. @kindex C-c \
  3011. @kindex C-c / T
  3012. @item C-c \
  3013. @itemx C-c / T
  3014. Create a sparse tree with all headlines matching a tags search. With a
  3015. @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
  3016. @kindex C-c a m
  3017. @item C-c a m
  3018. Create a global list of tag matches from all agenda files.
  3019. @xref{Matching tags and properties}.
  3020. @kindex C-c a M
  3021. @item C-c a M
  3022. Create a global list of tag matches from all agenda files, but check
  3023. only TODO items and force checking subitems (see variable
  3024. @code{org-tags-match-list-sublevels}).
  3025. @end table
  3026. @cindex Boolean logic, for tag searches
  3027. A @i{tags} search string can use Boolean operators @samp{&} for AND and
  3028. @samp{|} for OR. @samp{&} binds more strongly than @samp{|}.
  3029. Parenthesis are currently not implemented. A tag may also be preceded
  3030. by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
  3031. positive selection. The AND operator @samp{&} is optional when @samp{+}
  3032. or @samp{-} is present. Examples:
  3033. @table @samp
  3034. @item +work-boss
  3035. Select headlines tagged @samp{:work:}, but discard those also tagged
  3036. @samp{:boss:}.
  3037. @item work|laptop
  3038. Selects lines tagged @samp{:work:} or @samp{:laptop:}.
  3039. @item work|laptop&night
  3040. Like before, but require the @samp{:laptop:} lines to be tagged also
  3041. @samp{:night:}.
  3042. @end table
  3043. @cindex TODO keyword matching, with tags search
  3044. If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
  3045. can be useful to also match on the TODO keyword. This can be done by
  3046. adding a condition after a slash to a tags match. The syntax is similar
  3047. to the tag matches, but should be applied with consideration: For
  3048. example, a positive selection on several TODO keywords can not
  3049. meaningfully be combined with boolean AND. However, @emph{negative
  3050. selection} combined with AND can be meaningful. To make sure that only
  3051. lines are checked that actually have any TODO keyword, use @kbd{C-c a
  3052. M}, or equivalently start the TODO part after the slash with @samp{!}.
  3053. Examples:
  3054. @table @samp
  3055. @item work/WAITING
  3056. Select @samp{:work:}-tagged TODO lines with the specific TODO
  3057. keyword @samp{WAITING}.
  3058. @item work/!-WAITING-NEXT
  3059. Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
  3060. nor @samp{NEXT}
  3061. @item work/+WAITING|+NEXT
  3062. Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
  3063. @samp{NEXT}.
  3064. @end table
  3065. @cindex regular expressions, with tags search
  3066. Any element of the tag/todo match can be a regular expression - in this
  3067. case it must be enclosed in curly braces. For example,
  3068. @samp{work+@{^boss.*@}} matches headlines that contain the tag
  3069. @samp{:work:} and any tag @i{starting} with @samp{boss}.
  3070. @cindex level, require for tags/property match
  3071. @cindex category, require for tags/property match
  3072. You can also require a headline to be of a certain level or category, by
  3073. writing instead of any TAG an expression like @samp{LEVEL=3} or
  3074. @samp{CATEGORY="work"}, respectively. For example, a search
  3075. @samp{+LEVEL=3+boss/-DONE} lists all level three headlines that have the
  3076. tag @samp{boss} and are @emph{not} marked with the TODO keyword DONE.
  3077. @node Properties and Columns, Dates and Times, Tags, Top
  3078. @chapter Properties and Columns
  3079. @cindex properties
  3080. Properties are a set of key-value pairs associated with an entry. There
  3081. are two main applications for properties in Org mode. First, properties
  3082. are like tags, but with a value. Second, you can use properties to
  3083. implement (very basic) database capabilities in an Org buffer. For
  3084. an example of the first application, imagine maintaining a file where
  3085. you document bugs and plan releases of a piece of software. Instead of
  3086. using tags like @code{:release_1:}, @code{:release_2:}, one can use a
  3087. property, say @code{:Release:}, that in different subtrees has different
  3088. values, such as @code{1.0} or @code{2.0}. For an example of the second
  3089. application of properties, imagine keeping track of your music CD's,
  3090. where properties could be things such as the album artist, date of
  3091. release, number of tracks, and so on.
  3092. Properties can be conveniently edited and viewed in column view
  3093. (@pxref{Column view}).
  3094. Properties are like tags, but with a value. For example, in a file
  3095. where you document bugs and plan releases of a piece of software,
  3096. instead of using tags like @code{:release_1:}, @code{:release_2:}, it
  3097. can be more efficient to use a property @code{:Release:} with a value
  3098. @code{1.0} or @code{2.0}. Second, you can use properties to implement
  3099. (very basic) database capabilities in an Org buffer, for example to
  3100. create a list of Music CD's you own. You can edit and view properties
  3101. conveniently in column view (@pxref{Column view}).
  3102. @menu
  3103. * Property syntax:: How properties are spelled out
  3104. * Special properties:: Access to other Org mode features
  3105. * Property searches:: Matching property values
  3106. * Property inheritance:: Passing values down the tree
  3107. * Column view:: Tabular viewing and editing
  3108. * Property API:: Properties for Lisp programmers
  3109. @end menu
  3110. @node Property syntax, Special properties, Properties and Columns, Properties and Columns
  3111. @section Property syntax
  3112. @cindex property syntax
  3113. @cindex drawer, for properties
  3114. Properties are key-value pairs. They need to be inserted into a special
  3115. drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property
  3116. is specified on a single line, with the key (surrounded by colons)
  3117. first, and the value after it. Here is an example:
  3118. @example
  3119. * CD collection
  3120. ** Classic
  3121. *** Goldberg Variations
  3122. :PROPERTIES:
  3123. :Title: Goldberg Variations
  3124. :Composer: J.S. Bach
  3125. :Artist: Glen Gould
  3126. :Publisher: Deutsche Grammphon
  3127. :NDisks: 1
  3128. :END:
  3129. @end example
  3130. You may define the allowed values for a particular property @samp{:Xyz:}
  3131. by setting a property @samp{:Xyz_ALL:}. This special property is
  3132. @emph{inherited}, so if you set it in a level 1 entry, it will apply to
  3133. the entire tree. When allowed values are defined, setting the
  3134. corresponding property becomes easier and is less prone to typing
  3135. errors. For the example with the CD collection, we can predefine
  3136. publishers and the number of disks in a box like this:
  3137. @example
  3138. * CD collection
  3139. :PROPERTIES:
  3140. :NDisks_ALL: 1 2 3 4
  3141. :Publisher_ALL: "Deutsche Grammophon" Phillips EMI
  3142. :END:
  3143. @end example
  3144. If you want to set properties that can be inherited by any entry in a
  3145. file, use a line like
  3146. @example
  3147. #+PROPERTY: NDisks_ALL 1 2 3 4
  3148. @end example
  3149. Property values set with the global variable
  3150. @code{org-global-properties} can be inherited by all entries in all
  3151. Org files.
  3152. @noindent
  3153. The following commands help to work with properties:
  3154. @table @kbd
  3155. @kindex M-@key{TAB}
  3156. @item M-@key{TAB}
  3157. After an initial colon in a line, complete property keys. All keys used
  3158. in the current file will be offered as possible completions.
  3159. @kindex C-c C-x p
  3160. @item C-c C-x p
  3161. Set a property. This prompts for a property name and a value. If
  3162. necessary, the property drawer is created as well.
  3163. @item M-x org-insert-property-drawer
  3164. Insert a property drawer into the current entry. The drawer will be
  3165. inserted early in the entry, but after the lines with planning
  3166. information like deadlines.
  3167. @kindex C-c C-c
  3168. @item C-c C-c
  3169. With the cursor in a property drawer, this executes property commands.
  3170. @item C-c C-c s
  3171. Set a property in the current entry. Both the property and the value
  3172. can be inserted using completion.
  3173. @kindex S-@key{right}
  3174. @kindex S-@key{left}
  3175. @item S-@key{left}/@key{right}
  3176. Switch property at point to the next/previous allowed value.
  3177. @item C-c C-c d
  3178. Remove a property from the current entry.
  3179. @item C-c C-c D
  3180. Globally remove a property, from all entries in the current file.
  3181. @item C-c C-c c
  3182. Compute the property at point, using the operator and scope from the
  3183. nearest column format definition.
  3184. @end table
  3185. @node Special properties, Property searches, Property syntax, Properties and Columns
  3186. @section Special properties
  3187. @cindex properties, special
  3188. Special properties provide alternative access method to Org mode
  3189. features discussed in the previous chapters, like the TODO state or the
  3190. priority of an entry. This interface exists so that you can include
  3191. these states into columns view (@pxref{Column view}), or to use them in
  3192. queries. The following property names are special and should not be
  3193. used as keys in the properties drawer:
  3194. @example
  3195. TODO @r{The TODO keyword of the entry.}
  3196. TAGS @r{The tags defined directly in the headline.}
  3197. ALLTAGS @r{All tags, including inherited ones.}
  3198. PRIORITY @r{The priority of the entry, a string with a single letter.}
  3199. DEADLINE @r{The deadline time string, without the angular brackets.}
  3200. SCHEDULED @r{The scheduling time stamp, without the angular brackets.}
  3201. TIMESTAMP @r{The first keyword-less time stamp in the entry.}
  3202. TIMESTAMP_IA @r{The first inactive time stamp in the entry.}
  3203. CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}}
  3204. @r{must be run first to compute the values.}
  3205. @end example
  3206. @node Property searches, Property inheritance, Special properties, Properties and Columns
  3207. @section Property searches
  3208. @cindex properties, searching
  3209. @cindex searching, of properties
  3210. To create sparse trees and special lists with selection based on properties,
  3211. the same commands are used as for tag searches (@pxref{Tag searches}), and
  3212. the same logic applies. For example, here is a search string:
  3213. @example
  3214. +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2+With=@{Sarah\|Denny@}
  3215. @end example
  3216. @noindent
  3217. If the comparison value is a plain number, a numerical comparison is done,
  3218. and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=},
  3219. @samp{>=}, and @samp{<>}. If the comparison value is enclosed in double
  3220. quotes, a string comparison is done, and the same operators are allowed. If
  3221. the comparison value is enclosed in curly braces, a regexp match is
  3222. performed, with @samp{=} meaning that the regexp matches the property value,
  3223. and @samp{<>} meaning that it does not match. So the search string in the
  3224. example finds entries tagged @samp{:work:} but not @samp{:boss:}, which also
  3225. have a priority value @samp{A}, a @samp{:Coffee:} property with the value
  3226. @samp{unlimited}, an @samp{Effort} property that is numerically smaller than
  3227. 2, and a @samp{:With:} property that is matched by the regular expression
  3228. @samp{Sarah\|Denny}.
  3229. You can configure Org mode to use property inheritance during a search, but
  3230. beware that this can slow down searches considerably. See @ref{Property
  3231. inheritance} for details.
  3232. There is also a special command for creating sparse trees based on a
  3233. single property:
  3234. @table @kbd
  3235. @kindex C-c / p
  3236. @item C-c / p
  3237. Create a sparse tree based on the value of a property. This first
  3238. prompts for the name of a property, and then for a value. A sparse tree
  3239. is created with all entries that define this property with the given
  3240. value. If you enclose the value into curly braces, it is interpreted as
  3241. a regular expression and matched against the property values.
  3242. @end table
  3243. @node Property inheritance, Column view, Property searches, Properties and Columns
  3244. @section Property Inheritance
  3245. @cindex properties, inheritance
  3246. @cindex inheritance, of properties
  3247. The outline structure of Org mode documents lends itself for an
  3248. inheritance model of properties: If the parent in a tree has a certain
  3249. property, the children can inherit this property. Org mode does not
  3250. turn this on by default, because it can slow down property searches
  3251. significantly and is often not needed. However, if you find inheritance
  3252. useful, you can turn it on by setting the variable
  3253. @code{org-use-property-inheritance}. It may be set to @code{t}, to make
  3254. all properties inherited from the parent, to a list of properties
  3255. that should be inherited, or to a regular expression that matches
  3256. inherited properties.
  3257. Org mode has a few properties for which inheritance is hard-coded, at
  3258. least for the special applications for which they are used:
  3259. @table @code
  3260. @item COLUMNS
  3261. The @code{:COLUMNS:} property defines the format of column view
  3262. (@pxref{Column view}). It is inherited in the sense that the level
  3263. where a @code{:COLUMNS:} property is defined is used as the starting
  3264. point for a column view table, independently of the location in the
  3265. subtree from where columns view is turned on.
  3266. @item CATEGORY
  3267. For agenda view, a category set through a @code{:CATEGORY:} property
  3268. applies to the entire subtree.
  3269. @item ARCHIVE
  3270. For archiving, the @code{:ARCHIVE:} property may define the archive
  3271. location for the entire subtree (@pxref{Moving subtrees}).
  3272. @item LOGGING
  3273. The LOGGING property may define logging settings for an entry or a
  3274. subtree (@pxref{Tracking TODO state changes}).
  3275. @end table
  3276. @node Column view, Property API, Property inheritance, Properties and Columns
  3277. @section Column view
  3278. A great way to view and edit properties in an outline tree is
  3279. @emph{column view}. In column view, each outline item is turned into a
  3280. table row. Columns in this table provide access to properties of the
  3281. entries. Org mode implements columns by overlaying a tabular structure
  3282. over the headline of each item. While the headlines have been turned
  3283. into a table row, you can still change the visibility of the outline
  3284. tree. For example, you get a compact table by switching to CONTENTS
  3285. view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
  3286. is active), but you can still open, read, and edit the entry below each
  3287. headline. Or, you can switch to column view after executing a sparse
  3288. tree command and in this way get a table only for the selected items.
  3289. Column view also works in agenda buffers (@pxref{Agenda Views}) where
  3290. queries have collected selected items, possibly from a number of files.
  3291. @menu
  3292. * Defining columns:: The COLUMNS format property
  3293. * Using column view:: How to create and use column view
  3294. * Capturing column view:: A dynamic block for column view
  3295. @end menu
  3296. @node Defining columns, Using column view, Column view, Column view
  3297. @subsection Defining columns
  3298. @cindex column view, for properties
  3299. @cindex properties, column view
  3300. Setting up a column view first requires defining the columns. This is
  3301. done by defining a column format line.
  3302. @menu
  3303. * Scope of column definitions:: Where defined, where valid?
  3304. * Column attributes:: Appearance and content of a column
  3305. @end menu
  3306. @node Scope of column definitions, Column attributes, Defining columns, Defining columns
  3307. @subsubsection Scope of column definitions
  3308. To define a column format for an entire file, use a line like
  3309. @example
  3310. #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  3311. @end example
  3312. To specify a format that only applies to a specific tree, add a
  3313. @code{:COLUMNS:} property to the top node of that tree, for example:
  3314. @example
  3315. ** Top node for columns view
  3316. :PROPERTIES:
  3317. :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  3318. :END:
  3319. @end example
  3320. If a @code{:COLUMNS:} property is present in an entry, it defines columns
  3321. for the entry itself, and for the entire subtree below it. Since the
  3322. column definition is part of the hierarchical structure of the document,
  3323. you can define columns on level 1 that are general enough for all
  3324. sublevels, and more specific columns further down, when you edit a
  3325. deeper part of the tree.
  3326. @node Column attributes, , Scope of column definitions, Defining columns
  3327. @subsubsection Column attributes
  3328. A column definition sets the attributes of a column. The general
  3329. definition looks like this:
  3330. @example
  3331. %[width]property[(title)][@{summary-type@}]
  3332. @end example
  3333. @noindent
  3334. Except for the percent sign and the property name, all items are
  3335. optional. The individual parts have the following meaning:
  3336. @example
  3337. width @r{An integer specifying the width of the column in characters.}
  3338. @r{If omitted, the width will be determined automatically.}
  3339. property @r{The property that should be edited in this column.}
  3340. (title) @r{The header text for the column. If omitted, the}
  3341. @r{property name is used.}
  3342. @{summary-type@} @r{The summary type. If specified, the column values for}
  3343. @r{parent nodes are computed from the children.}
  3344. @r{Supported summary types are:}
  3345. @{+@} @r{Sum numbers in this column.}
  3346. @{+;%.1f@} @r{Like @samp{+}, but format result with @samp{%.1f}.}
  3347. @{$@} @r{Currency, short for @samp{+;%.2f}.}
  3348. @{:@} @r{Sum times, HH:MM:SS, plain numbers are hours.}
  3349. @{X@} @r{Checkbox status, [X] if all children are [X].}
  3350. @{X/@} @r{Checkbox status, [n/m].}
  3351. @{X%@} @r{Checkbox status, [n%].}
  3352. @end example
  3353. @noindent
  3354. Here is an example for a complete columns definition, along with allowed
  3355. values.
  3356. @example
  3357. :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.}
  3358. %10Time_Estimate@{:@} %CLOCKSUM
  3359. :Owner_ALL: Tammy Mark Karl Lisa Don
  3360. :Status_ALL: "In progress" "Not started yet" "Finished" ""
  3361. :Approved_ALL: "[ ]" "[X]"
  3362. @end example
  3363. The first column, @samp{%25ITEM}, means the first 25 characters of the
  3364. item itself, i.e. of the headline. You probably always should start the
  3365. column definition with the @samp{ITEM} specifier. The other specifiers
  3366. create columns @samp{Owner} with a list of names as allowed values, for
  3367. @samp{Status} with four different possible values, and for a checkbox
  3368. field @samp{Approved}. When no width is given after the @samp{%}
  3369. character, the column will be exactly as wide as it needs to be in order
  3370. to fully display all values. The @samp{Approved} column does have a
  3371. modified title (@samp{Approved?}, with a question mark). Summaries will
  3372. be created for the @samp{Time_Estimate} column by adding time duration
  3373. expressions like HH:MM, and for the @samp{Approved} column, by providing
  3374. an @samp{[X]} status if all children have been checked. The
  3375. @samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
  3376. in the subtree.
  3377. @node Using column view, Capturing column view, Defining columns, Column view
  3378. @subsection Using column view
  3379. @table @kbd
  3380. @tsubheading{Turning column view on and off}
  3381. @kindex C-c C-x C-c
  3382. @item C-c C-x C-c
  3383. Create the column view for the local environment. This command searches
  3384. the hierarchy, up from point, for a @code{:COLUMNS:} property that defines
  3385. a format. When one is found, the column view table is established for
  3386. the entire tree, starting from the entry that contains the @code{:COLUMNS:}
  3387. property. If none is found, the format is taken from the @code{#+COLUMNS}
  3388. line or from the variable @code{org-columns-default-format}, and column
  3389. view is established for the current entry and its subtree.
  3390. @kindex r
  3391. @item r
  3392. Recreate the column view, to include recent changes made in the buffer.
  3393. @kindex g
  3394. @item g
  3395. Same as @kbd{r}.
  3396. @kindex q
  3397. @item q
  3398. Exit column view.
  3399. @tsubheading{Editing values}
  3400. @item @key{left} @key{right} @key{up} @key{down}
  3401. Move through the column view from field to field.
  3402. @kindex S-@key{left}
  3403. @kindex S-@key{right}
  3404. @item S-@key{left}/@key{right}
  3405. Switch to the next/previous allowed value of the field. For this, you
  3406. have to have specified allowed values for a property.
  3407. @kindex n
  3408. @kindex p
  3409. @itemx n / p
  3410. Same as @kbd{S-@key{left}/@key{right}}
  3411. @kindex e
  3412. @item e
  3413. Edit the property at point. For the special properties, this will
  3414. invoke the same interface that you normally use to change that
  3415. property. For example, when editing a TAGS property, the tag completion
  3416. or fast selection interface will pop up.
  3417. @kindex C-c C-c
  3418. @item C-c C-c
  3419. When there is a checkbox at point, toggle it.
  3420. @kindex v
  3421. @item v
  3422. View the full value of this property. This is useful if the width of
  3423. the column is smaller than that of the value.
  3424. @kindex a
  3425. @item a
  3426. Edit the list of allowed values for this property. If the list is found
  3427. in the hierarchy, the modified values is stored there. If no list is
  3428. found, the new value is stored in the first entry that is part of the
  3429. current column view.
  3430. @tsubheading{Modifying the table structure}
  3431. @kindex <
  3432. @kindex >
  3433. @item < / >
  3434. Make the column narrower/wider by one character.
  3435. @kindex S-M-@key{right}
  3436. @item S-M-@key{right}
  3437. Insert a new column, to the right of the current column.
  3438. @kindex S-M-@key{left}
  3439. @item S-M-@key{left}
  3440. Delete the current column.
  3441. @end table
  3442. @node Capturing column view, , Using column view, Column view
  3443. @subsection Capturing column view
  3444. Since column view is just an overlay over a buffer, it cannot be
  3445. exported or printed directly. If you want to capture a column view, use
  3446. this @code{columnview} dynamic block (@pxref{Dynamic blocks}). The frame
  3447. of this block looks like this:
  3448. @cindex #+BEGIN: columnview
  3449. @example
  3450. * The column view
  3451. #+BEGIN: columnview :hlines 1 :id "label"
  3452. #+END:
  3453. @end example
  3454. @noindent This dynamic block has the following parameters:
  3455. @table @code
  3456. @item :id
  3457. This is most important parameter. Column view is a feature that is
  3458. often localized to a certain (sub)tree, and the capture block might be
  3459. in a different location in the file. To identify the tree whose view to
  3460. capture, you can use 3 values:
  3461. @example
  3462. local @r{use the tree in which the capture block is located}
  3463. global @r{make a global view, including all headings in the file}
  3464. "label" @r{call column view in the tree that has and @code{:ID:}}
  3465. @r{property with the value @i{label}}
  3466. @end example
  3467. @item :hlines
  3468. When @code{t}, insert a hline after every line. When a number N, insert
  3469. a hline before each headline with level @code{<= N}.
  3470. @item :vlines
  3471. When set to @code{t}, enforce column groups to get vertical lines.
  3472. @item :maxlevel
  3473. When set to a number, don't capture entries below this level.
  3474. @item :skip-empty-rows
  3475. When set to @code{t}, skip row where the only non-empty specifier of the
  3476. column view is @code{ITEM}.
  3477. @end table
  3478. @noindent
  3479. The following commands insert or update the dynamic block:
  3480. @table @kbd
  3481. @kindex C-c C-x r
  3482. @item C-c C-x r
  3483. Insert a dynamic block capturing a column view. You will be prompted
  3484. for the scope or id of the view.
  3485. @kindex C-c C-c
  3486. @item C-c C-c
  3487. @kindex C-c C-x C-u
  3488. @itemx C-c C-x C-u
  3489. Update dynamical block at point. The cursor needs to be in the
  3490. @code{#+BEGIN} line of the dynamic block.
  3491. @kindex C-u C-c C-x C-u
  3492. @item C-u C-c C-x C-u
  3493. Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
  3494. you have several clock table blocks in a buffer.
  3495. @end table
  3496. @node Property API, , Column view, Properties and Columns
  3497. @section The Property API
  3498. @cindex properties, API
  3499. @cindex API, for properties
  3500. There is a full API for accessing and changing properties. This API can
  3501. be used by Emacs Lisp programs to work with properties and to implement
  3502. features based on them. For more information see @ref{Using the
  3503. property API}.
  3504. @node Dates and Times, Remember, Properties and Columns, Top
  3505. @chapter Dates and Times
  3506. @cindex dates
  3507. @cindex times
  3508. @cindex time stamps
  3509. @cindex date stamps
  3510. To assist project planning, TODO items can be labeled with a date and/or
  3511. a time. The specially formatted string carrying the date and time
  3512. information is called a @emph{timestamp} in Org mode. This may be a
  3513. little confusing because timestamp is often used as indicating when
  3514. something was created or last changed. However, in Org mode this term
  3515. is used in a much wider sense.
  3516. @menu
  3517. * Timestamps:: Assigning a time to a tree entry
  3518. * Creating timestamps:: Commands which insert timestamps
  3519. * Deadlines and scheduling:: Planning your work
  3520. * Clocking work time:: Tracking how long you spend on a task
  3521. * Effort estimates:: Planning work effort in advance
  3522. @end menu
  3523. @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
  3524. @section Timestamps, deadlines and scheduling
  3525. @cindex time stamps
  3526. @cindex ranges, time
  3527. @cindex date stamps
  3528. @cindex deadlines
  3529. @cindex scheduling
  3530. A time stamp is a specification of a date (possibly with time or a range
  3531. of times) in a special format, either @samp{<2003-09-16 Tue>} or
  3532. @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
  3533. 12:00-12:30>}@footnote{This is the standard ISO date/time format. To
  3534. use an alternative format, see @ref{Custom time format}.}. A time stamp
  3535. can appear anywhere in the headline or body of an Org tree entry. Its
  3536. presence causes entries to be shown on specific dates in the agenda
  3537. (@pxref{Weekly/daily agenda}). We distinguish:
  3538. @table @var
  3539. @item Plain time stamp; Event; Appointment
  3540. @cindex timestamp
  3541. A simple time stamp just assigns a date/time to an item. This is just
  3542. like writing down an appointment or event in a paper agenda. In the
  3543. timeline and agenda displays, the headline of an entry associated with a
  3544. plain time stamp will be shown exactly on that date.
  3545. @example
  3546. * Meet Peter at the movies <2006-11-01 Wed 19:15>
  3547. * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
  3548. @end example
  3549. @item Time stamp with repeater interval
  3550. @cindex timestamp, with repeater interval
  3551. A time stamp may contain a @emph{repeater interval}, indicating that it
  3552. applies not only on the given date, but again and again after a certain
  3553. interval of N days (d), weeks (w), months(m), or years(y). The
  3554. following will show up in the agenda every Wednesday:
  3555. @example
  3556. * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
  3557. @end example
  3558. @item Diary-style sexp entries
  3559. For more complex date specifications, Org mode supports using the
  3560. special sexp diary entries implemented in the Emacs calendar/diary
  3561. package. For example
  3562. @example
  3563. * The nerd meeting on every 2nd Thursday of the month
  3564. <%%(diary-float t 4 2)>
  3565. @end example
  3566. @item Time/Date range
  3567. @cindex timerange
  3568. @cindex date range
  3569. Two time stamps connected by @samp{--} denote a range. The headline
  3570. will be shown on the first and last day of the range, and on any dates
  3571. that are displayed and fall in the range. Here is an example:
  3572. @example
  3573. ** Meeting in Amsterdam
  3574. <2004-08-23 Mon>--<2004-08-26 Thu>
  3575. @end example
  3576. @item Inactive time stamp
  3577. @cindex timestamp, inactive
  3578. @cindex inactive timestamp
  3579. Just like a plain time stamp, but with square brackets instead of
  3580. angular ones. These time stamps are inactive in the sense that they do
  3581. @emph{not} trigger an entry to show up in the agenda.
  3582. @example
  3583. * Gillian comes late for the fifth time [2006-11-01 Wed]
  3584. @end example
  3585. @end table
  3586. @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
  3587. @section Creating timestamps
  3588. @cindex creating timestamps
  3589. @cindex timestamps, creating
  3590. For Org mode to recognize time stamps, they need to be in the specific
  3591. format. All commands listed below produce time stamps in the correct
  3592. format.
  3593. @table @kbd
  3594. @kindex C-c .
  3595. @item C-c .
  3596. Prompt for a date and insert a corresponding time stamp. When the
  3597. cursor is at a previously used time stamp, it is updated to NOW. When
  3598. this command is used twice in succession, a time range is inserted.
  3599. @c
  3600. @kindex C-u C-c .
  3601. @item C-u C-c .
  3602. Like @kbd{C-c .}, but use the alternative format which contains date
  3603. and time. The default time can be rounded to multiples of 5 minutes,
  3604. see the option @code{org-time-stamp-rounding-minutes}.
  3605. @c
  3606. @kindex C-c !
  3607. @item C-c !
  3608. Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
  3609. an agenda entry.
  3610. @c
  3611. @kindex C-c <
  3612. @item C-c <
  3613. Insert a time stamp corresponding to the cursor date in the Calendar.
  3614. @c
  3615. @kindex C-c >
  3616. @item C-c >
  3617. Access the Emacs calendar for the current date. If there is a
  3618. timestamp in the current line, go to the corresponding date
  3619. instead.
  3620. @c
  3621. @kindex C-c C-o
  3622. @item C-c C-o
  3623. Access the agenda for the date given by the time stamp or -range at
  3624. point (@pxref{Weekly/daily agenda}).
  3625. @c
  3626. @kindex S-@key{left}
  3627. @kindex S-@key{right}
  3628. @item S-@key{left}
  3629. @itemx S-@key{right}
  3630. Change date at cursor by one day. These key bindings conflict with
  3631. CUA mode (@pxref{Conflicts}).
  3632. @c
  3633. @kindex S-@key{up}
  3634. @kindex S-@key{down}
  3635. @item S-@key{up}
  3636. @itemx S-@key{down}
  3637. Change the item under the cursor in a timestamp. The cursor can be on a
  3638. year, month, day, hour or minute. Note that if the cursor is in a
  3639. headline and not at a time stamp, these same keys modify the priority of
  3640. an item. (@pxref{Priorities}). The key bindings also conflict with
  3641. CUA mode (@pxref{Conflicts}).
  3642. @c
  3643. @kindex C-c C-y
  3644. @cindex evaluate time range
  3645. @item C-c C-y
  3646. Evaluate a time range by computing the difference between start and end.
  3647. With a prefix argument, insert result after the time range (in a table: into
  3648. the following column).
  3649. @end table
  3650. @menu
  3651. * The date/time prompt:: How Org mode helps you entering date and time
  3652. * Custom time format:: Making dates look different
  3653. @end menu
  3654. @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
  3655. @subsection The date/time prompt
  3656. @cindex date, reading in minibuffer
  3657. @cindex time, reading in minibuffer
  3658. When Org mode prompts for a date/time, the default is shown as an ISO
  3659. date, and the prompt therefore seems to ask for an ISO date. But it
  3660. will in fact accept any string containing some date and/or time
  3661. information, and it is really smart about interpreting your input. You
  3662. can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
  3663. copied from an email message. Org mode will find whatever information
  3664. is in there and derive anything you have not specified from the
  3665. @emph{default date and time}. The default is usually the current date
  3666. and time, but when modifying an existing time stamp, or when entering
  3667. the second stamp of a range, it is taken from the stamp in the buffer.
  3668. When filling in information, Org mode assumes that most of the time you
  3669. will want to enter a date in the future: If you omit the month/year and
  3670. the given day/month is @i{before} today, it will assume that you mean a
  3671. future date@footnote{See the variable
  3672. @code{org-read-date-prefer-future}.}.
  3673. For example, lets assume that today is @b{June 13, 2006}. Here is how
  3674. various inputs will be interpreted, the items filled in by Org mode are
  3675. in @b{bold}.
  3676. @example
  3677. 3-2-5 --> 2003-02-05
  3678. 14 --> @b{2006}-@b{06}-14
  3679. 12 --> @b{2006}-@b{07}-12
  3680. Fri --> nearest Friday (defaultdate or later)
  3681. sep 15 --> @b{2006}-11-15
  3682. feb 15 --> @b{2007}-02-15
  3683. sep 12 9 --> 2009-09-12
  3684. 12:45 --> @b{2006}-@b{06}-@b{13} 12:45
  3685. 22 sept 0:34 --> @b{2006}-09-22 0:34
  3686. w4 --> ISO week for of the current year @b{2006}
  3687. 2012 w4 fri --> Friday of ISO week 4 in 2012
  3688. 2012-w04-5 --> Same as above
  3689. @end example
  3690. Furthermore you can specify a relative date by giving, as the
  3691. @emph{first} thing in the input: a plus/minus sign, a number and a
  3692. letter [dwmy] to indicate change in days weeks, months, years. With a
  3693. single plus or minus, the date is always relative to today. With a
  3694. double plus or minus, it is relative to the default date. If instead of
  3695. a single letter, you use the abbreviation of day name, the date will be
  3696. the nth such day. E.g.
  3697. @example
  3698. +0 --> today
  3699. . --> today
  3700. +4d --> four days from today
  3701. +4 --> same as above
  3702. +2w --> two weeks from today
  3703. ++5 --> five days from default date
  3704. +2tue --> second tuesday from now.
  3705. @end example
  3706. The function understands English month and weekday abbreviations. If
  3707. you want to use unabbreviated names and/or other languages, configure
  3708. the variables @code{parse-time-months} and @code{parse-time-weekdays}.
  3709. @cindex calendar, for selecting date
  3710. Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
  3711. you don't need/want the calendar, configure the variable
  3712. @code{org-popup-calendar-for-date-prompt}.}. When you exit the date
  3713. prompt, either by clicking on a date in the calendar, or by pressing
  3714. @key{RET}, the date selected in the calendar will be combined with the
  3715. information entered at the prompt. You can control the calendar fully
  3716. from the minibuffer:
  3717. @kindex <
  3718. @kindex >
  3719. @kindex mouse-1
  3720. @kindex S-@key{right}
  3721. @kindex S-@key{left}
  3722. @kindex S-@key{down}
  3723. @kindex S-@key{up}
  3724. @kindex M-S-@key{right}
  3725. @kindex M-S-@key{left}
  3726. @kindex @key{RET}
  3727. @example
  3728. > / < @r{Scroll calendar forward/backward by one month.}
  3729. mouse-1 @r{Select date by clicking on it.}
  3730. S-@key{right}/@key{left} @r{One day forward/backward.}
  3731. S-@key{down}/@key{up} @r{One week forward/backward.}
  3732. M-S-@key{right}/@key{left} @r{One month forward/backward.}
  3733. @key{RET} @r{Choose date in calendar.}
  3734. @end example
  3735. The actions of the date/time prompt may seem complex, but I assure you they
  3736. will grow on you, and you will start getting annoyed by pretty much any other
  3737. way of entering a date/time out there. To help you understand what is going
  3738. on, the current interpretation of your input will be displayed live in the
  3739. minibuffer@footnote{If you find this distracting, turn the display of with
  3740. @code{org-read-date-display-live}.}.
  3741. @node Custom time format, , The date/time prompt, Creating timestamps
  3742. @subsection Custom time format
  3743. @cindex custom date/time format
  3744. @cindex time format, custom
  3745. @cindex date format, custom
  3746. Org mode uses the standard ISO notation for dates and times as it is
  3747. defined in ISO 8601. If you cannot get used to this and require another
  3748. representation of date and time to keep you happy, you can get it by
  3749. customizing the variables @code{org-display-custom-times} and
  3750. @code{org-time-stamp-custom-formats}.
  3751. @table @kbd
  3752. @kindex C-c C-x C-t
  3753. @item C-c C-x C-t
  3754. Toggle the display of custom formats for dates and times.
  3755. @end table
  3756. @noindent
  3757. Org mode needs the default format for scanning, so the custom date/time
  3758. format does not @emph{replace} the default format - instead it is put
  3759. @emph{over} the default format using text properties. This has the
  3760. following consequences:
  3761. @itemize @bullet
  3762. @item
  3763. You cannot place the cursor onto a time stamp anymore, only before or
  3764. after.
  3765. @item
  3766. The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
  3767. each component of a time stamp. If the cursor is at the beginning of
  3768. the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
  3769. just like @kbd{S-@key{left}/@key{right}}. At the end of the stamp, the
  3770. time will be changed by one minute.
  3771. @item
  3772. If the time stamp contains a range of clock times or a repeater, these
  3773. will not be overlayed, but remain in the buffer as they were.
  3774. @item
  3775. When you delete a time stamp character-by-character, it will only
  3776. disappear from the buffer after @emph{all} (invisible) characters
  3777. belonging to the ISO timestamp have been removed.
  3778. @item
  3779. If the custom time stamp format is longer than the default and you are
  3780. using dates in tables, table alignment will be messed up. If the custom
  3781. format is shorter, things do work as expected.
  3782. @end itemize
  3783. @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
  3784. @section Deadlines and scheduling
  3785. A time stamp may be preceded by special keywords to facilitate planning:
  3786. @table @var
  3787. @item DEADLINE
  3788. @cindex DEADLINE keyword
  3789. Meaning: the task (most likely a TODO item, though not necessarily) is supposed
  3790. to be finished on that date.
  3791. On the deadline date, the task will be listed in the agenda. In
  3792. addition, the agenda for @emph{today} will carry a warning about the
  3793. approaching or missed deadline, starting
  3794. @code{org-deadline-warning-days} before the due date, and continuing
  3795. until the entry is marked DONE. An example:
  3796. @example
  3797. *** TODO write article about the Earth for the Guide
  3798. The editor in charge is [[bbdb:Ford Prefect]]
  3799. DEADLINE: <2004-02-29 Sun>
  3800. @end example
  3801. You can specify a different lead time for warnings for a specific
  3802. deadlines using the following syntax. Here is an example with a warning
  3803. period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
  3804. @item SCHEDULED
  3805. @cindex SCHEDULED keyword
  3806. Meaning: you are planning to start working on that task on the given
  3807. date.
  3808. The headline will be listed under the given date@footnote{It will still
  3809. be listed on that date after it has been marked DONE. If you don't like
  3810. this, set the variable @code{org-agenda-skip-scheduled-if-done}.}. In
  3811. addition, a reminder that the scheduled date has passed will be present
  3812. in the compilation for @emph{today}, until the entry is marked DONE.
  3813. I.e., the task will automatically be forwarded until completed.
  3814. @example
  3815. *** TODO Call Trillian for a date on New Years Eve.
  3816. SCHEDULED: <2004-12-25 Sat>
  3817. @end example
  3818. @noindent
  3819. @b{Important:} Scheduling an item in Org mode should @i{not} be
  3820. understood in the same way that we understand @i{scheduling a meeting}.
  3821. Setting a date for a meeting is just a simple appointment, you should
  3822. mark this entry with a simple plain time stamp, to get this item shown
  3823. on the date where it applies. This is a frequent mis-understanding from
  3824. Org-users. In Org mode, @i{scheduling} means setting a date when you
  3825. want to start working on an action item.
  3826. @end table
  3827. You may use time stamps with repeaters in scheduling and deadline
  3828. entries. Org mode will issue early and late warnings based on the
  3829. assumption that the time stamp represents the @i{nearest instance} of
  3830. the repeater. However, the use of diary sexp entries like
  3831. @c
  3832. @code{<%%(diary-float t 42)>}
  3833. @c
  3834. in scheduling and deadline timestamps is limited. Org mode does not
  3835. know enough about the internals of each sexp function to issue early and
  3836. late warnings. However, it will show the item on each day where the
  3837. sexp entry matches.
  3838. @menu
  3839. * Inserting deadline/schedule:: Planning items
  3840. * Repeated tasks:: Items that show up again and again
  3841. @end menu
  3842. @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
  3843. @subsection Inserting deadlines or schedules
  3844. The following commands allow to quickly insert a deadline or to schedule
  3845. an item:
  3846. @table @kbd
  3847. @c
  3848. @kindex C-c C-d
  3849. @item C-c C-d
  3850. Insert @samp{DEADLINE} keyword along with a stamp. The insertion will
  3851. happen in the line directly following the headline. When called with a
  3852. prefix arg, an existing deadline will be removed from the entry.
  3853. @c FIXME Any CLOSED timestamp will be removed.????????
  3854. @c
  3855. @kindex C-c / d
  3856. @cindex sparse tree, for deadlines
  3857. @item C-c / d
  3858. Create a sparse tree with all deadlines that are either past-due, or
  3859. which will become due within @code{org-deadline-warning-days}.
  3860. With @kbd{C-u} prefix, show all deadlines in the file. With a numeric
  3861. prefix, check that many days. For example, @kbd{C-1 C-c / d} shows
  3862. all deadlines due tomorrow.
  3863. @c
  3864. @kindex C-c C-s
  3865. @item C-c C-s
  3866. Insert @samp{SCHEDULED} keyword along with a stamp. The insertion will
  3867. happen in the line directly following the headline. Any CLOSED
  3868. timestamp will be removed. When called with a prefix argument, remove
  3869. the scheduling date from the entry.
  3870. @end table
  3871. @node Repeated tasks, , Inserting deadline/schedule, Deadlines and scheduling
  3872. @subsection Repeated tasks
  3873. Some tasks need to be repeated again and again. Org mode helps to
  3874. organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
  3875. or plain time stamp. In the following example
  3876. @example
  3877. ** TODO Pay the rent
  3878. DEADLINE: <2005-10-01 Sat +1m>
  3879. @end example
  3880. the @code{+1m} is a repeater; the intended interpretation is that the
  3881. task has a deadline on <2005-10-01> and repeats itself every (one) month
  3882. starting from that time. If you need both a repeater and a special
  3883. warning period in a deadline entry, the repeater comes first and the
  3884. warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
  3885. Deadlines and scheduled items produce entries in the agenda when they
  3886. are over-due, so it is important to be able to mark such an entry as
  3887. completed once you have done so. When you mark a DEADLINE or a SCHEDULE
  3888. with the TODO keyword DONE, it will no longer produce entries in the
  3889. agenda. The problem with this is, however, that then also the
  3890. @emph{next} instance of the repeated entry will not be active. Org mode
  3891. deals with this in the following way: When you try to mark such an entry
  3892. DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
  3893. time stamp by the repeater interval, and immediately set the entry state
  3894. back to TODO. In the example above, setting the state to DONE would
  3895. actually switch the date like this:
  3896. @example
  3897. ** TODO Pay the rent
  3898. DEADLINE: <2005-11-01 Tue +1m>
  3899. @end example
  3900. A timestamp@footnote{You can change this using the option
  3901. @code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat},
  3902. @code{lognoterepeat}, and @code{nologrepeat}. With @code{lognoterepeat}, you
  3903. will aslo be prompted for a note.} will be added under the deadline, to keep
  3904. a record that you actually acted on the previous instance of this deadline.
  3905. As a consequence of shifting the base date, this entry will no longer be
  3906. visible in the agenda when checking past dates, but all future instances
  3907. will be visible.
  3908. With the @samp{+1m} cookie, the date shift will always be exactly one
  3909. month. So if you have not payed the rent for three months, marking this
  3910. entry DONE will still keep it as an overdue deadline. Depending on the
  3911. task, this may not be the best way to handle it. For example, if you
  3912. forgot to call you father for 3 weeks, it does not make sense to call
  3913. him 3 times in a single day to make up for it. Finally, there are tasks
  3914. like changing batteries which should always repeat a certain time
  3915. @i{after} the last time you did it. For these tasks, Org mode has
  3916. special repeaters markers with @samp{++} and @samp{.+}. For example:
  3917. @example
  3918. ** TODO Call Father
  3919. DEADLINE: <2008-02-10 Sun ++1w>
  3920. Marking this DONE will shift the date by at least one week,
  3921. but also by as many weeks as it takes to get this date into
  3922. the future. However, it stays on a Sunday, even if you called
  3923. and marked it done on Saturday.
  3924. ** TODO Check the batteries in the smoke detectors
  3925. DEADLINE: <2005-11-01 Tue .+1m>
  3926. Marking this DONE will shift the date to one month after
  3927. today.
  3928. @end example
  3929. You may have both scheduling and deadline information for a specific
  3930. task - just make sure that the repeater intervals on both are the same.
  3931. @node Clocking work time, Effort estimates, Deadlines and scheduling, Dates and Times
  3932. @section Clocking work time
  3933. Org mode allows you to clock the time you spent on specific tasks in a
  3934. project. When you start working on an item, you can start the clock.
  3935. When you stop working on that task, or when you mark the task done, the
  3936. clock is stopped and the corresponding time interval is recorded. It
  3937. also computes the total time spent on each subtree of a project.
  3938. @table @kbd
  3939. @kindex C-c C-x C-i
  3940. @item C-c C-x C-i
  3941. Start the clock on the current item (clock-in). This inserts the CLOCK
  3942. keyword together with a timestamp. If this is not the first clocking of
  3943. this item, the multiple CLOCK lines will be wrapped into a
  3944. @code{:CLOCK:} drawer (see also the variable
  3945. @code{org-clock-into-drawer}). When called with a @kbd{C-u} prefix argument,
  3946. select the task from a list of recently clocked tasks. With two @kbd{C-u
  3947. C-u} prefixes, clock into the task at point and mark it as the default task.
  3948. The default task will always be available when selecting a clocking task,
  3949. with letter @kbd{d}.
  3950. @kindex C-c C-x C-o
  3951. @item C-c C-x C-o
  3952. Stop the clock (clock-out). The inserts another timestamp at the same
  3953. location where the clock was last started. It also directly computes
  3954. the resulting time in inserts it after the time range as @samp{=>
  3955. HH:MM}. See the variable @code{org-log-note-clock-out} for the
  3956. possibility to record an additional note together with the clock-out
  3957. time stamp@footnote{The corresponding in-buffer setting is:
  3958. @code{#+STARTUP: lognoteclock-out}}.
  3959. @kindex C-c C-y
  3960. @item C-c C-y
  3961. Recompute the time interval after changing one of the time stamps. This
  3962. is only necessary if you edit the time stamps directly. If you change
  3963. them with @kbd{S-@key{cursor}} keys, the update is automatic.
  3964. @kindex C-c C-t
  3965. @item C-c C-t
  3966. Changing the TODO state of an item to DONE automatically stops the clock
  3967. if it is running in this same item.
  3968. @kindex C-c C-x C-x
  3969. @item C-c C-x C-x
  3970. Cancel the current clock. This is useful if a clock was started by
  3971. mistake, or if you ended up working on something else.
  3972. @kindex C-c C-x C-j
  3973. @item C-c C-x C-j
  3974. Jump to the entry that contains the currently running clock. With a
  3975. @kbd{C-u} prefix arg, select the target task from a list of recently clocked
  3976. tasks.
  3977. @kindex C-c C-x C-d
  3978. @item C-c C-x C-d
  3979. Display time summaries for each subtree in the current buffer. This
  3980. puts overlays at the end of each headline, showing the total time
  3981. recorded under that heading, including the time of any subheadings. You
  3982. can use visibility cycling to study the tree, but the overlays disappear
  3983. when you change the buffer (see variable
  3984. @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
  3985. @kindex C-c C-x C-r
  3986. @item C-c C-x C-r
  3987. Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
  3988. report as an Org mode table into the current file. When the cursor is
  3989. at an existing clock table, just update it. When called with a prefix
  3990. argument, jump to the first clock report in the current document and
  3991. update it.
  3992. @cindex #+BEGIN: clocktable
  3993. @example
  3994. #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
  3995. #+END: clocktable
  3996. @end example
  3997. @noindent
  3998. If such a block already exists at point, its content is replaced by the
  3999. new table. The @samp{BEGIN} line can specify options:
  4000. @example
  4001. :maxlevel @r{Maximum level depth to which times are listed in the table.}
  4002. :emphasize @r{When @code{t}, emphasize level one and level two items}
  4003. :scope @r{The scope to consider. This can be any of the following:}
  4004. nil @r{the current buffer or narrowed region}
  4005. file @r{the full current buffer}
  4006. subtree @r{the subtree where the clocktable is located}
  4007. treeN @r{the surrounding level N tree, for example @code{tree3}}
  4008. tree @r{the surrounding level 1 tree}
  4009. agenda @r{all agenda files}
  4010. ("file"..) @r{scan these files}
  4011. file-with-archives @r{current file and its archives}
  4012. agenda-with-archives @r{all agenda files, including archives}
  4013. :block @r{The time block to consider. This block is specified either}
  4014. @r{absolute, or relative to the current time and may be any of}
  4015. @r{these formats:}
  4016. 2007-12-31 @r{New year eve 2007}
  4017. 2007-12 @r{December 2007}
  4018. 2007-W50 @r{ISO-week 50 in 2007}
  4019. 2007 @r{the year 2007}
  4020. today, yesterday, today-N @r{a relative day}
  4021. thisweek, lastweek, thisweek-N @r{a relative week}
  4022. thismonth, lastmonth, thismonth-N @r{a relative month}
  4023. thisyear, lastyear, thisyear-N @r{a relative year}
  4024. @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
  4025. :tstart @r{A time string specifying when to start considering times}
  4026. :tend @r{A time string specifying when to stop considering times}
  4027. :step @r{@code{week} or @code{day}, to split the table into chunks.}
  4028. @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
  4029. :link @r{Link the item headlines in the table to their origins}
  4030. @end example
  4031. So to get a clock summary of the current level 1 tree, for the current
  4032. day, you could write
  4033. @example
  4034. #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
  4035. #+END: clocktable
  4036. @end example
  4037. and to use a specific time range you could write@footnote{Note that all
  4038. parameters must be specified in a single line - the line is broken here
  4039. only to fit it onto the manual.}
  4040. @example
  4041. #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
  4042. :tend "<2006-08-10 Thu 12:00>"
  4043. #+END: clocktable
  4044. @end example
  4045. @kindex C-c C-c
  4046. @item C-c C-c
  4047. @kindex C-c C-x C-u
  4048. @itemx C-c C-x C-u
  4049. Update dynamical block at point. The cursor needs to be in the
  4050. @code{#+BEGIN} line of the dynamic block.
  4051. @kindex C-u C-c C-x C-u
  4052. @item C-u C-c C-x C-u
  4053. Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
  4054. you have several clock table blocks in a buffer.
  4055. @kindex S-@key{left}
  4056. @kindex S-@key{right}
  4057. @item S-@key{left}
  4058. @itemx S-@key{right}
  4059. Shift the current @code{:block} interval and update the table. The cursor
  4060. needs to be in the @code{#+BEGIN: clocktable} line for this command. If
  4061. @code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
  4062. @end table
  4063. The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
  4064. the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
  4065. worked on or closed during a day.
  4066. @node Effort estimates, , Clocking work time, Dates and Times
  4067. @section Effort estimates
  4068. @cindex Effort estimates
  4069. If you want to plan your work in a very detailed way, or if you need to
  4070. produce offers with quotations of the estimated work effort, you may want to
  4071. assign effort estimates to entries. If you are also clocking your work, you
  4072. may later want to compare the planned effort with the actual working time, a
  4073. great way to improve planning estimates. Effort estimates are stored in a
  4074. special property @samp{Effort}@footnote{You may change the property being
  4075. used with the variable @code{org-effort-property}.}. Clearly the best way to
  4076. work with effort estimates is through column view (@pxref{Column view}). You
  4077. should start by setting up discrete values for effort estimates, and a
  4078. @code{COLUMNS} format that displays these values together with clock sums (if
  4079. you want to clock your time). For a specific buffer you can use
  4080. @example
  4081. #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00
  4082. #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
  4083. @end example
  4084. @noindent
  4085. or you can set up these values globally by customizing the variables
  4086. @code{org-global-properties} and @code{org-columns-default-format}. In
  4087. particular if you want to use this setup also in the agenda, a global setup
  4088. may be advised.
  4089. The way to assign estimates to individual items is then to switch to column
  4090. mode, and to use @kbd{S-@key{right}} and @kbd{S-@key{left}} to change the
  4091. value. The values you enter will immediately be summed up in the hierarchy.
  4092. In the column next to it, any clocked time will be displayed.
  4093. If you switch to column view in the daily/weekly agenda, the effort column
  4094. will summarize the estimated work effort for each day@footnote{Please note
  4095. the pitfalls of summing hierarchical data in a flat list (@pxref{Agenda
  4096. column view}.}, and you can use this to find space in your schedule. To get
  4097. an overview of the entire part of the day that is committed, you can set the
  4098. option @code{org-agenda-columns-add-appointments-to-effort-sum}. The
  4099. appointments on a day that take place over a specified time interval will
  4100. then also be added to the load estimate of the day.
  4101. @node Remember, Agenda Views, Dates and Times, Top
  4102. @chapter Remember
  4103. @cindex @file{remember.el}
  4104. The @i{Remember} package by John Wiegley lets you store quick notes with
  4105. little interruption of your work flow. See
  4106. @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
  4107. information. It is an excellent way to add new notes and tasks to
  4108. Org files. Org significantly expands the possibilities of
  4109. @i{remember}: You may define templates for different note types, and
  4110. associate target files and headlines with specific templates. It also
  4111. allows you to select the location where a note should be stored
  4112. interactively, on the fly.
  4113. @menu
  4114. * Setting up Remember:: Some code for .emacs to get things going
  4115. * Remember templates:: Define the outline of different note types
  4116. * Storing notes:: Directly get the note to where it belongs
  4117. * Refiling notes:: Moving a note or task to a project
  4118. @end menu
  4119. @node Setting up Remember, Remember templates, Remember, Remember
  4120. @section Setting up Remember
  4121. The following customization will tell @i{remember} to use org files as
  4122. target, and to create annotations compatible with Org links.
  4123. @example
  4124. (org-remember-insinuate)
  4125. (setq org-directory "~/path/to/my/orgfiles/")
  4126. (setq org-default-notes-file (concat org-directory "/notes.org"))
  4127. (define-key global-map "\C-cr" 'org-remember)
  4128. @end example
  4129. The last line binds the command @code{org-remember} to a global
  4130. key@footnote{Please select your own key, @kbd{C-c r} is only a
  4131. suggestion.}. @code{org-remember} basically just calls @code{remember},
  4132. but it makes a few things easier: If there is an active region, it will
  4133. automatically copy the region into the remember buffer. It also allows
  4134. to jump to the buffer and location where remember notes are being
  4135. stored: Just call @code{org-remember} with a prefix argument. If you
  4136. use two prefix arguments, Org jumps to the location where the last
  4137. remember note was stored.
  4138. @node Remember templates, Storing notes, Setting up Remember, Remember
  4139. @section Remember templates
  4140. @cindex templates, for remember
  4141. In combination with Org, you can use templates to generate
  4142. different types of @i{remember} notes. For example, if you would like
  4143. to use one template to create general TODO entries, another one for
  4144. journal entries, and a third one for collecting random ideas, you could
  4145. use:
  4146. @example
  4147. (setq org-remember-templates
  4148. '(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks")
  4149. ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
  4150. ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
  4151. @end example
  4152. @noindent In these entries, the first string is just a name, and the
  4153. character specifies how to select the template. It is useful if the
  4154. character is also the first letter of the name. The next string
  4155. specifies the template. Two more (optional) strings give the file in
  4156. which, and the headline under which the new note should be stored. The
  4157. file (if not present or @code{nil}) defaults to
  4158. @code{org-default-notes-file}, the heading to
  4159. @code{org-remember-default-headline}. If the file name is not an
  4160. absolute path, it will be interpreted relative to @code{org-directory}.
  4161. An optional sixth element specifies the contexts in which the user can
  4162. select the template. This element can be either a list of major modes
  4163. or a function. @code{org-remember} will first check whether the function
  4164. returns @code{t} or if we are in any of the listed major mode, and select
  4165. the template accordingly.
  4166. So for example:
  4167. @example
  4168. (setq org-remember-templates
  4169. '(("Bug" ?b "* BUG %?\n %i\n %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
  4170. ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org" my-check)
  4171. ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
  4172. @end example
  4173. The first template will only be available when invoking @code{org-remember}
  4174. from an buffer in @code{emacs-lisp-mode}. The second template will only be
  4175. available when the function @code{my-check} returns @code{t}. The third
  4176. template will be proposed in any context.
  4177. When you call @kbd{M-x org-remember} (or @kbd{M-x remember}) to remember
  4178. something, Org will prompt for a key to select the template (if you have
  4179. more than one template) and then prepare the buffer like
  4180. @example
  4181. * TODO
  4182. [[file:link to where you called remember]]
  4183. @end example
  4184. @noindent
  4185. During expansion of the template, special @kbd{%}-escapes allow dynamic
  4186. insertion of content:
  4187. @example
  4188. %^@{prompt@} @r{prompt the user for a string and replace this sequence with it.}
  4189. @r{You may specify a default value and a completion table with}
  4190. @r{%^@{prompt|default|completion2|completion3...@}}
  4191. @r{The arrow keys access a prompt-specific history.}
  4192. %t @r{time stamp, date only}
  4193. %T @r{time stamp with date and time}
  4194. %u, %U @r{like the above, but inactive time stamps}
  4195. %^t @r{like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}}
  4196. @r{You may define a prompt like @code{%^@{Birthday@}t}}
  4197. %n @r{user name (taken from @code{user-full-name})}
  4198. %a @r{annotation, normally the link created with @code{org-store-link}}
  4199. %A @r{like @code{%a}, but prompt for the description part}
  4200. %i @r{initial content, the region when remember is called with C-u.}
  4201. @r{The entire text will be indented like @code{%i} itself.}
  4202. %c @r{Current kill ring head.}
  4203. %x @r{Content of the X clipboard.}
  4204. %^C @r{Interactive selection of which kill or clip to use.}
  4205. %^L @r{Like @code{%^C}, but insert as link.}
  4206. %^g @r{prompt for tags, with completion on tags in target file.}
  4207. %^G @r{prompt for tags, with completion all tags in all agenda files.}
  4208. %:keyword @r{specific information for certain link types, see below}
  4209. %[pathname] @r{insert the contents of the file given by @code{pathname}}
  4210. %(sexp) @r{evaluate elisp @code{(sexp)} and replace with the result}
  4211. %! @r{immediately store note after completing the template}
  4212. @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
  4213. @end example
  4214. @noindent
  4215. For specific link types, the following keywords will be
  4216. defined@footnote{If you define your own link types (@pxref{Adding
  4217. hyperlink types}), any property you store with
  4218. @code{org-store-link-props} can be accessed in remember templates in a
  4219. similar way.}:
  4220. @example
  4221. Link type | Available keywords
  4222. -------------------+----------------------------------------------
  4223. bbdb | %:name %:company
  4224. bbdb | %::server %:port %:nick
  4225. vm, wl, mh, rmail | %:type %:subject %:message-id
  4226. | %:from %:fromname %:fromaddress
  4227. | %:to %:toname %:toaddress
  4228. | %: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}.}}
  4229. gnus | %:group, @r{for messages also all email fields}
  4230. w3, w3m | %:url
  4231. info | %:file %:node
  4232. calendar | %:date"
  4233. @end example
  4234. @noindent
  4235. To place the cursor after template expansion use:
  4236. @example
  4237. %? @r{After completing the template, position cursor here.}
  4238. @end example
  4239. @noindent
  4240. If you change your mind about which template to use, call
  4241. @code{org-remember} in the remember buffer. You may then select a new
  4242. template that will be filled with the previous context information.
  4243. @node Storing notes, Refiling notes, Remember templates, Remember
  4244. @section Storing notes
  4245. When you are finished preparing a note with @i{remember}, you have to press
  4246. @kbd{C-c C-c} to file the note away. If you have started the clock in the
  4247. remember buffer, you will first be asked if you want to clock out
  4248. now@footnote{To avoid this query, configure the variable
  4249. @code{org-remember-clock-out-on-exit}.}. If you answer @kbd{n}, the clock
  4250. will continue to run after the note is filed away.
  4251. The handler will then store the note in the file and under the headline
  4252. specified in the template, or it will use the default file and headlines.
  4253. The window configuration will be restored, sending you back to the working
  4254. context before the call to @code{remember}. To re-use the location found
  4255. during the last call to @code{remember}, exit the remember buffer with
  4256. @kbd{C-u C-u C-c C-c}, i.e. specify a double prefix argument to @kbd{C-c
  4257. C-c}.
  4258. If you want to store the note directly to a different place, use
  4259. @kbd{C-u C-c C-c} instead to exit remember@footnote{Configure the
  4260. variable @code{org-remember-store-without-prompt} to make this behavior
  4261. the default.}. The handler will then first prompt for a target file -
  4262. if you press @key{RET}, the value specified for the template is used.
  4263. Then the command offers the headings tree of the selected file, with the
  4264. cursor position at the default headline (if you had specified one in the
  4265. template). You can either immediately press @key{RET} to get the note
  4266. placed there. Or you can use the following keys to find a different
  4267. location:
  4268. @example
  4269. @key{TAB} @r{Cycle visibility.}
  4270. @key{down} / @key{up} @r{Next/previous visible headline.}
  4271. n / p @r{Next/previous visible headline.}
  4272. f / b @r{Next/previous headline same level.}
  4273. u @r{One level up.}
  4274. @c 0-9 @r{Digit argument.}
  4275. @end example
  4276. @noindent
  4277. Pressing @key{RET} or @key{left} or @key{right}
  4278. then leads to the following result.
  4279. @multitable @columnfractions 0.2 0.15 0.65
  4280. @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
  4281. @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor, first or last
  4282. @item @tab @tab depending on @code{org-reverse-note-order}.
  4283. @item @tab @key{left}/@key{right} @tab as same level, before/after current heading
  4284. @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
  4285. @item @tab @tab depending on @code{org-reverse-note-order}.
  4286. @item not on headline @tab @key{RET}
  4287. @tab at cursor position, level taken from context.
  4288. @end multitable
  4289. Before inserting the text into a tree, the function ensures that the
  4290. text has a headline, i.e. a first line that starts with a @samp{*}. If
  4291. not, a headline is constructed from the current date and some additional
  4292. data. If you have indented the text of the note below the headline, the
  4293. indentation will be adapted if inserting the note into the tree requires
  4294. demotion from level 1.
  4295. @node Refiling notes, , Storing notes, Remember
  4296. @section Refiling notes
  4297. @cindex refiling notes
  4298. Remember is usually used to quickly capture notes and tasks into one or
  4299. a few capture lists. When reviewing the captured data, you may want to
  4300. refile some of the entries into a different list, for example into a
  4301. project. Cutting, finding the right location and then pasting the note
  4302. is cumbersome. To simplify this process, you can use the following
  4303. special command:
  4304. @table @kbd
  4305. @kindex C-c C-w
  4306. @item C-c C-w
  4307. Refile the entry at point. This command offers possible locations for
  4308. refiling the entry and lets you select one with completion. The item is
  4309. filed below the target heading as a subitem. Depending on
  4310. @code{org-reverse-note-order}, it will be either the first of last
  4311. subitem.@* By default, all level 1 headlines in the current buffer are
  4312. considered to be targets, but you can have more complex definitions
  4313. across a number of files. See the variable @code{org-refile-targets}
  4314. for details.
  4315. @kindex C-u C-c C-w
  4316. @item C-u C-c C-w
  4317. Use the refile interface to jump to a heading.
  4318. @kindex C-u C-u C-c C-w
  4319. @item C-u C-u C-c C-w
  4320. Jump to the location where @code{org-refile} last moved a tree to.
  4321. @end table
  4322. @node Agenda Views, Embedded LaTeX, Remember, Top
  4323. @chapter Agenda Views
  4324. @cindex agenda views
  4325. Due to the way Org works, TODO items, time-stamped items, and
  4326. tagged headlines can be scattered throughout a file or even a number of
  4327. files. To get an overview of open action items, or of events that are
  4328. important for a particular date, this information must be collected,
  4329. sorted and displayed in an organized way.
  4330. Org can select items based on various criteria, and display them
  4331. in a separate buffer. Seven different view types are provided:
  4332. @itemize @bullet
  4333. @item
  4334. an @emph{agenda} that is like a calendar and shows information
  4335. for specific dates,
  4336. @item
  4337. a @emph{TODO list} that covers all unfinished
  4338. action items,
  4339. @item
  4340. a @emph{tags view}, showings headlines based on
  4341. the tags associated with them,
  4342. @item
  4343. a @emph{timeline view} that shows all events in a single Org file,
  4344. in time-sorted view,
  4345. @item
  4346. a @emph{keyword search view} that shows all entries from multiple files
  4347. that contain specified keywords.
  4348. @item
  4349. a @emph{stuck projects view} showing projects that currently don't move
  4350. along, and
  4351. @item
  4352. @emph{custom views} that are special tag/keyword searches and
  4353. combinations of different views.
  4354. @end itemize
  4355. @noindent
  4356. The extracted information is displayed in a special @emph{agenda
  4357. buffer}. This buffer is read-only, but provides commands to visit the
  4358. corresponding locations in the original Org files, and even to
  4359. edit these files remotely.
  4360. Two variables control how the agenda buffer is displayed and whether the
  4361. window configuration is restored when the agenda exits:
  4362. @code{org-agenda-window-setup} and
  4363. @code{org-agenda-restore-windows-after-quit}.
  4364. @menu
  4365. * Agenda files:: Files being searched for agenda information
  4366. * Agenda dispatcher:: Keyboard access to agenda views
  4367. * Built-in agenda views:: What is available out of the box?
  4368. * Presentation and sorting:: How agenda items are prepared for display
  4369. * Agenda commands:: Remote editing of Org trees
  4370. * Custom agenda views:: Defining special searches and views
  4371. * Agenda column view:: Using column view for collected entries
  4372. @end menu
  4373. @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
  4374. @section Agenda files
  4375. @cindex agenda files
  4376. @cindex files for agenda
  4377. The information to be shown is normally collected from all @emph{agenda
  4378. files}, the files listed in the variable
  4379. @code{org-agenda-files}@footnote{If the value of that variable is not a
  4380. list, but a single file name, then the list of agenda files will be
  4381. maintained in that external file.}. If a directory is part of this list,
  4382. all files with the extension @file{.org} in this directory will be part
  4383. of the list.
  4384. Thus even if you only work with a single Org file, this file should
  4385. be put into that list@footnote{When using the dispatcher, pressing
  4386. @kbd{<} before selecting a command will actually limit the command to
  4387. the current file, and ignore @code{org-agenda-files} until the next
  4388. dispatcher command.}. You can customize @code{org-agenda-files}, but
  4389. the easiest way to maintain it is through the following commands
  4390. @cindex files, adding to agenda list
  4391. @table @kbd
  4392. @kindex C-c [
  4393. @item C-c [
  4394. Add current file to the list of agenda files. The file is added to
  4395. the front of the list. If it was already in the list, it is moved to
  4396. the front. With a prefix argument, file is added/moved to the end.
  4397. @kindex C-c ]
  4398. @item C-c ]
  4399. Remove current file from the list of agenda files.
  4400. @kindex C-,
  4401. @kindex C-'
  4402. @item C-,
  4403. @itemx C-'
  4404. Cycle through agenda file list, visiting one file after the other.
  4405. @kindex M-x org-iswitchb
  4406. @item M-x org-iswitchb
  4407. Command to use an @code{iswitchb}-like interface to switch to and between Org
  4408. buffers.
  4409. @end table
  4410. @noindent
  4411. The Org menu contains the current list of files and can be used
  4412. to visit any of them.
  4413. If you would like to focus the agenda temporarily onto a file not in
  4414. this list, or onto just one file in the list or even only a subtree in a
  4415. file, this can be done in different ways. For a single agenda command,
  4416. you may press @kbd{<} once or several times in the dispatcher
  4417. (@pxref{Agenda dispatcher}). To restrict the agenda scope for an
  4418. extended period, use the following commands:
  4419. @table @kbd
  4420. @kindex C-c C-x <
  4421. @item C-c C-x <
  4422. Permanently restrict the agenda to the current subtree. When with a
  4423. prefix argument, or with the cursor before the first headline in a file,
  4424. the agenda scope is set to the entire file. This restriction remains in
  4425. effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
  4426. or @kbd{>} in the agenda dispatcher. If there is a window displaying an
  4427. agenda view, the new restriction takes effect immediately.
  4428. @kindex C-c C-x <
  4429. @item C-c C-x <
  4430. Remove the permanent restriction created by @kbd{C-c C-x <}.
  4431. @end table
  4432. @noindent
  4433. When working with @file{Speedbar}, you can use the following commands in
  4434. the Speedbar frame:
  4435. @table @kbd
  4436. @kindex <
  4437. @item < @r{in the speedbar frame}
  4438. Permanently restrict the agenda to the item at the cursor in the
  4439. Speedbar frame, either an Org file or a subtree in such a file.
  4440. If there is a window displaying an agenda view, the new restriction takes
  4441. effect immediately.
  4442. @kindex <
  4443. @item > @r{in the speedbar frame}
  4444. Lift the restriction again.
  4445. @end table
  4446. @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
  4447. @section The agenda dispatcher
  4448. @cindex agenda dispatcher
  4449. @cindex dispatching agenda commands
  4450. The views are created through a dispatcher that should be bound to a
  4451. global key, for example @kbd{C-c a} (@pxref{Installation}). In the
  4452. following we will assume that @kbd{C-c a} is indeed how the dispatcher
  4453. is accessed and list keyboard access to commands accordingly. After
  4454. pressing @kbd{C-c a}, an additional letter is required to execute a
  4455. command. The dispatcher offers the following default commands:
  4456. @table @kbd
  4457. @item a
  4458. Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
  4459. @item t @r{/} T
  4460. Create a list of all TODO items (@pxref{Global TODO list}).
  4461. @item m @r{/} M
  4462. Create a list of headlines matching a TAGS expression (@pxref{Matching
  4463. tags and properties}).
  4464. @item L
  4465. Create the timeline view for the current buffer (@pxref{Timeline}).
  4466. @item s
  4467. Create a list of entries selected by a boolean expression of keywords
  4468. and/or regular expressions that must or must not occur in the entry.
  4469. @item /
  4470. Search for a regular expression in all agenda files and additionally in
  4471. the files listed in @code{org-agenda-multi-occur-extra-files}. This
  4472. uses the Emacs command @code{multi-occur}. A prefix argument can be
  4473. used to specify the number of context lines for each match, default is
  4474. 1.
  4475. @item # @r{/} !
  4476. Create a list of stuck projects (@pxref{Stuck projects}).
  4477. @item <
  4478. Restrict an agenda command to the current buffer@footnote{For backward
  4479. compatibility, you can also press @kbd{1} to restrict to the current
  4480. buffer.}. After pressing @kbd{<}, you still need to press the character
  4481. selecting the command.
  4482. @item < <
  4483. If there is an active region, restrict the following agenda command to
  4484. the region. Otherwise, restrict it to the current subtree@footnote{For
  4485. backward compatibility, you can also press @kbd{0} to restrict to the
  4486. current buffer.}. After pressing @kbd{< <}, you still need to press the
  4487. character selecting the command.
  4488. @end table
  4489. You can also define custom commands that will be accessible through the
  4490. dispatcher, just like the default commands. This includes the
  4491. possibility to create extended agenda buffers that contain several
  4492. blocks together, for example the weekly agenda, the global TODO list and
  4493. a number of special tags matches. @xref{Custom agenda views}.
  4494. @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
  4495. @section The built-in agenda views
  4496. In this section we describe the built-in views.
  4497. @menu
  4498. * Weekly/daily agenda:: The calendar page with current tasks
  4499. * Global TODO list:: All unfinished action items
  4500. * Matching tags and properties:: Structured information with fine-tuned search
  4501. * Timeline:: Time-sorted view for single file
  4502. * Keyword search:: Finding entries by keyword
  4503. * Stuck projects:: Find projects you need to review
  4504. @end menu
  4505. @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
  4506. @subsection The weekly/daily agenda
  4507. @cindex agenda
  4508. @cindex weekly agenda
  4509. @cindex daily agenda
  4510. The purpose of the weekly/daily @emph{agenda} is to act like a page of a
  4511. paper agenda, showing all the tasks for the current week or day.
  4512. @table @kbd
  4513. @cindex org-agenda, command
  4514. @kindex C-c a a
  4515. @item C-c a a
  4516. Compile an agenda for the current week from a list of org files. The
  4517. agenda shows the entries for each day. With a numeric
  4518. prefix@footnote{For backward compatibility, the universal prefix
  4519. @kbd{C-u} causes all TODO entries to be listed before the agenda. This
  4520. feature is deprecated, use the dedicated TODO list, or a block agenda
  4521. instead.} (like @kbd{C-u 2 1 C-c a a}) you may set the number of days
  4522. to be displayed (see also the variable @code{org-agenda-ndays})
  4523. @end table
  4524. Remote editing from the agenda buffer means, for example, that you can
  4525. change the dates of deadlines and appointments from the agenda buffer.
  4526. The commands available in the Agenda buffer are listed in @ref{Agenda
  4527. commands}.
  4528. @subsubheading Calendar/Diary integration
  4529. @cindex calendar integration
  4530. @cindex diary integration
  4531. Emacs contains the calendar and diary by Edward M. Reingold. The
  4532. calendar displays a three-month calendar with holidays from different
  4533. countries and cultures. The diary allows you to keep track of
  4534. anniversaries, lunar phases, sunrise/set, recurrent appointments
  4535. (weekly, monthly) and more. In this way, it is quite complementary to
  4536. Org. It can be very useful to combine output from Org with
  4537. the diary.
  4538. In order to include entries from the Emacs diary into Org mode's
  4539. agenda, you only need to customize the variable
  4540. @lisp
  4541. (setq org-agenda-include-diary t)
  4542. @end lisp
  4543. @noindent After that, everything will happen automatically. All diary
  4544. entries including holidays, anniversaries etc will be included in the
  4545. agenda buffer created by Org mode. @key{SPC}, @key{TAB}, and
  4546. @key{RET} can be used from the agenda buffer to jump to the diary
  4547. file in order to edit existing diary entries. The @kbd{i} command to
  4548. insert new entries for the current date works in the agenda buffer, as
  4549. well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
  4550. Sunrise/Sunset times, show lunar phases and to convert to other
  4551. calendars, respectively. @kbd{c} can be used to switch back and forth
  4552. between calendar and agenda.
  4553. If you are using the diary only for sexp entries and holidays, it is
  4554. faster to not use the above setting, but instead to copy or even move
  4555. the entries into an Org file. Org mode evaluates diary-style sexp
  4556. entries, and does it faster because there is no overhead for first
  4557. creating the diary display. Note that the sexp entries must start at
  4558. the left margin, no white space is allowed before them. For example,
  4559. the following segment of an Org file will be processed and entries
  4560. will be made in the agenda:
  4561. @example
  4562. * Birthdays and similar stuff
  4563. #+CATEGORY: Holiday
  4564. %%(org-calendar-holiday) ; special function for holiday names
  4565. #+CATEGORY: Ann
  4566. %%(diary-anniversary 14 5 1956) Arthur Dent is %d years old
  4567. %%(diary-anniversary 2 10 1869) Mahatma Gandhi would be %d years old
  4568. @end example
  4569. @subsubheading Appointment reminders
  4570. @cindex @file{appt.el}
  4571. @cindex appointment reminders
  4572. Org can interact with Emacs appointments notification facility.
  4573. To add all the appointments of your agenda files, use the command
  4574. @code{org-agenda-to-appt}. This commands also lets you filter through
  4575. the list of your appointments and add only those belonging to a specific
  4576. category or matching a regular expression. See the docstring for
  4577. details.
  4578. @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
  4579. @subsection The global TODO list
  4580. @cindex global TODO list
  4581. @cindex TODO list, global
  4582. The global TODO list contains all unfinished TODO items, formatted and
  4583. collected into a single place.
  4584. @table @kbd
  4585. @kindex C-c a t
  4586. @item C-c a t
  4587. Show the global TODO list. This collects the TODO items from all
  4588. agenda files (@pxref{Agenda Views}) into a single buffer. The buffer is in
  4589. @code{agenda-mode}, so there are commands to examine and manipulate
  4590. the TODO entries directly from that buffer (@pxref{Agenda commands}).
  4591. @kindex C-c a T
  4592. @item C-c a T
  4593. @cindex TODO keyword matching
  4594. Like the above, but allows selection of a specific TODO keyword. You
  4595. can also do this by specifying a prefix argument to @kbd{C-c a t}. With
  4596. a @kbd{C-u} prefix you are prompted for a keyword, and you may also
  4597. specify several keywords by separating them with @samp{|} as boolean OR
  4598. operator. With a numeric prefix, the Nth keyword in
  4599. @code{org-todo-keywords} is selected.
  4600. @kindex r
  4601. The @kbd{r} key in the agenda buffer regenerates it, and you can give
  4602. a prefix argument to this command to change the selected TODO keyword,
  4603. for example @kbd{3 r}. If you often need a search for a specific
  4604. keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
  4605. Matching specific TODO keywords can also be done as part of a tags
  4606. search (@pxref{Tag searches}).
  4607. @end table
  4608. Remote editing of TODO items means that you can change the state of a
  4609. TODO entry with a single key press. The commands available in the
  4610. TODO list are described in @ref{Agenda commands}.
  4611. @cindex sublevels, inclusion into TODO list
  4612. Normally the global TODO list simply shows all headlines with TODO
  4613. keywords. This list can become very long. There are two ways to keep
  4614. it more compact:
  4615. @itemize @minus
  4616. @item
  4617. Some people view a TODO item that has been @emph{scheduled} for
  4618. execution (@pxref{Timestamps}) as no longer @emph{open}. Configure the
  4619. variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
  4620. items from the global TODO list.
  4621. @item
  4622. TODO items may have sublevels to break up the task into subtasks. In
  4623. such cases it may be enough to list only the highest level TODO headline
  4624. and omit the sublevels from the global list. Configure the variable
  4625. @code{org-agenda-todo-list-sublevels} to get this behavior.
  4626. @end itemize
  4627. @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
  4628. @subsection Matching tags and properties
  4629. @cindex matching, of tags
  4630. @cindex matching, of properties
  4631. @cindex tags view
  4632. If headlines in the agenda files are marked with @emph{tags}
  4633. (@pxref{Tags}), you can select headlines based on the tags that apply
  4634. to them and collect them into an agenda buffer.
  4635. @table @kbd
  4636. @kindex C-c a m
  4637. @item C-c a m
  4638. Produce a list of all headlines that match a given set of tags. The
  4639. command prompts for a selection criterion, which is a boolean logic
  4640. expression with tags, like @samp{+work+urgent-withboss} or
  4641. @samp{work|home} (@pxref{Tags}). If you often need a specific search,
  4642. define a custom command for it (@pxref{Agenda dispatcher}).
  4643. @kindex C-c a M
  4644. @item C-c a M
  4645. Like @kbd{C-c a m}, but only select headlines that are also TODO items
  4646. and force checking subitems (see variable
  4647. @code{org-tags-match-list-sublevels}). Matching specific TODO keywords
  4648. together with a tags match is also possible, see @ref{Tag searches}.
  4649. @end table
  4650. The commands available in the tags list are described in @ref{Agenda
  4651. commands}.
  4652. @node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
  4653. @subsection Timeline for a single file
  4654. @cindex timeline, single file
  4655. @cindex time-sorted view
  4656. The timeline summarizes all time-stamped items from a single Org mode
  4657. file in a @emph{time-sorted view}. The main purpose of this command is
  4658. to give an overview over events in a project.
  4659. @table @kbd
  4660. @kindex C-c a L
  4661. @item C-c a L
  4662. Show a time-sorted view of the org file, with all time-stamped items.
  4663. When called with a @kbd{C-u} prefix, all unfinished TODO entries
  4664. (scheduled or not) are also listed under the current date.
  4665. @end table
  4666. @noindent
  4667. The commands available in the timeline buffer are listed in
  4668. @ref{Agenda commands}.
  4669. @node Keyword search, Stuck projects, Timeline, Built-in agenda views
  4670. @subsection Keyword search
  4671. @cindex keyword search
  4672. @cindex searching, for keywords
  4673. This agenda view is a general text search facility for Org mode entries.
  4674. It is particularly useful to find notes.
  4675. @table @kbd
  4676. @kindex C-c a s
  4677. @item C-c a s
  4678. This is a special search that lets you select entries by keywords or
  4679. regular expression, using a boolean logic. For example, the search
  4680. string
  4681. @example
  4682. +computer +wifi -ethernet -@{8\.11[bg]@}
  4683. @end example
  4684. @noindent
  4685. will search for note entries that contain the keywords @code{computer}
  4686. and @code{wifi}, but not the keyword @code{ethernet}, and which are also
  4687. not matched by the regular expression @code{8\.11[bg]}, meaning to
  4688. exclude both 8.11b and 8.11g.
  4689. Note that in addition to the agenda files, this command will also search
  4690. the files listed in @code{org-agenda-text-search-extra-files}.
  4691. @end table
  4692. @node Stuck projects, , Keyword search, Built-in agenda views
  4693. @subsection Stuck projects
  4694. If you are following a system like David Allen's GTD to organize your
  4695. work, one of the ``duties'' you have is a regular review to make sure
  4696. that all projects move along. A @emph{stuck} project is a project that
  4697. has no defined next actions, so it will never show up in the TODO lists
  4698. Org mode produces. During the review, you need to identify such
  4699. projects and define next actions for them.
  4700. @table @kbd
  4701. @kindex C-c a #
  4702. @item C-c a #
  4703. List projects that are stuck.
  4704. @kindex C-c a !
  4705. @item C-c a !
  4706. Customize the variable @code{org-stuck-projects} to define what a stuck
  4707. project is and how to find it.
  4708. @end table
  4709. You almost certainly will have to configure this view before it will
  4710. work for you. The built-in default assumes that all your projects are
  4711. level-2 headlines, and that a project is not stuck if it has at least
  4712. one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
  4713. Lets assume that you, in your own way of using Org mode, identify
  4714. projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
  4715. indicate a project that should not be considered yet. Lets further
  4716. assume that the TODO keyword DONE marks finished projects, and that NEXT
  4717. and TODO indicate next actions. The tag @@SHOP indicates shopping and
  4718. is a next action even without the NEXT tag. Finally, if the project
  4719. contains the special word IGNORE anywhere, it should not be listed
  4720. either. In this case you would start by identifying eligible projects
  4721. with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
  4722. TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
  4723. are not stuck. The correct customization for this is
  4724. @lisp
  4725. (setq org-stuck-projects
  4726. '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
  4727. "\\<IGNORE\\>"))
  4728. @end lisp
  4729. @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
  4730. @section Presentation and sorting
  4731. @cindex presentation, of agenda items
  4732. Before displaying items in an agenda view, Org mode visually prepares
  4733. the items and sorts them. Each item occupies a single line. The line
  4734. starts with a @emph{prefix} that contains the @emph{category}
  4735. (@pxref{Categories}) of the item and other important information. You can
  4736. customize the prefix using the option @code{org-agenda-prefix-format}.
  4737. The prefix is followed by a cleaned-up version of the outline headline
  4738. associated with the item.
  4739. @menu
  4740. * Categories:: Not all tasks are equal
  4741. * Time-of-day specifications:: How the agenda knows the time
  4742. * Sorting of agenda items:: The order of things
  4743. @end menu
  4744. @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
  4745. @subsection Categories
  4746. @cindex category
  4747. The category is a broad label assigned to each agenda item. By default,
  4748. the category is simply derived from the file name, but you can also
  4749. specify it with a special line in the buffer, like this@footnote{For
  4750. backward compatibility, the following also works: If there are several
  4751. such lines in a file, each specifies the category for the text below it.
  4752. The first category also applies to any text before the first CATEGORY
  4753. line. However, using this method is @emph{strongly} deprecated as it is
  4754. incompatible with the outline structure of the document. The correct
  4755. method for setting multiple categories in a buffer is using a
  4756. property.}:
  4757. @example
  4758. #+CATEGORY: Thesis
  4759. @end example
  4760. @noindent
  4761. If you would like to have a special CATEGORY for a single entry or a
  4762. (sub)tree, give the entry a @code{:CATEGORY:} property with the location
  4763. as the value (@pxref{Properties and Columns}).
  4764. @noindent
  4765. The display in the agenda buffer looks best if the category is not
  4766. longer than 10 characters.
  4767. @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
  4768. @subsection Time-of-day specifications
  4769. @cindex time-of-day specification
  4770. Org mode checks each agenda item for a time-of-day specification. The
  4771. time can be part of the time stamp that triggered inclusion into the
  4772. agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time
  4773. ranges can be specified with two time stamps, like
  4774. @c
  4775. @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
  4776. In the headline of the entry itself, a time(range) may also appear as
  4777. plain text (like @samp{12:45} or a @samp{8:30-1pm}. If the agenda
  4778. integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
  4779. specifications in diary entries are recognized as well.
  4780. For agenda display, Org mode extracts the time and displays it in a
  4781. standard 24 hour format as part of the prefix. The example times in
  4782. the previous paragraphs would end up in the agenda like this:
  4783. @example
  4784. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  4785. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  4786. 19:00...... The Vogon reads his poem
  4787. 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
  4788. @end example
  4789. @cindex time grid
  4790. If the agenda is in single-day mode, or for the display of today, the
  4791. timed entries are embedded in a time grid, like
  4792. @example
  4793. 8:00...... ------------------
  4794. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  4795. 10:00...... ------------------
  4796. 12:00...... ------------------
  4797. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  4798. 14:00...... ------------------
  4799. 16:00...... ------------------
  4800. 18:00...... ------------------
  4801. 19:00...... The Vogon reads his poem
  4802. 20:00...... ------------------
  4803. 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
  4804. @end example
  4805. The time grid can be turned on and off with the variable
  4806. @code{org-agenda-use-time-grid}, and can be configured with
  4807. @code{org-agenda-time-grid}.
  4808. @node Sorting of agenda items, , Time-of-day specifications, Presentation and sorting
  4809. @subsection Sorting of agenda items
  4810. @cindex sorting, of agenda items
  4811. @cindex priorities, of agenda items
  4812. Before being inserted into a view, the items are sorted. How this is
  4813. done depends on the type of view.
  4814. @itemize @bullet
  4815. @item
  4816. For the daily/weekly agenda, the items for each day are sorted. The
  4817. default order is to first collect all items containing an explicit
  4818. time-of-day specification. These entries will be shown at the beginning
  4819. of the list, as a @emph{schedule} for the day. After that, items remain
  4820. grouped in categories, in the sequence given by @code{org-agenda-files}.
  4821. Within each category, items are sorted by priority (@pxref{Priorities}),
  4822. which is composed of the base priority (2000 for priority @samp{A}, 1000
  4823. for @samp{B}, and 0 for @samp{C}), plus additional increments for
  4824. overdue scheduled or deadline items.
  4825. @item
  4826. For the TODO list, items remain in the order of categories, but within
  4827. each category, sorting takes place according to priority
  4828. (@pxref{Priorities}).
  4829. @item
  4830. For tags matches, items are not sorted at all, but just appear in the
  4831. sequence in which they are found in the agenda files.
  4832. @end itemize
  4833. Sorting can be customized using the variable
  4834. @code{org-agenda-sorting-strategy}, and may also include criteria based on
  4835. the estimated effort of an entry.
  4836. @c FIXME: link!!!!!!!!
  4837. @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
  4838. @section Commands in the agenda buffer
  4839. @cindex commands, in agenda buffer
  4840. Entries in the agenda buffer are linked back to the org file or diary
  4841. file where they originate. You are not allowed to edit the agenda
  4842. buffer itself, but commands are provided to show and jump to the
  4843. original entry location, and to edit the org-files ``remotely'' from
  4844. the agenda buffer. In this way, all information is stored only once,
  4845. removing the risk that your agenda and note files may diverge.
  4846. Some commands can be executed with mouse clicks on agenda lines. For
  4847. the other commands, the cursor needs to be in the desired line.
  4848. @table @kbd
  4849. @tsubheading{Motion}
  4850. @cindex motion commands in agenda
  4851. @kindex n
  4852. @item n
  4853. Next line (same as @key{up} and @kbd{C-p}).
  4854. @kindex p
  4855. @item p
  4856. Previous line (same as @key{down} and @kbd{C-n}).
  4857. @tsubheading{View/Go to org file}
  4858. @kindex mouse-3
  4859. @kindex @key{SPC}
  4860. @item mouse-3
  4861. @itemx @key{SPC}
  4862. Display the original location of the item in another window.
  4863. @c
  4864. @kindex L
  4865. @item L
  4866. Display original location and recenter that window.
  4867. @c
  4868. @kindex mouse-2
  4869. @kindex mouse-1
  4870. @kindex @key{TAB}
  4871. @item mouse-2
  4872. @itemx mouse-1
  4873. @itemx @key{TAB}
  4874. Go to the original location of the item in another window. Under Emacs
  4875. 22, @kbd{mouse-1} will also works for this.
  4876. @c
  4877. @kindex @key{RET}
  4878. @itemx @key{RET}
  4879. Go to the original location of the item and delete other windows.
  4880. @c
  4881. @kindex f
  4882. @item f
  4883. Toggle Follow mode. In Follow mode, as you move the cursor through
  4884. the agenda buffer, the other window always shows the corresponding
  4885. location in the org file. The initial setting for this mode in new
  4886. agenda buffers can be set with the variable
  4887. @code{org-agenda-start-with-follow-mode}.
  4888. @c
  4889. @kindex b
  4890. @item b
  4891. Display the entire subtree of the current item in an indirect buffer. With a
  4892. numeric prefix argument N, go up to level N and then take that tree. If N is
  4893. negative, go up that many levels. With a @kbd{C-u} prefix, do not remove the
  4894. previously used indirect buffer.
  4895. @c
  4896. @kindex l
  4897. @item l
  4898. Toggle Logbook mode. In Logbook mode, entries that where marked DONE while
  4899. logging was on (variable @code{org-log-done}) are shown in the agenda,
  4900. as are entries that have been clocked on that day.
  4901. @c
  4902. @kindex R
  4903. @item R
  4904. Toggle Clockreport mode. In clockreport mode, the daily/weekly agenda will
  4905. always show a table with the clocked times for the timespan and file scope
  4906. covered by the current agenda view. The initial setting for this mode in new
  4907. agenda buffers can be set with the variable
  4908. @code{org-agenda-start-with-clockreport-mode}.
  4909. @tsubheading{Change display}
  4910. @cindex display changing, in agenda
  4911. @kindex o
  4912. @item o
  4913. Delete other windows.
  4914. @c
  4915. @kindex d
  4916. @kindex w
  4917. @kindex m
  4918. @kindex y
  4919. @item d w m y
  4920. Switch to day/week/month/year view. When switching to day or week view,
  4921. this setting becomes the default for subsequent agenda commands. Since
  4922. month and year views are slow to create, they do not become the default.
  4923. A numeric prefix argument may be used to jump directly to a specific day
  4924. of the year, ISO week, month, or year, respectively. For example,
  4925. @kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9. When
  4926. setting day, week, or month view, a year may be encoded in the prefix
  4927. argument as well. For example, @kbd{200712 w} will jump to week 12 in
  4928. 2007. If such a year specification has only one or two digits, it will
  4929. be mapped to the interval 1938-2037.
  4930. @c
  4931. @kindex D
  4932. @item D
  4933. Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
  4934. @c
  4935. @kindex G
  4936. @item G
  4937. Toggle the time grid on and off. See also the variables
  4938. @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
  4939. @c
  4940. @kindex r
  4941. @item r
  4942. Recreate the agenda buffer, for example to reflect the changes
  4943. after modification of the time stamps of items with S-@key{left} and
  4944. S-@key{right}. When the buffer is the global TODO list, a prefix
  4945. argument is interpreted to create a selective list for a specific TODO
  4946. keyword.
  4947. @kindex g
  4948. @item g
  4949. Same as @kbd{r}.
  4950. @c
  4951. @kindex s
  4952. @kindex C-x C-s
  4953. @item s
  4954. @itemx C-x C-s
  4955. Save all Org buffers in the current Emacs session.
  4956. @c
  4957. @kindex @key{right}
  4958. @item @key{right}
  4959. Display the following @code{org-agenda-ndays} days. For example, if
  4960. the display covers a week, switch to the following week. With prefix
  4961. arg, go forward that many times @code{org-agenda-ndays} days.
  4962. @c
  4963. @kindex @key{left}
  4964. @item @key{left}
  4965. Display the previous dates.
  4966. @c
  4967. @kindex .
  4968. @item .
  4969. Go to today.
  4970. @c
  4971. @kindex C-c C-x C-c
  4972. @item C-c C-x C-c
  4973. Invoke column view (@pxref{Column view}) in the agenda buffer. The column
  4974. view format is taken from the entry at point, or (if there is no entry at
  4975. point), from the first entry in the agenda view. So whatever the format for
  4976. that entry would be in the original buffer (taken from a property, from a
  4977. @code{#+COLUMNS} line, or from the default variable
  4978. @code{org-columns-default-format}), will be used in the agenda.
  4979. @tsubheading{Query editing}
  4980. @cindex query editing, in agenda
  4981. @kindex [
  4982. @kindex ]
  4983. @kindex @{
  4984. @kindex @}
  4985. @item [ ] @{ @}
  4986. In the @i{search view} (@pxref{Keyword search}), these keys add new
  4987. search words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{}
  4988. and @kbd{@}}) to the query string. The opening bracket/brace will add a
  4989. positive search term prefixed by @samp{+}, indicating that this search
  4990. term @i{must} occur/match in the entry. Closing bracket/brace add a
  4991. negative search term which @i{must not} occur/match in the entry for it
  4992. to be selected.
  4993. @tsubheading{Remote editing}
  4994. @cindex remote editing, from agenda
  4995. @item 0-9
  4996. Digit argument.
  4997. @c
  4998. @cindex undoing remote-editing events
  4999. @cindex remote editing, undo
  5000. @kindex C-_
  5001. @item C-_
  5002. Undo a change due to a remote editing command. The change is undone
  5003. both in the agenda buffer and in the remote buffer.
  5004. @c
  5005. @kindex t
  5006. @item t
  5007. Change the TODO state of the item, both in the agenda and in the
  5008. original org file.
  5009. @c
  5010. @kindex C-k
  5011. @item C-k
  5012. Delete the current agenda item along with the entire subtree belonging
  5013. to it in the original Org file. If the text to be deleted remotely
  5014. is longer than one line, the kill needs to be confirmed by the user. See
  5015. variable @code{org-agenda-confirm-kill}.
  5016. @c
  5017. @kindex a
  5018. @item a
  5019. Toggle the ARCHIVE tag for the current headline.
  5020. @c
  5021. @kindex A
  5022. @item A
  5023. Move the subtree corresponding to the current entry to its @emph{Archive
  5024. Sibling}.
  5025. @c
  5026. @kindex $
  5027. @item $
  5028. Archive the subtree corresponding to the current headline. This means the
  5029. entry will be moved to the configured archive location, most likely a
  5030. different file.
  5031. @c
  5032. @kindex T
  5033. @item T
  5034. Show all tags associated with the current item. Because of
  5035. inheritance, this may be more than the tags listed in the line itself.
  5036. @c
  5037. @kindex :
  5038. @item :
  5039. Set tags for the current headline. If there is an active region in the
  5040. agenda, change a tag for all headings in the region.
  5041. @c
  5042. @kindex ,
  5043. @item ,
  5044. Set the priority for the current item. Org mode prompts for the
  5045. priority character. If you reply with @key{SPC}, the priority cookie
  5046. is removed from the entry.
  5047. @c
  5048. @kindex P
  5049. @item P
  5050. Display weighted priority of current item.
  5051. @c
  5052. @kindex +
  5053. @kindex S-@key{up}
  5054. @item +
  5055. @itemx S-@key{up}
  5056. Increase the priority of the current item. The priority is changed in
  5057. the original buffer, but the agenda is not resorted. Use the @kbd{r}
  5058. key for this.
  5059. @c
  5060. @kindex -
  5061. @kindex S-@key{down}
  5062. @item -
  5063. @itemx S-@key{down}
  5064. Decrease the priority of the current item.
  5065. @c
  5066. @kindex C-c C-s
  5067. @item C-c C-s
  5068. Schedule this item
  5069. @c
  5070. @kindex C-c C-d
  5071. @item C-c C-d
  5072. Set a deadline for this item.
  5073. @c
  5074. @kindex S-@key{right}
  5075. @item S-@key{right}
  5076. Change the time stamp associated with the current line by one day into the
  5077. future. With a numeric prefix argument, change it by that many days. For
  5078. example, @kbd{3 6 5 S-@key{right}} will change it by a year. The stamp is
  5079. changed in the original org file, but the change is not directly reflected in
  5080. the agenda buffer. Use the @kbd{r} key to update the buffer.
  5081. @c
  5082. @kindex S-@key{left}
  5083. @item S-@key{left}
  5084. Change the time stamp associated with the current line by one day
  5085. into the past.
  5086. @c
  5087. @kindex >
  5088. @item >
  5089. Change the time stamp associated with the current line to today.
  5090. The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
  5091. on my keyboard.
  5092. @c
  5093. @kindex I
  5094. @item I
  5095. Start the clock on the current item. If a clock is running already, it
  5096. is stopped first.
  5097. @c
  5098. @kindex O
  5099. @item O
  5100. Stop the previously started clock.
  5101. @c
  5102. @kindex X
  5103. @item X
  5104. Cancel the currently running clock.
  5105. @kindex J
  5106. @item J
  5107. Jump to the running clock in another window.
  5108. @tsubheading{Calendar commands}
  5109. @cindex calendar commands, from agenda
  5110. @kindex c
  5111. @item c
  5112. Open the Emacs calendar and move to the date at the agenda cursor.
  5113. @c
  5114. @item c
  5115. When in the calendar, compute and show the Org mode agenda for the
  5116. date at the cursor.
  5117. @c
  5118. @cindex diary entries, creating from agenda
  5119. @kindex i
  5120. @item i
  5121. Insert a new entry into the diary. Prompts for the type of entry
  5122. (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
  5123. entry in the diary, just as @kbd{i d} etc. would do in the calendar.
  5124. The date is taken from the cursor position.
  5125. @c
  5126. @kindex M
  5127. @item M
  5128. Show the phases of the moon for the three months around current date.
  5129. @c
  5130. @kindex S
  5131. @item S
  5132. Show sunrise and sunset times. The geographical location must be set
  5133. with calendar variables, see documentation of the Emacs calendar.
  5134. @c
  5135. @kindex C
  5136. @item C
  5137. Convert the date at cursor into many other cultural and historic
  5138. calendars.
  5139. @c
  5140. @kindex H
  5141. @item H
  5142. Show holidays for three month around the cursor date.
  5143. @item M-x org-export-icalendar-combine-agenda-files
  5144. Export a single iCalendar file containing entries from all agenda files.
  5145. This is a globally available command, and also available in the agenda menu.
  5146. @tsubheading{Exporting to a file}
  5147. @kindex C-x C-w
  5148. @item C-x C-w
  5149. @cindex exporting agenda views
  5150. @cindex agenda views, exporting
  5151. Write the agenda view to a file. Depending on the extension of the
  5152. selected file name, the view will be exported as HTML (extension
  5153. @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
  5154. plain text (any other extension). Use the variable
  5155. @code{org-agenda-exporter-settings} to set options for @file{ps-print}
  5156. and for @file{htmlize} to be used during export.
  5157. @tsubheading{Quit and Exit}
  5158. @kindex q
  5159. @item q
  5160. Quit agenda, remove the agenda buffer.
  5161. @c
  5162. @kindex x
  5163. @cindex agenda files, removing buffers
  5164. @item x
  5165. Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
  5166. for the compilation of the agenda. Buffers created by the user to
  5167. visit org files will not be removed.
  5168. @end table
  5169. @node Custom agenda views, Agenda column view, Agenda commands, Agenda Views
  5170. @section Custom agenda views
  5171. @cindex custom agenda views
  5172. @cindex agenda views, custom
  5173. Custom agenda commands serve two purposes: to store and quickly access
  5174. frequently used TODO and tags searches, and to create special composite
  5175. agenda buffers. Custom agenda commands will be accessible through the
  5176. dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
  5177. @menu
  5178. * Storing searches:: Type once, use often
  5179. * Block agenda:: All the stuff you need in a single buffer
  5180. * Setting Options:: Changing the rules
  5181. * Exporting Agenda Views:: Writing agendas to files
  5182. * Using the agenda elsewhere:: Using agenda information in other programs
  5183. @end menu
  5184. @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
  5185. @subsection Storing searches
  5186. The first application of custom searches is the definition of keyboard
  5187. shortcuts for frequently used searches, either creating an agenda
  5188. buffer, or a sparse tree (the latter covering of course only the current
  5189. buffer).
  5190. @kindex C-c a C
  5191. Custom commands are configured in the variable
  5192. @code{org-agenda-custom-commands}. You can customize this variable, for
  5193. example by pressing @kbd{C-c a C}. You can also directly set it with
  5194. Emacs Lisp in @file{.emacs}. The following example contains all valid
  5195. search types:
  5196. @lisp
  5197. @group
  5198. (setq org-agenda-custom-commands
  5199. '(("w" todo "WAITING")
  5200. ("W" todo-tree "WAITING")
  5201. ("u" tags "+boss-urgent")
  5202. ("v" tags-todo "+boss-urgent")
  5203. ("U" tags-tree "+boss-urgent")
  5204. ("f" occur-tree "\\<FIXME\\>")
  5205. ("h" . "HOME+Name tags searches") ; description for "h" prefix
  5206. ("hl" tags "+home+Lisa")
  5207. ("hp" tags "+home+Peter")
  5208. ("hk" tags "+home+Kim")))
  5209. @end group
  5210. @end lisp
  5211. @noindent
  5212. The initial string in each entry defines the keys you have to press
  5213. after the dispatcher command @kbd{C-c a} in order to access the command.
  5214. Usually this will be just a single character, but if you have many
  5215. similar commands, you can also define two-letter combinations where the
  5216. first character is the same in several combinations and serves as a
  5217. prefix key@footnote{You can provide a description for a prefix key by
  5218. inserting a cons cell with the prefix and the description.}. The second
  5219. parameter is the search type, followed by the string or regular
  5220. expression to be used for the matching. The example above will
  5221. therefore define:
  5222. @table @kbd
  5223. @item C-c a w
  5224. as a global search for TODO entries with @samp{WAITING} as the TODO
  5225. keyword
  5226. @item C-c a W
  5227. as the same search, but only in the current buffer and displaying the
  5228. results as a sparse tree
  5229. @item C-c a u
  5230. as a global tags search for headlines marked @samp{:boss:} but not
  5231. @samp{:urgent:}
  5232. @item C-c a v
  5233. as the same search as @kbd{C-c a u}, but limiting the search to
  5234. headlines that are also TODO items
  5235. @item C-c a U
  5236. as the same search as @kbd{C-c a u}, but only in the current buffer and
  5237. displaying the result as a sparse tree
  5238. @item C-c a f
  5239. to create a sparse tree (again: current buffer only) with all entries
  5240. containing the word @samp{FIXME}
  5241. @item C-c a h
  5242. as a prefix command for a HOME tags search where you have to press an
  5243. additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
  5244. Peter, or Kim) as additional tag to match.
  5245. @end table
  5246. @node Block agenda, Setting Options, Storing searches, Custom agenda views
  5247. @subsection Block agenda
  5248. @cindex block agenda
  5249. @cindex agenda, with block views
  5250. Another possibility is the construction of agenda views that comprise
  5251. the results of @emph{several} commands, each of which creates a block in
  5252. the agenda buffer. The available commands include @code{agenda} for the
  5253. daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
  5254. for the global TODO list (as constructed with @kbd{C-c a t}), and the
  5255. matching commands discussed above: @code{todo}, @code{tags}, and
  5256. @code{tags-todo}. Here are two examples:
  5257. @lisp
  5258. @group
  5259. (setq org-agenda-custom-commands
  5260. '(("h" "Agenda and Home-related tasks"
  5261. ((agenda "")
  5262. (tags-todo "home")
  5263. (tags "garden")))
  5264. ("o" "Agenda and Office-related tasks"
  5265. ((agenda "")
  5266. (tags-todo "work")
  5267. (tags "office")))))
  5268. @end group
  5269. @end lisp
  5270. @noindent
  5271. This will define @kbd{C-c a h} to create a multi-block view for stuff
  5272. you need to attend to at home. The resulting agenda buffer will contain
  5273. your agenda for the current week, all TODO items that carry the tag
  5274. @samp{home}, and also all lines tagged with @samp{garden}. Finally the
  5275. command @kbd{C-c a o} provides a similar view for office tasks.
  5276. @node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
  5277. @subsection Setting options for custom commands
  5278. @cindex options, for custom agenda views
  5279. Org mode contains a number of variables regulating agenda construction
  5280. and display. The global variables define the behavior for all agenda
  5281. commands, including the custom commands. However, if you want to change
  5282. some settings just for a single custom view, you can do so. Setting
  5283. options requires inserting a list of variable names and values at the
  5284. right spot in @code{org-agenda-custom-commands}. For example:
  5285. @lisp
  5286. @group
  5287. (setq org-agenda-custom-commands
  5288. '(("w" todo "WAITING"
  5289. ((org-agenda-sorting-strategy '(priority-down))
  5290. (org-agenda-prefix-format " Mixed: ")))
  5291. ("U" tags-tree "+boss-urgent"
  5292. ((org-show-following-heading nil)
  5293. (org-show-hierarchy-above nil)))
  5294. ("N" search ""
  5295. ((org-agenda-files '("~org/notes.org"))
  5296. (org-agenda-text-search-extra-files nil)))))
  5297. @end group
  5298. @end lisp
  5299. @noindent
  5300. Now the @kbd{C-c a w} command will sort the collected entries only by
  5301. priority, and the prefix format is modified to just say @samp{ Mixed: }
  5302. instead of giving the category of the entry. The sparse tags tree of
  5303. @kbd{C-c a U} will now turn out ultra-compact, because neither the
  5304. headline hierarchy above the match, nor the headline following the match
  5305. will be shown. The command @kbd{C-c a N} will do a text search limited
  5306. to only a single file.
  5307. For command sets creating a block agenda,
  5308. @code{org-agenda-custom-commands} has two separate spots for setting
  5309. options. You can add options that should be valid for just a single
  5310. command in the set, and options that should be valid for all commands in
  5311. the set. The former are just added to the command entry, the latter
  5312. must come after the list of command entries. Going back to the block
  5313. agenda example (@pxref{Block agenda}), let's change the sorting strategy
  5314. for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
  5315. the results for GARDEN tags query in the opposite order,
  5316. @code{priority-up}. This would look like this:
  5317. @lisp
  5318. @group
  5319. (setq org-agenda-custom-commands
  5320. '(("h" "Agenda and Home-related tasks"
  5321. ((agenda)
  5322. (tags-todo "home")
  5323. (tags "garden"
  5324. ((org-agenda-sorting-strategy '(priority-up)))))
  5325. ((org-agenda-sorting-strategy '(priority-down))))
  5326. ("o" "Agenda and Office-related tasks"
  5327. ((agenda)
  5328. (tags-todo "work")
  5329. (tags "office")))))
  5330. @end group
  5331. @end lisp
  5332. As you see, the values and parenthesis setting is a little complex.
  5333. When in doubt, use the customize interface to set this variable - it
  5334. fully supports its structure. Just one caveat: When setting options in
  5335. this interface, the @emph{values} are just lisp expressions. So if the
  5336. value is a string, you need to add the double quotes around the value
  5337. yourself.
  5338. @node Exporting Agenda Views, Using the agenda elsewhere, Setting Options, Custom agenda views
  5339. @subsection Exporting Agenda Views
  5340. @cindex agenda views, exporting
  5341. If you are away from your computer, it can be very useful to have a
  5342. printed version of some agenda views to carry around. Org mode can
  5343. export custom agenda views as plain text, HTML@footnote{You need to
  5344. install Hrvoje Niksic' @file{htmlize.el}.} postscript, and iCalendar
  5345. files. If you want to do this only occasionally, use the command
  5346. @table @kbd
  5347. @kindex C-x C-w
  5348. @item C-x C-w
  5349. @cindex exporting agenda views
  5350. @cindex agenda views, exporting
  5351. Write the agenda view to a file. Depending on the extension of the
  5352. selected file name, the view will be exported as HTML (extension
  5353. @file{.html} or @file{.htm}), Postscript (extension @file{.ps}),
  5354. iCalendar (extension @file{.ics}), or plain text (any other extension).
  5355. Use the variable @code{org-agenda-exporter-settings} to
  5356. set options for @file{ps-print} and for @file{htmlize} to be used during
  5357. export, for example
  5358. @lisp
  5359. (setq org-agenda-exporter-settings
  5360. '((ps-number-of-columns 2)
  5361. (ps-landscape-mode t)
  5362. (htmlize-output-type 'css)))
  5363. @end lisp
  5364. @end table
  5365. If you need to export certain agenda views frequently, you can associate
  5366. any custom agenda command with a list of output file names
  5367. @footnote{If you want to store standard views like the weekly agenda
  5368. or the global TODO list as well, you need to define custom commands for
  5369. them in order to be able to specify file names.}. Here is an example
  5370. that first does define custom commands for the agenda and the global
  5371. todo list, together with a number of files to which to export them.
  5372. Then we define two block agenda commands and specify file names for them
  5373. as well. File names can be relative to the current working directory,
  5374. or absolute.
  5375. @lisp
  5376. @group
  5377. (setq org-agenda-custom-commands
  5378. '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  5379. ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  5380. ("h" "Agenda and Home-related tasks"
  5381. ((agenda "")
  5382. (tags-todo "home")
  5383. (tags "garden"))
  5384. nil
  5385. ("~/views/home.html"))
  5386. ("o" "Agenda and Office-related tasks"
  5387. ((agenda)
  5388. (tags-todo "work")
  5389. (tags "office"))
  5390. nil
  5391. ("~/views/office.ps" "~/calendars/office.ics"))))
  5392. @end group
  5393. @end lisp
  5394. The extension of the file name determines the type of export. If it is
  5395. @file{.html}, Org mode will use the @file{htmlize.el} package to convert
  5396. the buffer to HTML and save it to this file name. If the extension is
  5397. @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
  5398. postscript output. If the extension is @file{.ics}, iCalendar export is
  5399. run export over all files that were used to construct the agenda, and
  5400. limit the export to entries listed in the agenda now. Any other
  5401. extension produces a plain ASCII file.
  5402. The export files are @emph{not} created when you use one of those
  5403. commands interactively because this might use too much overhead.
  5404. Instead, there is a special command to produce @emph{all} specified
  5405. files in one step:
  5406. @table @kbd
  5407. @kindex C-c a e
  5408. @item C-c a e
  5409. Export all agenda views that have export file names associated with
  5410. them.
  5411. @end table
  5412. You can use the options section of the custom agenda commands to also
  5413. set options for the export commands. For example:
  5414. @lisp
  5415. (setq org-agenda-custom-commands
  5416. '(("X" agenda ""
  5417. ((ps-number-of-columns 2)
  5418. (ps-landscape-mode t)
  5419. (org-agenda-prefix-format " [ ] ")
  5420. (org-agenda-with-colors nil)
  5421. (org-agenda-remove-tags t))
  5422. ("theagenda.ps"))))
  5423. @end lisp
  5424. @noindent
  5425. This command sets two options for the postscript exporter, to make it
  5426. print in two columns in landscape format - the resulting page can be cut
  5427. in two and then used in a paper agenda. The remaining settings modify
  5428. the agenda prefix to omit category and scheduling information, and
  5429. instead include a checkbox to check off items. We also remove the tags
  5430. to make the lines compact, and we don't want to use colors for the
  5431. black-and-white printer. Settings specified in
  5432. @code{org-agenda-exporter-settings} will also apply, but the settings
  5433. in @code{org-agenda-custom-commands} take precedence.
  5434. @noindent
  5435. From the command line you may also use
  5436. @example
  5437. emacs -f org-batch-store-agenda-views -kill
  5438. @end example
  5439. @noindent
  5440. or, if you need to modify some parameters
  5441. @example
  5442. emacs -eval '(org-batch-store-agenda-views \
  5443. org-agenda-ndays 30 \
  5444. org-agenda-start-day "2007-11-01" \
  5445. org-agenda-include-diary nil \
  5446. org-agenda-files (quote ("~/org/project.org")))' \
  5447. -kill
  5448. @end example
  5449. @noindent
  5450. which will create the agenda views restricted to the file
  5451. @file{~/org/project.org}, without diary entries and with 30 days
  5452. extent.
  5453. @node Using the agenda elsewhere, , Exporting Agenda Views, Custom agenda views
  5454. @subsection Using agenda information outside of Org
  5455. @cindex agenda, pipe
  5456. @cindex Scripts, for agenda processing
  5457. Org provides commands to access agenda information for the command
  5458. line in emacs batch mode. This extracted information can be sent
  5459. directly to a printer, or it can be read by a program that does further
  5460. processing of the data. The first of these commands is the function
  5461. @code{org-batch-agenda}, that produces an agenda view and sends it as
  5462. ASCII text to STDOUT. The command takes a single string as parameter.
  5463. If the string has length 1, it is used as a key to one of the commands
  5464. you have configured in @code{org-agenda-custom-commands}, basically any
  5465. key you can use after @kbd{C-c a}. For example, to directly print the
  5466. current TODO list, you could use
  5467. @example
  5468. emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  5469. @end example
  5470. If the parameter is a string with 2 or more characters, it is used as a
  5471. tags/todo match string. For example, to print your local shopping list
  5472. (all items with the tag @samp{shop}, but excluding the tag
  5473. @samp{NewYork}), you could use
  5474. @example
  5475. emacs -batch -l ~/.emacs \
  5476. -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  5477. @end example
  5478. @noindent
  5479. You may also modify parameters on the fly like this:
  5480. @example
  5481. emacs -batch -l ~/.emacs \
  5482. -eval '(org-batch-agenda "a" \
  5483. org-agenda-ndays 30 \
  5484. org-agenda-include-diary nil \
  5485. org-agenda-files (quote ("~/org/project.org")))' \
  5486. | lpr
  5487. @end example
  5488. @noindent
  5489. which will produce a 30 day agenda, fully restricted to the Org file
  5490. @file{~/org/projects.org}, not even including the diary.
  5491. If you want to process the agenda data in more sophisticated ways, you
  5492. can use the command @code{org-batch-agenda-csv} to get a comma-separated
  5493. list of values for each agenda item. Each line in the output will
  5494. contain a number of fields separated by commas. The fields in a line
  5495. are:
  5496. @example
  5497. category @r{The category of the item}
  5498. head @r{The headline, without TODO kwd, TAGS and PRIORITY}
  5499. type @r{The type of the agenda entry, can be}
  5500. todo @r{selected in TODO match}
  5501. tagsmatch @r{selected in tags match}
  5502. diary @r{imported from diary}
  5503. deadline @r{a deadline}
  5504. scheduled @r{scheduled}
  5505. timestamp @r{appointment, selected by timestamp}
  5506. closed @r{entry was closed on date}
  5507. upcoming-deadline @r{warning about nearing deadline}
  5508. past-scheduled @r{forwarded scheduled item}
  5509. block @r{entry has date block including date}
  5510. todo @r{The TODO keyword, if any}
  5511. tags @r{All tags including inherited ones, separated by colons}
  5512. date @r{The relevant date, like 2007-2-14}
  5513. time @r{The time, like 15:00-16:50}
  5514. extra @r{String with extra planning info}
  5515. priority-l @r{The priority letter if any was given}
  5516. priority-n @r{The computed numerical priority}
  5517. @end example
  5518. @noindent
  5519. Time and date will only be given if a timestamp (or deadline/scheduled)
  5520. lead to the selection of the item.
  5521. A CSV list like this is very easy to use in a post processing script.
  5522. For example, here is a Perl program that gets the TODO list from
  5523. Emacs/Org and prints all the items, preceded by a checkbox:
  5524. @example
  5525. @group
  5526. #!/usr/bin/perl
  5527. # define the Emacs command to run
  5528. $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  5529. # run it and capture the output
  5530. $agenda = qx@{$cmd 2>/dev/null@};
  5531. # loop over all lines
  5532. foreach $line (split(/\n/,$agenda)) @{
  5533. # get the individual values
  5534. ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  5535. $priority_l,$priority_n) = split(/,/,$line);
  5536. # proccess and print
  5537. print "[ ] $head\n";
  5538. @}
  5539. @end group
  5540. @end example
  5541. @node Agenda column view, , Custom agenda views, Agenda Views
  5542. @section Using column view in the agenda
  5543. @cindex column view, in agenda
  5544. @cindex agenda, column view
  5545. Column view (@pxref{Column view}) is normally used to view and edit
  5546. properties embedded in the hierarchical structure of an Org file. It can be
  5547. quite useful to use column view also from the agenda, where entries are
  5548. collected by certain criteria.
  5549. @table @kbd
  5550. @kindex C-c C-x C-c
  5551. @item C-c C-x C-c
  5552. Turn on column view in the agenda.
  5553. @end table
  5554. To understand how to use this properly, it is important to realize that the
  5555. entries in the agenda are no longer in their proper outline environment.
  5556. This causes the following issues:
  5557. @enumerate
  5558. @item
  5559. Org needs to make a decision which @code{COLUMNS} format to use. Since the
  5560. entries in the agenda are collected from different files, and different files
  5561. may have different @code{COLUMNS} formats, this is a non-trivial problem.
  5562. Org first checks if the variable @code{org-overriding-columns-format} is
  5563. currently set, and if yes takes the format from there. Otherwise it takes
  5564. the format associated with the first item in the agenda, or, if that item
  5565. does not have a specific format (defined in a property, or in it's file), it
  5566. uses @code{org-columns-default-format}.
  5567. @item
  5568. If any of the columns has a summary type defined (@pxref{Column attributes}),
  5569. turning on column view in the agenda will visit all relevant agenda files and
  5570. make sure that the computations of this property are up to date. This is
  5571. also true for the special @code{CLOCKSUM} property. Org will then sum the
  5572. values displayed in the agenda. In the daily/weekly agenda, the sums will
  5573. cover a single day, in all other views they cover the entire block. It is
  5574. vital to realize that the agenda may show the same entry @emph{twice} (for
  5575. example as scheduled and as a deadline), and it may show two entries from the
  5576. same hierarchy (for example a @emph{parent} and it's @emph{child}). In these
  5577. cases, the summation in the agenda will lead to incorrect results because
  5578. some values will count double.
  5579. @item
  5580. When the column view in the agenda shows the @code{CLOCKSUM}, that is always
  5581. the entire clocked time for this item. So even in the daily/weekly agenda,
  5582. the clocksum listed in column view may originate from times outside the
  5583. current view. This has the advantage that you can compare these values with
  5584. a column listing the planned total effort for a task - one of the major
  5585. applications for column view in the agenda. If you want information about
  5586. clocked time in the displayed period use clock table mode (press @kbd{R} in
  5587. the agenda).
  5588. @end enumerate
  5589. @node Embedded LaTeX, Exporting, Agenda Views, Top
  5590. @chapter Embedded LaTeX
  5591. @cindex @TeX{} interpretation
  5592. @cindex La@TeX{} interpretation
  5593. Plain ASCII is normally sufficient for almost all note taking. One
  5594. exception, however, are scientific notes which need to be able to contain
  5595. mathematical symbols and the occasional formula. La@TeX{}@footnote{La@TeX{}
  5596. is a macro system based on Donald E. Knuth's @TeX{} system. Many of the
  5597. features described here as ``La@TeX{}'' are really from @TeX{}, but for
  5598. simplicity I am blurring this distinction.} is widely used to typeset
  5599. scientific documents. Org mode supports embedding La@TeX{} code into its
  5600. files, because many academics are used to reading La@TeX{} source code, and
  5601. because it can be readily processed into images for HTML production.
  5602. It is not necessary to mark La@TeX{} macros and code in any special way.
  5603. If you observe a few conventions, Org mode knows how to find it and what
  5604. to do with it.
  5605. @menu
  5606. * Math symbols:: TeX macros for symbols and Greek letters
  5607. * Subscripts and superscripts:: Simple syntax for raising/lowering text
  5608. * LaTeX fragments:: Complex formulas made easy
  5609. * Processing LaTeX fragments:: Previewing LaTeX processing
  5610. * CDLaTeX mode:: Speed up entering of formulas
  5611. @end menu
  5612. @node Math symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
  5613. @section Math symbols
  5614. @cindex math symbols
  5615. @cindex TeX macros
  5616. You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
  5617. to indicate the Greek letter, or @samp{\to} to indicate an arrow.
  5618. Completion for these macros is available, just type @samp{\} and maybe a
  5619. few letters, and press @kbd{M-@key{TAB}} to see possible completions.
  5620. Unlike La@TeX{} code, Org mode allows these macros to be present
  5621. without surrounding math delimiters, for example:
  5622. @example
  5623. Angles are written as Greek letters \alpha, \beta and \gamma.
  5624. @end example
  5625. During HTML export (@pxref{HTML export}), these symbols are translated
  5626. into the proper syntax for HTML, for the above examples this is
  5627. @samp{&alpha;} and @samp{&rarr;}, respectively.
  5628. @node Subscripts and superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
  5629. @section Subscripts and superscripts
  5630. @cindex subscript
  5631. @cindex superscript
  5632. Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
  5633. and subscripts. Again, these can be used without embedding them in
  5634. math-mode delimiters. To increase the readability of ASCII text, it is
  5635. not necessary (but OK) to surround multi-character sub- and superscripts
  5636. with curly braces. For example
  5637. @example
  5638. The mass if the sun is M_sun = 1.989 x 10^30 kg. The radius of
  5639. the sun is R_@{sun@} = 6.96 x 10^8 m.
  5640. @end example
  5641. To avoid interpretation as raised or lowered text, you can quote
  5642. @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
  5643. During HTML export (@pxref{HTML export}), subscript and superscripts
  5644. are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
  5645. @node LaTeX fragments, Processing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
  5646. @section LaTeX fragments
  5647. @cindex LaTeX fragments
  5648. With symbols, sub- and superscripts, HTML is pretty much at its end when
  5649. it comes to representing mathematical formulas@footnote{Yes, there is
  5650. MathML, but that is not yet fully supported by many browsers, and there
  5651. is no decent converter for turning La@TeX{} or ASCII representations of
  5652. formulas into MathML. So for the time being, converting formulas into
  5653. images seems the way to go.}. More complex expressions need a dedicated
  5654. formula processor. To this end, Org mode can contain arbitrary La@TeX{}
  5655. fragments. It provides commands to preview the typeset result of these
  5656. fragments, and upon export to HTML, all fragments will be converted to
  5657. images and inlined into the HTML document@footnote{The La@TeX{} export
  5658. will not use images for displaying La@TeX{} fragments but include these
  5659. fragments directly into the La@TeX{} code.}. For this to work you
  5660. need to be on a system with a working La@TeX{} installation. You also
  5661. need the @file{dvipng} program, available at
  5662. @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
  5663. will be used when processing a fragment can be configured with the
  5664. variable @code{org-format-latex-header}.
  5665. La@TeX{} fragments don't need any special marking at all. The following
  5666. snippets will be identified as La@TeX{} source code:
  5667. @itemize @bullet
  5668. @item
  5669. Environments of any kind. The only requirement is that the
  5670. @code{\begin} statement appears on a new line, preceded by only
  5671. whitespace.
  5672. @item
  5673. Text within the usual La@TeX{} math delimiters. To avoid conflicts with
  5674. currency specifications, single @samp{$} characters are only recognized
  5675. as math delimiters if the enclosed text contains at most two line breaks,
  5676. is directly attached to the @samp{$} characters with no whitespace in
  5677. between, and if the closing @samp{$} is followed by whitespace or
  5678. punctuation. For the other delimiters, there is no such restriction, so
  5679. when in doubt, use @samp{\(...\)} as inline math delimiters.
  5680. @end itemize
  5681. @noindent For example:
  5682. @example
  5683. \begin@{equation@} % arbitrary environments,
  5684. x=\sqrt@{b@} % even tables, figures
  5685. \end@{equation@} % etc
  5686. If $a^2=b$ and \( b=2 \), then the solution must be
  5687. either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
  5688. @end example
  5689. @noindent
  5690. If you need any of the delimiter ASCII sequences for other purposes, you
  5691. can configure the option @code{org-format-latex-options} to deselect the
  5692. ones you do not wish to have interpreted by the La@TeX{} converter.
  5693. @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
  5694. @section Processing LaTeX fragments
  5695. @cindex LaTeX fragments, preview
  5696. La@TeX{} fragments can be processed to produce a preview images of the
  5697. typeset expressions:
  5698. @table @kbd
  5699. @kindex C-c C-x C-l
  5700. @item C-c C-x C-l
  5701. Produce a preview image of the La@TeX{} fragment at point and overlay it
  5702. over the source code. If there is no fragment at point, process all
  5703. fragments in the current entry (between two headlines). When called
  5704. with a prefix argument, process the entire subtree. When called with
  5705. two prefix arguments, or when the cursor is before the first headline,
  5706. process the entire buffer.
  5707. @kindex C-c C-c
  5708. @item C-c C-c
  5709. Remove the overlay preview images.
  5710. @end table
  5711. During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
  5712. converted into images and inlined into the document if the following
  5713. setting is active:
  5714. @lisp
  5715. (setq org-export-with-LaTeX-fragments t)
  5716. @end lisp
  5717. @node CDLaTeX mode, , Processing LaTeX fragments, Embedded LaTeX
  5718. @section Using CDLaTeX to enter math
  5719. @cindex CDLaTeX
  5720. CDLaTeX mode is a minor mode that is normally used in combination with a
  5721. major La@TeX{} mode like AUCTeX in order to speed-up insertion of
  5722. environments and math templates. Inside Org mode, you can make use of
  5723. some of the features of CDLaTeX mode. You need to install
  5724. @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
  5725. AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
  5726. Don't use CDLaTeX mode itself under Org mode, but use the light
  5727. version @code{org-cdlatex-mode} that comes as part of Org mode. Turn it
  5728. on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
  5729. Org files with
  5730. @lisp
  5731. (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
  5732. @end lisp
  5733. When this mode is enabled, the following features are present (for more
  5734. details see the documentation of CDLaTeX mode):
  5735. @itemize @bullet
  5736. @kindex C-c @{
  5737. @item
  5738. Environment templates can be inserted with @kbd{C-c @{}.
  5739. @item
  5740. @kindex @key{TAB}
  5741. The @key{TAB} key will do template expansion if the cursor is inside a
  5742. La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
  5743. inside such a fragment, see the documentation of the function
  5744. @code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will
  5745. expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
  5746. correctly inside the first brace. Another @key{TAB} will get you into
  5747. the second brace. Even outside fragments, @key{TAB} will expand
  5748. environment abbreviations at the beginning of a line. For example, if
  5749. you write @samp{equ} at the beginning of a line and press @key{TAB},
  5750. this abbreviation will be expanded to an @code{equation} environment.
  5751. To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
  5752. @item
  5753. @kindex _
  5754. @kindex ^
  5755. Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
  5756. characters together with a pair of braces. If you use @key{TAB} to move
  5757. out of the braces, and if the braces surround only a single character or
  5758. macro, they are removed again (depending on the variable
  5759. @code{cdlatex-simplify-sub-super-scripts}).
  5760. @item
  5761. @kindex `
  5762. Pressing the backquote @kbd{`} followed by a character inserts math
  5763. macros, also outside La@TeX{} fragments. If you wait more than 1.5 seconds
  5764. after the backquote, a help window will pop up.
  5765. @item
  5766. @kindex '
  5767. Pressing the normal quote @kbd{'} followed by another character modifies
  5768. the symbol before point with an accent or a font. If you wait more than
  5769. 1.5 seconds after the backquote, a help window will pop up. Character
  5770. modification will work only inside La@TeX{} fragments, outside the quote
  5771. is normal.
  5772. @end itemize
  5773. @node Exporting, Publishing, Embedded LaTeX, Top
  5774. @chapter Exporting
  5775. @cindex exporting
  5776. Org mode documents can be exported into a variety of other formats. For
  5777. printing and sharing of notes, ASCII export produces a readable and
  5778. simple version of an Org file. HTML export allows you to publish a
  5779. notes file on the web, while the XOXO format provides a solid base for
  5780. exchange with a broad range of other applications. La@TeX{} export lets
  5781. you use Org mode and its structured editing functions to easily create
  5782. La@TeX{} files. To incorporate entries with associated times like
  5783. deadlines or appointments into a desktop calendar program like iCal,
  5784. Org mode can also produce extracts in the iCalendar format. Currently
  5785. Org mode only supports export, not import of these different formats.
  5786. @menu
  5787. * Markup rules:: Which structures are recognized?
  5788. * Export options:: Per-file export settings
  5789. * The export dispatcher:: How to access exporter commands
  5790. * ASCII export:: Exporting to plain ASCII
  5791. * HTML export:: Exporting to HTML
  5792. * LaTeX export:: Exporting to LaTeX
  5793. * XOXO export:: Exporting to XOXO
  5794. * iCalendar export:: Exporting in iCalendar format
  5795. @end menu
  5796. @node Markup rules, Export options, Exporting, Exporting
  5797. @section Markup rules
  5798. When exporting Org mode documents, the exporter tries to reflect the
  5799. structure of the document as accurately as possible in the back-end. Since
  5800. export targets like HTML or La@TeX{} allow much richer formatting, Org mode
  5801. has rules how to prepare text for rich export. This section summarizes the
  5802. markup rule used in an Org mode buffer.
  5803. @menu
  5804. * Document title:: How the document title is determined
  5805. * Headings and sections:: The main structure of the exported document
  5806. * Table of contents:: If, where, how to create a table of contents
  5807. * Initial text:: Text before the first headline
  5808. * Lists:: Plain lists are exported
  5809. * Paragraphs:: What determines beginning and ending
  5810. * Literal examples:: Source code and other examples
  5811. * Include files:: Include the contents of a file during export
  5812. * Tables exported:: Tables are exported richly
  5813. * Footnotes:: Numbers like [1]
  5814. * Emphasis and monospace:: To bold or not to bold
  5815. * TeX macros and LaTeX fragments:: Create special, rich export.
  5816. * Horizontal rules:: A line across the page
  5817. * Comment lines:: Some lines will not be exported
  5818. @end menu
  5819. @node Document title, Headings and sections, Markup rules, Markup rules
  5820. @subheading Document title
  5821. @cindex document title, markup rules
  5822. @noindent
  5823. The title of the exported document is taken from the special line
  5824. @example
  5825. #+TITLE: This is the title of the document
  5826. @end example
  5827. @noindent
  5828. If this line does not exist, the title is derived from the first non-empty,
  5829. non-comment line in the buffer. If no such line exists, or if you have
  5830. turned off exporting of the text before the first headline (see below), the
  5831. title will be the file name without extension.
  5832. If you are exporting only a subtree by marking is as the region, the heading
  5833. of the subtree will become the title of the document.
  5834. @node Headings and sections, Table of contents, Document title, Markup rules
  5835. @subheading Headings and sections
  5836. @cindex headings and sections, markup rules
  5837. The outline structure of the document as described in @ref{Document
  5838. Structure} forms the basis for defining sections of the exported document.
  5839. However, since the outline structure is also used for (for example) lists of
  5840. tasks, only the first three outline levels will be used as headings. Deeper
  5841. levels will become itemized lists. You can change the location of this
  5842. switch, globally by setting the variable @code{org-headline-levels}, or on a
  5843. per file basis with a line
  5844. @example
  5845. #+OPTIONS: H:4
  5846. @end example
  5847. @node Table of contents, Initial text, Headings and sections, Markup rules
  5848. @subheading Table of contents
  5849. @cindex table of contents, markup rules
  5850. The table of contents is normally inserted directly before the first headline
  5851. of the file. If you would like to get it to a different location, insert the
  5852. string @code{[TABLE-OF-CONTENTS]} on a line by itself at the desired
  5853. location. The depth of the table of contents is by default the same as the
  5854. number of headline levels, but you can choose a smaller number or turn off
  5855. the table of contents entirely by configuring the variable
  5856. @code{org-export-with-toc}, or on a per-file basis with a line like
  5857. @example
  5858. #+OPTIONS: toc:2 (only to two levels in TOC)
  5859. #+OPTIONS: toc:nil (no TOC at all)
  5860. @end example
  5861. @node Initial text, Lists, Table of contents, Markup rules
  5862. @subheading Text before the first headline
  5863. @cindex text before first headline, markup rules
  5864. @cindex #+TEXT
  5865. Org mode normally exports the text before the first headline, and even uses
  5866. the first line as the document title. The text will be fully marked up. If
  5867. you need to include literal HTML or La@TeX{} code, use the special constructs
  5868. described below in the sections for the individual exporters.
  5869. Some people like to use the space before the first headline for setup and
  5870. internal links and therefore would like to control the exported text before
  5871. the first headline in a different way. You can do so by setting the variable
  5872. @code{org-export-skip-text-before-1st-heading} to @code{t}. On a per-file
  5873. basis, you can get the same effect with @samp{#+OPTIONS: skip:t}.
  5874. @noindent
  5875. If you still want to have some text before the first headline, use the
  5876. @code{#+TEXT} construct:
  5877. @example
  5878. #+OPTIONS: skip:t
  5879. #+TEXT: This text will go before the *first* headline.
  5880. #+TEXT: [TABLE-OF-CONTENTS]
  5881. #+TEXT: This goes between the table of contents and the first headline
  5882. @end example
  5883. @node Lists, Paragraphs, Initial text, Markup rules
  5884. @subheading Lists
  5885. @cindex lists, markup rules
  5886. Plain lists as described in @ref{Plain lists} are translated to the back-ends
  5887. syntax for such lists. Most back-ends support unordered, ordered, and
  5888. description lists.
  5889. @node Paragraphs, Literal examples, Lists, Markup rules
  5890. @subheading Paragraphs, line breaks, and quoting
  5891. @cindex paragraphs, markup rules
  5892. Paragraphs are separated by at least one empty line. If you need to enforce
  5893. a line break within a paragraph, use @samp{\\} at the end of a line.
  5894. When quoting a passage from another document, it is customary to format this
  5895. as a paragraph that is indented on both the left and the right margin. You
  5896. can include quotations in Org mode documents like this:
  5897. @example
  5898. #+begin_quote
  5899. Everything should be made as simple as possible,
  5900. but not any simpler -- Albert Einstein
  5901. #+end_quote
  5902. @end example
  5903. @node Literal examples, Include files, Paragraphs, Markup rules
  5904. @subheading Literal examples
  5905. @cindex literal examples, markup rules
  5906. You can include literal examples that should not be subjected to
  5907. markup. Such examples will be typeset in monospace, so this is well suited
  5908. for source code and similar examples.
  5909. @cindex #+BEGIN_EXAMPLE
  5910. @example
  5911. #+begin_example
  5912. Some example from a text file.
  5913. #+end_example
  5914. @end example
  5915. For simplicity when using small examples, you can also start the example
  5916. lines with a colon:
  5917. @example
  5918. : Some example from a text file.
  5919. @end example
  5920. @cindex formatting source code, markup rules
  5921. If the example is source code from a programming language, or any other text
  5922. that can be marked up by font-lock in Emacs, you can ask for the example to
  5923. look like the fontified Emacs buffer@footnote{Currently this works only for
  5924. the HTML back-end, and requires the @file{htmlize.el} package version 1.34 or
  5925. later.}. This is done with the @samp{src} block, where you also need to
  5926. specify the name of the major mode that should be used to fontify the
  5927. example:
  5928. @cindex #+BEGIN_SRC
  5929. @example
  5930. #+begin_src emacs-lisp
  5931. (defun org-xor (a b)
  5932. "Exclusive or."
  5933. (if a (not b) b))
  5934. #+end_src
  5935. @end example
  5936. @node Include files, Tables exported, Literal examples, Markup rules
  5937. @subheading Include files
  5938. @cindex include files, markup rules
  5939. During export, you can include the content of another file. For example, to
  5940. include your .emacs file, you could use:
  5941. @cindex #+INCLUDE
  5942. @example
  5943. #+include "~/.emacs" src emacs-lisp
  5944. @end example
  5945. The optional second and third parameter are the markup (@samp{quote},
  5946. @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
  5947. language for formatting the contents. The markup is optional, if it is not
  5948. given, the text will be assumed to be in Org mode format and will be
  5949. processed normally.
  5950. @node Tables exported, Footnotes, Include files, Markup rules
  5951. @subheading Tables
  5952. @cindex tables, markup rules
  5953. Both the native Org mode tables (@pxref{Tables}) and tables formatted with
  5954. the @file{table.el} package will be exported properly. For Org mode tables,
  5955. the lines before the first horizontal separator line will become table header
  5956. lines.
  5957. @node Footnotes, Emphasis and monospace, Tables exported, Markup rules
  5958. @subheading Footnotes
  5959. @cindex footnotes, markup rules
  5960. @cindex @file{footnote.el}
  5961. @kindex C-c !
  5962. Numbers in square brackets are treated as footnote markers, and lines
  5963. starting with such a marker are interpreted as the footnote itself. You can
  5964. use the Emacs package @file{footnote.el} to create footnotes@footnote{The
  5965. @file{footnote} package uses @kbd{C-c !} to invoke its commands. This
  5966. binding conflicts with the Org mode command for inserting inactive time
  5967. stamps. You could use the variable @code{footnote-prefix} to switch
  5968. footnotes commands to another key. Or, if you are too used to this binding,
  5969. you could use @code{org-replace-disputed-keys} and @code{org-disputed-keys}
  5970. to change the settings in Org.}. For example:
  5971. @example
  5972. The Org homepage[1] now looks a lot better than it used to.
  5973. [1] The link is: http://orgmode.org
  5974. @end example
  5975. @node Emphasis and monospace, TeX macros and LaTeX fragments, Footnotes, Markup rules
  5976. @subheading Emphasis and monospace
  5977. @cindex underlined text, markup rules
  5978. @cindex bold text, markup rules
  5979. @cindex italic text, markup rules
  5980. @cindex verbatim text, markup rules
  5981. @cindex code text, markup rules
  5982. @cindex strike-through text, markup rules
  5983. You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
  5984. and @code{~verbatim~}, and, if you must, @samp{+strike-through+}. Text
  5985. in the code and verbatim string is not processed for Org mode specific
  5986. syntax, it is exported verbatim.
  5987. @node TeX macros and LaTeX fragments, Horizontal rules, Emphasis and monospace, Markup rules
  5988. @subheading @TeX{} macros and La@TeX{} fragments
  5989. @cindex LaTeX fragments, markup rules
  5990. @cindex TeX macros, markup rules
  5991. @cindex HTML entities
  5992. @cindex LaTeX entities
  5993. A @TeX{}-like syntax is used to specify special characters. Where possible,
  5994. these will be transformed into the native format of the exporter back-end.
  5995. Strings like @code{\alpha} will be exported as @code{&alpha;} in the HTML
  5996. output, and as @code{$\alpha$} in the La@TeX{} output. Similarly,
  5997. @code{\nbsp} will become @code{&nbsp;} in HTML and @code{~} in La@TeX{}.
  5998. This applies for a large number of entities, with names taken from both HTML
  5999. and La@TeX{}, see the variable @code{org-html-entities} for the complete
  6000. list. If you are unsure about a name, use @kbd{M-@key{TAB}} for completion
  6001. after having types the backslash and maybe a few characters
  6002. (@pxref{Completion}).
  6003. La@TeX{} fragments are converted into images for HTML export, and they are
  6004. written literally into the La@TeX{} export. See also @ref{Embedded LaTeX}.
  6005. Finally, @samp{\-} is treated as a shy hyphen, and @samp{--}, @samp{---}, and
  6006. @samp{...} are all converted into special commands creating hyphens of
  6007. different lengths or a compact set of dots.
  6008. @node Horizontal rules, Comment lines, TeX macros and LaTeX fragments, Markup rules
  6009. @subheading Horizontal rules
  6010. @cindex horizontal rules, markup rules
  6011. A line consisting of only dashes, and at least 5 of them, will be
  6012. exported as a horizontal line (@samp{<hr/>} in HTML).
  6013. @node Comment lines, , Horizontal rules, Markup rules
  6014. @subheading Comment lines
  6015. @cindex comment lines
  6016. @cindex exporting, not
  6017. Lines starting with @samp{#} in column zero are treated as comments
  6018. and will never be exported. Also entire subtrees starting with the
  6019. word @samp{COMMENT} will never be exported.
  6020. @table @kbd
  6021. @kindex C-c ;
  6022. @item C-c ;
  6023. Toggle the COMMENT keyword at the beginning of an entry.
  6024. @end table
  6025. @node Export options, The export dispatcher, Markup rules, Exporting
  6026. @section Export options
  6027. @cindex options, for export
  6028. @cindex completion, of option keywords
  6029. The exporter recognizes special lines in the buffer which provide
  6030. additional information. These lines may be put anywhere in the file.
  6031. The whole set of lines can be inserted into the buffer with @kbd{C-c
  6032. C-e t}. For individual lines, a good way to make sure the keyword is
  6033. correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
  6034. (@pxref{Completion}).
  6035. @table @kbd
  6036. @kindex C-c C-e t
  6037. @item C-c C-e t
  6038. Insert template with export options, see example below.
  6039. @end table
  6040. @cindex #+TITLE:
  6041. @cindex #+AUTHOR:
  6042. @cindex #+DATE:
  6043. @cindex #+EMAIL:
  6044. @cindex #+LANGUAGE:
  6045. @cindex #+TEXT:
  6046. @cindex #+OPTIONS:
  6047. @cindex #+LINK_UP:
  6048. @cindex #+LINK_HOME:
  6049. @example
  6050. #+TITLE: the title to be shown (default is the buffer name)
  6051. #+AUTHOR: the author (default taken from @code{user-full-name})
  6052. #+DATE: A date, fixed, of a format string for @code{format-time-string}
  6053. #+EMAIL: his/her email address (default from @code{user-mail-address})
  6054. #+LANGUAGE: language for HTML, e.g. @samp{en} (@code{org-export-default-language})
  6055. #+TEXT: Some descriptive text to be inserted at the beginning.
  6056. #+TEXT: Several lines may be given.
  6057. #+OPTIONS: H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
  6058. #+LINK_UP: the ``up'' link of an exported page
  6059. #+LINK_HOME: the ``home'' link of an exported page
  6060. @end example
  6061. @noindent
  6062. The OPTIONS line is a compact@footnote{If you want to configure many options
  6063. this way, you can use several OPTIONS lines.} form to specify export settings. Here
  6064. you can:
  6065. @cindex headline levels
  6066. @cindex section-numbers
  6067. @cindex table of contents
  6068. @cindex line-break preservation
  6069. @cindex quoted HTML tags
  6070. @cindex fixed-width sections
  6071. @cindex tables
  6072. @cindex @TeX{}-like syntax for sub- and superscripts
  6073. @cindex footnotes
  6074. @cindex special strings
  6075. @cindex emphasized text
  6076. @cindex @TeX{} macros
  6077. @cindex La@TeX{} fragments
  6078. @cindex author info, in export
  6079. @cindex time info, in export
  6080. @example
  6081. H: @r{set the number of headline levels for export}
  6082. num: @r{turn on/off section-numbers}
  6083. toc: @r{turn on/off table of contents, or set level limit (integer)}
  6084. \n: @r{turn on/off line-break-preservation}
  6085. @@: @r{turn on/off quoted HTML tags}
  6086. :: @r{turn on/off fixed-width sections}
  6087. |: @r{turn on/off tables}
  6088. ^: @r{turn on/off @TeX{}-like syntax for sub- and superscripts. If}
  6089. @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
  6090. @r{the simple @code{a_b} will be left as it is.}
  6091. -: @r{turn on/off conversion of special strings.}
  6092. f: @r{turn on/off footnotes like this[1].}
  6093. *: @r{turn on/off emphasized text (bold, italic, underlined)}
  6094. TeX: @r{turn on/off simple @TeX{} macros in plain text}
  6095. LaTeX: @r{turn on/off La@TeX{} fragments}
  6096. skip: @r{turn on/off skipping the text before the first heading}
  6097. author: @r{turn on/off inclusion of author name/email into exported file}
  6098. timestamp: @r{turn on/off inclusion creation time into exported file}
  6099. d: @r{turn on/off inclusion of drawers}
  6100. @end example
  6101. These options take effect in both the HTML and La@TeX{} export, except
  6102. for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
  6103. @code{nil} for the La@TeX{} export.
  6104. @node The export dispatcher, ASCII export, Export options, Exporting
  6105. @section The export dispatcher
  6106. @cindex dispatcher, for export commands
  6107. All export commands can be reached using the export dispatcher, which is a
  6108. prefix key that prompts for an additional key specifying the command.
  6109. Normally the entire file is exported, but if there is an active region that
  6110. contains one outline tree, the first heading is used as document title and
  6111. the subtrees are exported.
  6112. @table @kbd
  6113. @kindex C-c C-e
  6114. @item C-c C-e
  6115. Dispatcher for export and publishing commands. Displays a help-window
  6116. listing the additional key(s) needed to launch an export or publishing
  6117. command. The prefix arg is passed through to the exporter. If the option
  6118. @code{org-export-run-in-background} is set, Org will run the command in the
  6119. background if that seems useful for the specific command (i.e. commands that
  6120. write to a file).
  6121. @kindex C-c C-e v
  6122. @item C-c C-e v
  6123. Like @kbd{C-c C-e}, but only export the text that is currently visible
  6124. (i.e. not hidden by outline visibility).
  6125. @kindex C-u C-u C-c C-e
  6126. @item C-u C-u C-c C-e
  6127. Call an the exporter, but reverse the setting of
  6128. @code{org-export-run-in-background}, i.e. request background processing if
  6129. not set, or force processing in the current Emacs process if st.
  6130. @end table
  6131. @node ASCII export, HTML export, The export dispatcher, Exporting
  6132. @section ASCII export
  6133. @cindex ASCII export
  6134. ASCII export produces a simple and very readable version of an Org mode
  6135. file.
  6136. @cindex region, active
  6137. @cindex active region
  6138. @cindex Transient mark mode
  6139. @table @kbd
  6140. @kindex C-c C-e a
  6141. @item C-c C-e a
  6142. Export as ASCII file. For an org file @file{myfile.org}, the ASCII file
  6143. will be @file{myfile.txt}. The file will be overwritten without
  6144. warning. If there is an active region, only the region will be
  6145. exported. If the selected region is a single tree, the tree head will
  6146. become the document title. If the tree head entry has or inherits an
  6147. @code{:EXPORT_FILE_NAME:} property, that name will be used for the
  6148. export.
  6149. @kindex C-c C-e v a
  6150. @item C-c C-e v a
  6151. Export only the visible part of the document.
  6152. @end table
  6153. @cindex headline levels, for exporting
  6154. In the exported version, the first 3 outline levels will become
  6155. headlines, defining a general document structure. Additional levels
  6156. will be exported as itemized lists. If you want that transition to occur
  6157. at a different level, specify it with a prefix argument. For example,
  6158. @example
  6159. @kbd{C-1 C-c C-e a}
  6160. @end example
  6161. @noindent
  6162. creates only top level headlines and does the rest as items. When
  6163. headlines are converted to items, the indentation of the text following
  6164. the headline is changed to fit nicely under the item. This is done with
  6165. the assumption that the first body line indicates the base indentation of
  6166. the body text. Any indentation larger than this is adjusted to preserve
  6167. the layout relative to the first line. Should there be lines with less
  6168. indentation than the first, these are left alone.
  6169. @node HTML export, LaTeX export, ASCII export, Exporting
  6170. @section HTML export
  6171. @cindex HTML export
  6172. Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
  6173. HTML formatting, in ways similar to John Grubers @emph{markdown}
  6174. language, but with additional support for tables.
  6175. @menu
  6176. * HTML Export commands:: How to invoke HTML export
  6177. * Quoting HTML tags:: Using direct HTML in Org mode
  6178. * Links:: Transformation of links for HTML
  6179. * Images:: How to include images
  6180. * CSS support:: Changing the appearance of the output
  6181. * Javascript support:: Info and Folding in a web browser
  6182. @end menu
  6183. @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
  6184. @subsection HTML export commands
  6185. @cindex region, active
  6186. @cindex active region
  6187. @cindex Transient mark mode
  6188. @table @kbd
  6189. @kindex C-c C-e h
  6190. @item C-c C-e h
  6191. Export as HTML file @file{myfile.html}. For an org file
  6192. @file{myfile.org}, the ASCII file will be @file{myfile.html}. The file
  6193. will be overwritten without warning. If there is an active region, only
  6194. the region will be exported. If the selected region is a single tree,
  6195. the tree head will become the document title. If the tree head entry
  6196. has or inherits an @code{:EXPORT_FILE_NAME:} property, that name will be
  6197. used for the export.
  6198. @kindex C-c C-e b
  6199. @item C-c C-e b
  6200. Export as HTML file and immediately open it with a browser.
  6201. @kindex C-c C-e H
  6202. @item C-c C-e H
  6203. Export to a temporary buffer, do not create a file.
  6204. @kindex C-c C-e R
  6205. @item C-c C-e R
  6206. Export the active region to a temporary buffer. With a prefix argument, do
  6207. not produce the file header and footer, but just the plain HTML section for
  6208. the region. This is good for cut-and-paste operations.
  6209. @kindex C-c C-e v h
  6210. @kindex C-c C-e v b
  6211. @kindex C-c C-e v H
  6212. @kindex C-c C-e v R
  6213. @item C-c C-e v h
  6214. @item C-c C-e v b
  6215. @item C-c C-e v H
  6216. @item C-c C-e v R
  6217. Export only the visible part of the document.
  6218. @item M-x org-export-region-as-html
  6219. Convert the region to HTML under the assumption that it was Org mode
  6220. syntax before. This is a global command that can be invoked in any
  6221. buffer.
  6222. @item M-x org-replace-region-by-HTML
  6223. Replace the active region (assumed to be in Org mode syntax) by HTML
  6224. code.
  6225. @end table
  6226. @cindex headline levels, for exporting
  6227. In the exported version, the first 3 outline levels will become headlines,
  6228. defining a general document structure. Additional levels will be exported as
  6229. itemized lists. If you want that transition to occur at a different level,
  6230. specify it with a numeric prefix argument. For example,
  6231. @example
  6232. @kbd{C-2 C-c C-e b}
  6233. @end example
  6234. @noindent
  6235. creates two levels of headings and does the rest as items.
  6236. @node Quoting HTML tags, Links, HTML Export commands, HTML export
  6237. @subsection Quoting HTML tags
  6238. Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
  6239. @samp{&gt;} in HTML export. If you want to include simple HTML tags
  6240. which should be interpreted as such, mark them with @samp{@@} as in
  6241. @samp{@@<b>bold text@@</b>}. Note that this really works only for
  6242. simple tags. For more extensive HTML that should be copied verbatim to
  6243. the exported file use either
  6244. @example
  6245. #+HTML: Literal HTML code for export
  6246. @end example
  6247. @noindent or
  6248. @cindex #+BEGIN_HTML
  6249. @example
  6250. #+BEGIN_HTML
  6251. All lines between these markers are exported literally
  6252. #+END_HTML
  6253. @end example
  6254. @node Links, Images, Quoting HTML tags, HTML export
  6255. @subsection Links
  6256. @cindex links, in HTML export
  6257. @cindex internal links, in HTML export
  6258. @cindex external links, in HTML export
  6259. Internal links (@pxref{Internal links}) will continue to work in HTML
  6260. files only if they match a dedicated @samp{<<target>>}. Automatic links
  6261. created by radio targets (@pxref{Radio targets}) will also work in the
  6262. HTML file. Links to external files will still work if the HTML file is
  6263. in the same directory as the Org file. Links to other @file{.org}
  6264. files will be translated into HTML links under the assumption that an
  6265. HTML version also exists of the linked file. For information related to
  6266. linking files while publishing them to a publishing directory see
  6267. @ref{Publishing links}.
  6268. @node Images, CSS support, Links, HTML export
  6269. @subsection Images
  6270. @cindex images, inline in HTML
  6271. @cindex inlining images in HTML
  6272. HTML export can inline images given as links in the Org file, and
  6273. it can make an image the clickable part of a link. By
  6274. default@footnote{but see the variable
  6275. @code{org-export-html-inline-images}}, images are inlined if a link does
  6276. not have a description. So @samp{[[file:myimg.jpg]]} will be inlined,
  6277. while @samp{[[file:myimg.jpg][the image]]} will just produce a link
  6278. @samp{the image} that points to the image. If the description part
  6279. itself is a @code{file:} link or a @code{http:} URL pointing to an
  6280. image, this image will be inlined and activated so that clicking on the
  6281. image will activate the link. For example, to include a thumbnail that
  6282. will link to a high resolution version of the image, you could use:
  6283. @example
  6284. [[file:highres.jpg][file:thumb.jpg]]
  6285. @end example
  6286. @noindent
  6287. and you could use @code{http} addresses just as well.
  6288. @node CSS support, Javascript support, Images, HTML export
  6289. @subsection CSS support
  6290. @cindex CSS, for HTML export
  6291. @cindex HTML export, CSS
  6292. You can also give style information for the exported file. The HTML
  6293. exporter assigns the following CSS classes to appropriate parts of the
  6294. document - your style specifications may change these:
  6295. @example
  6296. .todo @r{TODO keywords}
  6297. .done @r{the DONE keyword}
  6298. .timestamp @r{time stamp}
  6299. .timestamp-kwd @r{keyword associated with a time stamp, like SCHEDULED}
  6300. .tag @r{tag in a headline}
  6301. .target @r{target for links}
  6302. @end example
  6303. The default style specification can be configured through the option
  6304. @code{org-export-html-style}. If you want to use a file-local style,
  6305. you may use file variables, best wrapped into a COMMENT section at the
  6306. end of the outline tree. For example@footnote{Under Emacs 21, the
  6307. continuation lines for a variable value should have no @samp{#} at the
  6308. start of the line.}:
  6309. @example
  6310. * COMMENT html style specifications
  6311. # Local Variables:
  6312. # org-export-html-style: " <style type=\"text/css\">
  6313. # p @{font-weight: normal; color: gray; @}
  6314. # h1 @{color: black; @}
  6315. # </style>"
  6316. # End:
  6317. @end example
  6318. Remember to execute @kbd{M-x normal-mode} after changing this to make
  6319. the new style visible to Emacs. This command restarts Org mode for the
  6320. current buffer and forces Emacs to re-evaluate the local variables
  6321. section in the buffer.
  6322. @c FIXME: More about header and footer styles
  6323. @c FIXME: Talk about links and targets.
  6324. @node Javascript support, , CSS support, HTML export
  6325. @subsection Javascript supported display of web pages
  6326. @emph{Sebastian Rose} has written a JavaScript program especially designed to
  6327. enhance the web viewing experience of HTML files created with Org. This
  6328. program allows to view large files in two different ways. The first one is
  6329. an @emph{Info}-like mode where each section is displayed separately and
  6330. navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
  6331. as well, press @kbd{?} for an overview of the available keys). The second
  6332. view type is a @emph{folding} view much like Org provides it inside Emacs.
  6333. The script is available at @url{http://orgmode.org/org-info.js} and you can
  6334. find the documentation for it at @url{http://orgmode.org/org-infojs.html}.
  6335. We are serving the script from our site, but if you use it a lot, you might
  6336. not want to be dependent on @url{orgmode.org} and prefer to install a local
  6337. copy on your own web server.
  6338. To use the script, you need to make sure that the @file{org-infojs.el} module
  6339. gets loaded. It should be loaded by default, try @kbd{M-x customize-variable
  6340. @key{RET} org-modules @key{RET}} to convince yourself that this is indeed the
  6341. case. All it then takes to make use of the program is adding a single line
  6342. to the Org file:
  6343. @example
  6344. #+INFOSJ_OPT: view:info toc:nil
  6345. @end example
  6346. @noindent
  6347. If this line is found, the HTML header will automatically contain the code
  6348. needed to invoke the script. Using the line above, you can set the following
  6349. viewing options:
  6350. @example
  6351. path: @r{The path to the script. The default is to grab the script from}
  6352. @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
  6353. @r{a local copy and use a path like @samp{../scripts/org-info.js}.}
  6354. view: @r{Initial view when website is first shown. Possible values are}
  6355. info @r{Info-like interface with one section per page.}
  6356. overview @r{Folding interface, initially showing only top-level.}
  6357. content @r{Folding interface, starting with all headlines visible.}
  6358. showall @r{Folding interface, all headlines and text visible.}
  6359. sdepth: @r{Maximum headline level that will still become an independent}
  6360. @r{section for info and folding modes. The default is taken from}
  6361. @r{@code{org-headline-levels} (= the @code{H} switch in @code{#+OPTIONS}).}
  6362. @r{If this is smaller than in @code{org-headline-levels}, each}
  6363. @r{info/folding section can still contain children headlines.}
  6364. toc: @r{Should the table of content @emph{initially} be visible?}
  6365. @r{Even when @code{nil}, you can always get to the toc with @kbd{i}.}
  6366. tdepth: @r{The depth of the table of contents. The defaults are taken from}
  6367. @r{the variables @code{org-headline-levels} and @code{org-export-with-toc}.}
  6368. ltoc: @r{Should there be short contents (children) in each section?}
  6369. mouse: @r{Headings are highlighted when the mouse is over them. Should be}
  6370. @r{@samp{underline} (default) or a background color like @samp{#cccccc}.}
  6371. buttons: @r{Should view-toggle buttons be everywhere? When @code{nil} (the}
  6372. @r{default), only one such button will be present.}
  6373. @end example
  6374. You can choose default values for these options by customizing the variable
  6375. @code{org-infojs-options}. If you always want to apply the script to your
  6376. pages, configure the variable @code{org-export-html-use-infojs}.
  6377. @node LaTeX export, XOXO export, HTML export, Exporting
  6378. @section LaTeX export
  6379. @cindex LaTeX export
  6380. Org mode contains a La@TeX{} exporter written by Bastien Guerry.
  6381. @menu
  6382. * LaTeX export commands:: How to invoke LaTeX export
  6383. * Quoting LaTeX code:: Incorporating literal LaTeX code
  6384. * Sectioning structure:: Changing sectioning in LaTeX output
  6385. @end menu
  6386. @node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export
  6387. @subsection LaTeX export commands
  6388. @table @kbd
  6389. @kindex C-c C-e l
  6390. @item C-c C-e l
  6391. Export as La@TeX{} file @file{myfile.tex}.
  6392. @kindex C-c C-e L
  6393. @item C-c C-e L
  6394. Export to a temporary buffer, do not create a file.
  6395. @kindex C-c C-e v l
  6396. @kindex C-c C-e v L
  6397. @item C-c C-e v l
  6398. @item C-c C-e v L
  6399. Export only the visible part of the document.
  6400. @item M-x org-export-region-as-latex
  6401. Convert the region to La@TeX{} under the assumption that it was Org mode
  6402. syntax before. This is a global command that can be invoked in any
  6403. buffer.
  6404. @item M-x org-replace-region-by-latex
  6405. Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
  6406. code.
  6407. @end table
  6408. @cindex headline levels, for exporting
  6409. In the exported version, the first 3 outline levels will become
  6410. headlines, defining a general document structure. Additional levels
  6411. will be exported as description lists. The exporter can ignore them or
  6412. convert them to a custom string depending on
  6413. @code{org-latex-low-levels}.
  6414. If you want that transition to occur at a different level, specify it
  6415. with a numeric prefix argument. For example,
  6416. @example
  6417. @kbd{C-2 C-c C-e l}
  6418. @end example
  6419. @noindent
  6420. creates two levels of headings and does the rest as items.
  6421. @node Quoting LaTeX code, Sectioning structure, LaTeX export commands, LaTeX export
  6422. @subsection Quoting LaTeX code
  6423. Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly
  6424. inserted into the La@TeX{} file. Furthermore, you can add special code
  6425. that should only be present in La@TeX{} export with the following
  6426. constructs:
  6427. @example
  6428. #+LaTeX: Literal LaTeX code for export
  6429. @end example
  6430. @noindent or
  6431. @cindex #+BEGIN_LaTeX
  6432. @example
  6433. #+BEGIN_LaTeX
  6434. All lines between these markers are exported literally
  6435. #+END_LaTeX
  6436. @end example
  6437. @node Sectioning structure, , Quoting LaTeX code, LaTeX export
  6438. @subsection Sectioning structure
  6439. @cindex LaTeX class
  6440. @cindex LaTeX sectioning structure
  6441. By default, the La@TeX{} output uses the class @code{article}.
  6442. You can change this globally by setting a different value for
  6443. @code{org-export-latex-default-class} or locally by adding an option
  6444. like @code{#+LaTeX_CLASS: myclass} in your file. The class should be
  6445. listed in @code{org-export-latex-classes}, where you can also define the
  6446. sectioning structure for each class.
  6447. @node XOXO export, iCalendar export, LaTeX export, Exporting
  6448. @section XOXO export
  6449. @cindex XOXO export
  6450. Org mode contains an exporter that produces XOXO-style output.
  6451. Currently, this exporter only handles the general outline structure and
  6452. does not interpret any additional Org mode features.
  6453. @table @kbd
  6454. @kindex C-c C-e x
  6455. @item C-c C-e x
  6456. Export as XOXO file @file{myfile.html}.
  6457. @kindex C-c C-e v
  6458. @item C-c C-e v x
  6459. Export only the visible part of the document.
  6460. @end table
  6461. @node iCalendar export, , XOXO export, Exporting
  6462. @section iCalendar export
  6463. @cindex iCalendar export
  6464. Some people like to use Org mode for keeping track of projects, but
  6465. still prefer a standard calendar application for anniversaries and
  6466. appointments. In this case it can be useful to have deadlines and
  6467. other time-stamped items in Org files show up in the calendar
  6468. application. Org mode can export calendar information in the standard
  6469. iCalendar format. If you also want to have TODO entries included in the
  6470. export, configure the variable @code{org-icalendar-include-todo}.
  6471. @table @kbd
  6472. @kindex C-c C-e i
  6473. @item C-c C-e i
  6474. Create iCalendar entries for the current file and store them in the same
  6475. directory, using a file extension @file{.ics}.
  6476. @kindex C-c C-e I
  6477. @item C-c C-e I
  6478. Like @kbd{C-c C-e i}, but do this for all files in
  6479. @code{org-agenda-files}. For each of these files, a separate iCalendar
  6480. file will be written.
  6481. @kindex C-c C-e c
  6482. @item C-c C-e c
  6483. Create a single large iCalendar file from all files in
  6484. @code{org-agenda-files} and write it to the file given by
  6485. @code{org-combined-agenda-icalendar-file}.
  6486. @end table
  6487. The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
  6488. the selected entries have them. If not, the summary will be derived
  6489. from the headline, and the description from the body (limited to
  6490. @code{org-icalendar-include-body} characters).
  6491. How this calendar is best read and updated, depends on the application
  6492. you are using. The FAQ covers this issue.
  6493. @node Publishing, Miscellaneous, Exporting, Top
  6494. @chapter Publishing
  6495. @cindex publishing
  6496. Org includes@footnote{@file{org-publish.el} is not distributed with
  6497. Emacs 21, if you are still using Emacs 21, you need you need to download
  6498. this file separately.} a publishing management system that allows you to
  6499. configure automatic HTML conversion of @emph{projects} composed of
  6500. interlinked org files. This system is called @emph{org-publish}. You can
  6501. also configure org-publish to automatically upload your exported HTML
  6502. pages and related attachments, such as images and source code files, to
  6503. a web server. Org-publish turns Org into a web-site authoring tool.
  6504. You can also use Org-publish to convert files into La@TeX{}, or even
  6505. combine HTML and La@TeX{} conversion so that files are available in both
  6506. formats on the server@footnote{Since La@TeX{} files on a server are not
  6507. that helpful, you surely want to perform further conversion on them --
  6508. e.g. convert them to @code{PDF} format.}.
  6509. Org-publish has been contributed to Org by David O'Toole.
  6510. @menu
  6511. * Configuration:: Defining projects
  6512. * Sample configuration:: Example projects
  6513. * Triggering publication:: Publication commands
  6514. @end menu
  6515. @node Configuration, Sample configuration, Publishing, Publishing
  6516. @section Configuration
  6517. Publishing needs significant configuration to specify files, destination
  6518. and many other properties of a project.
  6519. @menu
  6520. * Project alist:: The central configuration variable
  6521. * Sources and destinations:: From here to there
  6522. * Selecting files:: What files are part of the project?
  6523. * Publishing action:: Setting the function doing the publishing
  6524. * Publishing options:: Tweaking HTML export
  6525. * Publishing links:: Which links keep working after publishing?
  6526. * Project page index:: Publishing a list of project files
  6527. @end menu
  6528. @node Project alist, Sources and destinations, Configuration, Configuration
  6529. @subsection The variable @code{org-publish-project-alist}
  6530. @cindex org-publish-project-alist
  6531. @cindex projects, for publishing
  6532. Org-publish is configured almost entirely through setting the value of
  6533. one variable, called @code{org-publish-project-alist}.
  6534. Each element of the list configures one project, and may be in one of
  6535. the two following forms:
  6536. @lisp
  6537. ("project-name" :property value :property value ...)
  6538. @r{or}
  6539. ("project-name" :components ("project-name" "project-name" ...))
  6540. @end lisp
  6541. In both cases, projects are configured by specifying property values.
  6542. A project defines the set of files that will be published, as well as
  6543. the publishing configuration to use when publishing those files. When
  6544. a project takes the second form listed above, the individual members
  6545. of the ``components'' property are taken to be components of the
  6546. project, which group together files requiring different publishing
  6547. options. When you publish such a ``meta-project'' all the components
  6548. will also publish.
  6549. @node Sources and destinations, Selecting files, Project alist, Configuration
  6550. @subsection Sources and destinations for files
  6551. @cindex directories, for publishing
  6552. Most properties are optional, but some should always be set. In
  6553. particular, org-publish needs to know where to look for source files,
  6554. and where to put published files.
  6555. @multitable @columnfractions 0.3 0.7
  6556. @item @code{:base-directory}
  6557. @tab Directory containing publishing source files
  6558. @item @code{:publishing-directory}
  6559. @tab Directory (possibly remote) where output files will be published.
  6560. @item @code{:preparation-function}
  6561. @tab Function called before starting publishing process, for example to
  6562. run @code{make} for updating files to be published.
  6563. @end multitable
  6564. @noindent
  6565. @node Selecting files, Publishing action, Sources and destinations, Configuration
  6566. @subsection Selecting files
  6567. @cindex files, selecting for publishing
  6568. By default, all files with extension @file{.org} in the base directory
  6569. are considered part of the project. This can be modified by setting the
  6570. properties
  6571. @multitable @columnfractions 0.25 0.75
  6572. @item @code{:base-extension}
  6573. @tab Extension (without the dot!) of source files. This actually is a
  6574. regular expression.
  6575. @item @code{:exclude}
  6576. @tab Regular expression to match file names that should not be
  6577. published, even though they have been selected on the basis of their
  6578. extension.
  6579. @item @code{:include}
  6580. @tab List of files to be included regardless of @code{:base-extension}
  6581. and @code{:exclude}.
  6582. @end multitable
  6583. @node Publishing action, Publishing options, Selecting files, Configuration
  6584. @subsection Publishing action
  6585. @cindex action, for publishing
  6586. Publishing means that a file is copied to the destination directory and
  6587. possibly transformed in the process. The default transformation is to
  6588. export Org files as HTML files, and this is done by the function
  6589. @code{org-publish-org-to-html} which calls the HTML exporter
  6590. (@pxref{HTML export}). But you also can publish your files in La@TeX{} by
  6591. using the function @code{org-publish-org-to-latex} instead. Other files
  6592. like images only need to be copied to the publishing destination. For
  6593. non-Org files, you need to specify the publishing function.
  6594. @multitable @columnfractions 0.3 0.7
  6595. @item @code{:publishing-function}
  6596. @tab Function executing the publication of a file. This may also be a
  6597. list of functions, which will all be called in turn.
  6598. @end multitable
  6599. The function must accept two arguments: a property list containing at
  6600. least a @code{:publishing-directory} property, and the name of the file
  6601. to be published. It should take the specified file, make the necessary
  6602. transformation (if any) and place the result into the destination folder.
  6603. You can write your own publishing function, but @code{org-publish}
  6604. provides one for attachments (files that only need to be copied):
  6605. @code{org-publish-attachment}.
  6606. @node Publishing options, Publishing links, Publishing action, Configuration
  6607. @subsection Options for the HTML/LaTeX exporters
  6608. @cindex options, for publishing
  6609. The property list can be used to set many export options for the HTML
  6610. and La@TeX{} exporters. In most cases, these properties correspond to user
  6611. variables in Org. The table below lists these properties along
  6612. with the variable they belong to. See the documentation string for the
  6613. respective variable for details.
  6614. @multitable @columnfractions 0.3 0.7
  6615. @item @code{:language} @tab @code{org-export-default-language}
  6616. @item @code{:headline-levels} @tab @code{org-export-headline-levels}
  6617. @item @code{:section-numbers} @tab @code{org-export-with-section-numbers}
  6618. @item @code{:table-of-contents} @tab @code{org-export-with-toc}
  6619. @item @code{:archived-trees} @tab @code{org-export-with-archived-trees}
  6620. @item @code{:emphasize} @tab @code{org-export-with-emphasize}
  6621. @item @code{:sub-superscript} @tab @code{org-export-with-sub-superscripts}
  6622. @item @code{:special-strings} @tab @code{org-export-with-special-strings}
  6623. @item @code{:TeX-macros} @tab @code{org-export-with-TeX-macros}
  6624. @item @code{:LaTeX-fragments} @tab @code{org-export-with-LaTeX-fragments}
  6625. @item @code{:fixed-width} @tab @code{org-export-with-fixed-width}
  6626. @item @code{:timestamps} .@tab @code{org-export-with-timestamps}
  6627. @item @code{:tags} .@tab @code{org-export-with-tags}
  6628. @item @code{:tables} @tab @code{org-export-with-tables}
  6629. @item @code{:table-auto-headline} @tab @code{org-export-highlight-first-table-line}
  6630. @item @code{:style} @tab @code{org-export-html-style}
  6631. @item @code{:convert-org-links} @tab @code{org-export-html-link-org-files-as-html}
  6632. @item @code{:inline-images} @tab @code{org-export-html-inline-images}
  6633. @item @code{:expand-quoted-html} @tab @code{org-export-html-expand}
  6634. @item @code{:timestamp} @tab @code{org-export-html-with-timestamp}
  6635. @item @code{:publishing-directory} @tab @code{org-export-publishing-directory}
  6636. @item @code{:preamble} @tab @code{org-export-html-preamble}
  6637. @item @code{:postamble} @tab @code{org-export-html-postamble}
  6638. @item @code{:auto-preamble} @tab @code{org-export-html-auto-preamble}
  6639. @item @code{:auto-postamble} @tab @code{org-export-html-auto-postamble}
  6640. @item @code{:author} @tab @code{user-full-name}
  6641. @item @code{:email} @tab @code{user-mail-address}
  6642. @end multitable
  6643. If you use several email addresses, separate them by a semi-column.
  6644. Most of the @code{org-export-with-*} variables have the same effect in
  6645. both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
  6646. @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
  6647. La@TeX{} export.
  6648. When a property is given a value in @code{org-publish-project-alist},
  6649. its setting overrides the value of the corresponding user variable (if
  6650. any) during publishing. Options set within a file (@pxref{Export
  6651. options}), however, override everything.
  6652. @node Publishing links, Project page index, Publishing options, Configuration
  6653. @subsection Links between published files
  6654. @cindex links, publishing
  6655. To create a link from one Org file to another, you would use
  6656. something like @samp{[[file:foo.org][The foo]]} or simply
  6657. @samp{file:foo.org.} (@pxref{Hyperlinks}). Upon publishing this link
  6658. becomes a link to @file{foo.html}. In this way, you can interlink the
  6659. pages of your "org web" project and the links will work as expected when
  6660. you publish them to HTML.
  6661. You may also link to related files, such as images. Provided you are
  6662. careful with relative pathnames, and provided you have also configured
  6663. @code{org-publish} to upload the related files, these links will work
  6664. too. @ref{Complex example} for an example of this usage.
  6665. Sometime an Org file to be published may contain links that are
  6666. only valid in your production environment, but not in the publishing
  6667. location. In this case, use the property
  6668. @multitable @columnfractions 0.4 0.6
  6669. @item @code{:link-validation-function}
  6670. @tab Function to validate links
  6671. @end multitable
  6672. @noindent
  6673. to define a function for checking link validity. This function must
  6674. accept two arguments, the file name and a directory relative to which
  6675. the file name is interpreted in the production environment. If this
  6676. function returns @code{nil}, then the HTML generator will only insert a
  6677. description into the HTML file, but no link. One option for this
  6678. function is @code{org-publish-validate-link} which checks if the given
  6679. file is part of any project in @code{org-publish-project-alist}.
  6680. @node Project page index, , Publishing links, Configuration
  6681. @subsection Project page index
  6682. @cindex index, of published pages
  6683. The following properties may be used to control publishing of an
  6684. index of files or summary page for a given project.
  6685. @multitable @columnfractions 0.25 0.75
  6686. @item @code{:auto-index}
  6687. @tab When non-nil, publish an index during org-publish-current-project or
  6688. org-publish-all.
  6689. @item @code{:index-filename}
  6690. @tab Filename for output of index. Defaults to @file{index.org} (which
  6691. becomes @file{index.html}).
  6692. @item @code{:index-title}
  6693. @tab Title of index page. Defaults to name of file.
  6694. @item @code{:index-function}
  6695. @tab Plug-in function to use for generation of index.
  6696. Defaults to @code{org-publish-org-index}, which generates a plain list
  6697. of links to all files in the project.
  6698. @end multitable
  6699. @node Sample configuration, Triggering publication, Configuration, Publishing
  6700. @section Sample configuration
  6701. Below we provide two example configurations. The first one is a simple
  6702. project publishing only a set of Org files. The second example is
  6703. more complex, with a multi-component project.
  6704. @menu
  6705. * Simple example:: One-component publishing
  6706. * Complex example:: A multi-component publishing example
  6707. @end menu
  6708. @node Simple example, Complex example, Sample configuration, Sample configuration
  6709. @subsection Example: simple publishing configuration
  6710. This example publishes a set of Org files to the @file{public_html}
  6711. directory on the local machine.
  6712. @lisp
  6713. (setq org-publish-project-alist
  6714. '(("org"
  6715. :base-directory "~/org/"
  6716. :publishing-directory "~/public_html"
  6717. :section-numbers nil
  6718. :table-of-contents nil
  6719. :style "<link rel=stylesheet
  6720. href=\"../other/mystyle.css\"
  6721. type=\"text/css\">")))
  6722. @end lisp
  6723. @node Complex example, , Simple example, Sample configuration
  6724. @subsection Example: complex publishing configuration
  6725. This more complicated example publishes an entire website, including
  6726. org files converted to HTML, image files, emacs lisp source code, and
  6727. style sheets. The publishing-directory is remote and private files are
  6728. excluded.
  6729. To ensure that links are preserved, care should be taken to replicate
  6730. your directory structure on the web server, and to use relative file
  6731. paths. For example, if your org files are kept in @file{~/org} and your
  6732. publishable images in @file{~/images}, you'd link to an image with
  6733. @c
  6734. @example
  6735. file:../images/myimage.png
  6736. @end example
  6737. @c
  6738. On the web server, the relative path to the image should be the
  6739. same. You can accomplish this by setting up an "images" folder in the
  6740. right place on the web server, and publishing images to it.
  6741. @lisp
  6742. (setq org-publish-project-alist
  6743. '(("orgfiles"
  6744. :base-directory "~/org/"
  6745. :base-extension "org"
  6746. :publishing-directory "/ssh:user@@host:~/html/notebook/"
  6747. :publishing-function org-publish-org-to-html
  6748. :exclude "PrivatePage.org" ;; regexp
  6749. :headline-levels 3
  6750. :section-numbers nil
  6751. :table-of-contents nil
  6752. :style "<link rel=stylesheet
  6753. href=\"../other/mystyle.css\" type=\"text/css\">"
  6754. :auto-preamble t
  6755. :auto-postamble nil)
  6756. ("images"
  6757. :base-directory "~/images/"
  6758. :base-extension "jpg\\|gif\\|png"
  6759. :publishing-directory "/ssh:user@@host:~/html/images/"
  6760. :publishing-function org-publish-attachment)
  6761. ("other"
  6762. :base-directory "~/other/"
  6763. :base-extension "css\\|el"
  6764. :publishing-directory "/ssh:user@@host:~/html/other/"
  6765. :publishing-function org-publish-attachment)
  6766. ("website" :components ("orgfiles" "images" "other"))))
  6767. @end lisp
  6768. @node Triggering publication, , Sample configuration, Publishing
  6769. @section Triggering publication
  6770. Once org-publish is properly configured, you can publish with the
  6771. following functions:
  6772. @table @kbd
  6773. @item C-c C-e C
  6774. Prompt for a specific project and publish all files that belong to it.
  6775. @item C-c C-e P
  6776. Publish the project containing the current file.
  6777. @item C-c C-e F
  6778. Publish only the current file.
  6779. @item C-c C-e A
  6780. Publish all projects.
  6781. @end table
  6782. Org uses timestamps to track when a file has changed. The above
  6783. functions normally only publish changed files. You can override this and
  6784. force publishing of all files by giving a prefix argument.
  6785. @node Miscellaneous, Extensions and Hacking, Publishing, Top
  6786. @chapter Miscellaneous
  6787. @menu
  6788. * Completion:: M-TAB knows what you need
  6789. * Customization:: Adapting Org to your taste
  6790. * In-buffer settings:: Overview of the #+KEYWORDS
  6791. * The very busy C-c C-c key:: When in doubt, press C-c C-c
  6792. * Clean view:: Getting rid of leading stars in the outline
  6793. * TTY keys:: Using Org on a tty
  6794. * Interaction:: Other Emacs packages
  6795. * Bugs:: Things which do not work perfectly
  6796. @end menu
  6797. @node Completion, Customization, Miscellaneous, Miscellaneous
  6798. @section Completion
  6799. @cindex completion, of @TeX{} symbols
  6800. @cindex completion, of TODO keywords
  6801. @cindex completion, of dictionary words
  6802. @cindex completion, of option keywords
  6803. @cindex completion, of tags
  6804. @cindex completion, of property keys
  6805. @cindex completion, of link abbreviations
  6806. @cindex @TeX{} symbol completion
  6807. @cindex TODO keywords completion
  6808. @cindex dictionary word completion
  6809. @cindex option keyword completion
  6810. @cindex tag completion
  6811. @cindex link abbreviations, completion of
  6812. Org supports in-buffer completion. This type of completion does
  6813. not make use of the minibuffer. You simply type a few letters into
  6814. the buffer and use the key to complete text right there.
  6815. @table @kbd
  6816. @kindex M-@key{TAB}
  6817. @item M-@key{TAB}
  6818. Complete word at point
  6819. @itemize @bullet
  6820. @item
  6821. At the beginning of a headline, complete TODO keywords.
  6822. @item
  6823. After @samp{\}, complete @TeX{} symbols supported by the exporter.
  6824. @item
  6825. After @samp{*}, complete headlines in the current buffer so that they
  6826. can be used in search links like @samp{[[*find this headline]]}.
  6827. @item
  6828. After @samp{:} in a headline, complete tags. The list of tags is taken
  6829. from the variable @code{org-tag-alist} (possibly set through the
  6830. @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
  6831. dynamically from all tags used in the current buffer.
  6832. @item
  6833. After @samp{:} and not in a headline, complete property keys. The list
  6834. of keys is constructed dynamically from all keys used in the current
  6835. buffer.
  6836. @item
  6837. After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
  6838. @item
  6839. After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
  6840. @samp{OPTIONS} which set file-specific options for Org mode. When the
  6841. option keyword is already complete, pressing @kbd{M-@key{TAB}} again
  6842. will insert example settings for this keyword.
  6843. @item
  6844. In the line after @samp{#+STARTUP: }, complete startup keywords,
  6845. i.e. valid keys for this line.
  6846. @item
  6847. Elsewhere, complete dictionary words using Ispell.
  6848. @end itemize
  6849. @end table
  6850. @node Customization, In-buffer settings, Completion, Miscellaneous
  6851. @section Customization
  6852. @cindex customization
  6853. @cindex options, for customization
  6854. @cindex variables, for customization
  6855. There are more than 180 variables that can be used to customize
  6856. Org. For the sake of compactness of the manual, I am not
  6857. describing the variables here. A structured overview of customization
  6858. variables is available with @kbd{M-x org-customize}. Or select
  6859. @code{Browse Org Group} from the @code{Org->Customization} menu. Many
  6860. settings can also be activated on a per-file basis, by putting special
  6861. lines into the buffer (@pxref{In-buffer settings}).
  6862. @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
  6863. @section Summary of in-buffer settings
  6864. @cindex in-buffer settings
  6865. @cindex special keywords
  6866. Org mode uses special lines in the buffer to define settings on a
  6867. per-file basis. These lines start with a @samp{#+} followed by a
  6868. keyword, a colon, and then individual words defining a setting. Several
  6869. setting words can be in the same line, but you can also have multiple
  6870. lines for the keyword. While these settings are described throughout
  6871. the manual, here is a summary. After changing any of those lines in the
  6872. buffer, press @kbd{C-c C-c} with the cursor still in the line to
  6873. activate the changes immediately. Otherwise they become effective only
  6874. when the file is visited again in a new Emacs session.
  6875. @table @kbd
  6876. @item #+ARCHIVE: %s_done::
  6877. This line sets the archive location for the agenda file. It applies for
  6878. all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
  6879. of the file. The first such line also applies to any entries before it.
  6880. The corresponding variable is @code{org-archive-location}.
  6881. @item #+CATEGORY:
  6882. This line sets the category for the agenda file. The category applies
  6883. for all subsequent lines until the next @samp{#+CATEGORY} line, or the
  6884. end of the file. The first such line also applies to any entries before it.
  6885. @item #+COLUMNS: %25ITEM .....
  6886. Set the default format for columns view. This format applies when
  6887. columns view is invoked in location where no @code{COLUMNS} property
  6888. applies.
  6889. @item #+CONSTANTS: name1=value1 ...
  6890. Set file-local values for constants to be used in table formulas. This
  6891. line set the local variable @code{org-table-formula-constants-local}.
  6892. The global version of this variable is
  6893. @code{org-table-formula-constants}.
  6894. @item #+DRAWERS: NAME1 .....
  6895. Set the file-local set of drawers. The corresponding global variable is
  6896. @code{org-drawers}.
  6897. @item #+LINK: linkword replace
  6898. These lines (several are allowed) specify link abbreviations.
  6899. @xref{Link abbreviations}. The corresponding variable is
  6900. @code{org-link-abbrev-alist}.
  6901. @item #+PRIORITIES: highest lowest default
  6902. This line sets the limits and the default for the priorities. All three
  6903. must be either letters A-Z or numbers 0-9. The highest priority must
  6904. have a lower ASCII number that the lowest priority.
  6905. @item #+PROPERTY: Property_Name Value
  6906. This line sets a default inheritance value for entries in the current
  6907. buffer, most useful for specifying the allowed values of a property.
  6908. @item #+SETUPFILE: file
  6909. This line defines a file that holds more in-buffer setup. Normally this is
  6910. entirely ignored. Only when the buffer is parsed for option-setting lines
  6911. (i.e. when starting Org mode for a file, when pressing @kbd{C-c C-c} in a
  6912. settings line, or when exporting), then the contents of this file are parsed
  6913. as if they had been included in the buffer. In particlar, the file can be
  6914. any other Org mode file with internal setup.
  6915. @item #+STARTUP:
  6916. This line sets options to be used at startup of Org mode, when an
  6917. Org file is being visited. The first set of options deals with the
  6918. initial visibility of the outline tree. The corresponding variable for
  6919. global default settings is @code{org-startup-folded}, with a default
  6920. value @code{t}, which means @code{overview}.
  6921. @cindex @code{overview}, STARTUP keyword
  6922. @cindex @code{content}, STARTUP keyword
  6923. @cindex @code{showall}, STARTUP keyword
  6924. @example
  6925. overview @r{top-level headlines only}
  6926. content @r{all headlines}
  6927. showall @r{no folding at all, show everything}
  6928. @end example
  6929. Then there are options for aligning tables upon visiting a file. This
  6930. is useful in files containing narrowed table columns. The corresponding
  6931. variable is @code{org-startup-align-all-tables}, with a default value
  6932. @code{nil}.
  6933. @cindex @code{align}, STARTUP keyword
  6934. @cindex @code{noalign}, STARTUP keyword
  6935. @example
  6936. align @r{align all tables}
  6937. noalign @r{don't align tables on startup}
  6938. @end example
  6939. Logging closing and reinstating TODO items, and clock intervals
  6940. (variables @code{org-log-done}, @code{org-log-note-clock-out}, and
  6941. @code{org-log-repeat}) can be configured using these options.
  6942. @cindex @code{logdone}, STARTUP keyword
  6943. @cindex @code{lognotedone}, STARTUP keyword
  6944. @cindex @code{nologdone}, STARTUP keyword
  6945. @cindex @code{lognoteclock-out}, STARTUP keyword
  6946. @cindex @code{nolognoteclock-out}, STARTUP keyword
  6947. @cindex @code{logrepeat}, STARTUP keyword
  6948. @cindex @code{lognoterepeat}, STARTUP keyword
  6949. @cindex @code{nologrepeat}, STARTUP keyword
  6950. @example
  6951. logdone @r{record a timestamp when an item is marked DONE}
  6952. lognotedone @r{record timestamp and a note when DONE}
  6953. nologdone @r{don't record when items are marked DONE}
  6954. logrepeat @r{record a time when reinstating a repeating item}
  6955. lognoterepeat @r{record a note when reinstating a repeating item}
  6956. nologrepeat @r{do not record when reinstating repeating item}
  6957. lognoteclock-out @r{record a note when clocking out}
  6958. nolognoteclock-out @r{don't record a note when clocking out}
  6959. @end example
  6960. Here are the options for hiding leading stars in outline headings. The
  6961. corresponding variables are @code{org-hide-leading-stars} and
  6962. @code{org-odd-levels-only}, both with a default setting @code{nil}
  6963. (meaning @code{showstars} and @code{oddeven}).
  6964. @cindex @code{hidestars}, STARTUP keyword
  6965. @cindex @code{showstars}, STARTUP keyword
  6966. @cindex @code{odd}, STARTUP keyword
  6967. @cindex @code{even}, STARTUP keyword
  6968. @example
  6969. hidestars @r{make all but one of the stars starting a headline invisible.}
  6970. showstars @r{show all stars starting a headline}
  6971. odd @r{allow only odd outline levels (1,3,...)}
  6972. oddeven @r{allow all outline levels}
  6973. @end example
  6974. To turn on custom format overlays over time stamps (variables
  6975. @code{org-put-time-stamp-overlays} and
  6976. @code{org-time-stamp-overlay-formats}), use
  6977. @cindex @code{customtime}, STARTUP keyword
  6978. @example
  6979. customtime @r{overlay custom time format}
  6980. @end example
  6981. The following options influence the table spreadsheet (variable
  6982. @code{constants-unit-system}).
  6983. @cindex @code{constcgs}, STARTUP keyword
  6984. @cindex @code{constSI}, STARTUP keyword
  6985. @example
  6986. constcgs @r{@file{constants.el} should use the c-g-s unit system}
  6987. constSI @r{@file{constants.el} should use the SI unit system}
  6988. @end example
  6989. @item #+TAGS: TAG1(c1) TAG2(c2)
  6990. These lines (several such lines are allowed) specify the valid tags in
  6991. this file, and (potentially) the corresponding @emph{fast tag selection}
  6992. keys. The corresponding variable is @code{org-tag-alist}.
  6993. @item #+TBLFM:
  6994. This line contains the formulas for the table directly above the line.
  6995. @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:
  6996. These lines provide settings for exporting files. For more details see
  6997. @ref{Export options}.
  6998. @item #+SEQ_TODO: #+TYP_TODO:
  6999. These lines set the TODO keywords and their interpretation in the
  7000. current file. The corresponding variables are @code{org-todo-keywords}
  7001. and @code{org-todo-interpretation}.
  7002. @end table
  7003. @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
  7004. @section The very busy C-c C-c key
  7005. @kindex C-c C-c
  7006. @cindex C-c C-c, overview
  7007. The key @kbd{C-c C-c} has many purposes in Org, which are all
  7008. mentioned scattered throughout this manual. One specific function of
  7009. this key is to add @emph{tags} to a headline (@pxref{Tags}). In many
  7010. other circumstances it means something like @emph{Hey Org, look
  7011. here and update according to what you see here}. Here is a summary of
  7012. what this means in different contexts.
  7013. @itemize @minus
  7014. @item
  7015. If there are highlights in the buffer from the creation of a sparse
  7016. tree, or from clock display, remove these highlights.
  7017. @item
  7018. If the cursor is in one of the special @code{#+KEYWORD} lines, this
  7019. triggers scanning the buffer for these lines and updating the
  7020. information.
  7021. @item
  7022. If the cursor is inside a table, realign the table. This command
  7023. works even if the automatic table editor has been turned off.
  7024. @item
  7025. If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
  7026. the entire table.
  7027. @item
  7028. If the cursor is inside a table created by the @file{table.el} package,
  7029. activate that table.
  7030. @item
  7031. If the current buffer is a remember buffer, close the note and file it.
  7032. With a prefix argument, file it, without further interaction, to the
  7033. default location.
  7034. @item
  7035. If the cursor is on a @code{<<<target>>>}, update radio targets and
  7036. corresponding links in this buffer.
  7037. @item
  7038. If the cursor is in a property line or at the start or end of a property
  7039. drawer, offer property commands.
  7040. @item
  7041. If the cursor is in a plain list item with a checkbox, toggle the status
  7042. of the checkbox.
  7043. @item
  7044. If the cursor is on a numbered item in a plain list, renumber the
  7045. ordered list.
  7046. @item
  7047. If the cursor is on the @code{#+BEGIN} line of a dynamical block, the
  7048. block is updated.
  7049. @end itemize
  7050. @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
  7051. @section A cleaner outline view
  7052. @cindex hiding leading stars
  7053. @cindex clean outline view
  7054. Some people find it noisy and distracting that the Org headlines
  7055. are starting with a potentially large number of stars. For example
  7056. the tree from @ref{Headlines}:
  7057. @example
  7058. * Top level headline
  7059. ** Second level
  7060. *** 3rd level
  7061. some text
  7062. *** 3rd level
  7063. more text
  7064. * Another top level headline
  7065. @end example
  7066. @noindent
  7067. Unfortunately this is deeply ingrained into the code of Org and
  7068. cannot be easily changed. You can, however, modify the display in such
  7069. a way that all leading stars become invisible and the outline more easy
  7070. to read. To do this, customize the variable
  7071. @code{org-hide-leading-stars} like this:
  7072. @lisp
  7073. (setq org-hide-leading-stars t)
  7074. @end lisp
  7075. @noindent
  7076. or change this on a per-file basis with one of the lines (anywhere in
  7077. the buffer)
  7078. @example
  7079. #+STARTUP: showstars
  7080. #+STARTUP: hidestars
  7081. @end example
  7082. @noindent
  7083. Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
  7084. the modifications.
  7085. With stars hidden, the tree becomes:
  7086. @example
  7087. * Top level headline
  7088. * Second level
  7089. * 3rd level
  7090. some text
  7091. * 3rd level
  7092. more text
  7093. * Another top level headline
  7094. @end example
  7095. @noindent
  7096. Note that the leading stars are not truly replaced by whitespace, they
  7097. are only fontified with the face @code{org-hide} that uses the
  7098. background color as font color. If you are not using either white or
  7099. black background, you may have to customize this face to get the wanted
  7100. effect. Another possibility is to set this font such that the extra
  7101. stars are @i{almost} invisible, for example using the color
  7102. @code{grey90} on a white background.
  7103. Things become cleaner still if you skip all the even levels and use only
  7104. odd levels 1, 3, 5..., effectively adding two stars to go from one
  7105. outline level to the next:
  7106. @example
  7107. * Top level headline
  7108. * Second level
  7109. * 3rd level
  7110. some text
  7111. * 3rd level
  7112. more text
  7113. * Another top level headline
  7114. @end example
  7115. @noindent
  7116. In order to make the structure editing and export commands handle this
  7117. convention correctly, use
  7118. @lisp
  7119. (setq org-odd-levels-only t)
  7120. @end lisp
  7121. @noindent
  7122. or set this on a per-file basis with one of the following lines (don't
  7123. forget to press @kbd{C-c C-c} with the cursor in the startup line to
  7124. activate changes immediately).
  7125. @example
  7126. #+STARTUP: odd
  7127. #+STARTUP: oddeven
  7128. @end example
  7129. You can convert an Org file from single-star-per-level to the
  7130. double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
  7131. RET} in that file. The reverse operation is @kbd{M-x
  7132. org-convert-to-oddeven-levels}.
  7133. @node TTY keys, Interaction, Clean view, Miscellaneous
  7134. @section Using Org on a tty
  7135. @cindex tty key bindings
  7136. Because Org contains a large number of commands, by default much of
  7137. Org's core commands are bound to keys that are generally not
  7138. accessible on a tty, such as the cursor keys (@key{left}, @key{right},
  7139. @key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
  7140. together with modifiers like @key{Meta} and/or @key{Shift}. To access
  7141. these commands on a tty when special keys are unavailable, the following
  7142. alternative bindings can be used. The tty bindings below will likely be
  7143. more cumbersome; you may find for some of the bindings below that a
  7144. customized work-around suits you better. For example, changing a time
  7145. stamp is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
  7146. tty you would rather use @kbd{C-c .} to re-insert the timestamp.
  7147. @multitable @columnfractions 0.15 0.2 0.2
  7148. @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
  7149. @item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab
  7150. @item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{@key{Esc} @key{left}}
  7151. @item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab
  7152. @item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{@key{Esc} @key{right}}
  7153. @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab
  7154. @item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{@key{Esc} @key{up}}
  7155. @item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab
  7156. @item @kbd{M-@key{down}} @tab @kbd{C-c C-x d} @tab @kbd{@key{Esc} @key{down}}
  7157. @item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab
  7158. @item @kbd{S-@key{RET}} @tab @kbd{C-c C-x c} @tab
  7159. @item @kbd{M-@key{RET}} @tab @kbd{C-c C-x m} @tab @kbd{@key{Esc} @key{RET}}
  7160. @item @kbd{M-S-@key{RET}} @tab @kbd{C-c C-x M} @tab
  7161. @item @kbd{S-@key{left}} @tab @kbd{C-c @key{left}} @tab
  7162. @item @kbd{S-@key{right}} @tab @kbd{C-c @key{right}} @tab
  7163. @item @kbd{S-@key{up}} @tab @kbd{C-c @key{up}} @tab
  7164. @item @kbd{S-@key{down}} @tab @kbd{C-c @key{down}} @tab
  7165. @item @kbd{C-S-@key{left}} @tab @kbd{C-c C-x @key{left}} @tab
  7166. @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
  7167. @end multitable
  7168. @node Interaction, Bugs, TTY keys, Miscellaneous
  7169. @section Interaction with other packages
  7170. @cindex packages, interaction with other
  7171. Org lives in the world of GNU Emacs and interacts in various ways
  7172. with other code out there.
  7173. @menu
  7174. * Cooperation:: Packages Org cooperates with
  7175. * Conflicts:: Packages that lead to conflicts
  7176. @end menu
  7177. @node Cooperation, Conflicts, Interaction, Interaction
  7178. @subsection Packages that Org cooperates with
  7179. @table @asis
  7180. @cindex @file{calc.el}
  7181. @item @file{calc.el} by Dave Gillespie
  7182. Org uses the Calc package for implementing spreadsheet
  7183. functionality in its tables (@pxref{The spreadsheet}). Org
  7184. checks for the availability of Calc by looking for the function
  7185. @code{calc-eval} which should be autoloaded in your setup if Calc has
  7186. been installed properly. As of Emacs 22, Calc is part of the Emacs
  7187. distribution. Another possibility for interaction between the two
  7188. packages is using Calc for embedded calculations. @xref{Embedded Mode,
  7189. , Embedded Mode, Calc, GNU Emacs Calc Manual}.
  7190. @cindex @file{constants.el}
  7191. @item @file{constants.el} by Carsten Dominik
  7192. In a table formula (@pxref{The spreadsheet}), it is possible to use
  7193. names for natural constants or units. Instead of defining your own
  7194. constants in the variable @code{org-table-formula-constants}, install
  7195. the @file{constants} package which defines a large number of constants
  7196. and units, and lets you use unit prefixes like @samp{M} for
  7197. @samp{Mega} etc. You will need version 2.0 of this package, available
  7198. at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
  7199. the function @code{constants-get}, which has to be autoloaded in your
  7200. setup. See the installation instructions in the file
  7201. @file{constants.el}.
  7202. @item @file{cdlatex.el} by Carsten Dominik
  7203. @cindex @file{cdlatex.el}
  7204. Org mode can make use of the CDLaTeX package to efficiently enter
  7205. La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}.
  7206. @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
  7207. @cindex @file{imenu.el}
  7208. Imenu allows menu access to an index of items in a file. Org mode
  7209. supports Imenu - all you need to do to get the index is the following:
  7210. @lisp
  7211. (add-hook 'org-mode-hook
  7212. (lambda () (imenu-add-to-menubar "Imenu")))
  7213. @end lisp
  7214. By default the index is two levels deep - you can modify the depth using
  7215. the option @code{org-imenu-depth}.
  7216. @item @file{remember.el} by John Wiegley
  7217. @cindex @file{remember.el}
  7218. Org cooperates with remember, see @ref{Remember}.
  7219. @file{Remember.el} is not part of Emacs, find it on the web.
  7220. @item @file{speedbar.el} by Eric M. Ludlam
  7221. @cindex @file{speedbar.el}
  7222. Speedbar is a package that creates a special frame displaying files and
  7223. index items in files. Org mode supports Speedbar and allows you to
  7224. drill into Org files directly from the Speedbar. It also allows to
  7225. restrict the scope of agenda commands to a file or a subtree by using
  7226. the command @kbd{<} in the Speedbar frame.
  7227. @cindex @file{table.el}
  7228. @item @file{table.el} by Takaaki Ota
  7229. @kindex C-c C-c
  7230. @cindex table editor, @file{table.el}
  7231. @cindex @file{table.el}
  7232. Complex ASCII tables with automatic line wrapping, column- and
  7233. row-spanning, and alignment can be created using the Emacs table
  7234. package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
  7235. and also part of Emacs 22).
  7236. When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
  7237. will call @command{table-recognize-table} and move the cursor into the
  7238. table. Inside a table, the keymap of Org mode is inactive. In order
  7239. to execute Org mode-related commands, leave the table.
  7240. @table @kbd
  7241. @kindex C-c C-c
  7242. @item C-c C-c
  7243. Recognize @file{table.el} table. Works when the cursor is in a
  7244. table.el table.
  7245. @c
  7246. @kindex C-c ~
  7247. @item C-c ~
  7248. Insert a table.el table. If there is already a table at point, this
  7249. command converts it between the table.el format and the Org mode
  7250. format. See the documentation string of the command
  7251. @code{org-convert-table} for the restrictions under which this is
  7252. possible.
  7253. @end table
  7254. @file{table.el} is part of Emacs 22.
  7255. @cindex @file{footnote.el}
  7256. @item @file{footnote.el} by Steven L. Baur
  7257. Org mode recognizes numerical footnotes as provided by this package
  7258. (@pxref{Footnotes}).
  7259. @end table
  7260. @node Conflicts, , Cooperation, Interaction
  7261. @subsection Packages that lead to conflicts with Org mode
  7262. @table @asis
  7263. @cindex @file{allout.el}
  7264. @item @file{allout.el} by Ken Manheimer
  7265. Startup of Org may fail with the error message
  7266. @code{(wrong-type-argument keymapp nil)} when there is an outdated
  7267. version @file{allout.el} on the load path, for example the version
  7268. distributed with Emacs 21.x. Upgrade to Emacs 22 and this problem will
  7269. disappear. If for some reason you cannot do this, make sure that org.el
  7270. is loaded @emph{before} @file{allout.el}, for example by putting
  7271. @code{(require 'org)} early enough into your @file{.emacs} file.
  7272. @cindex @file{CUA.el}
  7273. @item @file{CUA.el} by Kim. F. Storm
  7274. Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by
  7275. CUA mode (as well as pc-select-mode and s-region-mode) to select and
  7276. extend the region. If you want to use one of these packages along with
  7277. Org, configure the variable @code{org-replace-disputed-keys}. When
  7278. set, Org will move the following key bindings in Org files, and
  7279. in the agenda buffer (but not during date selection).
  7280. @example
  7281. S-UP -> M-p S-DOWN -> M-n
  7282. S-LEFT -> M-- S-RIGHT -> M-+
  7283. @end example
  7284. Yes, these are unfortunately more difficult to remember. If you want
  7285. to have other replacement keys, look at the variable
  7286. @code{org-disputed-keys}.
  7287. @item @file{windmove.el} by Hovav Shacham
  7288. @cindex @file{windmove.el}
  7289. Also this package uses the @kbd{S-<cursor>} keys, so everything written
  7290. in the paragraph above about CUA mode also applies here.
  7291. @cindex @file{footnote.el}
  7292. @item @file{footnote.el} by Steven L. Baur
  7293. Org supports the syntax of the footnote package, but only the
  7294. numerical footnote markers. Also, the default key for footnote
  7295. commands, @kbd{C-c !} is already used by Org. You could use the
  7296. variable @code{footnote-prefix} to switch footnotes commands to another
  7297. key. Or, you could use @code{org-replace-disputed-keys} and
  7298. @code{org-disputed-keys} to change the settings in Org.
  7299. @end table
  7300. @node Bugs, , Interaction, Miscellaneous
  7301. @section Bugs
  7302. @cindex bugs
  7303. Here is a list of things that should work differently, but which I
  7304. have found too hard to fix.
  7305. @itemize @bullet
  7306. @item
  7307. If a table field starts with a link, and if the corresponding table
  7308. column is narrowed (@pxref{Narrow columns}) to a width too small to
  7309. display the link, the field would look entirely empty even though it is
  7310. not. To prevent this, Org throws an error. The work-around is to
  7311. make the column wide enough to fit the link, or to add some text (at
  7312. least 2 characters) before the link in the same field.
  7313. @item
  7314. Narrowing table columns does not work on XEmacs, because the
  7315. @code{format} function does not transport text properties.
  7316. @item
  7317. Text in an entry protected with the @samp{QUOTE} keyword should not
  7318. autowrap.
  7319. @item
  7320. When the application called by @kbd{C-c C-o} to open a file link fails
  7321. (for example because the application does not exist or refuses to open
  7322. the file), it does so silently. No error message is displayed.
  7323. @item
  7324. Recalculating a table line applies the formulas from left to right.
  7325. If a formula uses @emph{calculated} fields further down the row,
  7326. multiple recalculation may be needed to get all fields consistent. You
  7327. may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
  7328. recalculate until convergence.
  7329. @item
  7330. A single letter cannot be made bold, for example @samp{*a*}.
  7331. @item
  7332. The exporters work well, but could be made more efficient.
  7333. @end itemize
  7334. @node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top
  7335. @appendix Extensions, Hooks and Hacking
  7336. This appendix lists extensions for Org written by other authors.
  7337. It also covers some aspects where users can extend the functionality of
  7338. Org.
  7339. @menu
  7340. * Extensions:: Existing 3rd-party extensions
  7341. * Adding hyperlink types:: New custom link types
  7342. * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
  7343. * Dynamic blocks:: Automatically filled blocks
  7344. * Special agenda views:: Customized views
  7345. * Using the property API:: Writing programs that use entry properties
  7346. @end menu
  7347. @node Extensions, Adding hyperlink types, Extensions and Hacking, Extensions and Hacking
  7348. @section Third-party extensions for Org
  7349. @cindex extension, third-party
  7350. There are lots of extensions that have been written by other people. Most of
  7351. them have either been integrated into Org by now, or they can be found in the
  7352. Org distribution, in the @file{contrib} directory. The list has gotten too
  7353. long to cover in any detail here, but there is a seaparate manual for these
  7354. extensions.
  7355. @node Adding hyperlink types, Tables in arbitrary syntax, Extensions, Extensions and Hacking
  7356. @section Adding hyperlink types
  7357. @cindex hyperlinks, adding new types
  7358. Org has a large number of hyperlink types built-in
  7359. (@pxref{Hyperlinks}). If you would like to add new link types, it
  7360. provides an interface for doing so. Lets look at an example file
  7361. @file{org-man.el} that will add support for creating links like
  7362. @samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
  7363. emacs:
  7364. @lisp
  7365. ;;; org-man.el - Support for links to manpages in Org
  7366. (require 'org)
  7367. (org-add-link-type "man" 'org-man-open)
  7368. (add-hook 'org-store-link-functions 'org-man-store-link)
  7369. (defcustom org-man-command 'man
  7370. "The Emacs command to be used to display a man page."
  7371. :group 'org-link
  7372. :type '(choice (const man) (const woman)))
  7373. (defun org-man-open (path)
  7374. "Visit the manpage on PATH.
  7375. PATH should be a topic that can be thrown at the man command."
  7376. (funcall org-man-command path))
  7377. (defun org-man-store-link ()
  7378. "Store a link to a manpage."
  7379. (when (memq major-mode '(Man-mode woman-mode))
  7380. ;; This is a man page, we do make this link
  7381. (let* ((page (org-man-get-page-name))
  7382. (link (concat "man:" page))
  7383. (description (format "Manpage for %s" page)))
  7384. (org-store-link-props
  7385. :type "man"
  7386. :link link
  7387. :description description))))
  7388. (defun org-man-get-page-name ()
  7389. "Extract the page name from the buffer name."
  7390. ;; This works for both `Man-mode' and `woman-mode'.
  7391. (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  7392. (match-string 1 (buffer-name))
  7393. (error "Cannot create link to this man page")))
  7394. (provide 'org-man)
  7395. ;;; org-man.el ends here
  7396. @end lisp
  7397. @noindent
  7398. You would activate this new link type in @file{.emacs} with
  7399. @lisp
  7400. (require 'org-man)
  7401. @end lisp
  7402. @noindent
  7403. Lets go through the file and see what it does.
  7404. @enumerate
  7405. @item
  7406. It does @code{(require 'org)} to make sure that @file{org.el} has been
  7407. loaded.
  7408. @item
  7409. The next line calls @code{org-add-link-type} to define a new link type
  7410. with prefix @samp{man}. The call also contains the name of a function
  7411. that will be called to follow such a link.
  7412. @item
  7413. The next line adds a function to @code{org-store-link-functions}, in
  7414. order to allow the command @kbd{C-c l} to record a useful link in a
  7415. buffer displaying a man page.
  7416. @end enumerate
  7417. The rest of the file defines the necessary variables and functions.
  7418. First there is a customization variable that determines which emacs
  7419. command should be used to display man pages. There are two options,
  7420. @code{man} and @code{woman}. Then the function to follow a link is
  7421. defined. It gets the link path as an argument - in this case the link
  7422. path is just a topic for the manual command. The function calls the
  7423. value of @code{org-man-command} to display the man page.
  7424. Finally the function @code{org-man-store-link} is defined. When you try
  7425. to store a link with @kbd{C-c l}, also this function will be called to
  7426. try to make a link. The function must first decide if it is supposed to
  7427. create the link for this buffer type, we do this by checking the value
  7428. of the variable @code{major-mode}. If not, the function must exit and
  7429. return the value @code{nil}. If yes, the link is created by getting the
  7430. manual topic from the buffer name and prefixing it with the string
  7431. @samp{man:}. Then it must call the command @code{org-store-link-props}
  7432. and set the @code{:type} and @code{:link} properties. Optionally you
  7433. can also set the @code{:description} property to provide a default for
  7434. the link description when the link is later inserted into an Org
  7435. buffer with @kbd{C-c C-l}.
  7436. @node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Extensions and Hacking
  7437. @section Tables and lists in arbitrary syntax
  7438. @cindex tables, in other modes
  7439. @cindex lists, in other modes
  7440. @cindex Orgtbl mode
  7441. Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
  7442. frequent feature request has been to make it work with native tables in
  7443. specific languages, for example La@TeX{}. However, this is extremely
  7444. hard to do in a general way, would lead to a customization nightmare,
  7445. and would take away much of the simplicity of the Orgtbl mode table
  7446. editor.
  7447. This appendix describes a different approach. We keep the Orgtbl mode
  7448. table in its native format (the @i{source table}), and use a custom
  7449. function to @i{translate} the table to the correct syntax, and to
  7450. @i{install} it in the right location (the @i{target table}). This puts
  7451. the burden of writing conversion functions on the user, but it allows
  7452. for a very flexible system.
  7453. Bastien added the ability to do the same with lists. You can use Org's
  7454. facilities to edit and structure lists by turning @code{orgstruct-mode}
  7455. on, then locally exporting such lists in another format (HTML, La@TeX{}
  7456. or Texinfo.)
  7457. @menu
  7458. * Radio tables:: Sending and receiving
  7459. * A LaTeX example:: Step by step, almost a tutorial
  7460. * Translator functions:: Copy and modify
  7461. * Radio lists:: Doing the same for lists
  7462. @end menu
  7463. @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
  7464. @subsection Radio tables
  7465. @cindex radio tables
  7466. To define the location of the target table, you first need to create two
  7467. lines that are comments in the current mode, but contain magic words for
  7468. Orgtbl mode to find. Orgtbl mode will insert the translated table
  7469. between these lines, replacing whatever was there before. For example:
  7470. @example
  7471. /* BEGIN RECEIVE ORGTBL table_name */
  7472. /* END RECEIVE ORGTBL table_name */
  7473. @end example
  7474. @noindent
  7475. Just above the source table, we put a special line that tells
  7476. Orgtbl mode how to translate this table and where to install it. For
  7477. example:
  7478. @example
  7479. #+ORGTBL: SEND table_name translation_function arguments....
  7480. @end example
  7481. @noindent
  7482. @code{table_name} is the reference name for the table that is also used
  7483. in the receiver lines. @code{translation_function} is the Lisp function
  7484. that does the translation. Furthermore, the line can contain a list of
  7485. arguments (alternating key and value) at the end. The arguments will be
  7486. passed as a property list to the translation function for
  7487. interpretation. A few standard parameters are already recognized and
  7488. acted upon before the translation function is called:
  7489. @table @code
  7490. @item :skip N
  7491. Skip the first N lines of the table. Hlines do count!
  7492. @item :skipcols (n1 n2 ...)
  7493. List of columns that should be skipped. If the table has a column with
  7494. calculation marks, that column is automatically discarded as well.
  7495. Please note that the translator function sees the table @emph{after} the
  7496. removal of these columns, the function never knows that there have been
  7497. additional columns.
  7498. @end table
  7499. @noindent
  7500. The one problem remaining is how to keep the source table in the buffer
  7501. without disturbing the normal workings of the file, for example during
  7502. compilation of a C file or processing of a La@TeX{} file. There are a
  7503. number of different solutions:
  7504. @itemize @bullet
  7505. @item
  7506. The table could be placed in a block comment if that is supported by the
  7507. language. For example, in C mode you could wrap the table between
  7508. @samp{/*} and @samp{*/} lines.
  7509. @item
  7510. Sometimes it is possible to put the table after some kind of @i{END}
  7511. statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
  7512. in La@TeX{}.
  7513. @item
  7514. You can just comment the table line by line whenever you want to process
  7515. the file, and uncomment it whenever you need to edit the table. This
  7516. only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
  7517. make this comment-toggling very easy, in particular if you bind it to a
  7518. key.
  7519. @end itemize
  7520. @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
  7521. @subsection A LaTeX example of radio tables
  7522. @cindex LaTeX, and Orgtbl mode
  7523. The best way to wrap the source table in La@TeX{} is to use the
  7524. @code{comment} environment provided by @file{comment.sty}. It has to be
  7525. activated by placing @code{\usepackage@{comment@}} into the document
  7526. header. Orgtbl mode can insert a radio table skeleton@footnote{By
  7527. default this works only for La@TeX{}, HTML, and Texinfo. Configure the
  7528. variable @code{orgtbl-radio-tables} to install templates for other
  7529. modes.} with the command @kbd{M-x orgtbl-insert-radio-table}. You will
  7530. be prompted for a table name, lets say we use @samp{salesfigures}. You
  7531. will then get the following template:
  7532. @cindex #+ORGTBL: SEND
  7533. @example
  7534. % BEGIN RECEIVE ORGTBL salesfigures
  7535. % END RECEIVE ORGTBL salesfigures
  7536. \begin@{comment@}
  7537. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  7538. | | |
  7539. \end@{comment@}
  7540. @end example
  7541. @noindent
  7542. The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
  7543. @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
  7544. into the receiver location with name @code{salesfigures}. You may now
  7545. fill in the table, feel free to use the spreadsheet features@footnote{If
  7546. the @samp{#+TBLFM} line contains an odd number of dollar characters,
  7547. this may cause problems with font-lock in LaTeX mode. As shown in the
  7548. example you can fix this by adding an extra line inside the
  7549. @code{comment} environment that is used to balance the dollar
  7550. expressions. If you are using AUCTeX with the font-latex library, a
  7551. much better solution is to add the @code{comment} environment to the
  7552. variable @code{LaTeX-verbatim-environments}.}:
  7553. @example
  7554. % BEGIN RECEIVE ORGTBL salesfigures
  7555. % END RECEIVE ORGTBL salesfigures
  7556. \begin@{comment@}
  7557. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  7558. | Month | Days | Nr sold | per day |
  7559. |-------+------+---------+---------|
  7560. | Jan | 23 | 55 | 2.4 |
  7561. | Feb | 21 | 16 | 0.8 |
  7562. | March | 22 | 278 | 12.6 |
  7563. #+TBLFM: $4=$3/$2;%.1f
  7564. % $ (optional extra dollar to keep font-lock happy, see footnote)
  7565. \end@{comment@}
  7566. @end example
  7567. @noindent
  7568. When you are done, press @kbd{C-c C-c} in the table to get the converted
  7569. table inserted between the two marker lines.
  7570. Now lets assume you want to make the table header by hand, because you
  7571. want to control how columns are aligned etc. In this case we make sure
  7572. that the table translator does skip the first 2 lines of the source
  7573. table, and tell the command to work as a @i{splice}, i.e. to not produce
  7574. header and footer commands of the target table:
  7575. @example
  7576. \begin@{tabular@}@{lrrr@}
  7577. Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
  7578. % BEGIN RECEIVE ORGTBL salesfigures
  7579. % END RECEIVE ORGTBL salesfigures
  7580. \end@{tabular@}
  7581. %
  7582. \begin@{comment@}
  7583. #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  7584. | Month | Days | Nr sold | per day |
  7585. |-------+------+---------+---------|
  7586. | Jan | 23 | 55 | 2.4 |
  7587. | Feb | 21 | 16 | 0.8 |
  7588. | March | 22 | 278 | 12.6 |
  7589. #+TBLFM: $4=$3/$2;%.1f
  7590. \end@{comment@}
  7591. @end example
  7592. The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
  7593. Orgtbl mode. It uses a @code{tabular} environment to typeset the table
  7594. and marks horizontal lines with @code{\hline}. Furthermore, it
  7595. interprets the following parameters:
  7596. @table @code
  7597. @item :splice nil/t
  7598. When set to t, return only table body lines, don't wrap them into a
  7599. tabular environment. Default is nil.
  7600. @item :fmt fmt
  7601. A format to be used to wrap each field, should contain @code{%s} for the
  7602. original field value. For example, to wrap each field value in dollars,
  7603. you could use @code{:fmt "$%s$"}. This may also be a property list with
  7604. column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
  7605. A function of one argument can be used in place of the strings; the
  7606. function must return a formatted string.
  7607. @item :efmt efmt
  7608. Use this format to print numbers with exponentials. The format should
  7609. have @code{%s} twice for inserting mantissa and exponent, for example
  7610. @code{"%s\\times10^@{%s@}"}. The default is @code{"%s\\,(%s)"}. This
  7611. may also be a property list with column numbers and formats, for example
  7612. @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
  7613. @code{efmt} has been applied to a value, @code{fmt} will also be
  7614. applied. Similar to @code{fmt}, functions of two arguments can be
  7615. supplied instead of strings.
  7616. @end table
  7617. @node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
  7618. @subsection Translator functions
  7619. @cindex HTML, and Orgtbl mode
  7620. @cindex translator function
  7621. Orgtbl mode has several translator functions built-in:
  7622. @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and
  7623. @code{orgtbl-to-texinfo}. Except for @code{orgtbl-to-html}@footnote{The
  7624. HTML translator uses the same code that produces tables during HTML
  7625. export.}, these all use a generic translator, @code{orgtbl-to-generic}.
  7626. For example, @code{orgtbl-to-latex} itself is a very short function that
  7627. computes the column definitions for the @code{tabular} environment,
  7628. defines a few field and line separators and then hands over to the
  7629. generic translator. Here is the entire code:
  7630. @lisp
  7631. @group
  7632. (defun orgtbl-to-latex (table params)
  7633. "Convert the Orgtbl mode TABLE to LaTeX."
  7634. (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
  7635. org-table-last-alignment ""))
  7636. (params2
  7637. (list
  7638. :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
  7639. :tend "\\end@{tabular@}"
  7640. :lstart "" :lend " \\\\" :sep " & "
  7641. :efmt "%s\\,(%s)" :hline "\\hline")))
  7642. (orgtbl-to-generic table (org-combine-plists params2 params))))
  7643. @end group
  7644. @end lisp
  7645. As you can see, the properties passed into the function (variable
  7646. @var{PARAMS}) are combined with the ones newly defined in the function
  7647. (variable @var{PARAMS2}). The ones passed into the function (i.e. the
  7648. ones set by the @samp{ORGTBL SEND} line) take precedence. So if you
  7649. would like to use the La@TeX{} translator, but wanted the line endings to
  7650. be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
  7651. overrule the default with
  7652. @example
  7653. #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  7654. @end example
  7655. For a new language, you can either write your own converter function in
  7656. analogy with the La@TeX{} translator, or you can use the generic function
  7657. directly. For example, if you have a language where a table is started
  7658. with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
  7659. started with @samp{!BL!}, ended with @samp{!EL!} and where the field
  7660. separator is a TAB, you could call the generic translator like this (on
  7661. a single line!):
  7662. @example
  7663. #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
  7664. :lstart "!BL! " :lend " !EL!" :sep "\t"
  7665. @end example
  7666. @noindent
  7667. Please check the documentation string of the function
  7668. @code{orgtbl-to-generic} for a full list of parameters understood by
  7669. that function and remember that you can pass each of them into
  7670. @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
  7671. using the generic function.
  7672. Of course you can also write a completely new function doing complicated
  7673. things the generic translator cannot do. A translator function takes
  7674. two arguments. The first argument is the table, a list of lines, each
  7675. line either the symbol @code{hline} or a list of fields. The second
  7676. argument is the property list containing all parameters specified in the
  7677. @samp{#+ORGTBL: SEND} line. The function must return a single string
  7678. containing the formatted table. If you write a generally useful
  7679. translator, please post it on @code{emacs-orgmode@@gnu.org} so that
  7680. others can benefit from your work.
  7681. @node Radio lists, , Translator functions, Tables in arbitrary syntax
  7682. @subsection Radio lists
  7683. @cindex radio lists
  7684. @cindex org-list-insert-radio-list
  7685. Sending and receiving radio lists works exactly the same way than
  7686. sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
  7687. need to load the @code{org-export-latex.el} package to use radio lists
  7688. since the relevant code is there for now.}. As for radio tables, you
  7689. can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by
  7690. calling @code{org-list-insert-radio-list}.
  7691. Here are the differences with radio tables:
  7692. @itemize @minus
  7693. @item
  7694. Use @code{ORGLST} instead of @code{ORGTBL}.
  7695. @item
  7696. The available translation functions for radio lists don't take
  7697. parameters.
  7698. @item
  7699. `C-c C-c' will work when pressed on the first item of the list.
  7700. @end itemize
  7701. Here is a La@TeX{} example. Let's say that you have this in your
  7702. La@TeX{} file:
  7703. @example
  7704. % BEGIN RECEIVE ORGLST to-buy
  7705. % END RECEIVE ORGLST to-buy
  7706. \begin@{comment@}
  7707. #+ORGLIST: SEND to-buy orgtbl-to-latex
  7708. - a new house
  7709. - a new computer
  7710. + a new keyboard
  7711. + a new mouse
  7712. - a new life
  7713. \end@{comment@}
  7714. @end example
  7715. Pressing `C-c C-c' on @code{a new house} and will insert the converted
  7716. La@TeX{} list between the two marker lines.
  7717. @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Extensions and Hacking
  7718. @section Dynamic blocks
  7719. @cindex dynamic blocks
  7720. Org documents can contain @emph{dynamic blocks}. These are
  7721. specially marked regions that are updated by some user-written function.
  7722. A good example for such a block is the clock table inserted by the
  7723. command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
  7724. Dynamic block are enclosed by a BEGIN-END structure that assigns a name
  7725. to the block and can also specify parameters for the function producing
  7726. the content of the block.
  7727. #+BEGIN:dynamic block
  7728. @example
  7729. #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  7730. #+END:
  7731. @end example
  7732. Dynamic blocks are updated with the following commands
  7733. @table @kbd
  7734. @kindex C-c C-x C-u
  7735. @item C-c C-x C-u
  7736. Update dynamic block at point.
  7737. @kindex C-u C-c C-x C-u
  7738. @item C-u C-c C-x C-u
  7739. Update all dynamic blocks in the current file.
  7740. @end table
  7741. Updating a dynamic block means to remove all the text between BEGIN and
  7742. END, parse the BEGIN line for parameters and then call the specific
  7743. writer function for this block to insert the new content. If you want
  7744. to use the original content in the writer function, you can use the
  7745. extra parameter @code{:content}.
  7746. For a block with name @code{myblock}, the writer function is
  7747. @code{org-dblock-write:myblock} with as only parameter a property list
  7748. with the parameters given in the begin line. Here is a trivial example
  7749. of a block that keeps track of when the block update function was last
  7750. run:
  7751. @example
  7752. #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  7753. #+END:
  7754. @end example
  7755. @noindent
  7756. The corresponding block writer function could look like this:
  7757. @lisp
  7758. (defun org-dblock-write:block-update-time (params)
  7759. (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  7760. (insert "Last block update at: "
  7761. (format-time-string fmt (current-time)))))
  7762. @end lisp
  7763. If you want to make sure that all dynamic blocks are always up-to-date,
  7764. you could add the function @code{org-update-all-dblocks} to a hook, for
  7765. example @code{before-save-hook}. @code{org-update-all-dblocks} is
  7766. written in a way that is does nothing in buffers that are not in
  7767. @code{org-mode}.
  7768. @node Special agenda views, Using the property API, Dynamic blocks, Extensions and Hacking
  7769. @section Special agenda views
  7770. @cindex agenda views, user-defined
  7771. Org provides a special hook that can be used to narrow down the
  7772. selection made by any of the agenda views. You may specify a function
  7773. that is used at each match to verify if the match should indeed be part
  7774. of the agenda view, and if not, how much should be skipped.
  7775. Let's say you want to produce a list of projects that contain a WAITING
  7776. tag anywhere in the project tree. Let's further assume that you have
  7777. marked all tree headings that define a project with the TODO keyword
  7778. PROJECT. In this case you would run a TODO search for the keyword
  7779. PROJECT, but skip the match unless there is a WAITING tag anywhere in
  7780. the subtree belonging to the project line.
  7781. To achieve this, you must write a function that searches the subtree for
  7782. the tag. If the tag is found, the function must return @code{nil} to
  7783. indicate that this match should not be skipped. If there is no such
  7784. tag, return the location of the end of the subtree, to indicate that
  7785. search should continue from there.
  7786. @lisp
  7787. (defun my-skip-unless-waiting ()
  7788. "Skip trees that are not waiting"
  7789. (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  7790. (if (re-search-forward ":waiting:" subtree-end t)
  7791. nil ; tag found, do not skip
  7792. subtree-end))) ; tag not found, continue after end of subtree
  7793. @end lisp
  7794. Now you may use this function in an agenda custom command, for example
  7795. like this:
  7796. @lisp
  7797. (org-add-agenda-custom-command
  7798. '("b" todo "PROJECT"
  7799. ((org-agenda-skip-function 'my-org-waiting-projects)
  7800. (org-agenda-overriding-header "Projects waiting for something: "))))
  7801. @end lisp
  7802. Note that this also binds @code{org-agenda-overriding-header} to get a
  7803. meaningful header in the agenda view.
  7804. A general way to create custom searches is to base them on a search for
  7805. entries with a certain level limit. If you want to study all entries with
  7806. your custom search function, simply do a search for @samp{LEVEL>0}, and then
  7807. use @code{org-agenda-skip-function} to select the entries you really want to
  7808. have.
  7809. You may also put a Lisp form into @code{org-agenda-skip-function}. In
  7810. particular, you may use the functions @code{org-agenda-skip-entry-if}
  7811. and @code{org-agenda-skip-subtree-if} in this form, for example:
  7812. @table @code
  7813. @item '(org-agenda-skip-entry-if 'scheduled)
  7814. Skip current entry if it has been scheduled.
  7815. @item '(org-agenda-skip-entry-if 'notscheduled)
  7816. Skip current entry if it has not been scheduled.
  7817. @item '(org-agenda-skip-entry-if 'deadline)
  7818. Skip current entry if it has a deadline.
  7819. @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
  7820. Skip current entry if it has a deadline, or if it is scheduled.
  7821. @item '(org-agenda-skip-entry 'regexp "regular expression")
  7822. Skip current entry if the regular expression matches in the entry.
  7823. @item '(org-agenda-skip-entry 'notregexp "regular expression")
  7824. Skip current entry unless the regular expression matches.
  7825. @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
  7826. Same as above, but check and skip the entire subtree.
  7827. @end table
  7828. Therefore we could also have written the search for WAITING projects
  7829. like this, even without defining a special function:
  7830. @lisp
  7831. (org-add-agenda-custom-command
  7832. '("b" todo "PROJECT"
  7833. ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  7834. 'regexp ":waiting:"))
  7835. (org-agenda-overriding-header "Projects waiting for something: "))))
  7836. @end lisp
  7837. @node Using the property API, , Special agenda views, Extensions and Hacking
  7838. @section Using the property API
  7839. @cindex API, for properties
  7840. @cindex properties, API
  7841. Here is a description of the functions that can be used to work with
  7842. properties.
  7843. @defun org-entry-properties &optional pom which
  7844. Get all properties of the entry at point-or-marker POM.
  7845. This includes the TODO keyword, the tags, time strings for deadline,
  7846. scheduled, and clocking, and any additional properties defined in the
  7847. entry. The return value is an alist, keys may occur multiple times
  7848. if the property key was used several times.
  7849. POM may also be nil, in which case the current entry is used.
  7850. If WHICH is nil or `all', get all properties. If WHICH is
  7851. `special' or `standard', only get that subclass.
  7852. @end defun
  7853. @defun org-entry-get pom property &optional inherit
  7854. Get value of PROPERTY for entry at point-or-marker POM. By default,
  7855. this only looks at properties defined locally in the entry. If INHERIT
  7856. is non-nil and the entry does not have the property, then also check
  7857. higher levels of the hierarchy. If INHERIT is the symbol
  7858. @code{selective}, use inheritance if and only if the setting of
  7859. @code{org-use-property-inheritance} selects PROPERTY for inheritance.
  7860. @end defun
  7861. @defun org-entry-delete pom property
  7862. Delete the property PROPERTY from entry at point-or-marker POM.
  7863. @end defun
  7864. @defun org-entry-put pom property value
  7865. Set PROPERTY to VALUE for entry at point-or-marker POM.
  7866. @end defun
  7867. @defun org-buffer-property-keys &optional include-specials
  7868. Get all property keys in the current buffer.
  7869. @end defun
  7870. @defun org-insert-property-drawer
  7871. Insert a property drawer at point.
  7872. @end defun
  7873. @defun org-entry-add-to-multivalued-property pom property value
  7874. Treat the value of the property PROPERTY as a whitespace-separated list of
  7875. values and make sure that VALUE is in this list.
  7876. @end defun
  7877. @defun org-entry-remove-from-multivalued-property pom property value
  7878. Treat the value of the property PROPERTY as a whitespace-separated list of
  7879. values and make sure that VALUE is @emph{not} in this list.
  7880. @end defun
  7881. @defun org-entry-member-in-multivalued-property pom property value
  7882. Treat the value of the property PROPERTY as a whitespace-separated list of
  7883. values and check if VALUE is in this list.
  7884. @end defun
  7885. @node History and Acknowledgments, Main Index, Extensions and Hacking, Top
  7886. @appendix History and Acknowledgments
  7887. @cindex acknowledgments
  7888. @cindex history
  7889. @cindex thanks
  7890. Org was borne in 2003, out of frustration over the user interface
  7891. of the Emacs Outline mode. I was trying to organize my notes and
  7892. projects, and using Emacs seemed to be the natural way to go. However,
  7893. having to remember eleven different commands with two or three keys per
  7894. command, only to hide and show parts of the outline tree, that seemed
  7895. entirely unacceptable to me. Also, when using outlines to take notes, I
  7896. constantly want to restructure the tree, organizing it parallel to my
  7897. thoughts and plans. @emph{Visibility cycling} and @emph{structure
  7898. editing} were originally implemented in the package
  7899. @file{outline-magic.el}, but quickly moved to the more general
  7900. @file{org.el}. As this environment became comfortable for project
  7901. planning, the next step was adding @emph{TODO entries}, basic @emph{time
  7902. stamps}, and @emph{table support}. These areas highlight the two main
  7903. goals that Org still has today: To create a new, outline-based,
  7904. plain text mode with innovative and intuitive editing features, and to
  7905. incorporate project planning functionality directly into a notes file.
  7906. A special thanks goes to @i{Bastien Guerry} who has not only writen a large
  7907. number of extensions to Org (most of them integrated into the core by now),
  7908. but has also helped the development and maintenance of Org so much that he
  7909. should be considered co-author of this package.
  7910. Since the first release, literally thousands of emails to me or on
  7911. @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
  7912. reports, feedback, new ideas, and sometimes patches and add-on code.
  7913. Many thanks to everyone who has helped to improve this package. I am
  7914. trying to keep here a list of the people who had significant influence
  7915. in shaping one or more aspects of Org. The list may not be
  7916. complete, if I have forgotten someone, please accept my apologies and
  7917. let me know.
  7918. @itemize @bullet
  7919. @item
  7920. @i{Russel Adams} came up with the idea for drawers.
  7921. @item
  7922. @i{Thomas Baumann} wrote @file{org-bbdb.el} and @file{org-mhe.el}.
  7923. @item
  7924. @i{Alex Bochannek} provided a patch for rounding time stamps.
  7925. @item
  7926. @i{Charles Cave}'s suggestion sparked the implementation of templates
  7927. for Remember.
  7928. @item
  7929. @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
  7930. specified time.
  7931. @item
  7932. @i{Gregory Chernov} patched support for lisp forms into table
  7933. calculations and improved XEmacs compatibility, in particular by porting
  7934. @file{nouline.el} to XEmacs.
  7935. @item
  7936. @i{Sacha Chua} suggested to copy some linking code from Planner.
  7937. @item
  7938. @i{Eddward DeVilla} proposed and tested checkbox statistics. He also
  7939. came up with the idea of properties, and that there should be an API for
  7940. them.
  7941. @item
  7942. @i{Kees Dullemond} used to edit projects lists directly in HTML and so
  7943. inspired some of the early development, including HTML export. He also
  7944. asked for a way to narrow wide table columns.
  7945. @item
  7946. @i{Christian Egli} converted the documentation into Texinfo format,
  7947. patched CSS formatting into the HTML exporter, and inspired the agenda.
  7948. @item
  7949. @i{David Emery} provided a patch for custom CSS support in exported
  7950. HTML agendas.
  7951. @item
  7952. @i{Nic Ferrier} contributed mailcap and XOXO support.
  7953. @item
  7954. @i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
  7955. @item
  7956. @i{John Foerch} figured out how to make incremental search show context
  7957. around a match in a hidden outline tree.
  7958. @item
  7959. @i{Niels Giesen} had the idea to automatically archive DONE trees.
  7960. @item
  7961. @i{Bastien Guerry} wrote the La@TeX{} exporter and @file{org-bibtex.el}, and
  7962. has been prolific with patches, ideas, and bug reports.
  7963. @item
  7964. @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
  7965. @item
  7966. @i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
  7967. task state change logging, and the clocktable. His clear explanations have
  7968. been critical when we started to adopt the GIT version control system.
  7969. @item
  7970. @i{Phil Jackson} wrote @file{org-irc.el}.
  7971. @item
  7972. @i{Scott Jaderholm} proposed footnotes, control over whitespace between
  7973. folded entries, and column view for properties.
  7974. @item
  7975. @i{Tokuya Kameshima} wrote @file{org-wl.el} and @file{org-mew.el}.
  7976. @item
  7977. @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it. He also
  7978. provided frequent feedback and some patches.
  7979. @item
  7980. @i{Jason F. McBrayer} suggested agenda export to CSV format.
  7981. @item
  7982. @i{Max Mikhanosha} came up with the idea of refiling.
  7983. @item
  7984. @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
  7985. basis.
  7986. @item
  7987. @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
  7988. happy.
  7989. @item
  7990. @i{Rick Moynihan} proposed to allow multiple TODO sequences in a file
  7991. and to be able to quickly restrict the agenda to a subtree.
  7992. @item
  7993. @i{Todd Neal} provided patches for links to Info files and elisp forms.
  7994. @item
  7995. @i{Tim O'Callaghan} suggested in-file links, search options for general
  7996. file links, and TAGS.
  7997. @item
  7998. @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
  7999. into Japanese.
  8000. @item
  8001. @i{Oliver Oppitz} suggested multi-state TODO items.
  8002. @item
  8003. @i{Scott Otterson} sparked the introduction of descriptive text for
  8004. links, among other things.
  8005. @item
  8006. @i{Pete Phillips} helped during the development of the TAGS feature, and
  8007. provided frequent feedback.
  8008. @item
  8009. @i{T.V. Raman} reported bugs and suggested improvements.
  8010. @item
  8011. @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
  8012. control.
  8013. @item
  8014. @i{Kevin Rogers} contributed code to access VM files on remote hosts.
  8015. @item
  8016. @i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
  8017. webpages derived from Org using an Info-like, or a folding interface with
  8018. single key navigation.
  8019. @item
  8020. @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
  8021. conflict with @file{allout.el}.
  8022. @item
  8023. @i{Jason Riedy} generalized the send-receive mechanism for orgtbl tables with
  8024. extensive patches.
  8025. @item
  8026. @i{Philip Rooke} created the Org reference card, provided lots
  8027. of feedback, developed and applied standards to the Org documentation and
  8028. wrote the manual for the contributed packages.
  8029. @item
  8030. @i{Christian Schlauer} proposed angular brackets around links, among
  8031. other things.
  8032. @item
  8033. Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s
  8034. @file{organizer-mode.el}.
  8035. @item
  8036. @i{Ilya Shlyakhter} proposed the Archive Sibling.
  8037. @item
  8038. @i{Daniel Sinder} came up with the idea of internal archiving by locking
  8039. subtrees.
  8040. @item
  8041. @i{Dale Smith} proposed link abbreviations.
  8042. @item
  8043. @i{Adam Spiers} asked for global linking commands and inspired the link
  8044. extension system. support mairix.
  8045. @item
  8046. @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
  8047. chapter about publishing.
  8048. @item
  8049. @i{J@"urgen Vollmer} contributed code generating the table of contents
  8050. in HTML output.
  8051. @item
  8052. @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
  8053. keyword.
  8054. @item
  8055. @i{David Wainberg} suggested archiving, and improvements to the linking
  8056. system.
  8057. @item
  8058. @i{John Wiegley} wrote @file{emacs-wiki.el}, @file{planner.el}, and
  8059. @file{muse.el}, which have similar goals as Org. Initially the development
  8060. of Org was fully independent because I was not aware of the existence of
  8061. these packages. But with time I have accasionally looked at John's code and
  8062. learned a lot from it. John has also contributed a number of great ideas and
  8063. patches directly to Org, including the file @code{org-mac-message.el}'
  8064. @item
  8065. @i{Carsten Wimmer} suggested some changes and helped fix a bug in
  8066. linking to Gnus.
  8067. @item
  8068. @i{Roland Winkler} requested additional key bindings to make Org
  8069. work on a tty.
  8070. @item
  8071. @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
  8072. and contributed various ideas and code snippets.
  8073. @end itemize
  8074. @node Main Index, Key Index, History and Acknowledgments, Top
  8075. @unnumbered The Main Index
  8076. @printindex cp
  8077. @node Key Index, , Main Index, Top
  8078. @unnumbered Key Index
  8079. @printindex ky
  8080. @bye
  8081. @ignore
  8082. arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
  8083. @end ignore
  8084. @c Local variables:
  8085. @c ispell-local-dictionary: "en_US-w_accents"
  8086. @c ispell-local-pdict: "./.aspell.org.pws"
  8087. @c fill-column: 77
  8088. @c End: