org.texi 510 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618
  1. \input texinfo
  2. @c %**start of header
  3. @setfilename ../../info/org
  4. @settitle The Org Manual
  5. @set VERSION 6.34trans
  6. @set DATE January 2010
  7. @c Version and Contact Info
  8. @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
  9. @set AUTHOR Carsten Dominik
  10. @set MAINTAINER Carsten Dominik
  11. @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
  12. @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
  13. @c %**end of header
  14. @finalout
  15. @c Macro definitions
  16. @iftex
  17. @c @hyphenation{time-stamp time-stamps time-stamp-ing time-stamp-ed}
  18. @end iftex
  19. @macro Ie {}
  20. I.e.,
  21. @end macro
  22. @macro ie {}
  23. i.e.,
  24. @end macro
  25. @macro Eg {}
  26. E.g.,
  27. @end macro
  28. @macro eg {}
  29. e.g.,
  30. @end macro
  31. @c Subheadings inside a table.
  32. @macro tsubheading{text}
  33. @ifinfo
  34. @subsubheading \text\
  35. @end ifinfo
  36. @ifnotinfo
  37. @item @b{\text\}
  38. @end ifnotinfo
  39. @end macro
  40. @copying
  41. This manual is for Org version @value{VERSION}.
  42. Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
  43. @quotation
  44. Permission is granted to copy, distribute and/or modify this document
  45. under the terms of the GNU Free Documentation License, Version 1.3 or
  46. any later version published by the Free Software Foundation; with no
  47. Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
  48. and with the Back-Cover Texts as in (a) below. A copy of the license
  49. is included in the section entitled ``GNU Free Documentation License.''
  50. (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
  51. modify this GNU manual. Buying copies from the FSF supports it in
  52. developing GNU and promoting software freedom.''
  53. This document is part of a collection distributed under the GNU Free
  54. Documentation License. If you want to distribute this document
  55. separately from the collection, you can do so by adding a copy of the
  56. license to the document, as described in section 6 of the license.
  57. @end quotation
  58. @end copying
  59. @dircategory Emacs
  60. @direntry
  61. * Org Mode: (org). Outline-based notes management and organizer
  62. @end direntry
  63. @titlepage
  64. @title The Org Manual
  65. @subtitle Release @value{VERSION}
  66. @author by Carsten Dominik
  67. @c The following two commands start the copyright page.
  68. @page
  69. @vskip 0pt plus 1filll
  70. @insertcopying
  71. @end titlepage
  72. @c Output the table of contents at the beginning.
  73. @contents
  74. @ifnottex
  75. @node Top, Introduction, (dir), (dir)
  76. @top Org Mode Manual
  77. @insertcopying
  78. @end ifnottex
  79. @menu
  80. * Introduction:: Getting started
  81. * Document Structure:: A tree works like your brain
  82. * Tables:: Pure magic for quick formatting
  83. * Hyperlinks:: Notes in context
  84. * TODO Items:: Every tree branch can be a TODO item
  85. * Tags:: Tagging headlines and matching sets of tags
  86. * Properties and Columns:: Storing information about an entry
  87. * Dates and Times:: Making items useful for planning
  88. * Capture - Refile - Archive:: The ins and outs for projects
  89. * Agenda Views:: Collecting information into views
  90. * Markup:: Prepare text for rich export
  91. * Exporting:: Sharing and publishing of notes
  92. * Publishing:: Create a web site of linked Org files
  93. * Miscellaneous:: All the rest which did not fit elsewhere
  94. * Hacking:: How to hack your way around
  95. * MobileOrg:: Viewing and capture on a mobile device
  96. * History and Acknowledgments:: How Org came into being
  97. * Main Index:: An index of Org's concepts and features
  98. * Key Index:: Key bindings and where they are described
  99. * Variable Index:: Variables mentioned in the manual
  100. @detailmenu
  101. --- The Detailed Node Listing ---
  102. Introduction
  103. * Summary:: Brief summary of what Org does
  104. * Installation:: How to install a downloaded version of Org
  105. * Activation:: How to activate Org for certain buffers
  106. * Feedback:: Bug reports, ideas, patches etc.
  107. * Conventions:: Type-setting conventions in the manual
  108. Document Structure
  109. * Outlines:: Org is based on Outline mode
  110. * Headlines:: How to typeset Org tree headlines
  111. * Visibility cycling:: Show and hide, much simplified
  112. * Motion:: Jumping to other headlines
  113. * Structure editing:: Changing sequence and level of headlines
  114. * Sparse trees:: Matches embedded in context
  115. * Plain lists:: Additional structure within an entry
  116. * Drawers:: Tucking stuff away
  117. * Blocks:: Folding blocks
  118. * Footnotes:: How footnotes are defined in Org's syntax
  119. * Orgstruct mode:: Structure editing outside Org
  120. Tables
  121. * Built-in table editor:: Simple tables
  122. * Column width and alignment:: Overrule the automatic settings
  123. * Column groups:: Grouping to trigger vertical lines
  124. * Orgtbl mode:: The table editor as minor mode
  125. * The spreadsheet:: The table editor has spreadsheet capabilities
  126. * Org-Plot:: Plotting from org tables
  127. The spreadsheet
  128. * References:: How to refer to another field or range
  129. * Formula syntax for Calc:: Using Calc to compute stuff
  130. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
  131. * Field formulas:: Formulas valid for a single field
  132. * Column formulas:: Formulas valid for an entire column
  133. * Editing and debugging formulas:: Fixing formulas
  134. * Updating the table:: Recomputing all dependent fields
  135. * Advanced features:: Field names, parameters and automatic recalc
  136. Hyperlinks
  137. * Link format:: How links in Org are formatted
  138. * Internal links:: Links to other places in the current file
  139. * External links:: URL-like links to the world
  140. * Handling links:: Creating, inserting and following
  141. * Using links outside Org:: Linking from my C source code?
  142. * Link abbreviations:: Shortcuts for writing complex links
  143. * Search options:: Linking to a specific location
  144. * Custom searches:: When the default search is not enough
  145. Internal links
  146. * Radio targets:: Make targets trigger links in plain text
  147. TODO Items
  148. * TODO basics:: Marking and displaying TODO entries
  149. * TODO extensions:: Workflow and assignments
  150. * Progress logging:: Dates and notes for progress
  151. * Priorities:: Some things are more important than others
  152. * Breaking down tasks:: Splitting a task into manageable pieces
  153. * Checkboxes:: Tick-off lists
  154. Extended use of TODO keywords
  155. * Workflow states:: From TODO to DONE in steps
  156. * TODO types:: I do this, Fred does the rest
  157. * Multiple sets in one file:: Mixing it all, and still finding your way
  158. * Fast access to TODO states:: Single letter selection of a state
  159. * Per-file keywords:: Different files, different requirements
  160. * Faces for TODO keywords:: Highlighting states
  161. * TODO dependencies:: When one task needs to wait for others
  162. Progress logging
  163. * Closing items:: When was this entry marked DONE?
  164. * Tracking TODO state changes:: When did the status change?
  165. * Tracking your habits:: How consistent have you been?
  166. Tags
  167. * Tag inheritance:: Tags use the tree structure of the outline
  168. * Setting tags:: How to assign tags to a headline
  169. * Tag searches:: Searching for combinations of tags
  170. Properties and Columns
  171. * Property syntax:: How properties are spelled out
  172. * Special properties:: Access to other Org mode features
  173. * Property searches:: Matching property values
  174. * Property inheritance:: Passing values down the tree
  175. * Column view:: Tabular viewing and editing
  176. * Property API:: Properties for Lisp programmers
  177. Column view
  178. * Defining columns:: The COLUMNS format property
  179. * Using column view:: How to create and use column view
  180. * Capturing column view:: A dynamic block for column view
  181. Defining columns
  182. * Scope of column definitions:: Where defined, where valid?
  183. * Column attributes:: Appearance and content of a column
  184. Dates and Times
  185. * Timestamps:: Assigning a time to a tree entry
  186. * Creating timestamps:: Commands which insert timestamps
  187. * Deadlines and scheduling:: Planning your work
  188. * Clocking work time:: Tracking how long you spend on a task
  189. * Resolving idle time:: Resolving time if you've been idle
  190. * Effort estimates:: Planning work effort in advance
  191. * Relative timer:: Notes with a running timer
  192. Creating timestamps
  193. * The date/time prompt:: How Org mode helps you entering date and time
  194. * Custom time format:: Making dates look different
  195. Deadlines and scheduling
  196. * Inserting deadline/schedule:: Planning items
  197. * Repeated tasks:: Items that show up again and again
  198. Capture - Refile - Archive
  199. * Remember:: Capture new tasks/ideas with little interruption
  200. * Attachments:: Add files to tasks.
  201. * RSS Feeds:: Getting input from RSS feeds
  202. * Protocols:: External (e.g. Browser) access to Emacs and Org
  203. * Refiling notes:: Moving a tree from one place to another
  204. * Archiving:: What to do with finished projects
  205. Remember
  206. * Setting up Remember for Org:: Some code for .emacs to get things going
  207. * Remember templates:: Define the outline of different note types
  208. * Storing notes:: Directly get the note to where it belongs
  209. Archiving
  210. * Moving subtrees:: Moving a tree to an archive file
  211. * Internal archiving:: Switch off a tree but keep i in the file
  212. Agenda Views
  213. * Agenda files:: Files being searched for agenda information
  214. * Agenda dispatcher:: Keyboard access to agenda views
  215. * Built-in agenda views:: What is available out of the box?
  216. * Presentation and sorting:: How agenda items are prepared for display
  217. * Agenda commands:: Remote editing of Org trees
  218. * Custom agenda views:: Defining special searches and views
  219. * Exporting Agenda Views:: Writing a view to a file
  220. * Agenda column view:: Using column view for collected entries
  221. The built-in agenda views
  222. * Weekly/daily agenda:: The calendar page with current tasks
  223. * Global TODO list:: All unfinished action items
  224. * Matching tags and properties:: Structured information with fine-tuned search
  225. * Timeline:: Time-sorted view for single file
  226. * Search view:: Find entries by searching for text
  227. * Stuck projects:: Find projects you need to review
  228. Presentation and sorting
  229. * Categories:: Not all tasks are equal
  230. * Time-of-day specifications:: How the agenda knows the time
  231. * Sorting of agenda items:: The order of things
  232. Custom agenda views
  233. * Storing searches:: Type once, use often
  234. * Block agenda:: All the stuff you need in a single buffer
  235. * Setting Options:: Changing the rules
  236. Markup for rich export
  237. * Structural markup elements:: The basic structure as seen by the exporter
  238. * Images and tables:: Tables and Images will be included
  239. * Literal examples:: Source code examples with special formatting
  240. * Include files:: Include additional files into a document
  241. * Macro replacement:: Use macros to create complex output
  242. * Embedded LaTeX:: LaTeX can be freely used inside Org documents
  243. Structural markup elements
  244. * Document title:: Where the title is taken from
  245. * Headings and sections:: The document structure as seen by the exporter
  246. * Table of contents:: The if and where of the table of contents
  247. * Initial text:: Text before the first heading?
  248. * Lists:: Lists
  249. * Paragraphs:: Paragraphs
  250. * Footnote markup:: Footnotes
  251. * Emphasis and monospace:: Bold, italic, etc.
  252. * Horizontal rules:: Make a line
  253. * Comment lines:: What will *not* be exported
  254. Embedded La@TeX{}
  255. * Special symbols:: Greek letters and other symbols
  256. * Subscripts and superscripts:: Simple syntax for raising/lowering text
  257. * LaTeX fragments:: Complex formulas made easy
  258. * Previewing LaTeX fragments:: What will this snippet look like?
  259. * CDLaTeX mode:: Speed up entering of formulas
  260. Exporting
  261. * Selective export:: Using tags to select and exclude trees
  262. * Export options:: Per-file export settings
  263. * The export dispatcher:: How to access exporter commands
  264. * ASCII export:: Exporting to plain ASCII
  265. * HTML export:: Exporting to HTML
  266. * LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF
  267. * DocBook export:: Exporting to DocBook
  268. * Freemind export:: Exporting to Freemind mind maps
  269. * XOXO export:: Exporting to XOXO
  270. * iCalendar export:: Exporting in iCalendar format
  271. HTML export
  272. * HTML Export commands:: How to invoke HTML export
  273. * Quoting HTML tags:: Using direct HTML in Org mode
  274. * Links in HTML export:: How links will be interpreted and formatted
  275. * Tables in HTML export:: How to modify the formatting of tables
  276. * Images in HTML export:: How to insert figures into HTML output
  277. * Text areas in HTML export:: An alternative way to show an example
  278. * CSS support:: Changing the appearance of the output
  279. * Javascript support:: Info and Folding in a web browser
  280. La@TeX{} and PDF export
  281. * LaTeX/PDF export commands:: Which key invokes which commands
  282. * Quoting LaTeX code:: Incorporating literal La@TeX{} code
  283. * Sectioning structure:: Changing sectioning in La@TeX{} output
  284. * Tables in LaTeX export:: Options for exporting tables to La@TeX{}
  285. * Images in LaTeX export:: How to insert figures into La@TeX{} output
  286. * Beamer class export:: Turning the file into a presentation
  287. DocBook export
  288. * DocBook export commands:: How to invoke DocBook export
  289. * Quoting DocBook code:: Incorporating DocBook code in Org files
  290. * Recursive sections:: Recursive sections in DocBook
  291. * Tables in DocBook export:: Tables are exported as HTML tables
  292. * Images in DocBook export:: How to insert figures into DocBook output
  293. * Special characters:: How to handle special characters
  294. Publishing
  295. * Configuration:: Defining projects
  296. * Uploading files:: How to get files up on the server
  297. * Sample configuration:: Example projects
  298. * Triggering publication:: Publication commands
  299. Configuration
  300. * Project alist:: The central configuration variable
  301. * Sources and destinations:: From here to there
  302. * Selecting files:: What files are part of the project?
  303. * Publishing action:: Setting the function doing the publishing
  304. * Publishing options:: Tweaking HTML export
  305. * Publishing links:: Which links keep working after publishing?
  306. * Project page index:: Publishing a list of project files
  307. Sample configuration
  308. * Simple example:: One-component publishing
  309. * Complex example:: A multi-component publishing example
  310. Miscellaneous
  311. * Completion:: M-TAB knows what you need
  312. * Speed keys:: Electic commands at the beginning of a headline
  313. * Customization:: Adapting Org to your taste
  314. * In-buffer settings:: Overview of the #+KEYWORDS
  315. * The very busy C-c C-c key:: When in doubt, press C-c C-c
  316. * Clean view:: Getting rid of leading stars in the outline
  317. * TTY keys:: Using Org on a tty
  318. * Interaction:: Other Emacs packages
  319. Interaction with other packages
  320. * Cooperation:: Packages Org cooperates with
  321. * Conflicts:: Packages that lead to conflicts
  322. Hacking
  323. * Hooks:: Who to reach into Org's internals
  324. * Add-on packages:: Available extensions
  325. * Adding hyperlink types:: New custom link types
  326. * Context-sensitive commands:: How to add functionality to such commands
  327. * Tables in arbitrary syntax:: Orgtbl for La@TeX{} and other programs
  328. * Dynamic blocks:: Automatically filled blocks
  329. * Special agenda views:: Customized views
  330. * Extracting agenda information:: Postprocessing of agenda information
  331. * Using the property API:: Writing programs that use entry properties
  332. * Using the mapping API:: Mapping over all or selected entries
  333. Tables and lists in arbitrary syntax
  334. * Radio tables:: Sending and receiving radio tables
  335. * A LaTeX example:: Step by step, almost a tutorial
  336. * Translator functions:: Copy and modify
  337. * Radio lists:: Doing the same for lists
  338. MobileOrg
  339. * Setting up the staging area:: Where to interact with the mobile device
  340. * Pushing to MobileOrg:: Uploading Org files and agendas
  341. * Pulling from MobileOrg:: Integrating captured and flagged items
  342. @end detailmenu
  343. @end menu
  344. @node Introduction, Document Structure, Top, Top
  345. @chapter Introduction
  346. @cindex introduction
  347. @menu
  348. * Summary:: Brief summary of what Org does
  349. * Installation:: How to install a downloaded version of Org
  350. * Activation:: How to activate Org for certain buffers
  351. * Feedback:: Bug reports, ideas, patches etc.
  352. * Conventions:: Type-setting conventions in the manual
  353. @end menu
  354. @node Summary, Installation, Introduction, Introduction
  355. @section Summary
  356. @cindex summary
  357. Org is a mode for keeping notes, maintaining TODO lists, and doing
  358. project planning with a fast and effective plain-text system.
  359. Org develops organizational tasks around NOTES files that contain
  360. lists or information about projects as plain text. Org is
  361. implemented on top of Outline mode, which makes it possible to keep the
  362. content of large files well structured. Visibility cycling and
  363. structure editing help to work with the tree. Tables are easily created
  364. with a built-in table editor. Org supports TODO items, deadlines,
  365. timestamps, and scheduling. It dynamically compiles entries into an
  366. agenda that utilizes and smoothly integrates much of the Emacs calendar
  367. and diary. Plain text URL-like links connect to websites, emails,
  368. Usenet messages, BBDB entries, and any files related to the projects.
  369. For printing and sharing of notes, an Org file can be exported as a
  370. structured ASCII file, as HTML, or (TODO and agenda items only) as an
  371. iCalendar file. It can also serve as a publishing tool for a set of
  372. linked web pages.
  373. An important design aspect that distinguishes Org from, for example,
  374. Planner/Muse is that it encourages you to store every piece of information
  375. only once. In Planner, you have project pages, day pages and possibly
  376. other files, duplicating some information such as tasks. In Org,
  377. you only have notes files. In your notes you mark entries as tasks, and
  378. label them with tags and timestamps. All necessary lists, like a
  379. schedule for the day, the agenda for a meeting, tasks lists selected by
  380. tags, etc., are created dynamically when you need them.
  381. Org keeps simple things simple. When first fired up, it should
  382. feel like a straightforward, easy to use outliner. Complexity is not
  383. imposed, but a large amount of functionality is available when you need
  384. it. Org is a toolbox and can be used in different ways, for
  385. example as:
  386. @example
  387. @r{@bullet{} an outline extension with visibility cycling and structure editing}
  388. @r{@bullet{} an ASCII system and table editor for taking structured notes}
  389. @r{@bullet{} an ASCII table editor with spreadsheet-like capabilities}
  390. @r{@bullet{} a TODO list editor}
  391. @r{@bullet{} a full agenda and planner with deadlines and work scheduling}
  392. @pindex GTD, Getting Things Done
  393. @r{@bullet{} an environment to implement David Allen's GTD system}
  394. @r{@bullet{} a basic database application}
  395. @r{@bullet{} a simple hypertext system, with HTML and La@TeX{} export}
  396. @r{@bullet{} a publishing tool to create a set of interlinked webpages}
  397. @end example
  398. Org's automatic, context-sensitive table editor with spreadsheet
  399. capabilities can be integrated into any major mode by activating the
  400. minor Orgtbl mode. Using a translation step, it can be used to maintain
  401. tables in arbitrary file types, for example in La@TeX{}. The structure
  402. editing and list creation capabilities can be used outside Org with
  403. the minor Orgstruct mode.
  404. @cindex FAQ
  405. There is a website for Org which provides links to the newest
  406. version of Org, as well as additional information, frequently asked
  407. questions (FAQ), links to tutorials, etc@. This page is located at
  408. @uref{http://orgmode.org}.
  409. @page
  410. @node Installation, Activation, Summary, Introduction
  411. @section Installation
  412. @cindex installation
  413. @cindex XEmacs
  414. @b{Important:} @i{If you are using a version of Org that is part of the Emacs
  415. distribution or an XEmacs package, please skip this section and go directly
  416. to @ref{Activation}.}
  417. If you have downloaded Org from the Web, either as a distribution @file{.zip}
  418. or @file{.tar} file, or as a Git archive, you must take the following steps
  419. to install it: go into the unpacked Org distribution directory and edit the
  420. top section of the file @file{Makefile}. You must set the name of the Emacs
  421. binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
  422. directories where local Lisp and Info files are kept. If you don't have
  423. access to the system-wide directories, you can simply run Org directly from
  424. the distribution directory by adding the @file{lisp} subdirectory to the
  425. Emacs load path. To do this, add the following line to @file{.emacs}:
  426. @example
  427. (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
  428. @end example
  429. @noindent
  430. If you plan to use code from the @file{contrib} subdirectory, do a similar
  431. step for this directory:
  432. @example
  433. (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
  434. @end example
  435. @sp 2
  436. @cartouche
  437. XEmacs users now need to install the file @file{noutline.el} from
  438. the @file{xemacs} sub-directory of the Org distribution. Use the
  439. command:
  440. @example
  441. make install-noutline
  442. @end example
  443. @end cartouche
  444. @sp 2
  445. @noindent Now byte-compile the Lisp files with the shell command:
  446. @example
  447. make
  448. @end example
  449. @noindent If you are running Org from the distribution directory, this is
  450. all. If you want to install Org into the system directories, use (as
  451. administrator)
  452. @example
  453. make install
  454. @end example
  455. Installing Info files is system dependent, because of differences in the
  456. @file{install-info} program. In Debian it copies the info files into the
  457. correct directory and modifies the info directory file. In many other
  458. systems, the files need to be copied to the correct directory separately, and
  459. @file{install-info} then only modifies the directory file. Check your system
  460. documentation to find out which of the following commands you need:
  461. @example
  462. make install-info
  463. make install-info-debian
  464. @end example
  465. Then add the following line to @file{.emacs}. It is needed so that
  466. Emacs can autoload functions that are located in files not immediately loaded
  467. when Org-mode starts.
  468. @lisp
  469. (require 'org-install)
  470. @end lisp
  471. Do not forget to activate Org as described in the following section.
  472. @page
  473. @node Activation, Feedback, Installation, Introduction
  474. @section Activation
  475. @cindex activation
  476. @cindex autoload
  477. @cindex global key bindings
  478. @cindex key bindings, global
  479. @iftex
  480. @b{Important:} @i{If you use copy-and-paste to copy Lisp code from the
  481. PDF documentation as viewed by some PDF viewers to your @file{.emacs} file, the
  482. single-quote character comes out incorrectly and the code will not work.
  483. You need to fix the single-quotes by hand, or copy from Info
  484. documentation.}
  485. @end iftex
  486. Add the following lines to your @file{.emacs} file. The last three lines
  487. define @emph{global} keys for the commands @command{org-store-link},
  488. @command{org-agenda}, and @command{org-iswitchb}---please choose suitable
  489. keys yourself.
  490. @lisp
  491. ;; The following lines are always needed. Choose your own keys.
  492. (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
  493. (global-set-key "\C-cl" 'org-store-link)
  494. (global-set-key "\C-ca" 'org-agenda)
  495. (global-set-key "\C-cb" 'org-iswitchb)
  496. @end lisp
  497. Furthermore, you must activate @code{font-lock-mode} in Org
  498. buffers, because significant functionality depends on font-locking being
  499. active. You can do this with either one of the following two lines
  500. (XEmacs users must use the second option):
  501. @lisp
  502. (global-font-lock-mode 1) ; for all buffers
  503. (add-hook 'org-mode-hook 'turn-on-font-lock) ; Org buffers only
  504. @end lisp
  505. @cindex Org mode, turning on
  506. With this setup, all files with extension @samp{.org} will be put
  507. into Org mode. As an alternative, make the first line of a file look
  508. like this:
  509. @example
  510. MY PROJECTS -*- mode: org; -*-
  511. @end example
  512. @vindex org-insert-mode-line-in-empty-file
  513. @noindent which will select Org mode for this buffer no matter what
  514. the file's name is. See also the variable
  515. @code{org-insert-mode-line-in-empty-file}.
  516. Many commands in Org work on the region if the region is @i{active}. To make
  517. use of this, you need to have @code{transient-mark-mode}
  518. (@code{zmacs-regions} in XEmacs) turned on. In Emacs 23 this is the default,
  519. in Emacs 22 you need to do this yourself with
  520. @lisp
  521. (transient-mark-mode 1)
  522. @end lisp
  523. @noindent If you do not like @code{transient-mark-mode}, you can create an
  524. active region by using the mouse to select a region, or pressing
  525. @kbd{C-@key{SPC}} twice before moving the cursor.
  526. @node Feedback, Conventions, Activation, Introduction
  527. @section Feedback
  528. @cindex feedback
  529. @cindex bug reports
  530. @cindex maintainer
  531. @cindex author
  532. If you find problems with Org, or if you have questions, remarks, or ideas
  533. about it, please mail to the Org mailing list @email{emacs-orgmode@@gnu.org}.
  534. If you are not a member of the mailing list, your mail will be passed to the
  535. list after a moderator has approved it.
  536. For bug reports, please provide as much information as possible, including
  537. the version information of Emacs (@kbd{M-x emacs-version @key{RET}}) and Org
  538. (@kbd{M-x org-version @key{RET}}), as well as the Org related setup in
  539. @file{.emacs}. The easiest way to do this is to use the command
  540. @example
  541. @kbd{M-x org-submit-bug-report}
  542. @end example
  543. @noindent which will put all this information into an Emacs mail buffer so
  544. that you only need to add your description. If you re not sending the Email
  545. from within Emacs, please copy and paste the content into your Email program.
  546. If an error occurs, a backtrace can be very useful (see below on how to
  547. create one). Often a small example file helps, along with clear information
  548. about:
  549. @enumerate
  550. @item What exactly did you do?
  551. @item What did you expect to happen?
  552. @item What happened instead?
  553. @end enumerate
  554. @noindent Thank you for helping to improve this mode.
  555. @subsubheading How to create a useful backtrace
  556. @cindex backtrace of an error
  557. If working with Org produces an error with a message you don't
  558. understand, you may have hit a bug. The best way to report this is by
  559. providing, in addition to what was mentioned above, a @emph{backtrace}.
  560. This is information from the built-in debugger about where and how the
  561. error occurred. Here is how to produce a useful backtrace:
  562. @enumerate
  563. @item
  564. Reload uncompiled versions of all Org-mode Lisp files. The backtrace
  565. contains much more information if it is produced with uncompiled code.
  566. To do this, use
  567. @example
  568. C-u M-x org-reload RET
  569. @end example
  570. @noindent
  571. or select @code{Org -> Refresh/Reload -> Reload Org uncompiled} from the
  572. menu.
  573. @item
  574. Go to the @code{Options} menu and select @code{Enter Debugger on Error}
  575. (XEmacs has this option in the @code{Troubleshooting} sub-menu).
  576. @item
  577. Do whatever you have to do to hit the error. Don't forget to
  578. document the steps you take.
  579. @item
  580. When you hit the error, a @file{*Backtrace*} buffer will appear on the
  581. screen. Save this buffer to a file (for example using @kbd{C-x C-w}) and
  582. attach it to your bug report.
  583. @end enumerate
  584. @node Conventions, , Feedback, Introduction
  585. @section Typesetting conventions used in this manual
  586. Org uses three types of keywords: TODO keywords, tags, and property
  587. names. In this manual we use the following conventions:
  588. @table @code
  589. @item TODO
  590. @itemx WAITING
  591. TODO keywords are written with all capitals, even if they are
  592. user-defined.
  593. @item boss
  594. @itemx ARCHIVE
  595. User-defined tags are written in lowercase; built-in tags with special
  596. meaning are written with all capitals.
  597. @item Release
  598. @itemx PRIORITY
  599. User-defined properties are capitalized; built-in properties with
  600. special meaning are written with all capitals.
  601. @end table
  602. @node Document Structure, Tables, Introduction, Top
  603. @chapter Document Structure
  604. @cindex document structure
  605. @cindex structure of document
  606. Org is based on Outline mode and provides flexible commands to
  607. edit the structure of the document.
  608. @menu
  609. * Outlines:: Org is based on Outline mode
  610. * Headlines:: How to typeset Org tree headlines
  611. * Visibility cycling:: Show and hide, much simplified
  612. * Motion:: Jumping to other headlines
  613. * Structure editing:: Changing sequence and level of headlines
  614. * Sparse trees:: Matches embedded in context
  615. * Plain lists:: Additional structure within an entry
  616. * Drawers:: Tucking stuff away
  617. * Blocks:: Folding blocks
  618. * Footnotes:: How footnotes are defined in Org's syntax
  619. * Orgstruct mode:: Structure editing outside Org
  620. @end menu
  621. @node Outlines, Headlines, Document Structure, Document Structure
  622. @section Outlines
  623. @cindex outlines
  624. @cindex Outline mode
  625. Org is implemented on top of Outline mode. Outlines allow a
  626. document to be organized in a hierarchical structure, which (at least
  627. for me) is the best representation of notes and thoughts. An overview
  628. of this structure is achieved by folding (hiding) large parts of the
  629. document to show only the general document structure and the parts
  630. currently being worked on. Org greatly simplifies the use of
  631. outlines by compressing the entire show/hide functionality into a single
  632. command, @command{org-cycle}, which is bound to the @key{TAB} key.
  633. @node Headlines, Visibility cycling, Outlines, Document Structure
  634. @section Headlines
  635. @cindex headlines
  636. @cindex outline tree
  637. @vindex org-special-ctrl-a/e
  638. Headlines define the structure of an outline tree. The headlines in
  639. Org start with one or more stars, on the left margin@footnote{See
  640. the variable @code{org-special-ctrl-a/e} to configure special behavior
  641. of @kbd{C-a} and @kbd{C-e} in headlines.}. For example:
  642. @example
  643. * Top level headline
  644. ** Second level
  645. *** 3rd level
  646. some text
  647. *** 3rd level
  648. more text
  649. * Another top level headline
  650. @end example
  651. @noindent Some people find the many stars too noisy and would prefer an
  652. outline that has whitespace followed by a single star as headline
  653. starters. @ref{Clean view}, describes a setup to realize this.
  654. @vindex org-cycle-separator-lines
  655. An empty line after the end of a subtree is considered part of it and
  656. will be hidden when the subtree is folded. However, if you leave at
  657. least two empty lines, one empty line will remain visible after folding
  658. the subtree, in order to structure the collapsed view. See the
  659. variable @code{org-cycle-separator-lines} to modify this behavior.
  660. @node Visibility cycling, Motion, Headlines, Document Structure
  661. @section Visibility cycling
  662. @cindex cycling, visibility
  663. @cindex visibility cycling
  664. @cindex trees, visibility
  665. @cindex show hidden text
  666. @cindex hide text
  667. Outlines make it possible to hide parts of the text in the buffer.
  668. Org uses just two commands, bound to @key{TAB} and
  669. @kbd{S-@key{TAB}} to change the visibility in the buffer.
  670. @cindex subtree visibility states
  671. @cindex subtree cycling
  672. @cindex folded, subtree visibility state
  673. @cindex children, subtree visibility state
  674. @cindex subtree, subtree visibility state
  675. @table @kbd
  676. @kindex @key{TAB}
  677. @item @key{TAB}
  678. @emph{Subtree cycling}: Rotate current subtree among the states
  679. @example
  680. ,-> FOLDED -> CHILDREN -> SUBTREE --.
  681. '-----------------------------------'
  682. @end example
  683. @vindex org-cycle-emulate-tab
  684. @vindex org-cycle-global-at-bob
  685. The cursor must be on a headline for this to work@footnote{see, however,
  686. the option @code{org-cycle-emulate-tab}.}. When the cursor is at the
  687. beginning of the buffer and the first line is not a headline, then
  688. @key{TAB} actually runs global cycling (see below)@footnote{see the
  689. option @code{org-cycle-global-at-bob}.}. Also when called with a prefix
  690. argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
  691. @cindex global visibility states
  692. @cindex global cycling
  693. @cindex overview, global visibility state
  694. @cindex contents, global visibility state
  695. @cindex show all, global visibility state
  696. @kindex S-@key{TAB}
  697. @item S-@key{TAB}
  698. @itemx C-u @key{TAB}
  699. @emph{Global cycling}: Rotate the entire buffer among the states
  700. @example
  701. ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
  702. '--------------------------------------'
  703. @end example
  704. When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
  705. CONTENTS view up to headlines of level N will be shown. Note that inside
  706. tables, @kbd{S-@key{TAB}} jumps to the previous field.
  707. @cindex show all, command
  708. @kindex C-u C-u C-u @key{TAB}
  709. @item C-u C-u C-u @key{TAB}
  710. Show all, including drawers.
  711. @kindex C-c C-r
  712. @item C-c C-r
  713. Reveal context around point, showing the current entry, the following heading
  714. and the hierarchy above. Useful for working near a location that has been
  715. exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
  716. (@pxref{Agenda commands}). With a prefix argument show, on each
  717. level, all sibling headings. With double prefix arg, also show the entire
  718. subtree of the parent.
  719. @kindex C-c C-x b
  720. @item C-c C-x b
  721. Show the current subtree in an indirect buffer@footnote{The indirect
  722. buffer
  723. @ifinfo
  724. (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
  725. @end ifinfo
  726. @ifnotinfo
  727. (see the Emacs manual for more information about indirect buffers)
  728. @end ifnotinfo
  729. will contain the entire buffer, but will be narrowed to the current
  730. tree. Editing the indirect buffer will also change the original buffer,
  731. but without affecting visibility in that buffer.}. With a numeric
  732. prefix argument N, go up to level N and then take that tree. If N is
  733. negative then go up that many levels. With a @kbd{C-u} prefix, do not remove
  734. the previously used indirect buffer.
  735. @end table
  736. @vindex org-startup-folded
  737. @cindex @code{overview}, STARTUP keyword
  738. @cindex @code{content}, STARTUP keyword
  739. @cindex @code{showall}, STARTUP keyword
  740. @cindex @code{showeverything}, STARTUP keyword
  741. When Emacs first visits an Org file, the global state is set to
  742. OVERVIEW, i.e. only the top level headlines are visible. This can be
  743. configured through the variable @code{org-startup-folded}, or on a
  744. per-file basis by adding one of the following lines anywhere in the
  745. buffer:
  746. @example
  747. #+STARTUP: overview
  748. #+STARTUP: content
  749. #+STARTUP: showall
  750. #+STARTUP: showeverything
  751. @end example
  752. @cindex property, VISIBILITY
  753. @noindent
  754. Furthermore, any entries with a @samp{VISIBILITY} property (@pxref{Properties
  755. and Columns}) will get their visibility adapted accordingly. Allowed values
  756. for this property are @code{folded}, @code{children}, @code{content}, and
  757. @code{all}.
  758. @table @kbd
  759. @kindex C-u C-u @key{TAB}
  760. @item C-u C-u @key{TAB}
  761. Switch back to the startup visibility of the buffer, i.e. whatever is
  762. requested by startup options and @samp{VISIBILITY} properties in individual
  763. entries.
  764. @end table
  765. @node Motion, Structure editing, Visibility cycling, Document Structure
  766. @section Motion
  767. @cindex motion, between headlines
  768. @cindex jumping, to headlines
  769. @cindex headline navigation
  770. The following commands jump to other headlines in the buffer.
  771. @table @kbd
  772. @kindex C-c C-n
  773. @item C-c C-n
  774. Next heading.
  775. @kindex C-c C-p
  776. @item C-c C-p
  777. Previous heading.
  778. @kindex C-c C-f
  779. @item C-c C-f
  780. Next heading same level.
  781. @kindex C-c C-b
  782. @item C-c C-b
  783. Previous heading same level.
  784. @kindex C-c C-u
  785. @item C-c C-u
  786. Backward to higher level heading.
  787. @kindex C-c C-j
  788. @item C-c C-j
  789. Jump to a different place without changing the current outline
  790. visibility. Shows the document structure in a temporary buffer, where
  791. you can use the following keys to find your destination:
  792. @vindex org-goto-auto-isearch
  793. @example
  794. @key{TAB} @r{Cycle visibility.}
  795. @key{down} / @key{up} @r{Next/previous visible headline.}
  796. @key{RET} @r{Select this location.}
  797. @kbd{/} @r{Do a Sparse-tree search}
  798. @r{The following keys work if you turn off @code{org-goto-auto-isearch}}
  799. n / p @r{Next/previous visible headline.}
  800. f / b @r{Next/previous headline same level.}
  801. u @r{One level up.}
  802. 0-9 @r{Digit argument.}
  803. q @r{Quit}
  804. @end example
  805. @vindex org-goto-interface
  806. @noindent
  807. See also the variable @code{org-goto-interface}.
  808. @end table
  809. @node Structure editing, Sparse trees, Motion, Document Structure
  810. @section Structure editing
  811. @cindex structure editing
  812. @cindex headline, promotion and demotion
  813. @cindex promotion, of subtrees
  814. @cindex demotion, of subtrees
  815. @cindex subtree, cut and paste
  816. @cindex pasting, of subtrees
  817. @cindex cutting, of subtrees
  818. @cindex copying, of subtrees
  819. @cindex sorting, of subtrees
  820. @cindex subtrees, cut and paste
  821. @table @kbd
  822. @kindex M-@key{RET}
  823. @item M-@key{RET}
  824. @vindex org-M-RET-may-split-line
  825. Insert new heading with same level as current. If the cursor is in a
  826. plain list item, a new item is created (@pxref{Plain lists}). To force
  827. creation of a new headline, use a prefix argument, or first press @key{RET}
  828. to get to the beginning of the next line. When this command is used in
  829. the middle of a line, the line is split and the rest of the line becomes
  830. the new headline@footnote{If you do not want the line to be split,
  831. customize the variable @code{org-M-RET-may-split-line}.}. If the
  832. command is used at the beginning of a headline, the new headline is
  833. created before the current line. If at the beginning of any other line,
  834. the content of that line is made the new heading. If the command is
  835. used at the end of a folded subtree (i.e. behind the ellipses at the end
  836. of a headline), then a headline like the current one will be inserted
  837. after the end of the subtree.
  838. @kindex C-@key{RET}
  839. @item C-@key{RET}
  840. Just like @kbd{M-@key{RET}}, except when adding a new heading below the
  841. current heading, the new heading is placed after the body instead of before
  842. it. This command works from anywhere in the entry.
  843. @kindex M-S-@key{RET}
  844. @item M-S-@key{RET}
  845. @vindex org-treat-insert-todo-heading-as-state-change
  846. Insert new TODO entry with same level as current heading. See also the
  847. variable @code{org-treat-insert-todo-heading-as-state-change}.
  848. @kindex C-S-@key{RET}
  849. @item C-S-@key{RET}
  850. Insert new TODO entry with same level as current heading. Like
  851. @kbd{C-@key{RET}}, the new headline will be inserted after the current
  852. subtree.
  853. @kindex @key{TAB}
  854. @item @key{TAB} @r{in new, empty entry}
  855. In a new entry with no text yet, the first @key{TAB} demotes the entry to
  856. become a child of the previous one. The next @key{TAB} makes it a parent,
  857. and so on, all the way to top level. Yet another @key{TAB}, and you are back
  858. to the initial level.
  859. @kindex M-@key{left}
  860. @item M-@key{left}
  861. Promote current heading by one level.
  862. @kindex M-@key{right}
  863. @item M-@key{right}
  864. Demote current heading by one level.
  865. @kindex M-S-@key{left}
  866. @item M-S-@key{left}
  867. Promote the current subtree by one level.
  868. @kindex M-S-@key{right}
  869. @item M-S-@key{right}
  870. Demote the current subtree by one level.
  871. @kindex M-S-@key{up}
  872. @item M-S-@key{up}
  873. Move subtree up (swap with previous subtree of same
  874. level).
  875. @kindex M-S-@key{down}
  876. @item M-S-@key{down}
  877. Move subtree down (swap with next subtree of same level).
  878. @kindex C-c C-x C-w
  879. @item C-c C-x C-w
  880. Kill subtree, i.e. remove it from buffer but save in kill ring.
  881. With a numeric prefix argument N, kill N sequential subtrees.
  882. @kindex C-c C-x M-w
  883. @item C-c C-x M-w
  884. Copy subtree to kill ring. With a numeric prefix argument N, copy the N
  885. sequential subtrees.
  886. @kindex C-c C-x C-y
  887. @item C-c C-x C-y
  888. Yank subtree from kill ring. This does modify the level of the subtree to
  889. make sure the tree fits in nicely at the yank position. The yank level can
  890. also be specified with a numeric prefix argument, or by yanking after a
  891. headline marker like @samp{****}.
  892. @kindex C-y
  893. @item C-y
  894. @vindex org-yank-adjusted-subtrees
  895. @vindex org-yank-folded-subtrees
  896. Depending on the variables @code{org-yank-adjusted-subtrees} and
  897. @code{org-yank-folded-subtrees}, Org's internal @code{yank} command will
  898. paste subtrees folded and in a clever way, using the same command as @kbd{C-c
  899. C-x C-y}. With the default settings, no level adjustment will take place,
  900. but the yanked tree will be folded unless doing so would swallow text
  901. previously visible. Any prefix argument to this command will force a normal
  902. @code{yank} to be executed, with the prefix passed along. A good way to
  903. force a normal yank is @kbd{C-u C-y}. If you use @code{yank-pop} after a
  904. yank, it will yank previous kill items plainly, without adjustment and
  905. folding.
  906. @kindex C-c C-x c
  907. @item C-c C-x c
  908. Clone a subtree by making a number of sibling copies of it. You will be
  909. prompted for the number of copies to make, and you can also specify if any
  910. timestamps in the entry should be shifted. This can be useful, for example,
  911. to create a number of tasks related to a series of lectures to prepare. For
  912. more details, see the docstring of the command
  913. @code{org-clone-subtree-with-time-shift}.
  914. @kindex C-c C-w
  915. @item C-c C-w
  916. Refile entry or region to a different location. @xref{Refiling notes}.
  917. @kindex C-c ^
  918. @item C-c ^
  919. Sort same-level entries. When there is an active region, all entries in the
  920. region will be sorted. Otherwise the children of the current headline are
  921. sorted. The command prompts for the sorting method, which can be
  922. alphabetically, numerically, by time (first timestamp with active preferred,
  923. creation time, scheduled time, deadline time), by priority, by TODO keyword
  924. (in the sequence the keywords have been defined in the setup) or by the value
  925. of a property. Reverse sorting is possible as well. You can also supply
  926. your own function to extract the sorting key. With a @kbd{C-u} prefix,
  927. sorting will be case-sensitive. With two @kbd{C-u C-u} prefixes, duplicate
  928. entries will also be removed.
  929. @kindex C-x n s
  930. @item C-x n s
  931. Narrow buffer to current subtree.
  932. @kindex C-x n w
  933. @item C-x n w
  934. Widen buffer to remove narrowing.
  935. @kindex C-c *
  936. @item C-c *
  937. Turn a normal line or plain list item into a headline (so that it becomes a
  938. subheading at its location). Also turn a headline into a normal line by
  939. removing the stars. If there is an active region, turn all lines in the
  940. region into headlines. If the first line in the region was an item, turn
  941. only the item lines into headlines. Finally, if the first line is a
  942. headline, remove the stars from all headlines in the region.
  943. @end table
  944. @cindex region, active
  945. @cindex active region
  946. @cindex transient mark mode
  947. When there is an active region (Transient Mark mode), promotion and
  948. demotion work on all headlines in the region. To select a region of
  949. headlines, it is best to place both point and mark at the beginning of a
  950. line, mark at the beginning of the first headline, and point at the line
  951. just after the last headline to change. Note that when the cursor is
  952. inside a table (@pxref{Tables}), the Meta-Cursor keys have different
  953. functionality.
  954. @node Sparse trees, Plain lists, Structure editing, Document Structure
  955. @section Sparse trees
  956. @cindex sparse trees
  957. @cindex trees, sparse
  958. @cindex folding, sparse trees
  959. @cindex occur, command
  960. @vindex org-show-hierarchy-above
  961. @vindex org-show-following-heading
  962. @vindex org-show-siblings
  963. @vindex org-show-entry-below
  964. An important feature of Org mode is the ability to construct @emph{sparse
  965. trees} for selected information in an outline tree, so that the entire
  966. document is folded as much as possible, but the selected information is made
  967. visible along with the headline structure above it@footnote{See also the
  968. variables @code{org-show-hierarchy-above}, @code{org-show-following-heading},
  969. @code{org-show-siblings}, and @code{org-show-entry-below} for detailed
  970. control on how much context is shown around each match.}. Just try it out
  971. and you will see immediately how it works.
  972. Org mode contains several commands creating such trees, all these
  973. commands can be accessed through a dispatcher:
  974. @table @kbd
  975. @kindex C-c /
  976. @item C-c /
  977. This prompts for an extra key to select a sparse-tree creating command.
  978. @kindex C-c / r
  979. @item C-c / r
  980. @vindex org-remove-highlights-with-change
  981. Occur. Prompts for a regexp and shows a sparse tree with all matches. If
  982. the match is in a headline, the headline is made visible. If the match is in
  983. the body of an entry, headline and body are made visible. In order to
  984. provide minimal context, also the full hierarchy of headlines above the match
  985. is shown, as well as the headline following the match. Each match is also
  986. highlighted; the highlights disappear when the buffer is changed by an
  987. editing command@footnote{This depends on the option
  988. @code{org-remove-highlights-with-change}}, or by pressing @kbd{C-c C-c}.
  989. When called with a @kbd{C-u} prefix argument, previous highlights are kept,
  990. so several calls to this command can be stacked.
  991. @end table
  992. @noindent
  993. @vindex org-agenda-custom-commands
  994. For frequently used sparse trees of specific search strings, you can
  995. use the variable @code{org-agenda-custom-commands} to define fast
  996. keyboard access to specific sparse trees. These commands will then be
  997. accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
  998. For example:
  999. @lisp
  1000. (setq org-agenda-custom-commands
  1001. '(("f" occur-tree "FIXME")))
  1002. @end lisp
  1003. @noindent will define the key @kbd{C-c a f} as a shortcut for creating
  1004. a sparse tree matching the string @samp{FIXME}.
  1005. The other sparse tree commands select headings based on TODO keywords,
  1006. tags, or properties and will be discussed later in this manual.
  1007. @kindex C-c C-e v
  1008. @cindex printing sparse trees
  1009. @cindex visible text, printing
  1010. To print a sparse tree, you can use the Emacs command
  1011. @code{ps-print-buffer-with-faces} which does not print invisible parts
  1012. of the document @footnote{This does not work under XEmacs, because
  1013. XEmacs uses selective display for outlining, not text properties.}.
  1014. Or you can use the command @kbd{C-c C-e v} to export only the visible
  1015. part of the document and print the resulting file.
  1016. @node Plain lists, Drawers, Sparse trees, Document Structure
  1017. @section Plain lists
  1018. @cindex plain lists
  1019. @cindex lists, plain
  1020. @cindex lists, ordered
  1021. @cindex ordered lists
  1022. Within an entry of the outline tree, hand-formatted lists can provide
  1023. additional structure. They also provide a way to create lists of
  1024. checkboxes (@pxref{Checkboxes}). Org supports editing such lists,
  1025. and the HTML exporter (@pxref{Exporting}) parses and formats them.
  1026. Org knows ordered lists, unordered lists, and description lists.
  1027. @itemize @bullet
  1028. @item
  1029. @emph{Unordered} list items start with @samp{-}, @samp{+}, or
  1030. @samp{*}@footnote{When using @samp{*} as a bullet, lines must be indented or
  1031. they will be seen as top-level headlines. Also, when you are hiding leading
  1032. stars to get a clean outline view, plain list items starting with a star are
  1033. visually indistinguishable from true headlines. In short: even though
  1034. @samp{*} is supported, it may be better to not use it for plain list items.}
  1035. as bullets.
  1036. @item
  1037. @emph{Ordered} list items start with a numeral followed by either a period or
  1038. a right parenthesis, such as @samp{1.} or @samp{1)}.
  1039. @item
  1040. @emph{Description} list items are unordered list items, and contain the
  1041. separator @samp{ :: } to separate the description @emph{term} from the
  1042. description.
  1043. @end itemize
  1044. @vindex org-empty-line-terminates-plain-lists
  1045. Items belonging to the same list must have the same indentation on the first
  1046. line. In particular, if an ordered list reaches number @samp{10.}, then the
  1047. 2--digit numbers must be written left-aligned with the other numbers in the
  1048. list. Indentation also determines the end of a list item. It ends before
  1049. the next line that is indented like the bullet/number, or less. Empty lines
  1050. are part of the previous item, so you can have several paragraphs in one
  1051. item. If you would like an empty line to terminate all currently open plain
  1052. lists, configure the variable @code{org-empty-line-terminates-plain-lists}.
  1053. Here is an example:
  1054. @example
  1055. @group
  1056. ** Lord of the Rings
  1057. My favorite scenes are (in this order)
  1058. 1. The attack of the Rohirrim
  1059. 2. Eowyn's fight with the witch king
  1060. + this was already my favorite scene in the book
  1061. + I really like Miranda Otto.
  1062. 3. Peter Jackson being shot by Legolas
  1063. - on DVD only
  1064. He makes a really funny face when it happens.
  1065. But in the end, no individual scenes matter but the film as a whole.
  1066. Important actors in this film are:
  1067. - @b{Elijah Wood} :: He plays Frodo
  1068. - @b{Sean Austin} :: He plays Sam, Frodo's friend. I still remember
  1069. him very well from his role as Mikey Walsh in @i{The Goonies}.
  1070. @end group
  1071. @end example
  1072. Org supports these lists by tuning filling and wrapping commands to deal with
  1073. them correctly@footnote{Org only changes the filling settings for Emacs. For
  1074. XEmacs, you should use Kyle E. Jones' @file{filladapt.el}. To turn this on,
  1075. put into @file{.emacs}: @code{(require 'filladapt)}}, and by exporting them
  1076. properly (@pxref{Exporting}). Since indentation is what governs the
  1077. structure of these lists, many structural constructs like @code{#+BEGIN_...}
  1078. blocks can be indented to signal that they should be part of a list item.
  1079. The following commands act on items when the cursor is in the first line
  1080. of an item (the line with the bullet or number).
  1081. @table @kbd
  1082. @kindex @key{TAB}
  1083. @item @key{TAB}
  1084. @vindex org-cycle-include-plain-lists
  1085. Items can be folded just like headline levels. Normally this works only if
  1086. the cursor is on a plain list item. For more details, see the variable
  1087. @code{org-cycle-include-plain-lists}. to @code{integrate}, plain list items
  1088. will be treated like low-level. The level of an item is then given by the
  1089. indentation of the bullet/number. Items are always subordinate to real
  1090. headlines, however; the hierarchies remain completely separated.
  1091. If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
  1092. fixes the indentation of the current line in a heuristic way.
  1093. @kindex M-@key{RET}
  1094. @item M-@key{RET}
  1095. @vindex org-M-RET-may-split-line
  1096. Insert new item at current level. With a prefix argument, force a new
  1097. heading (@pxref{Structure editing}). If this command is used in the middle
  1098. of a line, the line is @emph{split} and the rest of the line becomes the new
  1099. item@footnote{If you do not want the line to be split, customize the variable
  1100. @code{org-M-RET-may-split-line}.}. If this command is executed in the
  1101. @emph{whitespace before a bullet or number}, the new item is created
  1102. @emph{before} the current item. If the command is executed in the white
  1103. space before the text that is part of an item but does not contain the
  1104. bullet, a bullet is added to the current line.
  1105. @kindex M-S-@key{RET}
  1106. @item M-S-@key{RET}
  1107. Insert a new item with a checkbox (@pxref{Checkboxes}).
  1108. @kindex @key{TAB}
  1109. @item @key{TAB} @r{in new, empty item}
  1110. In a new item with no text yet, the first @key{TAB} demotes the item to
  1111. become a child of the previous one. The next @key{TAB} makes it a parent,
  1112. and so on, all the way to the left margin. Yet another @key{TAB}, and you
  1113. are back to the initial level.
  1114. @kindex S-@key{up}
  1115. @kindex S-@key{down}
  1116. @item S-@key{up}
  1117. @itemx S-@key{down}
  1118. @cindex shift-selection-mode
  1119. @vindex org-support-shift-select
  1120. Jump to the previous/next item in the current list, but only if
  1121. @code{org-support-shift-select} is off. If not, you can still use paragraph
  1122. jumping commands like @kbd{C-@key{up}} and @kbd{C-@key{down}} to quite
  1123. similar effect.
  1124. @kindex M-S-@key{up}
  1125. @kindex M-S-@key{down}
  1126. @item M-S-@key{up}
  1127. @itemx M-S-@key{down}
  1128. Move the item including subitems up/down (swap with previous/next item
  1129. of same indentation). If the list is ordered, renumbering is
  1130. automatic.
  1131. @kindex M-S-@key{left}
  1132. @kindex M-S-@key{right}
  1133. @item M-S-@key{left}
  1134. @itemx M-S-@key{right}
  1135. Decrease/increase the indentation of the item, including subitems.
  1136. Initially, the item tree is selected based on current indentation.
  1137. When these commands are executed several times in direct succession,
  1138. the initially selected region is used, even if the new indentation
  1139. would imply a different hierarchy. To use the new hierarchy, break
  1140. the command chain with a cursor motion or so.
  1141. @kindex C-c C-c
  1142. @item C-c C-c
  1143. If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
  1144. state of the checkbox. If not, this command makes sure that all the
  1145. items on this list level use the same bullet. Furthermore, if this is
  1146. an ordered list, make sure the numbering is OK.
  1147. @kindex C-c -
  1148. @item C-c -
  1149. Cycle the entire list level through the different itemize/enumerate bullets
  1150. (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}). With a numeric prefix
  1151. argument N, select the Nth bullet from this list. If there is an active
  1152. region when calling this, all lines will be converted to list items. If the
  1153. first line already was a list item, any item markers will be removed from the
  1154. list. Finally, even without an active region, a normal line will be
  1155. converted into a list item.
  1156. @kindex C-c *
  1157. @item C-c *
  1158. Turn a plain list item into a headline (so that it becomes a subheading at
  1159. its location). @xref{Structure editing}, for a detailed explanation.
  1160. @kindex S-@key{left}
  1161. @kindex S-@key{right}
  1162. @item S-@key{left}/@key{right}
  1163. @vindex org-support-shift-select
  1164. This command also cycles bullet styles when the cursor in on the bullet or
  1165. anywhere in an item line, details depending on
  1166. @code{org-support-shift-select}.
  1167. @kindex C-c ^
  1168. @item C-c ^
  1169. Sort the plain list. You will be prompted for the sorting method:
  1170. numerically, alphabetically, by time, or by custom function.
  1171. @end table
  1172. @node Drawers, Blocks, Plain lists, Document Structure
  1173. @section Drawers
  1174. @cindex drawers
  1175. @cindex #+DRAWERS
  1176. @cindex visibility cycling, drawers
  1177. @vindex org-drawers
  1178. Sometimes you want to keep information associated with an entry, but you
  1179. normally don't want to see it. For this, Org mode has @emph{drawers}.
  1180. Drawers need to be configured with the variable
  1181. @code{org-drawers}@footnote{You can define drawers on a per-file basis
  1182. with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}. Drawers
  1183. look like this:
  1184. @example
  1185. ** This is a headline
  1186. Still outside the drawer
  1187. :DRAWERNAME:
  1188. This is inside the drawer.
  1189. :END:
  1190. After the drawer.
  1191. @end example
  1192. Visibility cycling (@pxref{Visibility cycling}) on the headline will hide and
  1193. show the entry, but keep the drawer collapsed to a single line. In order to
  1194. look inside the drawer, you need to move the cursor to the drawer line and
  1195. press @key{TAB} there. Org mode uses the @code{PROPERTIES} drawer for
  1196. storing properties (@pxref{Properties and Columns}), and you can also arrange
  1197. for state change notes (@pxref{Tracking TODO state changes}) and clock times
  1198. (@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}.
  1199. @node Blocks, Footnotes, Drawers, Document Structure
  1200. @section Blocks
  1201. @vindex org-hide-block-startup
  1202. @cindex blocks, folding
  1203. Org-mode uses begin...end blocks for various purposes from including source
  1204. code examples (@pxref{Literal examples}) to capturing time logging
  1205. information (@pxref{Clocking work time}). These blocks can be folded and
  1206. unfolded by pressing TAB in the begin line. You can also get all blocks
  1207. folded at startup by configuring the variable @code{org-hide-block-startup}
  1208. or on a per-file basis by using
  1209. @cindex @code{hideblocks}, STARTUP keyword
  1210. @cindex @code{nohideblocks}, STARTUP keyword
  1211. @example
  1212. #+STARTUP: hideblocks
  1213. #+STARTUP: nohideblocks
  1214. @end example
  1215. @node Footnotes, Orgstruct mode, Blocks, Document Structure
  1216. @section Footnotes
  1217. @cindex footnotes
  1218. Org mode supports the creation of footnotes. In contrast to the
  1219. @file{footnote.el} package, Org mode's footnotes are designed for work on a
  1220. larger document, not only for one-off documents like emails. The basic
  1221. syntax is similar to the one used by @file{footnote.el}, i.e. a footnote is
  1222. defined in a paragraph that is started by a footnote marker in square
  1223. brackets in column 0, no indentation allowed. If you need a paragraph break
  1224. inside a footnote, use the La@TeX{} idiom @samp{\par}. The footnote reference
  1225. is simply the marker in square brackets, inside text. For example:
  1226. @example
  1227. The Org homepage[fn:1] now looks a lot better than it used to.
  1228. ...
  1229. [fn:1] The link is: http://orgmode.org
  1230. @end example
  1231. Org mode extends the number-based syntax to @emph{named} footnotes and
  1232. optional inline definition. Using plain numbers as markers (as
  1233. @file{footnote.el} does) is supported for backward compatibility, but not
  1234. encouraged because of possible conflicts with La@TeX{} snippets (@pxref{Embedded
  1235. LaTeX}). Here are the valid references:
  1236. @table @code
  1237. @item [1]
  1238. A plain numeric footnote marker. Compatible with @file{footnote.el}, but not
  1239. recommended because somthing like @samp{[1]} could easily be part of a code
  1240. snippet.
  1241. @item [fn:name]
  1242. A named footnote reference, where @code{name} is a unique label word, or, for
  1243. simplicity of automatic creation, a number.
  1244. @item [fn:: This is the inline definition of this footnote]
  1245. A La@TeX{}-like anonymous footnote where the definition is given directly at the
  1246. reference point.
  1247. @item [fn:name: a definition]
  1248. An inline definition of a footnote, which also specifies a name for the note.
  1249. Since Org allows multiple references to the same note, you can then use
  1250. @code{[fn:name]} to create additional references.
  1251. @end table
  1252. @vindex org-footnote-auto-label
  1253. Footnote labels can be created automatically, or you can create names yourself.
  1254. This is handled by the variable @code{org-footnote-auto-label} and its
  1255. corresponding @code{#+STARTUP} keywords, see the docstring of that variable
  1256. for details.
  1257. @noindent The following command handles footnotes:
  1258. @table @kbd
  1259. @kindex C-c C-x f
  1260. @item C-c C-x f
  1261. The footnote action command.
  1262. When the cursor is on a footnote reference, jump to the definition. When it
  1263. is at a definition, jump to the (first) reference.
  1264. @vindex org-footnote-define-inline
  1265. @vindex org-footnote-section
  1266. @vindex org-footnote-auto-adjust
  1267. Otherwise, create a new footnote. Depending on the variable
  1268. @code{org-footnote-define-inline}@footnote{The corresponding in-buffer
  1269. setting is: @code{#+STARTUP: fninline} or @code{#+STARTUP: nofninline}}, the
  1270. definition will be placed right into the text as part of the reference, or
  1271. separately into the location determined by the variable
  1272. @code{org-footnote-section}.
  1273. When this command is called with a prefix argument, a menu of additional
  1274. options is offered:
  1275. @example
  1276. s @r{Sort the footnote definitions by reference sequence. During editing,}
  1277. @r{Org makes no effort to sort footnote definitions into a particular}
  1278. @r{sequence. If you want them sorted, use this command, which will}
  1279. @r{also move entries according to @code{org-footnote-section}. Automatic}
  1280. @r{sorting after each insertion/deletion can be configured using the}
  1281. @r{variable @code{org-footnote-auto-adjust}.}
  1282. r @r{Renumber the simple @code{fn:N} footnotes. Automatic renumbering}
  1283. @r{after each insertion/deletion can be configured using the variable}
  1284. @r{@code{org-footnote-auto-adjust}.}
  1285. S @r{Short for first @code{r}, then @code{s} action.}
  1286. n @r{Normalize the footnotes by collecting all definitions (including}
  1287. @r{inline definitions) into a special section, and then numbering them}
  1288. @r{in sequence. The references will then also be numbers. This is}
  1289. @r{meant to be the final step before finishing a document (e.g. sending}
  1290. @r{off an email). The exporters do this automatically, and so could}
  1291. @r{something like @code{message-send-hook}.}
  1292. d @r{Delete the footnote at point, and all definitions of and references}
  1293. @r{to it.}
  1294. @end example
  1295. Depending on the variable @code{org-footnote-auto-adjust}@footnote{the
  1296. corresponding in-buffer options are @code{fnadjust} and @code{nofnadjust}.},
  1297. renumbering and sorting footnotes can be automatic after each insertion or
  1298. deletion.
  1299. @kindex C-c C-c
  1300. @item C-c C-c
  1301. If the cursor is on a footnote reference, jump to the definition. If it is a
  1302. the definition, jump back to the reference. When called at a footnote
  1303. location with a prefix argument, offer the same menu as @kbd{C-c C-x f}.
  1304. @kindex C-c C-o
  1305. @kindex mouse-1
  1306. @kindex mouse-2
  1307. @item C-c C-o @r{or} mouse-1/2
  1308. Footnote labels are also links to the corresponding definition/reference, and
  1309. you can use the usual commands to follow these links.
  1310. @end table
  1311. @node Orgstruct mode, , Footnotes, Document Structure
  1312. @section The Orgstruct minor mode
  1313. @cindex Orgstruct mode
  1314. @cindex minor mode for structure editing
  1315. If you like the intuitive way the Org mode structure editing and list
  1316. formatting works, you might want to use these commands in other modes like
  1317. Text mode or Mail mode as well. The minor mode @code{orgstruct-mode} makes
  1318. this possible. Toggle the mode with @kbd{M-x orgstruct-mode}, or
  1319. turn it on by default, for example in Mail mode, with one of:
  1320. @lisp
  1321. (add-hook 'mail-mode-hook 'turn-on-orgstruct)
  1322. (add-hook 'mail-mode-hook 'turn-on-orgstruct++)
  1323. @end lisp
  1324. When this mode is active and the cursor is on a line that looks to Org like a
  1325. headline or the first line of a list item, most structure editing commands
  1326. will work, even if the same keys normally have different functionality in the
  1327. major mode you are using. If the cursor is not in one of those special
  1328. lines, Orgstruct mode lurks silently in the shadow. When you use
  1329. @code{orgstruct++-mode}, Org will also export indentation and autofill
  1330. settings into that mode, and detect item context after the first line of an
  1331. item.
  1332. @node Tables, Hyperlinks, Document Structure, Top
  1333. @chapter Tables
  1334. @cindex tables
  1335. @cindex editing tables
  1336. Org comes with a fast and intuitive table editor. Spreadsheet-like
  1337. calculations are supported in connection with the Emacs @file{calc}
  1338. package
  1339. @ifinfo
  1340. (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
  1341. @end ifinfo
  1342. @ifnotinfo
  1343. (see the Emacs Calculator manual for more information about the Emacs
  1344. calculator).
  1345. @end ifnotinfo
  1346. @menu
  1347. * Built-in table editor:: Simple tables
  1348. * Column width and alignment:: Overrule the automatic settings
  1349. * Column groups:: Grouping to trigger vertical lines
  1350. * Orgtbl mode:: The table editor as minor mode
  1351. * The spreadsheet:: The table editor has spreadsheet capabilities
  1352. * Org-Plot:: Plotting from org tables
  1353. @end menu
  1354. @node Built-in table editor, Column width and alignment, Tables, Tables
  1355. @section The built-in table editor
  1356. @cindex table editor, built-in
  1357. Org makes it easy to format tables in plain ASCII. Any line with
  1358. @samp{|} as the first non-whitespace character is considered part of a
  1359. table. @samp{|} is also the column separator. A table might look like
  1360. this:
  1361. @example
  1362. | Name | Phone | Age |
  1363. |-------+-------+-----|
  1364. | Peter | 1234 | 17 |
  1365. | Anna | 4321 | 25 |
  1366. @end example
  1367. A table is re-aligned automatically each time you press @key{TAB} or
  1368. @key{RET} or @kbd{C-c C-c} inside the table. @key{TAB} also moves to
  1369. the next field (@key{RET} to the next row) and creates new table rows
  1370. at the end of the table or before horizontal lines. The indentation
  1371. of the table is set by the first line. Any line starting with
  1372. @samp{|-} is considered as a horizontal separator line and will be
  1373. expanded on the next re-align to span the whole table width. So, to
  1374. create the above table, you would only type
  1375. @example
  1376. |Name|Phone|Age|
  1377. |-
  1378. @end example
  1379. @noindent and then press @key{TAB} to align the table and start filling in
  1380. fields. Even faster would be to type @code{|Name|Phone|Age} followed by
  1381. @kbd{C-c @key{RET}}.
  1382. @vindex org-enable-table-editor
  1383. @vindex org-table-auto-blank-field
  1384. When typing text into a field, Org treats @key{DEL},
  1385. @key{Backspace}, and all character keys in a special way, so that
  1386. inserting and deleting avoids shifting other fields. Also, when
  1387. typing @emph{immediately after the cursor was moved into a new field
  1388. with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
  1389. field is automatically made blank. If this behavior is too
  1390. unpredictable for you, configure the variables
  1391. @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
  1392. @table @kbd
  1393. @tsubheading{Creation and conversion}
  1394. @kindex C-c |
  1395. @item C-c |
  1396. Convert the active region to table. If every line contains at least one
  1397. TAB character, the function assumes that the material is tab separated.
  1398. If every line contains a comma, comma-separated values (CSV) are assumed.
  1399. If not, lines are split at whitespace into fields. You can use a prefix
  1400. argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
  1401. C-u} forces TAB, and a numeric argument N indicates that at least N
  1402. consecutive spaces, or alternatively a TAB will be the separator.
  1403. @*
  1404. If there is no active region, this command creates an empty Org
  1405. table. But it's easier just to start typing, like
  1406. @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
  1407. @tsubheading{Re-aligning and field motion}
  1408. @kindex C-c C-c
  1409. @item C-c C-c
  1410. Re-align the table without moving the cursor.
  1411. @c
  1412. @kindex @key{TAB}
  1413. @item @key{TAB}
  1414. Re-align the table, move to the next field. Creates a new row if
  1415. necessary.
  1416. @c
  1417. @kindex S-@key{TAB}
  1418. @item S-@key{TAB}
  1419. Re-align, move to previous field.
  1420. @c
  1421. @kindex @key{RET}
  1422. @item @key{RET}
  1423. Re-align the table and move down to next row. Creates a new row if
  1424. necessary. At the beginning or end of a line, @key{RET} still does
  1425. NEWLINE, so it can be used to split a table.
  1426. @c
  1427. @kindex M-a
  1428. @item M-a
  1429. Move to beginning of the current table field, or on to the previous field.
  1430. @kindex M-e
  1431. @item M-e
  1432. Move to end of the current table field, or on to the next field.
  1433. @tsubheading{Column and row editing}
  1434. @kindex M-@key{left}
  1435. @kindex M-@key{right}
  1436. @item M-@key{left}
  1437. @itemx M-@key{right}
  1438. Move the current column left/right.
  1439. @c
  1440. @kindex M-S-@key{left}
  1441. @item M-S-@key{left}
  1442. Kill the current column.
  1443. @c
  1444. @kindex M-S-@key{right}
  1445. @item M-S-@key{right}
  1446. Insert a new column to the left of the cursor position.
  1447. @c
  1448. @kindex M-@key{up}
  1449. @kindex M-@key{down}
  1450. @item M-@key{up}
  1451. @itemx M-@key{down}
  1452. Move the current row up/down.
  1453. @c
  1454. @kindex M-S-@key{up}
  1455. @item M-S-@key{up}
  1456. Kill the current row or horizontal line.
  1457. @c
  1458. @kindex M-S-@key{down}
  1459. @item M-S-@key{down}
  1460. Insert a new row above the current row. With a prefix argument, the line is
  1461. created below the current one.
  1462. @c
  1463. @kindex C-c -
  1464. @item C-c -
  1465. Insert a horizontal line below current row. With a prefix argument, the line
  1466. is created above the current line.
  1467. @c
  1468. @kindex C-c @key{RET}
  1469. @item C-c @key{RET}
  1470. Insert a horizontal line below current row, and move the cursor into the row
  1471. below that line.
  1472. @c
  1473. @kindex C-c ^
  1474. @item C-c ^
  1475. Sort the table lines in the region. The position of point indicates the
  1476. column to be used for sorting, and the range of lines is the range
  1477. between the nearest horizontal separator lines, or the entire table. If
  1478. point is before the first column, you will be prompted for the sorting
  1479. column. If there is an active region, the mark specifies the first line
  1480. and the sorting column, while point should be in the last line to be
  1481. included into the sorting. The command prompts for the sorting type
  1482. (alphabetically, numerically, or by time). When called with a prefix
  1483. argument, alphabetic sorting will be case-sensitive.
  1484. @tsubheading{Regions}
  1485. @kindex C-c C-x M-w
  1486. @item C-c C-x M-w
  1487. Copy a rectangular region from a table to a special clipboard. Point and
  1488. mark determine edge fields of the rectangle. If there is no active region,
  1489. copy just the current field. The process ignores horizontal separator lines.
  1490. @c
  1491. @kindex C-c C-x C-w
  1492. @item C-c C-x C-w
  1493. Copy a rectangular region from a table to a special clipboard, and
  1494. blank all fields in the rectangle. So this is the ``cut'' operation.
  1495. @c
  1496. @kindex C-c C-x C-y
  1497. @item C-c C-x C-y
  1498. Paste a rectangular region into a table.
  1499. The upper left corner ends up in the current field. All involved fields
  1500. will be overwritten. If the rectangle does not fit into the present table,
  1501. the table is enlarged as needed. The process ignores horizontal separator
  1502. lines.
  1503. @c
  1504. @kindex M-@key{RET}
  1505. @itemx M-@kbd{RET}
  1506. Wrap several fields in a column like a paragraph. If there is an active
  1507. region, and both point and mark are in the same column, the text in the
  1508. column is wrapped to minimum width for the given number of lines. A numeric
  1509. prefix argument may be used to change the number of desired lines. If there
  1510. is no region, the current field is split at the cursor position and the text
  1511. fragment to the right of the cursor is prepended to the field one line
  1512. down. If there is no region, but you specify a prefix argument, the current
  1513. field is made blank, and the content is appended to the field above.
  1514. @tsubheading{Calculations}
  1515. @cindex formula, in tables
  1516. @cindex calculations, in tables
  1517. @cindex region, active
  1518. @cindex active region
  1519. @cindex transient mark mode
  1520. @kindex C-c +
  1521. @item C-c +
  1522. Sum the numbers in the current column, or in the rectangle defined by
  1523. the active region. The result is shown in the echo area and can
  1524. be inserted with @kbd{C-y}.
  1525. @c
  1526. @kindex S-@key{RET}
  1527. @item S-@key{RET}
  1528. @vindex org-table-copy-increment
  1529. When current field is empty, copy from first non-empty field above. When not
  1530. empty, copy current field down to next row and move cursor along with it.
  1531. Depending on the variable @code{org-table-copy-increment}, integer field
  1532. values will be incremented during copy. Integers that are too large will not
  1533. be incremented. Also, a @code{0} prefix argument temporarily disables the
  1534. increment. This key is also used by shift-selection and related modes
  1535. (@pxref{Conflicts}).
  1536. @tsubheading{Miscellaneous}
  1537. @kindex C-c `
  1538. @item C-c `
  1539. Edit the current field in a separate window. This is useful for fields that
  1540. are not fully visible (@pxref{Column width and alignment}). When called with
  1541. a @kbd{C-u} prefix, just make the full field visible, so that it can be
  1542. edited in place.
  1543. @c
  1544. @item M-x org-table-import
  1545. Import a file as a table. The table should be TAB or whitespace
  1546. separated. Use, for example, to import a spreadsheet table or data
  1547. from a database, because these programs generally can write
  1548. TAB-separated text files. This command works by inserting the file into
  1549. the buffer and then converting the region to a table. Any prefix
  1550. argument is passed on to the converter, which uses it to determine the
  1551. separator.
  1552. @item C-c |
  1553. Tables can also be imported by pasting tabular text into the Org
  1554. buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
  1555. @kbd{C-c |} command (see above under @i{Creation and conversion}).
  1556. @c
  1557. @item M-x org-table-export
  1558. @vindex org-table-export-default-format
  1559. Export the table, by default as a TAB-separated file. Use for data
  1560. exchange with, for example, spreadsheet or database programs. The format
  1561. used to export the file can be configured in the variable
  1562. @code{org-table-export-default-format}. You may also use properties
  1563. @code{TABLE_EXPORT_FILE} and @code{TABLE_EXPORT_FORMAT} to specify the file
  1564. name and the format for table export in a subtree. Org supports quite
  1565. general formats for exported tables. The exporter format is the same as the
  1566. format used by Orgtbl radio tables, see @ref{Translator functions}, for a
  1567. detailed description.
  1568. @end table
  1569. If you don't like the automatic table editor because it gets in your
  1570. way on lines which you would like to start with @samp{|}, you can turn
  1571. it off with
  1572. @lisp
  1573. (setq org-enable-table-editor nil)
  1574. @end lisp
  1575. @noindent Then the only table command that still works is
  1576. @kbd{C-c C-c} to do a manual re-align.
  1577. @node Column width and alignment, Column groups, Built-in table editor, Tables
  1578. @section Column width and alignment
  1579. @cindex narrow columns in tables
  1580. @cindex alignment in tables
  1581. The width of columns is automatically determined by the table editor. And
  1582. also the alignment of a column is determined automatically from the fraction
  1583. of number-like versus non-number fields in the column.
  1584. Sometimes a single field or a few fields need to carry more text,
  1585. leading to inconveniently wide columns. To limit@footnote{This feature
  1586. does not work on XEmacs.} the width of a column, one field anywhere in
  1587. the column may contain just the string @samp{<N>} where @samp{N} is an
  1588. integer specifying the width of the column in characters. The next
  1589. re-align will then set the width of this column to no more than this
  1590. value.
  1591. @example
  1592. @group
  1593. |---+------------------------------| |---+--------|
  1594. | | | | | <6> |
  1595. | 1 | one | | 1 | one |
  1596. | 2 | two | ----\ | 2 | two |
  1597. | 3 | This is a long chunk of text | ----/ | 3 | This=> |
  1598. | 4 | four | | 4 | four |
  1599. |---+------------------------------| |---+--------|
  1600. @end group
  1601. @end example
  1602. @noindent
  1603. Fields that are wider become clipped and end in the string @samp{=>}.
  1604. Note that the full text is still in the buffer, it is only invisible.
  1605. To see the full text, hold the mouse over the field---a tool-tip window
  1606. will show the full content. To edit such a field, use the command
  1607. @kbd{C-c `} (that is @kbd{C-c} followed by the backquote). This will
  1608. open a new window with the full field. Edit it and finish with @kbd{C-c
  1609. C-c}.
  1610. @vindex org-startup-align-all-tables
  1611. When visiting a file containing a table with narrowed columns, the
  1612. necessary character hiding has not yet happened, and the table needs to
  1613. be aligned before it looks nice. Setting the option
  1614. @code{org-startup-align-all-tables} will realign all tables in a file
  1615. upon visiting, but also slow down startup. You can also set this option
  1616. on a per-file basis with:
  1617. @example
  1618. #+STARTUP: align
  1619. #+STARTUP: noalign
  1620. @end example
  1621. If you would like to overrule the automatic alignment of number-rich columns
  1622. to the right and of string-rich column to the left, you and use @samp{<r>} or
  1623. @samp{<l>} in a similar fashion. You may also combine alignment and field
  1624. width like this: @samp{<l10>}.
  1625. @node Column groups, Orgtbl mode, Column width and alignment, Tables
  1626. @section Column groups
  1627. @cindex grouping columns in tables
  1628. When Org exports tables, it does so by default without vertical
  1629. lines because that is visually more satisfying in general. Occasionally
  1630. however, vertical lines can be useful to structure a table into groups
  1631. of columns, much like horizontal lines can do for groups of rows. In
  1632. order to specify column groups, you can use a special row where the
  1633. first field contains only @samp{/}. The further fields can either
  1634. contain @samp{<} to indicate that this column should start a group,
  1635. @samp{>} to indicate the end of a column, or @samp{<>} to make a column
  1636. a group of its own. Boundaries between column groups will upon export be
  1637. marked with vertical lines. Here is an example:
  1638. @example
  1639. | | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1640. |---+----+-----+-----+-----+---------+------------|
  1641. | / | <> | < | | > | < | > |
  1642. | # | 1 | 1 | 1 | 1 | 1 | 1 |
  1643. | # | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
  1644. | # | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
  1645. |---+----+-----+-----+-----+---------+------------|
  1646. #+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2)))
  1647. @end example
  1648. It is also sufficient to just insert the column group starters after
  1649. every vertical line you'd like to have:
  1650. @example
  1651. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1652. |----+-----+-----+-----+---------+------------|
  1653. | / | < | | | < | |
  1654. @end example
  1655. @node Orgtbl mode, The spreadsheet, Column groups, Tables
  1656. @section The Orgtbl minor mode
  1657. @cindex Orgtbl mode
  1658. @cindex minor mode for tables
  1659. If you like the intuitive way the Org table editor works, you
  1660. might also want to use it in other modes like Text mode or Mail mode.
  1661. The minor mode Orgtbl mode makes this possible. You can always toggle
  1662. the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
  1663. example in mail mode, use
  1664. @lisp
  1665. (add-hook 'mail-mode-hook 'turn-on-orgtbl)
  1666. @end lisp
  1667. Furthermore, with some special setup, it is possible to maintain tables
  1668. in arbitrary syntax with Orgtbl mode. For example, it is possible to
  1669. construct La@TeX{} tables with the underlying ease and power of
  1670. Orgtbl mode, including spreadsheet capabilities. For details, see
  1671. @ref{Tables in arbitrary syntax}.
  1672. @node The spreadsheet, Org-Plot, Orgtbl mode, Tables
  1673. @section The spreadsheet
  1674. @cindex calculations, in tables
  1675. @cindex spreadsheet capabilities
  1676. @cindex @file{calc} package
  1677. The table editor makes use of the Emacs @file{calc} package to implement
  1678. spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to
  1679. derive fields from other fields. While fully featured, Org's
  1680. implementation is not identical to other spreadsheets. For example,
  1681. Org knows the concept of a @emph{column formula} that will be
  1682. applied to all non-header fields in a column without having to copy the
  1683. formula to each relevant field.
  1684. @menu
  1685. * References:: How to refer to another field or range
  1686. * Formula syntax for Calc:: Using Calc to compute stuff
  1687. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
  1688. * Field formulas:: Formulas valid for a single field
  1689. * Column formulas:: Formulas valid for an entire column
  1690. * Editing and debugging formulas:: Fixing formulas
  1691. * Updating the table:: Recomputing all dependent fields
  1692. * Advanced features:: Field names, parameters and automatic recalc
  1693. @end menu
  1694. @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
  1695. @subsection References
  1696. @cindex references
  1697. To compute fields in the table from other fields, formulas must
  1698. reference other fields or ranges. In Org, fields can be referenced
  1699. by name, by absolute coordinates, and by relative coordinates. To find
  1700. out what the coordinates of a field are, press @kbd{C-c ?} in that
  1701. field, or press @kbd{C-c @}} to toggle the display of a grid.
  1702. @subsubheading Field references
  1703. @cindex field references
  1704. @cindex references, to fields
  1705. Formulas can reference the value of another field in two ways. Like in
  1706. any other spreadsheet, you may reference fields with a letter/number
  1707. combination like @code{B3}, meaning the 2nd field in the 3rd row.
  1708. @c Such references are always fixed to that field, they don't change
  1709. @c when you copy and paste a formula to a different field. So
  1710. @c Org's @code{B3} behaves like @code{$B$3} in other spreadsheets.
  1711. @noindent
  1712. Org also uses another, more general operator that looks like this:
  1713. @example
  1714. @@@var{row}$@var{column}
  1715. @end example
  1716. @noindent
  1717. Column references can be absolute like @samp{1}, @samp{2},...@samp{@var{N}},
  1718. or relative to the current column like @samp{+1} or @samp{-2}.
  1719. The row specification only counts data lines and ignores horizontal
  1720. separator lines (hlines). You can use absolute row numbers
  1721. @samp{1}...@samp{@var{N}}, and row numbers relative to the current row like
  1722. @samp{+3} or @samp{-1}. Or specify the row relative to one of the
  1723. hlines: @samp{I} refers to the first hline@footnote{Note that only
  1724. hlines are counted that @emph{separate} table lines. If the table
  1725. starts with a hline above the header, it does not count.}, @samp{II} to
  1726. the second, etc@. @samp{-I} refers to the first such line above the
  1727. current line, @samp{+I} to the first such line below the current line.
  1728. You can also write @samp{III+2} which is the second data line after the
  1729. third hline in the table.
  1730. @samp{0} refers to the current row and column. Also, if you omit
  1731. either the column or the row part of the reference, the current
  1732. row/column is implied.
  1733. Org's references with @emph{unsigned} numbers are fixed references
  1734. in the sense that if you use the same reference in the formula for two
  1735. different fields, the same field will be referenced each time.
  1736. Org's references with @emph{signed} numbers are floating
  1737. references because the same reference operator can reference different
  1738. fields depending on the field being calculated by the formula.
  1739. As a special case, references like @samp{$LR5} and @samp{$LR12} can be used
  1740. to refer in a stable way to the 5th and 12th field in the last row of the
  1741. table.
  1742. Here are a few examples:
  1743. @example
  1744. @@2$3 @r{2nd row, 3rd column}
  1745. C2 @r{same as previous}
  1746. $5 @r{column 5 in the current row}
  1747. E& @r{same as previous}
  1748. @@2 @r{current column, row 2}
  1749. @@-1$-3 @r{the field one row up, three columns to the left}
  1750. @@-I$2 @r{field just under hline above current row, column 2}
  1751. @end example
  1752. @subsubheading Range references
  1753. @cindex range references
  1754. @cindex references, to ranges
  1755. You may reference a rectangular range of fields by specifying two field
  1756. references connected by two dots @samp{..}. If both fields are in the
  1757. current row, you may simply use @samp{$2..$7}, but if at least one field
  1758. is in a different row, you need to use the general @code{@@row$column}
  1759. format at least for the first field (i.e the reference must start with
  1760. @samp{@@} in order to be interpreted correctly). Examples:
  1761. @example
  1762. $1..$3 @r{First three fields in the current row.}
  1763. $P..$Q @r{Range, using column names (see under Advanced)}
  1764. @@2$1..@@4$3 @r{6 fields between these two fields.}
  1765. A2..C4 @r{Same as above.}
  1766. @@-1$-2..@@-1 @r{3 numbers from the column to the left, 2 up to current row}
  1767. @end example
  1768. @noindent Range references return a vector of values that can be fed
  1769. into Calc vector functions. Empty fields in ranges are normally
  1770. suppressed, so that the vector contains only the non-empty fields (but
  1771. see the @samp{E} mode switch below). If there are no non-empty fields,
  1772. @samp{[0]} is returned to avoid syntax errors in formulas.
  1773. @subsubheading Named references
  1774. @cindex named references
  1775. @cindex references, named
  1776. @cindex name, of column or field
  1777. @cindex constants, in calculations
  1778. @cindex #+CONSTANTS
  1779. @vindex org-table-formula-constants
  1780. @samp{$name} is interpreted as the name of a column, parameter or
  1781. constant. Constants are defined globally through the variable
  1782. @code{org-table-formula-constants}, and locally (for the file) through a
  1783. line like
  1784. @example
  1785. #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
  1786. @end example
  1787. @noindent
  1788. @vindex constants-unit-system
  1789. @pindex constants.el
  1790. Also properties (@pxref{Properties and Columns}) can be used as
  1791. constants in table formulas: for a property @samp{:Xyz:} use the name
  1792. @samp{$PROP_Xyz}, and the property will be searched in the current
  1793. outline entry and in the hierarchy above it. If you have the
  1794. @file{constants.el} package, it will also be used to resolve constants,
  1795. including natural constants like @samp{$h} for Planck's constant, and
  1796. units like @samp{$km} for kilometers@footnote{@file{constants.el} can
  1797. supply the values of constants in two different unit systems, @code{SI}
  1798. and @code{cgs}. Which one is used depends on the value of the variable
  1799. @code{constants-unit-system}. You can use the @code{#+STARTUP} options
  1800. @code{constSI} and @code{constcgs} to set this value for the current
  1801. buffer.}. Column names and parameters can be specified in special table
  1802. lines. These are described below, see @ref{Advanced features}. All
  1803. names must start with a letter, and further consist of letters and
  1804. numbers.
  1805. @subsubheading Remote references
  1806. @cindex remote references
  1807. @cindex references, remote
  1808. @cindex references, to a different table
  1809. @cindex name, of column or field
  1810. @cindex constants, in calculations
  1811. @cindex #+TBLNAME
  1812. You may also reference constants, fields and ranges from a different table,
  1813. either in the current file or even in a different file. The syntax is
  1814. @example
  1815. remote(NAME-OR-ID,REF)
  1816. @end example
  1817. @noindent
  1818. where NAME can be the name of a table in the current file as set by a
  1819. @code{#+TBLNAME: NAME} line before the table. It can also be the ID of an
  1820. entry, even in a different file, and the reference then refers to the first
  1821. table in that entry. REF is an absolute field or range reference as
  1822. described above for example @code{@@3$3} or @code{$somename}, valid in the
  1823. referenced table.
  1824. @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
  1825. @subsection Formula syntax for Calc
  1826. @cindex formula syntax, Calc
  1827. @cindex syntax, of formulas
  1828. A formula can be any algebraic expression understood by the Emacs
  1829. @file{Calc} package. @b{Note that @file{calc} has the
  1830. non-standard convention that @samp{/} has lower precedence than
  1831. @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before
  1832. evaluation by @code{calc-eval} (@pxref{Calling Calc from
  1833. Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
  1834. Emacs Calc Manual}),
  1835. @c FIXME: The link to the Calc manual in HTML does not work.
  1836. variable substitution takes place according to the rules described above.
  1837. @cindex vectors, in table calculations
  1838. The range vectors can be directly fed into the Calc vector functions
  1839. like @samp{vmean} and @samp{vsum}.
  1840. @cindex format specifier
  1841. @cindex mode, for @file{calc}
  1842. @vindex org-calc-default-modes
  1843. A formula can contain an optional mode string after a semicolon. This
  1844. string consists of flags to influence Calc and other modes during
  1845. execution. By default, Org uses the standard Calc modes (precision
  1846. 12, angular units degrees, fraction and symbolic modes off). The display
  1847. format, however, has been changed to @code{(float 8)} to keep tables
  1848. compact. The default settings can be configured using the variable
  1849. @code{org-calc-default-modes}.
  1850. @example
  1851. p20 @r{set the internal Calc calculation precision to 20 digits}
  1852. n3 s3 e2 f4 @r{Normal, scientific, engineering, or fixed}
  1853. @r{format of the result of Calc passed back to Org.}
  1854. @r{Calc formatting is unlimited in precision as}
  1855. @r{long as the Calc calculation precision is greater.}
  1856. D R @r{angle modes: degrees, radians}
  1857. F S @r{fraction and symbolic modes}
  1858. N @r{interpret all fields as numbers, use 0 for non-numbers}
  1859. T @r{force text interpretation}
  1860. E @r{keep empty fields in ranges}
  1861. L @r{literal}
  1862. @end example
  1863. @noindent
  1864. Unless you use large integer numbers or high-precision-calculation
  1865. and -display for floating point numbers you may alternatively provide a
  1866. @code{printf} format specifier to reformat the Calc result after it has been
  1867. passed back to Org instead of letting Calc already do the
  1868. formatting@footnote{The @code{printf} reformatting is limited in precision
  1869. because the value passed to it is converted into an @code{integer} or
  1870. @code{double}. The @code{integer} is limited in size by truncating the
  1871. signed value to 32 bits. The @code{double} is limited in precision to 64
  1872. bits overall which leaves approximately 16 significant decimal digits.}.
  1873. A few examples:
  1874. @example
  1875. $1+$2 @r{Sum of first and second field}
  1876. $1+$2;%.2f @r{Same, format result to two decimals}
  1877. exp($2)+exp($1) @r{Math functions can be used}
  1878. $0;%.1f @r{Reformat current cell to 1 decimal}
  1879. ($3-32)*5/9 @r{Degrees F -> C conversion}
  1880. $c/$1/$cm @r{Hz -> cm conversion, using @file{constants.el}}
  1881. tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1}
  1882. sin($1);Dp3%.1e @r{Same, but use printf specifier for display}
  1883. vmean($2..$7) @r{Compute column range mean, using vector function}
  1884. vmean($2..$7);EN @r{Same, but treat empty fields as 0}
  1885. taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree}
  1886. @end example
  1887. Calc also contains a complete set of logical operations. For example
  1888. @example
  1889. if($1<20,teen,string("")) @r{``teen'' if age $1 less than 20, else empty}
  1890. @end example
  1891. @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
  1892. @subsection Emacs Lisp forms as formulas
  1893. @cindex Lisp forms, as table formulas
  1894. It is also possible to write a formula in Emacs Lisp; this can be useful
  1895. for string manipulation and control structures, if Calc's
  1896. functionality is not enough. If a formula starts with a single-quote
  1897. followed by an opening parenthesis, then it is evaluated as a Lisp form.
  1898. The evaluation should return either a string or a number. Just as with
  1899. @file{calc} formulas, you can specify modes and a printf format after a
  1900. semicolon. With Emacs Lisp forms, you need to be conscious about the way
  1901. field references are interpolated into the form. By default, a
  1902. reference will be interpolated as a Lisp string (in double-quotes)
  1903. containing the field. If you provide the @samp{N} mode switch, all
  1904. referenced elements will be numbers (non-number fields will be zero) and
  1905. interpolated as Lisp numbers, without quotes. If you provide the
  1906. @samp{L} flag, all fields will be interpolated literally, without quotes.
  1907. I.e., if you want a reference to be interpreted as a string by the Lisp
  1908. form, enclose the reference operator itself in double-quotes, like
  1909. @code{"$3"}. Ranges are inserted as space-separated fields, so you can
  1910. embed them in list or vector syntax. A few examples, note how the
  1911. @samp{N} mode is used when we do computations in Lisp.
  1912. @example
  1913. @r{Swap the first two characters of the content of column 1}
  1914. '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
  1915. @r{Add columns 1 and 2, equivalent to Calc's @code{$1+$2}}
  1916. '(+ $1 $2);N
  1917. @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
  1918. '(apply '+ '($1..$4));N
  1919. @end example
  1920. @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
  1921. @subsection Field formulas
  1922. @cindex field formula
  1923. @cindex formula, for individual table field
  1924. To assign a formula to a particular field, type it directly into the
  1925. field, preceded by @samp{:=}, for example @samp{:=$1+$2}. When you
  1926. press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
  1927. the field, the formula will be stored as the formula for this field,
  1928. evaluated, and the current field replaced with the result.
  1929. @cindex #+TBLFM
  1930. Formulas are stored in a special line starting with @samp{#+TBLFM:}
  1931. directly below the table. If you typed the equation in the 4th field of
  1932. the 3rd data line in the table, the formula will look like
  1933. @samp{@@3$4=$1+$2}. When inserting/deleting/swapping column and rows
  1934. with the appropriate commands, @i{absolute references} (but not relative
  1935. ones) in stored formulas are modified in order to still reference the
  1936. same field. Of course this is not true if you edit the table structure
  1937. with normal editing commands---then you must fix the equations yourself.
  1938. The left-hand side of a formula may also be a named field (@pxref{Advanced
  1939. features}), or a last-row reference like @samp{$LR3}.
  1940. Instead of typing an equation into the field, you may also use the
  1941. following command
  1942. @table @kbd
  1943. @kindex C-u C-c =
  1944. @item C-u C-c =
  1945. Install a new formula for the current field. The command prompts for a
  1946. formula with default taken from the @samp{#+TBLFM:} line, applies
  1947. it to the current field, and stores it.
  1948. @end table
  1949. @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
  1950. @subsection Column formulas
  1951. @cindex column formula
  1952. @cindex formula, for table column
  1953. Often in a table, the same formula should be used for all fields in a
  1954. particular column. Instead of having to copy the formula to all fields
  1955. in that column, Org allows you to assign a single formula to an entire
  1956. column. If the table contains horizontal separator hlines, everything
  1957. before the first such line is considered part of the table @emph{header}
  1958. and will not be modified by column formulas.
  1959. To assign a formula to a column, type it directly into any field in the
  1960. column, preceded by an equal sign, like @samp{=$1+$2}. When you press
  1961. @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the field,
  1962. the formula will be stored as the formula for the current column, evaluated
  1963. and the current field replaced with the result. If the field contains only
  1964. @samp{=}, the previously stored formula for this column is used. For each
  1965. column, Org will only remember the most recently used formula. In the
  1966. @samp{#+TBLFM:} line, column formulas will look like @samp{$4=$1+$2}. The left-hand
  1967. side of a column formula cannot currently be the name of column, it
  1968. must be the numeric column reference.
  1969. Instead of typing an equation into the field, you may also use the
  1970. following command:
  1971. @table @kbd
  1972. @kindex C-c =
  1973. @item C-c =
  1974. Install a new formula for the current column and replace current field with
  1975. the result of the formula. The command prompts for a formula, with default
  1976. taken from the @samp{#+TBLFM} line, applies it to the current field and
  1977. stores it. With a numeric prefix argument(e.g. @kbd{C-5 C-c =}) the command
  1978. will apply it to that many consecutive fields in the current column.
  1979. @end table
  1980. @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
  1981. @subsection Editing and debugging formulas
  1982. @cindex formula editing
  1983. @cindex editing, of table formulas
  1984. @vindex org-table-use-standard-references
  1985. You can edit individual formulas in the minibuffer or directly in the
  1986. field. Org can also prepare a special buffer with all active
  1987. formulas of a table. When offering a formula for editing, Org
  1988. converts references to the standard format (like @code{B3} or @code{D&})
  1989. if possible. If you prefer to only work with the internal format (like
  1990. @code{@@3$2} or @code{$4}), configure the variable
  1991. @code{org-table-use-standard-references}.
  1992. @table @kbd
  1993. @kindex C-c =
  1994. @kindex C-u C-c =
  1995. @item C-c =
  1996. @itemx C-u C-c =
  1997. Edit the formula associated with the current column/field in the
  1998. minibuffer. See @ref{Column formulas}, and @ref{Field formulas}.
  1999. @kindex C-u C-u C-c =
  2000. @item C-u C-u C-c =
  2001. Re-insert the active formula (either a
  2002. field formula, or a column formula) into the current field, so that you
  2003. can edit it directly in the field. The advantage over editing in the
  2004. minibuffer is that you can use the command @kbd{C-c ?}.
  2005. @kindex C-c ?
  2006. @item C-c ?
  2007. While editing a formula in a table field, highlight the field(s)
  2008. referenced by the reference at the cursor position in the formula.
  2009. @kindex C-c @}
  2010. @item C-c @}
  2011. Toggle the display of row and column numbers for a table, using
  2012. overlays. These are updated each time the table is aligned; you can
  2013. force it with @kbd{C-c C-c}.
  2014. @kindex C-c @{
  2015. @item C-c @{
  2016. Toggle the formula debugger on and off. See below.
  2017. @kindex C-c '
  2018. @item C-c '
  2019. Edit all formulas for the current table in a special buffer, where the
  2020. formulas will be displayed one per line. If the current field has an
  2021. active formula, the cursor in the formula editor will mark it.
  2022. While inside the special buffer, Org will automatically highlight
  2023. any field or range reference at the cursor position. You may edit,
  2024. remove and add formulas, and use the following commands:
  2025. @table @kbd
  2026. @kindex C-c C-c
  2027. @kindex C-x C-s
  2028. @item C-c C-c
  2029. @itemx C-x C-s
  2030. Exit the formula editor and store the modified formulas. With @kbd{C-u}
  2031. prefix, also apply the new formulas to the entire table.
  2032. @kindex C-c C-q
  2033. @item C-c C-q
  2034. Exit the formula editor without installing changes.
  2035. @kindex C-c C-r
  2036. @item C-c C-r
  2037. Toggle all references in the formula editor between standard (like
  2038. @code{B3}) and internal (like @code{@@3$2}).
  2039. @kindex @key{TAB}
  2040. @item @key{TAB}
  2041. Pretty-print or indent Lisp formula at point. When in a line containing
  2042. a Lisp formula, format the formula according to Emacs Lisp rules.
  2043. Another @key{TAB} collapses the formula back again. In the open
  2044. formula, @key{TAB} re-indents just like in Emacs Lisp mode.
  2045. @kindex M-@key{TAB}
  2046. @item M-@key{TAB}
  2047. Complete Lisp symbols, just like in Emacs Lisp mode.
  2048. @kindex S-@key{up}
  2049. @kindex S-@key{down}
  2050. @kindex S-@key{left}
  2051. @kindex S-@key{right}
  2052. @item S-@key{up}/@key{down}/@key{left}/@key{right}
  2053. Shift the reference at point. For example, if the reference is
  2054. @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
  2055. This also works for relative references and for hline references.
  2056. @kindex M-S-@key{up}
  2057. @kindex M-S-@key{down}
  2058. @item M-S-@key{up}/@key{down}
  2059. Move the test line for column formulas in the Org buffer up and
  2060. down.
  2061. @kindex M-@key{up}
  2062. @kindex M-@key{down}
  2063. @item M-@key{up}/@key{down}
  2064. Scroll the window displaying the table.
  2065. @kindex C-c @}
  2066. @item C-c @}
  2067. Turn the coordinate grid in the table on and off.
  2068. @end table
  2069. @end table
  2070. Making a table field blank does not remove the formula associated with
  2071. the field, because that is stored in a different line (the @samp{#+TBLFM}
  2072. line)---during the next recalculation the field will be filled again.
  2073. To remove a formula from a field, you have to give an empty reply when
  2074. prompted for the formula, or to edit the @samp{#+TBLFM} line.
  2075. @kindex C-c C-c
  2076. You may edit the @samp{#+TBLFM} directly and re-apply the changed
  2077. equations with @kbd{C-c C-c} in that line or with the normal
  2078. recalculation commands in the table.
  2079. @subsubheading Debugging formulas
  2080. @cindex formula debugging
  2081. @cindex debugging, of table formulas
  2082. When the evaluation of a formula leads to an error, the field content
  2083. becomes the string @samp{#ERROR}. If you would like see what is going
  2084. on during variable substitution and calculation in order to find a bug,
  2085. turn on formula debugging in the @code{Tbl} menu and repeat the
  2086. calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
  2087. field. Detailed information will be displayed.
  2088. @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
  2089. @subsection Updating the table
  2090. @cindex recomputing table fields
  2091. @cindex updating, table
  2092. Recalculation of a table is normally not automatic, but needs to be
  2093. triggered by a command. See @ref{Advanced features}, for a way to make
  2094. recalculation at least semi-automatic.
  2095. In order to recalculate a line of a table or the entire table, use the
  2096. following commands:
  2097. @table @kbd
  2098. @kindex C-c *
  2099. @item C-c *
  2100. Recalculate the current row by first applying the stored column formulas
  2101. from left to right, and all field formulas in the current row.
  2102. @c
  2103. @kindex C-u C-c *
  2104. @item C-u C-c *
  2105. @kindex C-u C-c C-c
  2106. @itemx C-u C-c C-c
  2107. Recompute the entire table, line by line. Any lines before the first
  2108. hline are left alone, assuming that these are part of the table header.
  2109. @c
  2110. @kindex C-u C-u C-c *
  2111. @kindex C-u C-u C-c C-c
  2112. @item C-u C-u C-c *
  2113. @itemx C-u C-u C-c C-c
  2114. Iterate the table by recomputing it until no further changes occur.
  2115. This may be necessary if some computed fields use the value of other
  2116. fields that are computed @i{later} in the calculation sequence.
  2117. @end table
  2118. @node Advanced features, , Updating the table, The spreadsheet
  2119. @subsection Advanced features
  2120. If you want the recalculation of fields to happen automatically, or if
  2121. you want to be able to assign @i{names} to fields and columns, you need
  2122. to reserve the first column of the table for special marking characters.
  2123. @table @kbd
  2124. @kindex C-#
  2125. @item C-#
  2126. Rotate the calculation mark in first column through the states @samp{ },
  2127. @samp{#}, @samp{*}, @samp{!}, @samp{$}. When there is an active region,
  2128. change all marks in the region.
  2129. @end table
  2130. Here is an example of a table that collects exam results of students and
  2131. makes use of these features:
  2132. @example
  2133. @group
  2134. |---+---------+--------+--------+--------+-------+------|
  2135. | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
  2136. |---+---------+--------+--------+--------+-------+------|
  2137. | ! | | P1 | P2 | P3 | Tot | |
  2138. | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
  2139. | ^ | | m1 | m2 | m3 | mt | |
  2140. |---+---------+--------+--------+--------+-------+------|
  2141. | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
  2142. | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
  2143. |---+---------+--------+--------+--------+-------+------|
  2144. | | Average | | | | 29.7 | |
  2145. | ^ | | | | | at | |
  2146. | $ | max=50 | | | | | |
  2147. |---+---------+--------+--------+--------+-------+------|
  2148. #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
  2149. @end group
  2150. @end example
  2151. @noindent @b{Important}: please note that for these special tables,
  2152. recalculating the table with @kbd{C-u C-c *} will only affect rows that
  2153. are marked @samp{#} or @samp{*}, and fields that have a formula assigned
  2154. to the field itself. The column formulas are not applied in rows with
  2155. empty first field.
  2156. @cindex marking characters, tables
  2157. The marking characters have the following meaning:
  2158. @table @samp
  2159. @item !
  2160. The fields in this line define names for the columns, so that you may
  2161. refer to a column as @samp{$Tot} instead of @samp{$6}.
  2162. @item ^
  2163. This row defines names for the fields @emph{above} the row. With such
  2164. a definition, any formula in the table may use @samp{$m1} to refer to
  2165. the value @samp{10}. Also, if you assign a formula to a names field, it
  2166. will be stored as @samp{$name=...}.
  2167. @item _
  2168. Similar to @samp{^}, but defines names for the fields in the row
  2169. @emph{below}.
  2170. @item $
  2171. Fields in this row can define @emph{parameters} for formulas. For
  2172. example, if a field in a @samp{$} row contains @samp{max=50}, then
  2173. formulas in this table can refer to the value 50 using @samp{$max}.
  2174. Parameters work exactly like constants, only that they can be defined on
  2175. a per-table basis.
  2176. @item #
  2177. Fields in this row are automatically recalculated when pressing
  2178. @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row. Also, this row
  2179. is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked
  2180. lines will be left alone by this command.
  2181. @item *
  2182. Selects this line for global recalculation with @kbd{C-u C-c *}, but
  2183. not for automatic recalculation. Use this when automatic
  2184. recalculation slows down editing too much.
  2185. @item
  2186. Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
  2187. All lines that should be recalculated should be marked with @samp{#}
  2188. or @samp{*}.
  2189. @item /
  2190. Do not export this line. Useful for lines that contain the narrowing
  2191. @samp{<N>} markers or column group markers.
  2192. @end table
  2193. Finally, just to whet your appetite for what can be done with the
  2194. fantastic @file{calc.el} package, here is a table that computes the Taylor
  2195. series of degree @code{n} at location @code{x} for a couple of
  2196. functions.
  2197. @example
  2198. @group
  2199. |---+-------------+---+-----+--------------------------------------|
  2200. | | Func | n | x | Result |
  2201. |---+-------------+---+-----+--------------------------------------|
  2202. | # | exp(x) | 1 | x | 1 + x |
  2203. | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
  2204. | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
  2205. | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
  2206. | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
  2207. | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
  2208. |---+-------------+---+-----+--------------------------------------|
  2209. #+TBLFM: $5=taylor($2,$4,$3);n3
  2210. @end group
  2211. @end example
  2212. @node Org-Plot, , The spreadsheet, Tables
  2213. @section Org-Plot
  2214. @cindex graph, in tables
  2215. @cindex plot tables using gnuplot
  2216. @cindex #+PLOT
  2217. Org-Plot can produce 2D and 3D graphs of information stored in org tables
  2218. using @file{Gnuplot} @uref{http://www.gnuplot.info/} and @file{gnuplot-mode}
  2219. @uref{http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html}. To see
  2220. this in action, ensure that you have both Gnuplot and Gnuplot mode installed
  2221. on your system, then call @code{org-plot/gnuplot} on the following table.
  2222. @example
  2223. @group
  2224. #+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
  2225. | Sede | Max cites | H-index |
  2226. |-----------+-----------+---------|
  2227. | Chile | 257.72 | 21.39 |
  2228. | Leeds | 165.77 | 19.68 |
  2229. | Sao Paolo | 71.00 | 11.50 |
  2230. | Stockholm | 134.19 | 14.33 |
  2231. | Morelia | 257.56 | 17.67 |
  2232. @end group
  2233. @end example
  2234. Notice that Org Plot is smart enough to apply the table's headers as labels.
  2235. Further control over the labels, type, content, and appearance of plots can
  2236. be exercised through the @code{#+PLOT:} lines preceding a table. See below
  2237. for a complete list of Org-plot options. For more information and examples
  2238. see the Org-plot tutorial at
  2239. @uref{http://orgmode.org/worg/org-tutorials/org-plot.php}.
  2240. @subsubheading Plot Options
  2241. @table @code
  2242. @item set
  2243. Specify any @command{gnuplot} option to be set when graphing.
  2244. @item title
  2245. Specify the title of the plot.
  2246. @item ind
  2247. Specify which column of the table to use as the @code{x} axis.
  2248. @item deps
  2249. Specify the columns to graph as a Lisp style list, surrounded by parentheses
  2250. and separated by spaces for example @code{dep:(3 4)} to graph the third and
  2251. fourth columns (defaults to graphing all other columns aside from the @code{ind}
  2252. column).
  2253. @item type
  2254. Specify whether the plot will be @code{2d}, @code{3d}, or @code{grid}.
  2255. @item with
  2256. Specify a @code{with} option to be inserted for every col being plotted
  2257. (e.g. @code{lines}, @code{points}, @code{boxes}, @code{impulses}, etc...).
  2258. Defaults to @code{lines}.
  2259. @item file
  2260. If you want to plot to a file, specify @code{"@var{path/to/desired/output-file}"}.
  2261. @item labels
  2262. List of labels to be used for the deps (defaults to the column headers if
  2263. they exist).
  2264. @item line
  2265. Specify an entire line to be inserted in the Gnuplot script.
  2266. @item map
  2267. When plotting @code{3d} or @code{grid} types, set this to @code{t} to graph a
  2268. flat mapping rather than a @code{3d} slope.
  2269. @item timefmt
  2270. Specify format of Org-mode timestamps as they will be parsed by Gnuplot.
  2271. Defaults to @samp{%Y-%m-%d-%H:%M:%S}.
  2272. @item script
  2273. If you want total control, you can specify a script file (place the file name
  2274. between double-quotes) which will be used to plot. Before plotting, every
  2275. instance of @code{$datafile} in the specified script will be replaced with
  2276. the path to the generated data file. Note: even if you set this option, you
  2277. may still want to specify the plot type, as that can impact the content of
  2278. the data file.
  2279. @end table
  2280. @node Hyperlinks, TODO Items, Tables, Top
  2281. @chapter Hyperlinks
  2282. @cindex hyperlinks
  2283. Like HTML, Org provides links inside a file, external links to
  2284. other files, Usenet articles, emails, and much more.
  2285. @menu
  2286. * Link format:: How links in Org are formatted
  2287. * Internal links:: Links to other places in the current file
  2288. * External links:: URL-like links to the world
  2289. * Handling links:: Creating, inserting and following
  2290. * Using links outside Org:: Linking from my C source code?
  2291. * Link abbreviations:: Shortcuts for writing complex links
  2292. * Search options:: Linking to a specific location
  2293. * Custom searches:: When the default search is not enough
  2294. @end menu
  2295. @node Link format, Internal links, Hyperlinks, Hyperlinks
  2296. @section Link format
  2297. @cindex link format
  2298. @cindex format, of links
  2299. Org will recognize plain URL-like links and activate them as
  2300. clickable links. The general link format, however, looks like this:
  2301. @example
  2302. [[link][description]] @r{or alternatively} [[link]]
  2303. @end example
  2304. @noindent
  2305. Once a link in the buffer is complete (all brackets present), Org
  2306. will change the display so that @samp{description} is displayed instead
  2307. of @samp{[[link][description]]} and @samp{link} is displayed instead of
  2308. @samp{[[link]]}. Links will be highlighted in the face @code{org-link},
  2309. which by default is an underlined face. You can directly edit the
  2310. visible part of a link. Note that this can be either the @samp{link}
  2311. part (if there is no description) or the @samp{description} part. To
  2312. edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
  2313. cursor on the link.
  2314. If you place the cursor at the beginning or just behind the end of the
  2315. displayed text and press @key{BACKSPACE}, you will remove the
  2316. (invisible) bracket at that location. This makes the link incomplete
  2317. and the internals are again displayed as plain text. Inserting the
  2318. missing bracket hides the link internals again. To show the
  2319. internal structure of all links, use the menu entry
  2320. @code{Org->Hyperlinks->Literal links}.
  2321. @node Internal links, External links, Link format, Hyperlinks
  2322. @section Internal links
  2323. @cindex internal links
  2324. @cindex links, internal
  2325. @cindex targets, for links
  2326. @cindex property, CUSTOM_ID
  2327. If the link does not look like a URL, it is considered to be internal in the
  2328. current file. The most important case is a link like
  2329. @samp{[[#my-custom-id]]} which will link to the entry with the
  2330. @code{CUSTOM_ID} property @samp{my-custom-id}. Such custom IDs are very good
  2331. for HTML export (@pxref{HTML export}) where they produce pretty section
  2332. links. You are responsible yourself to make sure these custom IDs are unique
  2333. in a file.
  2334. Links such as @samp{[[My Target]]} or @samp{[[My Target][Find my target]]}
  2335. lead to a text search in the current file.
  2336. The link can be followed with @kbd{C-c C-o} when the cursor is on the link,
  2337. or with a mouse click (@pxref{Handling links}). Links to custom IDs will
  2338. point to the corresponding headline. The preferred match for a text link is
  2339. a @i{dedicated target}: the same string in double angular brackets. Targets
  2340. may be located anywhere; sometimes it is convenient to put them into a
  2341. comment line. For example
  2342. @example
  2343. # <<My Target>>
  2344. @end example
  2345. @noindent In HTML export (@pxref{HTML export}), such targets will become
  2346. named anchors for direct access through @samp{http} links@footnote{Note that
  2347. text before the first headline is usually not exported, so the first such
  2348. target should be after the first headline, or in the line directly before the
  2349. first headline.}.
  2350. If no dedicated target exists, Org will search for the words in the link. In
  2351. the above example the search would be for @samp{my target}. Links starting
  2352. with a star like @samp{*My Target} restrict the search to
  2353. headlines@footnote{To insert a link targeting a headline, in-buffer
  2354. completion can be used. Just type a star followed by a few optional letters
  2355. into the buffer and press @kbd{M-@key{TAB}}. All headlines in the current
  2356. buffer will be offered as completions. @xref{Handling links}, for more
  2357. commands creating links.}. When searching, Org mode will first try an
  2358. exact match, but then move on to more and more lenient searches. For
  2359. example, the link @samp{[[*My Targets]]} will find any of the following:
  2360. @example
  2361. ** My targets
  2362. ** TODO my targets are bright
  2363. ** my 20 targets are
  2364. @end example
  2365. Following a link pushes a mark onto Org's own mark ring. You can
  2366. return to the previous position with @kbd{C-c &}. Using this command
  2367. several times in direct succession goes back to positions recorded
  2368. earlier.
  2369. @menu
  2370. * Radio targets:: Make targets trigger links in plain text
  2371. @end menu
  2372. @node Radio targets, , Internal links, Internal links
  2373. @subsection Radio targets
  2374. @cindex radio targets
  2375. @cindex targets, radio
  2376. @cindex links, radio targets
  2377. Org can automatically turn any occurrences of certain target names
  2378. in normal text into a link. So without explicitly creating a link, the
  2379. text connects to the target radioing its position. Radio targets are
  2380. enclosed by triple angular brackets. For example, a target @samp{<<<My
  2381. Target>>>} causes each occurrence of @samp{my target} in normal text to
  2382. become activated as a link. The Org file is scanned automatically
  2383. for radio targets only when the file is first loaded into Emacs. To
  2384. update the target list during editing, press @kbd{C-c C-c} with the
  2385. cursor on or at a target.
  2386. @node External links, Handling links, Internal links, Hyperlinks
  2387. @section External links
  2388. @cindex links, external
  2389. @cindex external links
  2390. @cindex links, external
  2391. @cindex Gnus links
  2392. @cindex BBDB links
  2393. @cindex IRC links
  2394. @cindex URL links
  2395. @cindex file links
  2396. @cindex VM links
  2397. @cindex RMAIL links
  2398. @cindex WANDERLUST links
  2399. @cindex MH-E links
  2400. @cindex USENET links
  2401. @cindex SHELL links
  2402. @cindex Info links
  2403. @cindex Elisp links
  2404. Org supports links to files, websites, Usenet and email messages,
  2405. BBDB database entries and links to both IRC conversations and their
  2406. logs. External links are URL-like locators. They start with a short
  2407. identifying string followed by a colon. There can be no space after
  2408. the colon. The following list shows examples for each link type.
  2409. @example
  2410. http://www.astro.uva.nl/~dominik @r{on the web}
  2411. file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
  2412. /home/dominik/images/jupiter.jpg @r{same as above}
  2413. file:papers/last.pdf @r{file, relative path}
  2414. ./papers/last.pdf @r{same as above}
  2415. file:/myself@@some.where:papers/last.pdf @r{file, path on remote machine}
  2416. /myself@@some.where:papers/last.pdf @r{same as above}
  2417. file:sometextfile::NNN @r{file with line number to jump to}
  2418. file:projects.org @r{another Org file}
  2419. file:projects.org::some words @r{text search in Org file}
  2420. file:projects.org::*task title @r{heading search in Org file}
  2421. docview:papers/last.pdf::NNN @r{open file in doc-view mode at page NNN}
  2422. id:B7423F4D-2E8A-471B-8810-C40F074717E9 @r{Link to heading by ID}
  2423. news:comp.emacs @r{Usenet link}
  2424. mailto:adent@@galaxy.net @r{Mail link}
  2425. vm:folder @r{VM folder link}
  2426. vm:folder#id @r{VM message link}
  2427. vm://myself@@some.where.org/folder#id @r{VM on remote machine}
  2428. wl:folder @r{WANDERLUST folder link}
  2429. wl:folder#id @r{WANDERLUST message link}
  2430. mhe:folder @r{MH-E folder link}
  2431. mhe:folder#id @r{MH-E message link}
  2432. rmail:folder @r{RMAIL folder link}
  2433. rmail:folder#id @r{RMAIL message link}
  2434. gnus:group @r{Gnus group link}
  2435. gnus:group#id @r{Gnus article link}
  2436. bbdb:R.*Stallman @r{BBDB link (with regexp)}
  2437. irc:/irc.com/#emacs/bob @r{IRC link}
  2438. shell:ls *.org @r{A shell command}
  2439. elisp:org-agenda @r{Interactive Elisp command}
  2440. elisp:(find-file-other-frame "Elisp.org") @r{Elisp form to evaluate}
  2441. @end example
  2442. A link should be enclosed in double brackets and may contain a
  2443. descriptive text to be displayed instead of the URL (@pxref{Link
  2444. format}), for example:
  2445. @example
  2446. [[http://www.gnu.org/software/emacs/][GNU Emacs]]
  2447. @end example
  2448. @noindent
  2449. If the description is a file name or URL that points to an image, HTML
  2450. export (@pxref{HTML export}) will inline the image as a clickable
  2451. button. If there is no description at all and the link points to an
  2452. image,
  2453. that image will be inlined into the exported HTML file.
  2454. @cindex square brackets, around links
  2455. @cindex plain text external links
  2456. Org also finds external links in the normal text and activates them
  2457. as links. If spaces must be part of the link (for example in
  2458. @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
  2459. about the end of the link, enclose them in square brackets.
  2460. @node Handling links, Using links outside Org, External links, Hyperlinks
  2461. @section Handling links
  2462. @cindex links, handling
  2463. Org provides methods to create a link in the correct syntax, to
  2464. insert it into an Org file, and to follow the link.
  2465. @table @kbd
  2466. @kindex C-c l
  2467. @cindex storing links
  2468. @item C-c l
  2469. Store a link to the current location. This is a @emph{global} command (you
  2470. must create the key binding yourself) which can be used in any buffer to
  2471. create a link. The link will be stored for later insertion into an Org
  2472. buffer (see below). What kind of link will be created depends on the current
  2473. buffer:
  2474. @b{Org-mode buffers}@*
  2475. For Org files, if there is a @samp{<<target>>} at the cursor, the link points
  2476. to the target. Otherwise it points to the current headline, which will also
  2477. be the description.
  2478. @vindex org-link-to-org-use-id
  2479. @cindex property, CUSTOM_ID
  2480. @cindex property, ID
  2481. If the headline has a @code{CUSTOM_ID} property, a link to this custom ID
  2482. will be stored. In addition or alternatively (depending on the value of
  2483. @code{org-link-to-org-use-id}), a globally unique @code{ID} property will be
  2484. created and/or used to construct a link. So using this command in Org
  2485. buffers will potentially create two links: a human-readable from the custom
  2486. ID, and one that is globally unique and works even if the entry is moved from
  2487. file to file. Later, when inserting the link, you need to decide which one
  2488. to use.
  2489. @b{Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus}@*
  2490. Pretty much all Emacs mail clients are supported. The link will point to the
  2491. current article, or, in some GNUS buffers, to the group. The description is
  2492. constructed from the author and the subject.
  2493. @b{Web browsers: W3 and W3M}@*
  2494. Here the link will be the current URL, with the page title as description.
  2495. @b{Contacts: BBDB}@*
  2496. Links created in a BBDB buffer will point to the current entry.
  2497. @b{Chat: IRC}@*
  2498. @vindex org-irc-link-to-logs
  2499. For IRC links, if you set the variable @code{org-irc-link-to-logs} to
  2500. @code{t}, a @samp{file:/} style link to the relevant point in the logs for
  2501. the current conversation is created. Otherwise an @samp{irc:/} style link to
  2502. the user/channel/server under the point will be stored.
  2503. @b{Other files}@*
  2504. For any other files, the link will point to the file, with a search string
  2505. (@pxref{Search options}) pointing to the contents of the current line. If
  2506. there is an active region, the selected words will form the basis of the
  2507. search string. If the automatically created link is not working correctly or
  2508. accurately enough, you can write custom functions to select the search string
  2509. and to do the search for particular file types---see @ref{Custom searches}.
  2510. The key binding @kbd{C-c l} is only a suggestion---see @ref{Installation}.
  2511. @b{Agenda view}@*
  2512. When the cursor is in an agenda view, the created link points to the
  2513. entry referenced by the current line.
  2514. @c
  2515. @kindex C-c C-l
  2516. @cindex link completion
  2517. @cindex completion, of links
  2518. @cindex inserting links
  2519. @item C-c C-l
  2520. @vindex org-keep-stored-link-after-insertion
  2521. Insert a link@footnote{ Note that you don't have to use this command to
  2522. insert a link. Links in Org are plain text, and you can type or paste them
  2523. straight into the buffer. By using this command, the links are automatically
  2524. enclosed in double brackets, and you will be asked for the optional
  2525. descriptive text.}. This prompts for a link to be inserted into the buffer.
  2526. You can just type a link, using text for an internal link, or one of the link
  2527. type prefixes mentioned in the examples above. The link will be inserted
  2528. into the buffer@footnote{After insertion of a stored link, the link will be
  2529. removed from the list of stored links. To keep it in the list later use, use
  2530. a triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or configure the option
  2531. @code{org-keep-stored-link-after-insertion}.}, along with a descriptive text.
  2532. If some text was selected when this command is called, the selected text
  2533. becomes the default description.
  2534. @b{Inserting stored links}@*
  2535. All links stored during the
  2536. current session are part of the history for this prompt, so you can access
  2537. them with @key{up} and @key{down} (or @kbd{M-p/n}).
  2538. @b{Completion support}@* Completion with @key{TAB} will help you to insert
  2539. valid link prefixes like @samp{http:} or @samp{ftp:}, including the prefixes
  2540. defined through link abbreviations (@pxref{Link abbreviations}). If you
  2541. press @key{RET} after inserting only the @var{prefix}, Org will offer
  2542. specific completion support for some link types@footnote{This works by
  2543. calling a special function @code{org-PREFIX-complete-link}.} For
  2544. example, if you type @kbd{file @key{RET}}, file name completion (alternative
  2545. access: @kbd{C-u C-c C-l}, see below) will be offered, and after @kbd{bbdb
  2546. @key{RET}} you can complete contact names.
  2547. @kindex C-u C-c C-l
  2548. @cindex file name completion
  2549. @cindex completion, of file names
  2550. @item C-u C-c C-l
  2551. When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
  2552. a file will be inserted and you may use file name completion to select
  2553. the name of the file. The path to the file is inserted relative to the
  2554. directory of the current Org file, if the linked file is in the current
  2555. directory or in a sub-directory of it, or if the path is written relative
  2556. to the current directory using @samp{../}. Otherwise an absolute path
  2557. is used, if possible with @samp{~/} for your home directory. You can
  2558. force an absolute path with two @kbd{C-u} prefixes.
  2559. @c
  2560. @item C-c C-l @r{(with cursor on existing link)}
  2561. When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
  2562. link and description parts of the link.
  2563. @c
  2564. @cindex following links
  2565. @kindex C-c C-o
  2566. @kindex RET
  2567. @item C-c C-o @r{or} @key{RET}
  2568. @vindex org-file-apps
  2569. Open link at point. This will launch a web browser for URLs (using
  2570. @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for
  2571. the corresponding links, and execute the command in a shell link. When the
  2572. cursor is on an internal link, this commands runs the corresponding search.
  2573. When the cursor is on a TAG list in a headline, it creates the corresponding
  2574. TAGS view. If the cursor is on a timestamp, it compiles the agenda for that
  2575. date. Furthermore, it will visit text and remote files in @samp{file:} links
  2576. with Emacs and select a suitable application for local non-text files.
  2577. Classification of files is based on file extension only. See option
  2578. @code{org-file-apps}. If you want to override the default application and
  2579. visit the file with Emacs, use a @kbd{C-u} prefix. If you want to avoid
  2580. opening in Emacs, use a @kbd{C-u C-u} prefix.@*
  2581. If the cursor is on a headline, but not on a link, offer all links in the
  2582. headline and entry text.
  2583. @c
  2584. @kindex mouse-2
  2585. @kindex mouse-1
  2586. @item mouse-2
  2587. @itemx mouse-1
  2588. On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
  2589. would. Under Emacs 22, @kbd{mouse-1} will also follow a link.
  2590. @c
  2591. @kindex mouse-3
  2592. @item mouse-3
  2593. @vindex org-display-internal-link-with-indirect-buffer
  2594. Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
  2595. internal links to be displayed in another window@footnote{See the
  2596. variable @code{org-display-internal-link-with-indirect-buffer}}.
  2597. @c
  2598. @cindex mark ring
  2599. @kindex C-c %
  2600. @item C-c %
  2601. Push the current position onto the mark ring, to be able to return
  2602. easily. Commands following an internal link do this automatically.
  2603. @c
  2604. @cindex links, returning to
  2605. @kindex C-c &
  2606. @item C-c &
  2607. Jump back to a recorded position. A position is recorded by the
  2608. commands following internal links, and by @kbd{C-c %}. Using this
  2609. command several times in direct succession moves through a ring of
  2610. previously recorded positions.
  2611. @c
  2612. @kindex C-c C-x C-n
  2613. @kindex C-c C-x C-p
  2614. @cindex links, finding next/previous
  2615. @item C-c C-x C-n
  2616. @itemx C-c C-x C-p
  2617. Move forward/backward to the next link in the buffer. At the limit of
  2618. the buffer, the search fails once, and then wraps around. The key
  2619. bindings for this are really too long, you might want to bind this also
  2620. to @kbd{C-n} and @kbd{C-p}
  2621. @lisp
  2622. (add-hook 'org-load-hook
  2623. (lambda ()
  2624. (define-key 'org-mode-map "\C-n" 'org-next-link)
  2625. (define-key 'org-mode-map "\C-p" 'org-previous-link)))
  2626. @end lisp
  2627. @end table
  2628. @node Using links outside Org, Link abbreviations, Handling links, Hyperlinks
  2629. @section Using links outside Org
  2630. You can insert and follow links that have Org syntax not only in
  2631. Org, but in any Emacs buffer. For this, you should create two
  2632. global commands, like this (please select suitable global keys
  2633. yourself):
  2634. @lisp
  2635. (global-set-key "\C-c L" 'org-insert-link-global)
  2636. (global-set-key "\C-c o" 'org-open-at-point-global)
  2637. @end lisp
  2638. @node Link abbreviations, Search options, Using links outside Org, Hyperlinks
  2639. @section Link abbreviations
  2640. @cindex link abbreviations
  2641. @cindex abbreviation, links
  2642. Long URLs can be cumbersome to type, and often many similar links are
  2643. needed in a document. For this you can use link abbreviations. An
  2644. abbreviated link looks like this
  2645. @example
  2646. [[linkword:tag][description]]
  2647. @end example
  2648. @noindent
  2649. @vindex org-link-abbrev-alist
  2650. where the tag is optional. The @i{linkword} must be a word; letter, numbers,
  2651. @samp{-}, and @samp{_} are allowed here. Abbreviations are resolved
  2652. according to the information in the variable @code{org-link-abbrev-alist}
  2653. that relates the linkwords to replacement text. Here is an example:
  2654. @lisp
  2655. @group
  2656. (setq org-link-abbrev-alist
  2657. '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
  2658. ("google" . "http://www.google.com/search?q=")
  2659. ("ads" . "http://adsabs.harvard.edu/cgi-bin/
  2660. nph-abs_connect?author=%s&db_key=AST")))
  2661. @end group
  2662. @end lisp
  2663. If the replacement text contains the string @samp{%s}, it will be
  2664. replaced with the tag. Otherwise the tag will be appended to the string
  2665. in order to create the link. You may also specify a function that will
  2666. be called with the tag as the only argument to create the link.
  2667. With the above setting, you could link to a specific bug with
  2668. @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
  2669. @code{[[google:OrgMode]]} and find out what the Org author is
  2670. doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
  2671. If you need special abbreviations just for a single Org buffer, you
  2672. can define them in the file with
  2673. @cindex #+LINK
  2674. @example
  2675. #+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
  2676. #+LINK: google http://www.google.com/search?q=%s
  2677. @end example
  2678. @noindent
  2679. In-buffer completion (@pxref{Completion}) can be used after @samp{[} to
  2680. complete link abbreviations. You may also define a function
  2681. @code{org-PREFIX-complete-link} that implements special (e.g. completion)
  2682. support for inserting such a link with @kbd{C-c C-l}. Such a function should
  2683. not accept any arguments, and return the full link with prefix.
  2684. @node Search options, Custom searches, Link abbreviations, Hyperlinks
  2685. @section Search options in file links
  2686. @cindex search option in file links
  2687. @cindex file links, searching
  2688. File links can contain additional information to make Emacs jump to a
  2689. particular location in the file when following a link. This can be a
  2690. line number or a search option after a double@footnote{For backward
  2691. compatibility, line numbers can also follow a single colon.} colon. For
  2692. example, when the command @kbd{C-c l} creates a link (@pxref{Handling
  2693. links}) to a file, it encodes the words in the current line as a search
  2694. string that can be used to find this line back later when following the
  2695. link with @kbd{C-c C-o}.
  2696. Here is the syntax of the different ways to attach a search to a file
  2697. link, together with an explanation:
  2698. @example
  2699. [[file:~/code/main.c::255]]
  2700. [[file:~/xx.org::My Target]]
  2701. [[file:~/xx.org::*My Target]]
  2702. [[file:~/xx.org::/regexp/]]
  2703. @end example
  2704. @table @code
  2705. @item 255
  2706. Jump to line 255.
  2707. @item My Target
  2708. Search for a link target @samp{<<My Target>>}, or do a text search for
  2709. @samp{my target}, similar to the search in internal links, see
  2710. @ref{Internal links}. In HTML export (@pxref{HTML export}), such a file
  2711. link will become an HTML reference to the corresponding named anchor in
  2712. the linked file.
  2713. @item *My Target
  2714. In an Org file, restrict search to headlines.
  2715. @item /regexp/
  2716. Do a regular expression search for @code{regexp}. This uses the Emacs
  2717. command @code{occur} to list all matches in a separate window. If the
  2718. target file is in Org mode, @code{org-occur} is used to create a
  2719. sparse tree with the matches.
  2720. @c If the target file is a directory,
  2721. @c @code{grep} will be used to search all files in the directory.
  2722. @end table
  2723. As a degenerate case, a file link with an empty file name can be used
  2724. to search the current file. For example, @code{[[file:::find me]]} does
  2725. a search for @samp{find me} in the current file, just as
  2726. @samp{[[find me]]} would.
  2727. @node Custom searches, , Search options, Hyperlinks
  2728. @section Custom Searches
  2729. @cindex custom search strings
  2730. @cindex search strings, custom
  2731. The default mechanism for creating search strings and for doing the
  2732. actual search related to a file link may not work correctly in all
  2733. cases. For example, Bib@TeX{} database files have many entries like
  2734. @samp{year="1993"} which would not result in good search strings,
  2735. because the only unique identification for a Bib@TeX{} entry is the
  2736. citation key.
  2737. @vindex org-create-file-search-functions
  2738. @vindex org-execute-file-search-functions
  2739. If you come across such a problem, you can write custom functions to set
  2740. the right search string for a particular file type, and to do the search
  2741. for the string in the file. Using @code{add-hook}, these functions need
  2742. to be added to the hook variables
  2743. @code{org-create-file-search-functions} and
  2744. @code{org-execute-file-search-functions}. See the docstring for these
  2745. variables for more information. Org actually uses this mechanism
  2746. for Bib@TeX{} database files, and you can use the corresponding code as
  2747. an implementation example. See the file @file{org-bibtex.el}.
  2748. @node TODO Items, Tags, Hyperlinks, Top
  2749. @chapter TODO Items
  2750. @cindex TODO items
  2751. Org mode does not maintain TODO lists as separate documents@footnote{Of
  2752. course, you can make a document that contains only long lists of TODO items,
  2753. but this is not required.}. Instead, TODO items are an integral part of the
  2754. notes file, because TODO items usually come up while taking notes! With Org
  2755. mode, simply mark any entry in a tree as being a TODO item. In this way,
  2756. information is not duplicated, and the entire context from which the TODO
  2757. item emerged is always present.
  2758. Of course, this technique for managing TODO items scatters them
  2759. throughout your notes file. Org mode compensates for this by providing
  2760. methods to give you an overview of all the things that you have to do.
  2761. @menu
  2762. * TODO basics:: Marking and displaying TODO entries
  2763. * TODO extensions:: Workflow and assignments
  2764. * Progress logging:: Dates and notes for progress
  2765. * Priorities:: Some things are more important than others
  2766. * Breaking down tasks:: Splitting a task into manageable pieces
  2767. * Checkboxes:: Tick-off lists
  2768. @end menu
  2769. @node TODO basics, TODO extensions, TODO Items, TODO Items
  2770. @section Basic TODO functionality
  2771. Any headline becomes a TODO item when it starts with the word
  2772. @samp{TODO}, for example:
  2773. @example
  2774. *** TODO Write letter to Sam Fortune
  2775. @end example
  2776. @noindent
  2777. The most important commands to work with TODO entries are:
  2778. @table @kbd
  2779. @kindex C-c C-t
  2780. @cindex cycling, of TODO states
  2781. @item C-c C-t
  2782. Rotate the TODO state of the current item among
  2783. @example
  2784. ,-> (unmarked) -> TODO -> DONE --.
  2785. '--------------------------------'
  2786. @end example
  2787. The same rotation can also be done ``remotely'' from the timeline and
  2788. agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
  2789. @kindex C-u C-c C-t
  2790. @item C-u C-c C-t
  2791. Select a specific keyword using completion or (if it has been set up)
  2792. the fast selection interface. For the latter, you need to assign keys
  2793. to TODO states, see @ref{Per-file keywords}, and @ref{Setting tags}, for
  2794. more information.
  2795. @kindex S-@key{right}
  2796. @kindex S-@key{left}
  2797. @vindex org-treat-S-cursor-todo-selection-as-state-change
  2798. @item S-@key{right}
  2799. @itemx S-@key{left}
  2800. Select the following/preceding TODO state, similar to cycling. Useful
  2801. mostly if more than two TODO states are possible (@pxref{TODO
  2802. extensions}). See also @ref{Conflicts}, for a discussion of the interaction
  2803. with @code{shift-selection-mode}. See also the variable
  2804. @code{org-treat-S-cursor-todo-selection-as-state-change}.
  2805. @kindex C-c C-v
  2806. @kindex C-c / t
  2807. @cindex sparse tree, for TODO
  2808. @item C-c C-v
  2809. @itemx C-c / t
  2810. @vindex org-todo-keywords
  2811. View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds the
  2812. entire buffer, but shows all TODO items and the headings hierarchy above
  2813. them. With a prefix argument, search for a specific TODO. You will be
  2814. prompted for the keyword, and you can also give a list of keywords like
  2815. @code{KWD1|KWD2|...} to list entries that match any one of these keywords.
  2816. With numeric prefix argument N, show the tree for the Nth keyword in the
  2817. variable @code{org-todo-keywords}. With two prefix arguments, find all TODO
  2818. and DONE entries.
  2819. @kindex C-c a t
  2820. @item C-c a t
  2821. Show the global TODO list. Collects the TODO items from all agenda
  2822. files (@pxref{Agenda Views}) into a single buffer. The new buffer will
  2823. be in @code{agenda-mode}, which provides commands to examine and
  2824. manipulate the TODO entries from the new buffer (@pxref{Agenda
  2825. commands}). @xref{Global TODO list}, for more information.
  2826. @kindex S-M-@key{RET}
  2827. @item S-M-@key{RET}
  2828. Insert a new TODO entry below the current one.
  2829. @end table
  2830. @noindent
  2831. @vindex org-todo-state-tags-triggers
  2832. Changing a TODO state can also trigger tag changes. See the docstring of the
  2833. option @code{org-todo-state-tags-triggers} for details.
  2834. @node TODO extensions, Progress logging, TODO basics, TODO Items
  2835. @section Extended use of TODO keywords
  2836. @cindex extended TODO keywords
  2837. @vindex org-todo-keywords
  2838. By default, marked TODO entries have one of only two states: TODO and
  2839. DONE. Org mode allows you to classify TODO items in more complex ways
  2840. with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With
  2841. special setup, the TODO keyword system can work differently in different
  2842. files.
  2843. Note that @i{tags} are another way to classify headlines in general and
  2844. TODO items in particular (@pxref{Tags}).
  2845. @menu
  2846. * Workflow states:: From TODO to DONE in steps
  2847. * TODO types:: I do this, Fred does the rest
  2848. * Multiple sets in one file:: Mixing it all, and still finding your way
  2849. * Fast access to TODO states:: Single letter selection of a state
  2850. * Per-file keywords:: Different files, different requirements
  2851. * Faces for TODO keywords:: Highlighting states
  2852. * TODO dependencies:: When one task needs to wait for others
  2853. @end menu
  2854. @node Workflow states, TODO types, TODO extensions, TODO extensions
  2855. @subsection TODO keywords as workflow states
  2856. @cindex TODO workflow
  2857. @cindex workflow states as TODO keywords
  2858. You can use TODO keywords to indicate different @emph{sequential} states
  2859. in the process of working on an item, for example@footnote{Changing
  2860. this variable only becomes effective after restarting Org mode in a
  2861. buffer.}:
  2862. @lisp
  2863. (setq org-todo-keywords
  2864. '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
  2865. @end lisp
  2866. The vertical bar separates the TODO keywords (states that @emph{need
  2867. action}) from the DONE states (which need @emph{no further action}). If
  2868. you don't provide the separator bar, the last state is used as the DONE
  2869. state.
  2870. @cindex completion, of TODO keywords
  2871. With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
  2872. to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. You may
  2873. also use a numeric prefix argument to quickly select a specific state. For
  2874. example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
  2875. Or you can use @kbd{S-@key{left}} to go backward through the sequence. If you
  2876. define many keywords, you can use in-buffer completion
  2877. (@pxref{Completion}) or even a special one-key selection scheme
  2878. (@pxref{Fast access to TODO states}) to insert these words into the
  2879. buffer. Changing a TODO state can be logged with a timestamp, see
  2880. @ref{Tracking TODO state changes}, for more information.
  2881. @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
  2882. @subsection TODO keywords as types
  2883. @cindex TODO types
  2884. @cindex names as TODO keywords
  2885. @cindex types as TODO keywords
  2886. The second possibility is to use TODO keywords to indicate different
  2887. @emph{types} of action items. For example, you might want to indicate
  2888. that items are for ``work'' or ``home''. Or, when you work with several
  2889. people on a single project, you might want to assign action items
  2890. directly to persons, by using their names as TODO keywords. This would
  2891. be set up like this:
  2892. @lisp
  2893. (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
  2894. @end lisp
  2895. In this case, different keywords do not indicate a sequence, but rather
  2896. different types. So the normal work flow would be to assign a task to a
  2897. person, and later to mark it DONE. Org mode supports this style by adapting
  2898. the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
  2899. @kbd{t} command in the timeline and agenda buffers.}. When used several
  2900. times in succession, it will still cycle through all names, in order to first
  2901. select the right type for a task. But when you return to the item after some
  2902. time and execute @kbd{C-c C-t} again, it will switch from any name directly
  2903. to DONE. Use prefix arguments or completion to quickly select a specific
  2904. name. You can also review the items of a specific TODO type in a sparse tree
  2905. by using a numeric prefix to @kbd{C-c C-v}. For example, to see all things
  2906. Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect Lucy's items
  2907. from all agenda files into a single buffer, you would use the numeric prefix
  2908. argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
  2909. @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
  2910. @subsection Multiple keyword sets in one file
  2911. @cindex TODO keyword sets
  2912. Sometimes you may want to use different sets of TODO keywords in
  2913. parallel. For example, you may want to have the basic
  2914. @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
  2915. separate state indicating that an item has been canceled (so it is not
  2916. DONE, but also does not require action). Your setup would then look
  2917. like this:
  2918. @lisp
  2919. (setq org-todo-keywords
  2920. '((sequence "TODO" "|" "DONE")
  2921. (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
  2922. (sequence "|" "CANCELED")))
  2923. @end lisp
  2924. The keywords should all be different, this helps Org mode to keep track
  2925. of which subsequence should be used for a given entry. In this setup,
  2926. @kbd{C-c C-t} only operates within a subsequence, so it switches from
  2927. @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
  2928. (nothing) to @code{REPORT}. Therefore you need a mechanism to initially
  2929. select the correct sequence. Besides the obvious ways like typing a
  2930. keyword or using completion, you may also apply the following commands:
  2931. @table @kbd
  2932. @kindex C-S-@key{right}
  2933. @kindex C-S-@key{left}
  2934. @kindex C-u C-u C-c C-t
  2935. @item C-u C-u C-c C-t
  2936. @itemx C-S-@key{right}
  2937. @itemx C-S-@key{left}
  2938. These keys jump from one TODO subset to the next. In the above example,
  2939. @kbd{C-u C-u C-c C-t} or @kbd{C-S-@key{right}} would jump from @code{TODO} or
  2940. @code{DONE} to @code{REPORT}, and any of the words in the second row to
  2941. @code{CANCELED}. Note that the @kbd{C-S-} key binding conflict with
  2942. @code{shift-selection-mode} (@pxref{Conflicts}).
  2943. @kindex S-@key{right}
  2944. @kindex S-@key{left}
  2945. @item S-@key{right}
  2946. @itemx S-@key{left}
  2947. @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through @emph{all}
  2948. keywords from all sets, so for example @kbd{S-@key{<right>}} would switch
  2949. from @code{DONE} to @code{REPORT} in the example above. See also
  2950. @ref{Conflicts}, for a discussion of the interaction with
  2951. @code{shift-selection-mode}.
  2952. @end table
  2953. @node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
  2954. @subsection Fast access to TODO states
  2955. If you would like to quickly change an entry to an arbitrary TODO state
  2956. instead of cycling through the states, you can set up keys for
  2957. single-letter access to the states. This is done by adding the section
  2958. key after each keyword, in parentheses. For example:
  2959. @lisp
  2960. (setq org-todo-keywords
  2961. '((sequence "TODO(t)" "|" "DONE(d)")
  2962. (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
  2963. (sequence "|" "CANCELED(c)")))
  2964. @end lisp
  2965. @vindex org-fast-tag-selection-include-todo
  2966. If you then press @code{C-c C-t} followed by the selection key, the entry
  2967. will be switched to this state. @key{SPC} can be used to remove any TODO
  2968. keyword from an entry.@footnote{Check also the variable
  2969. @code{org-fast-tag-selection-include-todo}, it allows you to change the TODO
  2970. state through the tags interface (@pxref{Setting tags}), in case you like to
  2971. mingle the two concepts. Note that this means you need to come up with
  2972. unique keys across both sets of keywords.}
  2973. @node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
  2974. @subsection Setting up keywords for individual files
  2975. @cindex keyword options
  2976. @cindex per-file keywords
  2977. @cindex #+TODO
  2978. @cindex #+TYP_TODO
  2979. @cindex #+SEQ_TODO
  2980. It can be very useful to use different aspects of the TODO mechanism in
  2981. different files. For file-local settings, you need to add special lines
  2982. to the file which set the keywords and interpretation for that file
  2983. only. For example, to set one of the two examples discussed above, you
  2984. need one of the following lines, starting in column zero anywhere in the
  2985. file:
  2986. @example
  2987. #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
  2988. @end example
  2989. @noindent (you may also write @code{#+SEQ_TODO} to be explicit about the
  2990. interpretation, but it means the same as @code{#+TODO}), or
  2991. @example
  2992. #+TYP_TODO: Fred Sara Lucy Mike | DONE
  2993. @end example
  2994. A setup for using several sets in parallel would be:
  2995. @example
  2996. #+TODO: TODO | DONE
  2997. #+TODO: REPORT BUG KNOWNCAUSE | FIXED
  2998. #+TODO: | CANCELED
  2999. @end example
  3000. @cindex completion, of option keywords
  3001. @kindex M-@key{TAB}
  3002. @noindent To make sure you are using the correct keyword, type
  3003. @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
  3004. @cindex DONE, final TODO keyword
  3005. Remember that the keywords after the vertical bar (or the last keyword
  3006. if no bar is there) must always mean that the item is DONE (although you
  3007. may use a different word). After changing one of these lines, use
  3008. @kbd{C-c C-c} with the cursor still in the line to make the changes
  3009. known to Org mode@footnote{Org mode parses these lines only when
  3010. Org mode is activated after visiting a file. @kbd{C-c C-c} with the
  3011. cursor in a line starting with @samp{#+} is simply restarting Org mode
  3012. for the current buffer.}.
  3013. @node Faces for TODO keywords, TODO dependencies, Per-file keywords, TODO extensions
  3014. @subsection Faces for TODO keywords
  3015. @cindex faces, for TODO keywords
  3016. @vindex org-todo @r{(face)}
  3017. @vindex org-done @r{(face)}
  3018. @vindex org-todo-keyword-faces
  3019. Org mode highlights TODO keywords with special faces: @code{org-todo}
  3020. for keywords indicating that an item still has to be acted upon, and
  3021. @code{org-done} for keywords indicating that an item is finished. If
  3022. you are using more than 2 different states, you might want to use
  3023. special faces for some of them. This can be done using the variable
  3024. @code{org-todo-keyword-faces}. For example:
  3025. @lisp
  3026. @group
  3027. (setq org-todo-keyword-faces
  3028. '(("TODO" . org-warning) ("STARTED" . "yellow")
  3029. ("CANCELED" . (:foreground "blue" :weight bold))))
  3030. @end group
  3031. @end lisp
  3032. While using a list with face properties as shown for CANCELED @emph{should}
  3033. work, this does not aways seem to be the case. If necessary, define a
  3034. special face and use that. A string is interpreted as a color. The variable
  3035. @code{org-faces-easy-properties} determines if that color is interpreted as a
  3036. foreground or a background color.
  3037. @node TODO dependencies, , Faces for TODO keywords, TODO extensions
  3038. @subsection TODO dependencies
  3039. @cindex TODO dependencies
  3040. @cindex dependencies, of TODO states
  3041. @vindex org-enforce-todo-dependencies
  3042. @cindex property, ORDERED
  3043. The structure of Org files (hierarchy and lists) makes it easy to define TODO
  3044. dependencies. Usually, a parent TODO task should not be marked DONE until
  3045. all subtasks (defined as children tasks) are marked as DONE. And sometimes
  3046. there is a logical sequence to a number of (sub)tasks, so that one task
  3047. cannot be acted upon before all siblings above it are done. If you customize
  3048. the variable @code{org-enforce-todo-dependencies}, Org will block entries
  3049. from changing state to DONE while they have children that are not DONE.
  3050. Furthermore, if an entry has a property @code{ORDERED}, each of its children
  3051. will be blocked until all earlier siblings are marked DONE. Here is an
  3052. example:
  3053. @example
  3054. * TODO Blocked until (two) is done
  3055. ** DONE one
  3056. ** TODO two
  3057. * Parent
  3058. :PROPERTIES:
  3059. :ORDERED: t
  3060. :END:
  3061. ** TODO a
  3062. ** TODO b, needs to wait for (a)
  3063. ** TODO c, needs to wait for (a) and (b)
  3064. @end example
  3065. @table @kbd
  3066. @kindex C-c C-x o
  3067. @item C-c C-x o
  3068. @vindex org-track-ordered-property-with-tag
  3069. @cindex property, ORDERED
  3070. Toggle the @code{ORDERED} property of the current entry. A property is used
  3071. for this behavior because this should be local to the current entry, not
  3072. inherited like a tag. However, if you would like to @i{track} the value of
  3073. this property with a tag for better visibility, customize the variable
  3074. @code{org-track-ordered-property-with-tag}.
  3075. @kindex C-u C-u C-u C-c C-t
  3076. @item C-u C-u C-u C-c C-t
  3077. Change TODO state, circumventing any state blocking.
  3078. @end table
  3079. @vindex org-agenda-dim-blocked-tasks
  3080. If you set the variable @code{org-agenda-dim-blocked-tasks}, TODO entries
  3081. that cannot be closed because of such dependencies will be shown in a dimmed
  3082. font or even made invisible in agenda views (@pxref{Agenda Views}).
  3083. @cindex checkboxes and TODO dependencies
  3084. @vindex org-enforce-todo-dependencies
  3085. You can also block changes of TODO states by looking at checkboxes
  3086. (@pxref{Checkboxes}). If you set the variable
  3087. @code{org-enforce-todo-checkbox-dependencies}, an entry that has unchecked
  3088. checkboxes will be blocked from switching to DONE.
  3089. If you need more complex dependency structures, for example dependencies
  3090. between entries in different trees or files, check out the contributed
  3091. module @file{org-depend.el}.
  3092. @page
  3093. @node Progress logging, Priorities, TODO extensions, TODO Items
  3094. @section Progress logging
  3095. @cindex progress logging
  3096. @cindex logging, of progress
  3097. Org mode can automatically record a timestamp and possibly a note when
  3098. you mark a TODO item as DONE, or even each time you change the state of
  3099. a TODO item. This system is highly configurable, settings can be on a
  3100. per-keyword basis and can be localized to a file or even a subtree. For
  3101. information on how to clock working time for a task, see @ref{Clocking
  3102. work time}.
  3103. @menu
  3104. * Closing items:: When was this entry marked DONE?
  3105. * Tracking TODO state changes:: When did the status change?
  3106. * Tracking your habits:: How consistent have you been?
  3107. @end menu
  3108. @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
  3109. @subsection Closing items
  3110. The most basic logging is to keep track of @emph{when} a certain TODO
  3111. item was finished. This is achieved with@footnote{The corresponding
  3112. in-buffer setting is: @code{#+STARTUP: logdone}}.
  3113. @lisp
  3114. (setq org-log-done 'time)
  3115. @end lisp
  3116. @noindent
  3117. Then each time you turn an entry from a TODO (not-done) state into any
  3118. of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
  3119. just after the headline. If you turn the entry back into a TODO item
  3120. through further state cycling, that line will be removed again. If you
  3121. want to record a note along with the timestamp, use@footnote{The
  3122. corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
  3123. @lisp
  3124. (setq org-log-done 'note)
  3125. @end lisp
  3126. @noindent
  3127. You will then be prompted for a note, and that note will be stored below
  3128. the entry with a @samp{Closing Note} heading.
  3129. In the timeline (@pxref{Timeline}) and in the agenda
  3130. (@pxref{Weekly/daily agenda}), you can then use the @kbd{l} key to
  3131. display the TODO items with a @samp{CLOSED} timestamp on each day,
  3132. giving you an overview of what has been done.
  3133. @node Tracking TODO state changes, Tracking your habits, Closing items, Progress logging
  3134. @subsection Tracking TODO state changes
  3135. @cindex drawer, for state change recording
  3136. @vindex org-log-states-order-reversed
  3137. @vindex org-log-into-drawer
  3138. @cindex property, LOG_INTO_DRAWER
  3139. When TODO keywords are used as workflow states (@pxref{Workflow states}), you
  3140. might want to keep track of when a state change occurred and maybe take a
  3141. note about this change. You can either record just a timestamp, or a
  3142. time-stamped note for a change. These records will be inserted after the
  3143. headline as an itemized list, newest first@footnote{See the variable
  3144. @code{org-log-states-order-reversed}}. When taking a lot of notes, you might
  3145. want to get the notes out of the way into a drawer (@pxref{Drawers}).
  3146. Customize the variable @code{org-log-into-drawer} to get this
  3147. behavior---the recommended drawer for this is called @code{LOGBOOK}. You can
  3148. also overrule the setting of this variable for a subtree by setting a
  3149. @code{LOG_INTO_DRAWER} property.
  3150. Since it is normally too much to record a note for every state, Org mode
  3151. expects configuration on a per-keyword basis for this. This is achieved by
  3152. adding special markers @samp{!} (for a timestamp) and @samp{@@} (for a note)
  3153. in parentheses after each keyword. For example, with the setting
  3154. @lisp
  3155. (setq org-todo-keywords
  3156. '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
  3157. @end lisp
  3158. @noindent
  3159. @vindex org-log-done
  3160. you not only define global TODO keywords and fast access keys, but also
  3161. request that a time is recorded when the entry is set to
  3162. DONE@footnote{It is possible that Org mode will record two timestamps
  3163. when you are using both @code{org-log-done} and state change logging.
  3164. However, it will never prompt for two notes---if you have configured
  3165. both, the state change recording note will take precedence and cancel
  3166. the @samp{Closing Note}.}, and that a note is recorded when switching to
  3167. WAIT or CANCELED. The setting for WAIT is even more special: the
  3168. @samp{!} after the slash means that in addition to the note taken when
  3169. entering the state, a timestamp should be recorded when @i{leaving} the
  3170. WAIT state, if and only if the @i{target} state does not configure
  3171. logging for entering it. So it has no effect when switching from WAIT
  3172. to DONE, because DONE is configured to record a timestamp only. But
  3173. when switching from WAIT back to TODO, the @samp{/!} in the WAIT
  3174. setting now triggers a timestamp even though TODO has no logging
  3175. configured.
  3176. You can use the exact same syntax for setting logging preferences local
  3177. to a buffer:
  3178. @example
  3179. #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
  3180. @end example
  3181. @cindex property, LOGGING
  3182. In order to define logging settings that are local to a subtree or a
  3183. single item, define a LOGGING property in this entry. Any non-empty
  3184. LOGGING property resets all logging settings to nil. You may then turn
  3185. on logging for this specific tree using STARTUP keywords like
  3186. @code{lognotedone} or @code{logrepeat}, as well as adding state specific
  3187. settings like @code{TODO(!)}. For example
  3188. @example
  3189. * TODO Log each state with only a time
  3190. :PROPERTIES:
  3191. :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
  3192. :END:
  3193. * TODO Only log when switching to WAIT, and when repeating
  3194. :PROPERTIES:
  3195. :LOGGING: WAIT(@@) logrepeat
  3196. :END:
  3197. * TODO No logging at all
  3198. :PROPERTIES:
  3199. :LOGGING: nil
  3200. :END:
  3201. @end example
  3202. @node Tracking your habits, , Tracking TODO state changes, Progress logging
  3203. @subsection Tracking your habits
  3204. @cindex habits
  3205. Org has the ability to track the consistency of a special category of TODOs,
  3206. called ``habits''. A habit has the following properties:
  3207. @enumerate
  3208. @item
  3209. You have enabled the @code{habits} module by customizing the variable
  3210. @code{org-modules}.
  3211. @item
  3212. The habit is a TODO, with a TODO keyword representing an open state.
  3213. @item
  3214. The property @code{STYLE} is set to the value @code{habit}.
  3215. @item
  3216. The TODO has a scheduled date, with a @code{.+} style repeat interval.
  3217. @item
  3218. The TODO may also have minimum and maximum ranges specified by using the
  3219. syntax @samp{.+2d/3d}, which says that you want to do the task at least every
  3220. three days, but at most every two days.
  3221. @item
  3222. You must also have state logging for the @code{DONE} state enabled, in order
  3223. for historical data to be represented in the consistency graph. If it's not
  3224. enabled it's not an error, but the consistency graphs will be largely
  3225. meaningless.
  3226. @end enumerate
  3227. To give you an idea of what the above rules look like in action, here's an
  3228. actual habit with some history:
  3229. @example
  3230. ** TODO Shave
  3231. SCHEDULED: <2009-10-17 Sat .+2d/4d>
  3232. - State "DONE" from "TODO" [2009-10-15 Thu]
  3233. - State "DONE" from "TODO" [2009-10-12 Mon]
  3234. - State "DONE" from "TODO" [2009-10-10 Sat]
  3235. - State "DONE" from "TODO" [2009-10-04 Sun]
  3236. - State "DONE" from "TODO" [2009-10-02 Fri]
  3237. - State "DONE" from "TODO" [2009-09-29 Tue]
  3238. - State "DONE" from "TODO" [2009-09-25 Fri]
  3239. - State "DONE" from "TODO" [2009-09-19 Sat]
  3240. - State "DONE" from "TODO" [2009-09-16 Wed]
  3241. - State "DONE" from "TODO" [2009-09-12 Sat]
  3242. :PROPERTIES:
  3243. :STYLE: habit
  3244. :LAST_REPEAT: [2009-10-19 Mon 00:36]
  3245. :END:
  3246. @end example
  3247. What this habit says is: I want to shave at most every 2 days (given by the
  3248. @code{SCHEDULED} date and repeat interval) and at least every 4 days. If
  3249. today is the 15th, then the habit first appears in the agenda on Oct 17,
  3250. after the minimum of 2 days has elapsed, and will appear overdue on Oct 19,
  3251. after four days have elapsed.
  3252. What's really useful about habits is that they are displayed along with a
  3253. consistency graph, to show how consistent you've been at getting that task
  3254. done in the past. This graph shows every day that the task was done over the
  3255. past three weeks, with colors for each day. The colors used are:
  3256. @table @code
  3257. @item Blue
  3258. If the task wasn't to be done yet on that day.
  3259. @item Green
  3260. If the task could have been done on that day.
  3261. @item Yellow
  3262. If the task was going to be overdue the next day.
  3263. @item Red
  3264. If the task was overdue on that day.
  3265. @end table
  3266. In addition to coloring each day, the day is also marked with an asterix if
  3267. the task was actually done that day, and an exclamation mark to show where
  3268. the current day falls in the graph.
  3269. There are several configuration variables that can be used to change the way
  3270. habits are displayed in the agenda.
  3271. @table @code
  3272. @item org-habit-graph-column
  3273. The buffer column at which the consistency graph should be drawn. This will
  3274. overwrite any text in that column, so it's a good idea to keep your habits'
  3275. titles brief and to the point.
  3276. @item org-habit-preceding-days
  3277. The amount of history, in days before today, to appear in consistency graphs.
  3278. @item org-habit-following-days
  3279. The number of days after today that will appear in consistency graphs.
  3280. @item org-habit-show-habits-only-for-today
  3281. If non-nil, only show habits in today's agenda view. This is set to true by
  3282. default.
  3283. @end table
  3284. Lastly, pressing @kbd{K} in the agenda buffer will cause habits to
  3285. temporarily be disabled and they won't appear at all. Press @kbd{K} again to
  3286. bring them back. They are also subject to tag filtering, if you have habits
  3287. which should only be done in certain contexts, for example.
  3288. @node Priorities, Breaking down tasks, Progress logging, TODO Items
  3289. @section Priorities
  3290. @cindex priorities
  3291. If you use Org mode extensively, you may end up enough TODO items that
  3292. it starts to make sense to prioritize them. Prioritizing can be done by
  3293. placing a @emph{priority cookie} into the headline of a TODO item, like
  3294. this
  3295. @example
  3296. *** TODO [#A] Write letter to Sam Fortune
  3297. @end example
  3298. @noindent
  3299. @vindex org-priority-faces
  3300. By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
  3301. @samp{C}. @samp{A} is the highest priority. An entry without a cookie is
  3302. treated as priority @samp{B}. Priorities make a difference only in the
  3303. agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have no
  3304. inherent meaning to Org mode. The cookies can be highlighted with special
  3305. faces by customizing the variable @code{org-priority-faces}.
  3306. Priorities can be attached to any outline tree entries; they do not need
  3307. to be TODO items.
  3308. @table @kbd
  3309. @kindex @kbd{C-c ,}
  3310. @item @kbd{C-c ,}
  3311. Set the priority of the current headline. The command prompts for a
  3312. priority character @samp{A}, @samp{B} or @samp{C}. When you press
  3313. @key{SPC} instead, the priority cookie is removed from the headline.
  3314. The priorities can also be changed ``remotely'' from the timeline and
  3315. agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
  3316. @c
  3317. @kindex S-@key{up}
  3318. @kindex S-@key{down}
  3319. @item S-@key{up}
  3320. @itemx S-@key{down}
  3321. @vindex org-priority-start-cycle-with-default
  3322. Increase/decrease priority of current headline@footnote{See also the option
  3323. @code{org-priority-start-cycle-with-default}.}. Note that these keys are
  3324. also used to modify timestamps (@pxref{Creating timestamps}). See also
  3325. @ref{Conflicts}, for a discussion of the interaction with
  3326. @code{shift-selection-mode}.
  3327. @end table
  3328. @vindex org-highest-priority
  3329. @vindex org-lowest-priority
  3330. @vindex org-default-priority
  3331. You can change the range of allowed priorities by setting the variables
  3332. @code{org-highest-priority}, @code{org-lowest-priority}, and
  3333. @code{org-default-priority}. For an individual buffer, you may set
  3334. these values (highest, lowest, default) like this (please make sure that
  3335. the highest priority is earlier in the alphabet than the lowest
  3336. priority):
  3337. @cindex #+PRIORITIES
  3338. @example
  3339. #+PRIORITIES: A C B
  3340. @end example
  3341. @node Breaking down tasks, Checkboxes, Priorities, TODO Items
  3342. @section Breaking tasks down into subtasks
  3343. @cindex tasks, breaking down
  3344. @cindex statistics, for TODO items
  3345. @vindex org-agenda-todo-list-sublevels
  3346. It is often advisable to break down large tasks into smaller, manageable
  3347. subtasks. You can do this by creating an outline tree below a TODO item,
  3348. with detailed subtasks on the tree@footnote{To keep subtasks out of the
  3349. global TODO list, see the @code{org-agenda-todo-list-sublevels}.}. To keep
  3350. the overview over the fraction of subtasks that are already completed, insert
  3351. either @samp{[/]} or @samp{[%]} anywhere in the headline. These cookies will
  3352. be updates each time the todo status of a child changes, or when pressing
  3353. @kbd{C-c C-c} on the cookie. For example:
  3354. @example
  3355. * Organize Party [33%]
  3356. ** TODO Call people [1/2]
  3357. *** TODO Peter
  3358. *** DONE Sarah
  3359. ** TODO Buy food
  3360. ** DONE Talk to neighbor
  3361. @end example
  3362. @cindex property, COOKIE_DATA
  3363. If a heading has both checkboxes and TODO children below it, the meaning of
  3364. the statistics cookie become ambiguous. Set the property
  3365. @code{COOKIE_DATA} to either @samp{checkbox} or @samp{todo} to resolve
  3366. this issue.
  3367. @vindex org-hierarchical-todo-statistics
  3368. If you would like to have the statistics cookie count any TODO entries in the
  3369. subtree (not just direct children), configure the variable
  3370. @code{org-hierarchical-todo-statistics}. To do this for a single subtree,
  3371. include the word @samp{recursive} into the value of the @code{COOKIE_DATA}
  3372. property.
  3373. @example
  3374. * Parent capturing statistics [2/20]
  3375. :PROPERTIES:
  3376. :COOKIE_DATA: todo recursive
  3377. :END:
  3378. @end example
  3379. If you would like a TODO entry to automatically change to DONE
  3380. when all children are done, you can use the following setup:
  3381. @example
  3382. (defun org-summary-todo (n-done n-not-done)
  3383. "Switch entry to DONE when all subentries are done, to TODO otherwise."
  3384. (let (org-log-done org-log-states) ; turn off logging
  3385. (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
  3386. (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
  3387. @end example
  3388. Another possibility is the use of checkboxes to identify (a hierarchy of) a
  3389. large number of subtasks (@pxref{Checkboxes}).
  3390. @node Checkboxes, , Breaking down tasks, TODO Items
  3391. @section Checkboxes
  3392. @cindex checkboxes
  3393. Every item in a plain list (@pxref{Plain lists}) can be made into a
  3394. checkbox by starting it with the string @samp{[ ]}. This feature is
  3395. similar to TODO items (@pxref{TODO Items}), but is more lightweight.
  3396. Checkboxes are not included into the global TODO list, so they are often
  3397. great to split a task into a number of simple steps. Or you can use
  3398. them in a shopping list. To toggle a checkbox, use @kbd{C-c C-c}, or
  3399. use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
  3400. Here is an example of a checkbox list.
  3401. @example
  3402. * TODO Organize party [2/4]
  3403. - [-] call people [1/3]
  3404. - [ ] Peter
  3405. - [X] Sarah
  3406. - [ ] Sam
  3407. - [X] order food
  3408. - [ ] think about what music to play
  3409. - [X] talk to the neighbors
  3410. @end example
  3411. Checkboxes work hierarchically, so if a checkbox item has children that
  3412. are checkboxes, toggling one of the children checkboxes will make the
  3413. parent checkbox reflect if none, some, or all of the children are
  3414. checked.
  3415. @cindex statistics, for checkboxes
  3416. @cindex checkbox statistics
  3417. @cindex property, COOKIE_DATA
  3418. @vindex org-hierarchical-checkbox-statistics
  3419. The @samp{[2/4]} and @samp{[1/3]} in the first and second line are cookies
  3420. indicating how many checkboxes present in this entry have been checked off,
  3421. and the total number of checkboxes present. This can give you an idea on how
  3422. many checkboxes remain, even without opening a folded entry. The cookies can
  3423. be placed into a headline or into (the first line of) a plain list item.
  3424. Each cookie covers checkboxes of direct children structurally below the
  3425. headline/item on which the cookie appears@footnote{Set the variable
  3426. @code{org-hierarchical-checkbox-statistics} if you want such cookies to
  3427. represent the all checkboxes below the cookie, not just the direct
  3428. children.}. You have to insert the cookie yourself by typing either
  3429. @samp{[/]} or @samp{[%]}. With @samp{[/]} you get an @samp{n out of m}
  3430. result, as in the examples above. With @samp{[%]} you get information about
  3431. the percentage of checkboxes checked (in the above example, this would be
  3432. @samp{[50%]} and @samp{[33%]}, respectively). In a headline, a cookie can
  3433. count either checkboxes below the heading or TODO states of children, and it
  3434. will display whatever was changed last. Set the property @code{COOKIE_DATA}
  3435. to either @samp{checkbox} or @samp{todo} to resolve this issue.
  3436. @cindex blocking, of checkboxes
  3437. @cindex checkbox blocking
  3438. @cindex property, ORDERED
  3439. If the current outline node has an @code{ORDERED} property, checkboxes must
  3440. be checked off in sequence, and an error will be thrown if you try to check
  3441. off a box while there are unchecked boxes above it.
  3442. @noindent The following commands work with checkboxes:
  3443. @table @kbd
  3444. @kindex C-c C-c
  3445. @item C-c C-c
  3446. Toggle checkbox status or (with prefix arg) checkbox presence at point. With
  3447. double prefix argument, set it to @samp{[-]}, which is considered to be an
  3448. intermediate state.
  3449. @kindex C-c C-x C-b
  3450. @item C-c C-x C-b
  3451. Toggle checkbox status or (with prefix arg) checkbox presence at point. With
  3452. double prefix argument, set it to @samp{[-]}, which is considered to be an
  3453. intermediate state.
  3454. @itemize @minus
  3455. @item
  3456. If there is an active region, toggle the first checkbox in the region
  3457. and set all remaining boxes to the same status as the first. With a prefix
  3458. arg, add or remove the checkbox for all items in the region.
  3459. @item
  3460. If the cursor is in a headline, toggle checkboxes in the region between
  3461. this headline and the next (so @emph{not} the entire subtree).
  3462. @item
  3463. If there is no active region, just toggle the checkbox at point.
  3464. @end itemize
  3465. @kindex M-S-@key{RET}
  3466. @item M-S-@key{RET}
  3467. Insert a new item with a checkbox.
  3468. This works only if the cursor is already in a plain list item
  3469. (@pxref{Plain lists}).
  3470. @kindex C-c C-x o
  3471. @item C-c C-x o
  3472. @vindex org-track-ordered-property-with-tag
  3473. @cindex property, ORDERED
  3474. Toggle the @code{ORDERED} property of the entry, to toggle if checkboxes must
  3475. be checked off in sequence. A property is used for this behavior because
  3476. this should be local to the current entry, not inherited like a tag.
  3477. However, if you would like to @i{track} the value of this property with a tag
  3478. for better visibility, customize the variable
  3479. @code{org-track-ordered-property-with-tag}.
  3480. @kindex C-c #
  3481. @item C-c #
  3482. Update the statistics cookie in the current outline entry. When called with
  3483. a @kbd{C-u} prefix, update the entire file. Checkbox statistic cookies are
  3484. updated automatically if you toggle checkboxes with @kbd{C-c C-c} and make
  3485. new ones with @kbd{M-S-@key{RET}}. TODO statistics cookies update when
  3486. changing TODO states. If you delete boxes/entries or add/change them by
  3487. hand, use this command to get things back into sync. Or simply toggle any
  3488. entry twice (checkboxes with @kbd{C-c C-c}).
  3489. @end table
  3490. @node Tags, Properties and Columns, TODO Items, Top
  3491. @chapter Tags
  3492. @cindex tags
  3493. @cindex headline tagging
  3494. @cindex matching, tags
  3495. @cindex sparse tree, tag based
  3496. An excellent way to implement labels and contexts for cross-correlating
  3497. information is to assign @i{tags} to headlines. Org mode has extensive
  3498. support for tags.
  3499. @vindex org-tag-faces
  3500. Every headline can contain a list of tags; they occur at the end of the
  3501. headline. Tags are normal words containing letters, numbers, @samp{_}, and
  3502. @samp{@@}. Tags must be preceded and followed by a single colon, e.g.,
  3503. @samp{:work:}. Several tags can be specified, as in @samp{:work:urgent:}.
  3504. Tags will by default be in bold face with the same color as the headline.
  3505. You may specify special faces for specific tags using the variable
  3506. @code{org-tag-faces}, in much the same way as you can for TODO keywords
  3507. (@pxref{Faces for TODO keywords}).
  3508. @menu
  3509. * Tag inheritance:: Tags use the tree structure of the outline
  3510. * Setting tags:: How to assign tags to a headline
  3511. * Tag searches:: Searching for combinations of tags
  3512. @end menu
  3513. @node Tag inheritance, Setting tags, Tags, Tags
  3514. @section Tag inheritance
  3515. @cindex tag inheritance
  3516. @cindex inheritance, of tags
  3517. @cindex sublevels, inclusion into tags match
  3518. @i{Tags} make use of the hierarchical structure of outline trees. If a
  3519. heading has a certain tag, all subheadings will inherit the tag as
  3520. well. For example, in the list
  3521. @example
  3522. * Meeting with the French group :work:
  3523. ** Summary by Frank :boss:notes:
  3524. *** TODO Prepare slides for him :action:
  3525. @end example
  3526. @noindent
  3527. the final heading will have the tags @samp{:work:}, @samp{:boss:},
  3528. @samp{:notes:}, and @samp{:action:} even though the final heading is not
  3529. explicitly marked with those tags. You can also set tags that all entries in
  3530. a file should inherit just as if these tags were defined in a hypothetical
  3531. level zero that surrounds the entire file. Use a line like this@footnote{As
  3532. with all these in-buffer settings, pressing @kbd{C-c C-c} activates any
  3533. changes in the line.}:
  3534. @cindex #+FILETAGS
  3535. @example
  3536. #+FILETAGS: :Peter:Boss:Secret:
  3537. @end example
  3538. @noindent
  3539. @vindex org-use-tag-inheritance
  3540. @vindex org-tags-exclude-from-inheritance
  3541. To limit tag inheritance to specific tags, or to turn it off entirely, use
  3542. the variables @code{org-use-tag-inheritance} and
  3543. @code{org-tags-exclude-from-inheritance}.
  3544. @vindex org-tags-match-list-sublevels
  3545. When a headline matches during a tags search while tag inheritance is turned
  3546. on, all the sublevels in the same tree will (for a simple match form) match
  3547. as well@footnote{This is only true if the search does not involve more
  3548. complex tests including properties (@pxref{Property searches}).}. The list
  3549. of matches may then become very long. If you only want to see the first tags
  3550. match in a subtree, configure the variable
  3551. @code{org-tags-match-list-sublevels} (not recommended).
  3552. @node Setting tags, Tag searches, Tag inheritance, Tags
  3553. @section Setting tags
  3554. @cindex setting tags
  3555. @cindex tags, setting
  3556. @kindex M-@key{TAB}
  3557. Tags can simply be typed into the buffer at the end of a headline.
  3558. After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
  3559. also a special command for inserting tags:
  3560. @table @kbd
  3561. @kindex C-c C-q
  3562. @item C-c C-q
  3563. @cindex completion, of tags
  3564. @vindex org-tags-column
  3565. Enter new tags for the current headline. Org mode will either offer
  3566. completion or a special single-key interface for setting tags, see
  3567. below. After pressing @key{RET}, the tags will be inserted and aligned
  3568. to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all
  3569. tags in the current buffer will be aligned to that column, just to make
  3570. things look nice. TAGS are automatically realigned after promotion,
  3571. demotion, and TODO state changes (@pxref{TODO basics}).
  3572. @kindex C-c C-c
  3573. @item C-c C-c
  3574. When the cursor is in a headline, this does the same as @kbd{C-c C-q}.
  3575. @end table
  3576. @vindex org-tag-alist
  3577. Org will support tag insertion based on a @emph{list of tags}. By
  3578. default this list is constructed dynamically, containing all tags
  3579. currently used in the buffer. You may also globally specify a hard list
  3580. of tags with the variable @code{org-tag-alist}. Finally you can set
  3581. the default tags for a given file with lines like
  3582. @cindex #+TAGS
  3583. @example
  3584. #+TAGS: @@work @@home @@tennisclub
  3585. #+TAGS: laptop car pc sailboat
  3586. @end example
  3587. If you have globally defined your preferred set of tags using the
  3588. variable @code{org-tag-alist}, but would like to use a dynamic tag list
  3589. in a specific file, add an empty TAGS option line to that file:
  3590. @example
  3591. #+TAGS:
  3592. @end example
  3593. @vindex org-tag-persistent-alist
  3594. If you have a preferred set of tags that you would like to use in every file,
  3595. in addition to those defined on a per-file basis by TAGS option lines, then
  3596. you may specify a list of tags with the variable
  3597. @code{org-tag-persistent-alist}. You may turn this off on a per-file basis
  3598. by adding a STARTUP option line to that file:
  3599. @example
  3600. #+STARTUP: noptag
  3601. @end example
  3602. By default Org mode uses the standard minibuffer completion facilities for
  3603. entering tags. However, it also implements another, quicker, tag selection
  3604. method called @emph{fast tag selection}. This allows you to select and
  3605. deselect tags with just a single key press. For this to work well you should
  3606. assign unique letters to most of your commonly used tags. You can do this
  3607. globally by configuring the variable @code{org-tag-alist} in your
  3608. @file{.emacs} file. For example, you may find the need to tag many items in
  3609. different files with @samp{:@@home:}. In this case you can set something
  3610. like:
  3611. @lisp
  3612. (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
  3613. @end lisp
  3614. @noindent If the tag is only relevant to the file you are working on, then you
  3615. can instead set the TAGS option line as:
  3616. @example
  3617. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
  3618. @end example
  3619. @noindent The tags interface will show the available tags in a splash
  3620. window. If you want to start a new line after a specific tag, insert
  3621. @samp{\n} into the tag list
  3622. @example
  3623. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) \n laptop(l) pc(p)
  3624. @end example
  3625. @noindent or write them in two lines:
  3626. @example
  3627. #+TAGS: @@work(w) @@home(h) @@tennisclub(t)
  3628. #+TAGS: laptop(l) pc(p)
  3629. @end example
  3630. @noindent
  3631. You can also group together tags that are mutually exclusive by using
  3632. braces, as in:
  3633. @example
  3634. #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
  3635. @end example
  3636. @noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
  3637. and @samp{@@tennisclub} should be selected. Multiple such groups are allowed.
  3638. @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
  3639. these lines to activate any changes.
  3640. @noindent
  3641. To set these mutually exclusive groups in the variable @code{org-tags-alist},
  3642. you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
  3643. of the braces. Similarly, you can use @code{:newline} to indicate a line
  3644. break. The previous example would be set globally by the following
  3645. configuration:
  3646. @lisp
  3647. (setq org-tag-alist '((:startgroup . nil)
  3648. ("@@work" . ?w) ("@@home" . ?h)
  3649. ("@@tennisclub" . ?t)
  3650. (:endgroup . nil)
  3651. ("laptop" . ?l) ("pc" . ?p)))
  3652. @end lisp
  3653. If at least one tag has a selection key then pressing @kbd{C-c C-c} will
  3654. automatically present you with a special interface, listing inherited tags,
  3655. the tags of the current headline, and a list of all valid tags with
  3656. corresponding keys@footnote{Keys will automatically be assigned to tags which
  3657. have no configured keys.}. In this interface, you can use the following
  3658. keys:
  3659. @table @kbd
  3660. @item a-z...
  3661. Pressing keys assigned to tags will add or remove them from the list of
  3662. tags in the current line. Selecting a tag in a group of mutually
  3663. exclusive tags will turn off any other tags from that group.
  3664. @kindex @key{TAB}
  3665. @item @key{TAB}
  3666. Enter a tag in the minibuffer, even if the tag is not in the predefined
  3667. list. You will be able to complete on all tags present in the buffer.
  3668. @kindex @key{SPC}
  3669. @item @key{SPC}
  3670. Clear all tags for this line.
  3671. @kindex @key{RET}
  3672. @item @key{RET}
  3673. Accept the modified set.
  3674. @item C-g
  3675. Abort without installing changes.
  3676. @item q
  3677. If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
  3678. @item !
  3679. Turn off groups of mutually exclusive tags. Use this to (as an
  3680. exception) assign several tags from such a group.
  3681. @item C-c
  3682. Toggle auto-exit after the next change (see below).
  3683. If you are using expert mode, the first @kbd{C-c} will display the
  3684. selection window.
  3685. @end table
  3686. @noindent
  3687. This method lets you assign tags to a headline with very few keys. With
  3688. the above setup, you could clear the current tags and set @samp{@@home},
  3689. @samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
  3690. C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to
  3691. @samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
  3692. alternatively with @kbd{C-c C-c C-c w}. Adding the non-predefined tag
  3693. @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
  3694. @key{RET} @key{RET}}.
  3695. @vindex org-fast-tag-selection-single-key
  3696. If you find that most of the time you need only a single key press to
  3697. modify your list of tags, set the variable
  3698. @code{org-fast-tag-selection-single-key}. Then you no longer have to
  3699. press @key{RET} to exit fast tag selection---it will immediately exit
  3700. after the first change. If you then occasionally need more keys, press
  3701. @kbd{C-c} to turn off auto-exit for the current tag selection process
  3702. (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
  3703. C-c}). If you set the variable to the value @code{expert}, the special
  3704. window is not even shown for single-key tag selection, it comes up only
  3705. when you press an extra @kbd{C-c}.
  3706. @vindex org-complete-tags-always-offer-all-agenda-tags
  3707. As said before, when setting tags and @code{org-tag-alist} is nil, then the
  3708. list of tags in the current buffer is used. Normally, this behavior is very
  3709. convenient, except in org remember buffers (@pxref{Remember}), because there
  3710. are no tags that can be calculated dynamically. Here, you most probably want
  3711. to have completion for all tags in all agenda files. This can be done by
  3712. setting @code{org-complete-tags-always-offer-all-agenda-tags} to non-nil in
  3713. those buffers.
  3714. @lisp
  3715. (add-hook 'org-remember-mode-hook
  3716. (lambda ()
  3717. (set (make-local-variable
  3718. 'org-complete-tags-always-offer-all-agenda-tags)
  3719. t)))
  3720. @end lisp
  3721. Of course, you can also set it to @code{t} globally if you always want to
  3722. have completion of all tags in all agenda files.
  3723. @node Tag searches, , Setting tags, Tags
  3724. @section Tag searches
  3725. @cindex tag searches
  3726. @cindex searching for tags
  3727. Once a system of tags has been set up, it can be used to collect related
  3728. information into special lists.
  3729. @table @kbd
  3730. @kindex C-c \
  3731. @kindex C-c / m
  3732. @item C-c \
  3733. @itemx C-c / m
  3734. Create a sparse tree with all headlines matching a tags search. With a
  3735. @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
  3736. @kindex C-c a m
  3737. @item C-c a m
  3738. Create a global list of tag matches from all agenda files.
  3739. @xref{Matching tags and properties}.
  3740. @kindex C-c a M
  3741. @item C-c a M
  3742. @vindex org-tags-match-list-sublevels
  3743. Create a global list of tag matches from all agenda files, but check
  3744. only TODO items and force checking subitems (see variable
  3745. @code{org-tags-match-list-sublevels}).
  3746. @end table
  3747. These commands all prompt for a match string which allows basic Boolean logic
  3748. like @samp{+boss+urgent-project1}, to find entries with tags @samp{boss} and
  3749. @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find entries
  3750. which are tagged, like @samp{Kathy} or @samp{Sally}. The full syntax of the search
  3751. string is rich and allows also matching against TODO keywords, entry levels
  3752. and properties. For a complete description with many examples, see
  3753. @ref{Matching tags and properties}.
  3754. @node Properties and Columns, Dates and Times, Tags, Top
  3755. @chapter Properties and Columns
  3756. @cindex properties
  3757. Properties are a set of key-value pairs associated with an entry. There
  3758. are two main applications for properties in Org mode. First, properties
  3759. are like tags, but with a value. Second, you can use properties to
  3760. implement (very basic) database capabilities in an Org buffer. For
  3761. an example of the first application, imagine maintaining a file where
  3762. you document bugs and plan releases for a piece of software. Instead of
  3763. using tags like @code{:release_1:}, @code{:release_2:}, one can use a
  3764. property, say @code{:Release:}, that in different subtrees has different
  3765. values, such as @code{1.0} or @code{2.0}. For an example of the second
  3766. application of properties, imagine keeping track of your music CDs,
  3767. where properties could be things such as the album, artist, date of
  3768. release, number of tracks, and so on.
  3769. Properties can be conveniently edited and viewed in column view
  3770. (@pxref{Column view}).
  3771. @menu
  3772. * Property syntax:: How properties are spelled out
  3773. * Special properties:: Access to other Org mode features
  3774. * Property searches:: Matching property values
  3775. * Property inheritance:: Passing values down the tree
  3776. * Column view:: Tabular viewing and editing
  3777. * Property API:: Properties for Lisp programmers
  3778. @end menu
  3779. @node Property syntax, Special properties, Properties and Columns, Properties and Columns
  3780. @section Property syntax
  3781. @cindex property syntax
  3782. @cindex drawer, for properties
  3783. Properties are key-value pairs. They need to be inserted into a special
  3784. drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property
  3785. is specified on a single line, with the key (surrounded by colons)
  3786. first, and the value after it. Here is an example:
  3787. @example
  3788. * CD collection
  3789. ** Classic
  3790. *** Goldberg Variations
  3791. :PROPERTIES:
  3792. :Title: Goldberg Variations
  3793. :Composer: J.S. Bach
  3794. :Artist: Glen Gould
  3795. :Publisher: Deutsche Grammophon
  3796. :NDisks: 1
  3797. :END:
  3798. @end example
  3799. You may define the allowed values for a particular property @samp{:Xyz:}
  3800. by setting a property @samp{:Xyz_ALL:}. This special property is
  3801. @emph{inherited}, so if you set it in a level 1 entry, it will apply to
  3802. the entire tree. When allowed values are defined, setting the
  3803. corresponding property becomes easier and is less prone to typing
  3804. errors. For the example with the CD collection, we can predefine
  3805. publishers and the number of disks in a box like this:
  3806. @example
  3807. * CD collection
  3808. :PROPERTIES:
  3809. :NDisks_ALL: 1 2 3 4
  3810. :Publisher_ALL: "Deutsche Grammophon" Philips EMI
  3811. :END:
  3812. @end example
  3813. If you want to set properties that can be inherited by any entry in a
  3814. file, use a line like
  3815. @cindex property, _ALL
  3816. @cindex #+PROPERTY
  3817. @example
  3818. #+PROPERTY: NDisks_ALL 1 2 3 4
  3819. @end example
  3820. @vindex org-global-properties
  3821. Property values set with the global variable
  3822. @code{org-global-properties} can be inherited by all entries in all
  3823. Org files.
  3824. @noindent
  3825. The following commands help to work with properties:
  3826. @table @kbd
  3827. @kindex M-@key{TAB}
  3828. @item M-@key{TAB}
  3829. After an initial colon in a line, complete property keys. All keys used
  3830. in the current file will be offered as possible completions.
  3831. @kindex C-c C-x p
  3832. @item C-c C-x p
  3833. Set a property. This prompts for a property name and a value. If
  3834. necessary, the property drawer is created as well.
  3835. @item M-x org-insert-property-drawer
  3836. Insert a property drawer into the current entry. The drawer will be
  3837. inserted early in the entry, but after the lines with planning
  3838. information like deadlines.
  3839. @kindex C-c C-c
  3840. @item C-c C-c
  3841. With the cursor in a property drawer, this executes property commands.
  3842. @item C-c C-c s
  3843. Set a property in the current entry. Both the property and the value
  3844. can be inserted using completion.
  3845. @kindex S-@key{right}
  3846. @kindex S-@key{left}
  3847. @item S-@key{left}/@key{right}
  3848. Switch property at point to the next/previous allowed value.
  3849. @item C-c C-c d
  3850. Remove a property from the current entry.
  3851. @item C-c C-c D
  3852. Globally remove a property, from all entries in the current file.
  3853. @item C-c C-c c
  3854. Compute the property at point, using the operator and scope from the
  3855. nearest column format definition.
  3856. @end table
  3857. @node Special properties, Property searches, Property syntax, Properties and Columns
  3858. @section Special properties
  3859. @cindex properties, special
  3860. Special properties provide an alternative access method to Org mode
  3861. features, like the TODO state or the priority of an entry, discussed in the
  3862. previous chapters. This interface exists so that you can include
  3863. these states in a column view (@pxref{Column view}), or to use them in
  3864. queries. The following property names are special and should not be
  3865. used as keys in the properties drawer:
  3866. @cindex property, special, TODO
  3867. @cindex property, special, TAGS
  3868. @cindex property, special, ALLTAGS
  3869. @cindex property, special, CATEGORY
  3870. @cindex property, special, PRIORITY
  3871. @cindex property, special, DEADLINE
  3872. @cindex property, special, SCHEDULED
  3873. @cindex property, special, CLOSED
  3874. @cindex property, special, TIMESTAMP
  3875. @cindex property, special, TIMESTAMP_IA
  3876. @cindex property, special, CLOCKSUM
  3877. @c guessing that ITEM is needed in this area; also, should this list be sorted?
  3878. @cindex property, special, ITEM
  3879. @example
  3880. TODO @r{The TODO keyword of the entry.}
  3881. TAGS @r{The tags defined directly in the headline.}
  3882. ALLTAGS @r{All tags, including inherited ones.}
  3883. CATEGORY @r{The category of an entry.}
  3884. PRIORITY @r{The priority of the entry, a string with a single letter.}
  3885. DEADLINE @r{The deadline time string, without the angular brackets.}
  3886. SCHEDULED @r{The scheduling timestamp, without the angular brackets.}
  3887. CLOSED @r{When was this entry closed?}
  3888. TIMESTAMP @r{The first keyword-less timestamp in the entry.}
  3889. TIMESTAMP_IA @r{The first inactive timestamp in the entry.}
  3890. CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}}
  3891. @r{must be run first to compute the values.}
  3892. ITEM @r{The content of the entry.}
  3893. @end example
  3894. @node Property searches, Property inheritance, Special properties, Properties and Columns
  3895. @section Property searches
  3896. @cindex properties, searching
  3897. @cindex searching, of properties
  3898. To create sparse trees and special lists with selection based on properties,
  3899. the same commands are used as for tag searches (@pxref{Tag searches}).
  3900. @table @kbd
  3901. @kindex C-c \
  3902. @kindex C-c / m
  3903. @item C-c \
  3904. @itemx C-c / m
  3905. Create a sparse tree with all matching entries. With a
  3906. @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
  3907. @kindex C-c a m
  3908. @item C-c a m
  3909. Create a global list of tag/property matches from all agenda files.
  3910. @xref{Matching tags and properties}.
  3911. @kindex C-c a M
  3912. @item C-c a M
  3913. @vindex org-tags-match-list-sublevels
  3914. Create a global list of tag matches from all agenda files, but check
  3915. only TODO items and force checking of subitems (see variable
  3916. @code{org-tags-match-list-sublevels}).
  3917. @end table
  3918. The syntax for the search string is described in @ref{Matching tags and
  3919. properties}.
  3920. There is also a special command for creating sparse trees based on a
  3921. single property:
  3922. @table @kbd
  3923. @kindex C-c / p
  3924. @item C-c / p
  3925. Create a sparse tree based on the value of a property. This first
  3926. prompts for the name of a property, and then for a value. A sparse tree
  3927. is created with all entries that define this property with the given
  3928. value. If you enclose the value into curly braces, it is interpreted as
  3929. a regular expression and matched against the property values.
  3930. @end table
  3931. @node Property inheritance, Column view, Property searches, Properties and Columns
  3932. @section Property Inheritance
  3933. @cindex properties, inheritance
  3934. @cindex inheritance, of properties
  3935. @vindex org-use-property-inheritance
  3936. The outline structure of Org-mode documents lends itself for an
  3937. inheritance model of properties: if the parent in a tree has a certain
  3938. property, the children can inherit this property. Org mode does not
  3939. turn this on by default, because it can slow down property searches
  3940. significantly and is often not needed. However, if you find inheritance
  3941. useful, you can turn it on by setting the variable
  3942. @code{org-use-property-inheritance}. It may be set to @code{t} to make
  3943. all properties inherited from the parent, to a list of properties
  3944. that should be inherited, or to a regular expression that matches
  3945. inherited properties.
  3946. Org mode has a few properties for which inheritance is hard-coded, at
  3947. least for the special applications for which they are used:
  3948. @cindex property, COLUMNS
  3949. @table @code
  3950. @item COLUMNS
  3951. The @code{:COLUMNS:} property defines the format of column view
  3952. (@pxref{Column view}). It is inherited in the sense that the level
  3953. where a @code{:COLUMNS:} property is defined is used as the starting
  3954. point for a column view table, independently of the location in the
  3955. subtree from where columns view is turned on.
  3956. @item CATEGORY
  3957. @cindex property, CATEGORY
  3958. For agenda view, a category set through a @code{:CATEGORY:} property
  3959. applies to the entire subtree.
  3960. @item ARCHIVE
  3961. @cindex property, ARCHIVE
  3962. For archiving, the @code{:ARCHIVE:} property may define the archive
  3963. location for the entire subtree (@pxref{Moving subtrees}).
  3964. @item LOGGING
  3965. @cindex property, LOGGING
  3966. The LOGGING property may define logging settings for an entry or a
  3967. subtree (@pxref{Tracking TODO state changes}).
  3968. @end table
  3969. @node Column view, Property API, Property inheritance, Properties and Columns
  3970. @section Column view
  3971. A great way to view and edit properties in an outline tree is
  3972. @emph{column view}. In column view, each outline node is turned into a
  3973. table row. Columns in this table provide access to properties of the
  3974. entries. Org mode implements columns by overlaying a tabular structure
  3975. over the headline of each item. While the headlines have been turned
  3976. into a table row, you can still change the visibility of the outline
  3977. tree. For example, you get a compact table by switching to CONTENTS
  3978. view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
  3979. is active), but you can still open, read, and edit the entry below each
  3980. headline. Or, you can switch to column view after executing a sparse
  3981. tree command and in this way get a table only for the selected items.
  3982. Column view also works in agenda buffers (@pxref{Agenda Views}) where
  3983. queries have collected selected items, possibly from a number of files.
  3984. @menu
  3985. * Defining columns:: The COLUMNS format property
  3986. * Using column view:: How to create and use column view
  3987. * Capturing column view:: A dynamic block for column view
  3988. @end menu
  3989. @node Defining columns, Using column view, Column view, Column view
  3990. @subsection Defining columns
  3991. @cindex column view, for properties
  3992. @cindex properties, column view
  3993. Setting up a column view first requires defining the columns. This is
  3994. done by defining a column format line.
  3995. @menu
  3996. * Scope of column definitions:: Where defined, where valid?
  3997. * Column attributes:: Appearance and content of a column
  3998. @end menu
  3999. @node Scope of column definitions, Column attributes, Defining columns, Defining columns
  4000. @subsubsection Scope of column definitions
  4001. To define a column format for an entire file, use a line like
  4002. @cindex #+COLUMNS
  4003. @example
  4004. #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  4005. @end example
  4006. To specify a format that only applies to a specific tree, add a
  4007. @code{:COLUMNS:} property to the top node of that tree, for example:
  4008. @example
  4009. ** Top node for columns view
  4010. :PROPERTIES:
  4011. :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  4012. :END:
  4013. @end example
  4014. If a @code{:COLUMNS:} property is present in an entry, it defines columns
  4015. for the entry itself, and for the entire subtree below it. Since the
  4016. column definition is part of the hierarchical structure of the document,
  4017. you can define columns on level 1 that are general enough for all
  4018. sublevels, and more specific columns further down, when you edit a
  4019. deeper part of the tree.
  4020. @node Column attributes, , Scope of column definitions, Defining columns
  4021. @subsubsection Column attributes
  4022. A column definition sets the attributes of a column. The general
  4023. definition looks like this:
  4024. @example
  4025. %[@var{width}]@var{property}[(@var{title})][@{@var{summary-type}@}]
  4026. @end example
  4027. @noindent
  4028. Except for the percent sign and the property name, all items are
  4029. optional. The individual parts have the following meaning:
  4030. @example
  4031. @var{width} @r{An integer specifying the width of the column in characters.}
  4032. @r{If omitted, the width will be determined automatically.}
  4033. @var{property} @r{The property that should be edited in this column.}
  4034. @r{Special properties representing meta data are allowed here}
  4035. @r{as well (@pxref{Special properties})}
  4036. (title) @r{The header text for the column. If omitted, the}
  4037. @r{property name is used.}
  4038. @{@var{summary-type}@} @r{The summary type. If specified, the column values for}
  4039. @r{parent nodes are computed from the children.}
  4040. @r{Supported summary types are:}
  4041. @{+@} @r{Sum numbers in this column.}
  4042. @{+;%.1f@} @r{Like @samp{+}, but format result with @samp{%.1f}.}
  4043. @{$@} @r{Currency, short for @samp{+;%.2f}.}
  4044. @{:@} @r{Sum times, HH:MM:SS, plain numbers are hours.}
  4045. @{X@} @r{Checkbox status, @samp{[X]} if all children are @samp{[X]}.}
  4046. @{X/@} @r{Checkbox status, @samp{[n/m]}.}
  4047. @{X%@} @r{Checkbox status, @samp{[n%]}.}
  4048. @{min@} @r{Smallest number in column.}
  4049. @{max@} @r{Largest number.}
  4050. @{mean@} @r{Arithmetic mean of numbers.}
  4051. @{:min@} @r{Smallest time value in column.}
  4052. @{:max@} @r{Largest time value.}
  4053. @{:mean@} @r{Arithmetic mean of time values.}
  4054. @{@@min@} @r{Minimum age (in days/hours/mins/seconds).}
  4055. @{@@max@} @r{Maximum age (in days/hours/mins/seconds).}
  4056. @{@@mean@} @r{Arithmetic mean of ages (in days/hours/mins/seconds).}
  4057. @end example
  4058. @noindent
  4059. Be aware that you can only have one summary type for any property you
  4060. include. Subsequent columns referencing the same property will all display the
  4061. same summary information.
  4062. Here is an example for a complete columns definition, along with allowed
  4063. values.
  4064. @example
  4065. :COLUMNS: %25ITEM %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.}
  4066. %10Time_Estimate@{:@} %CLOCKSUM
  4067. :Owner_ALL: Tammy Mark Karl Lisa Don
  4068. :Status_ALL: "In progress" "Not started yet" "Finished" ""
  4069. :Approved_ALL: "[ ]" "[X]"
  4070. @end example
  4071. @noindent
  4072. The first column, @samp{%25ITEM}, means the first 25 characters of the
  4073. item itself, i.e. of the headline. You probably always should start the
  4074. column definition with the @samp{ITEM} specifier. The other specifiers
  4075. create columns @samp{Owner} with a list of names as allowed values, for
  4076. @samp{Status} with four different possible values, and for a checkbox
  4077. field @samp{Approved}. When no width is given after the @samp{%}
  4078. character, the column will be exactly as wide as it needs to be in order
  4079. to fully display all values. The @samp{Approved} column does have a
  4080. modified title (@samp{Approved?}, with a question mark). Summaries will
  4081. be created for the @samp{Time_Estimate} column by adding time duration
  4082. expressions like HH:MM, and for the @samp{Approved} column, by providing
  4083. an @samp{[X]} status if all children have been checked. The
  4084. @samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
  4085. in the subtree.
  4086. @node Using column view, Capturing column view, Defining columns, Column view
  4087. @subsection Using column view
  4088. @table @kbd
  4089. @tsubheading{Turning column view on and off}
  4090. @kindex C-c C-x C-c
  4091. @item C-c C-x C-c
  4092. @vindex org-columns-default-format
  4093. Turn on column view. If the cursor is before the first headline in the file,
  4094. column view is turned on for the entire file, using the @code{#+COLUMNS}
  4095. definition. If the cursor is somewhere inside the outline, this command
  4096. searches the hierarchy, up from point, for a @code{:COLUMNS:} property that
  4097. defines a format. When one is found, the column view table is established
  4098. for the tree starting at the entry that contains the @code{:COLUMNS:}
  4099. property. If no such property is found, the format is taken from the
  4100. @code{#+COLUMNS} line or from the variable @code{org-columns-default-format},
  4101. and column view is established for the current entry and its subtree.
  4102. @kindex r
  4103. @item r
  4104. Recreate the column view, to include recent changes made in the buffer.
  4105. @kindex g
  4106. @item g
  4107. Same as @kbd{r}.
  4108. @kindex q
  4109. @item q
  4110. Exit column view.
  4111. @tsubheading{Editing values}
  4112. @item @key{left} @key{right} @key{up} @key{down}
  4113. Move through the column view from field to field.
  4114. @kindex S-@key{left}
  4115. @kindex S-@key{right}
  4116. @item S-@key{left}/@key{right}
  4117. Switch to the next/previous allowed value of the field. For this, you
  4118. have to have specified allowed values for a property.
  4119. @item 1..9,0
  4120. Directly select the nth allowed value, @kbd{0} selects the 10th value.
  4121. @kindex n
  4122. @kindex p
  4123. @itemx n / p
  4124. Same as @kbd{S-@key{left}/@key{right}}
  4125. @kindex e
  4126. @item e
  4127. Edit the property at point. For the special properties, this will
  4128. invoke the same interface that you normally use to change that
  4129. property. For example, when editing a TAGS property, the tag completion
  4130. or fast selection interface will pop up.
  4131. @kindex C-c C-c
  4132. @item C-c C-c
  4133. When there is a checkbox at point, toggle it.
  4134. @kindex v
  4135. @item v
  4136. View the full value of this property. This is useful if the width of
  4137. the column is smaller than that of the value.
  4138. @kindex a
  4139. @item a
  4140. Edit the list of allowed values for this property. If the list is found
  4141. in the hierarchy, the modified values is stored there. If no list is
  4142. found, the new value is stored in the first entry that is part of the
  4143. current column view.
  4144. @tsubheading{Modifying the table structure}
  4145. @kindex <
  4146. @kindex >
  4147. @item < / >
  4148. Make the column narrower/wider by one character.
  4149. @kindex S-M-@key{right}
  4150. @item S-M-@key{right}
  4151. Insert a new column, to the left of the current column.
  4152. @kindex S-M-@key{left}
  4153. @item S-M-@key{left}
  4154. Delete the current column.
  4155. @end table
  4156. @node Capturing column view, , Using column view, Column view
  4157. @subsection Capturing column view
  4158. Since column view is just an overlay over a buffer, it cannot be
  4159. exported or printed directly. If you want to capture a column view, use
  4160. a @code{columnview} dynamic block (@pxref{Dynamic blocks}). The frame
  4161. of this block looks like this:
  4162. @cindex #+BEGIN, columnview
  4163. @example
  4164. * The column view
  4165. #+BEGIN: columnview :hlines 1 :id "label"
  4166. #+END:
  4167. @end example
  4168. @noindent This dynamic block has the following parameters:
  4169. @table @code
  4170. @item :id
  4171. This is the most important parameter. Column view is a feature that is
  4172. often localized to a certain (sub)tree, and the capture block might be
  4173. at a different location in the file. To identify the tree whose view to
  4174. capture, you can use 4 values:
  4175. @cindex property, ID
  4176. @example
  4177. local @r{use the tree in which the capture block is located}
  4178. global @r{make a global view, including all headings in the file}
  4179. "file:@var{path-to-file}"
  4180. @r{run column view at the top of this file}
  4181. "@var{ID}" @r{call column view in the tree that has an @code{:ID:}}
  4182. @r{property with the value @i{label}. You can use}
  4183. @r{@kbd{M-x org-id-copy} to create a globally unique ID for}
  4184. @r{the current entry and copy it to the kill-ring.}
  4185. @end example
  4186. @item :hlines
  4187. When @code{t}, insert an hline after every line. When a number @var{N}, insert
  4188. an hline before each headline with level @code{<= @var{N}}.
  4189. @item :vlines
  4190. When set to @code{t}, force column groups to get vertical lines.
  4191. @item :maxlevel
  4192. When set to a number, don't capture entries below this level.
  4193. @item :skip-empty-rows
  4194. When set to @code{t}, skip rows where the only non-empty specifier of the
  4195. column view is @code{ITEM}.
  4196. @end table
  4197. @noindent
  4198. The following commands insert or update the dynamic block:
  4199. @table @kbd
  4200. @kindex C-c C-x i
  4201. @item C-c C-x i
  4202. Insert a dynamic block capturing a column view. You will be prompted
  4203. for the scope or ID of the view.
  4204. @kindex C-c C-c
  4205. @item C-c C-c
  4206. @kindex C-c C-x C-u
  4207. @itemx C-c C-x C-u
  4208. Update dynamic block at point. The cursor needs to be in the
  4209. @code{#+BEGIN} line of the dynamic block.
  4210. @kindex C-u C-c C-x C-u
  4211. @item C-u C-c C-x C-u
  4212. Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
  4213. you have several clock table blocks in a buffer.
  4214. @end table
  4215. You can add formulas to the column view table and you may add plotting
  4216. instructions in front of the table---these will survive an update of the
  4217. block. If there is a @code{#+TBLFM:} after the table, the table will
  4218. actually be recalculated automatically after an update.
  4219. An alternative way to capture and process property values into a table is
  4220. provided by Eric Schulte's @file{org-collector.el} which is a contributed
  4221. package@footnote{Contributed packages are not part of Emacs, but are
  4222. distributed with the main distribution of Org (visit
  4223. @uref{http://orgmode.org}).}. It provides a general API to collect
  4224. properties from entries in a certain scope, and arbitrary Lisp expressions to
  4225. process these values before inserting them into a table or a dynamic block.
  4226. @node Property API, , Column view, Properties and Columns
  4227. @section The Property API
  4228. @cindex properties, API
  4229. @cindex API, for properties
  4230. There is a full API for accessing and changing properties. This API can
  4231. be used by Emacs Lisp programs to work with properties and to implement
  4232. features based on them. For more information see @ref{Using the
  4233. property API}.
  4234. @node Dates and Times, Capture - Refile - Archive, Properties and Columns, Top
  4235. @chapter Dates and Times
  4236. @cindex dates
  4237. @cindex times
  4238. @cindex timestamp
  4239. @cindex date stamp
  4240. To assist project planning, TODO items can be labeled with a date and/or
  4241. a time. The specially formatted string carrying the date and time
  4242. information is called a @emph{timestamp} in Org mode. This may be a
  4243. little confusing because timestamp is often used as indicating when
  4244. something was created or last changed. However, in Org mode this term
  4245. is used in a much wider sense.
  4246. @menu
  4247. * Timestamps:: Assigning a time to a tree entry
  4248. * Creating timestamps:: Commands which insert timestamps
  4249. * Deadlines and scheduling:: Planning your work
  4250. * Clocking work time:: Tracking how long you spend on a task
  4251. * Resolving idle time:: Resolving time if you've been idle
  4252. * Effort estimates:: Planning work effort in advance
  4253. * Relative timer:: Notes with a running timer
  4254. @end menu
  4255. @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
  4256. @section Timestamps, deadlines, and scheduling
  4257. @cindex timestamps
  4258. @cindex ranges, time
  4259. @cindex date stamps
  4260. @cindex deadlines
  4261. @cindex scheduling
  4262. A timestamp is a specification of a date (possibly with a time or a range of
  4263. times) in a special format, either @samp{<2003-09-16 Tue>} or
  4264. @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
  4265. 12:00-12:30>}@footnote{This is inspired by the standard ISO 6801 date/time
  4266. format. To use an alternative format, see @ref{Custom time format}.}. A
  4267. timestamp can appear anywhere in the headline or body of an Org tree entry.
  4268. Its presence causes entries to be shown on specific dates in the agenda
  4269. (@pxref{Weekly/daily agenda}). We distinguish:
  4270. @table @var
  4271. @item Plain timestamp; Event; Appointment
  4272. @cindex timestamp
  4273. A simple timestamp just assigns a date/time to an item. This is just
  4274. like writing down an appointment or event in a paper agenda. In the
  4275. timeline and agenda displays, the headline of an entry associated with a
  4276. plain timestamp will be shown exactly on that date.
  4277. @example
  4278. * Meet Peter at the movies <2006-11-01 Wed 19:15>
  4279. * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
  4280. @end example
  4281. @item Timestamp with repeater interval
  4282. @cindex timestamp, with repeater interval
  4283. A timestamp may contain a @emph{repeater interval}, indicating that it
  4284. applies not only on the given date, but again and again after a certain
  4285. interval of N days (d), weeks (w), months (m), or years (y). The
  4286. following will show up in the agenda every Wednesday:
  4287. @example
  4288. * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
  4289. @end example
  4290. @item Diary-style sexp entries
  4291. For more complex date specifications, Org mode supports using the
  4292. special sexp diary entries implemented in the Emacs calendar/diary
  4293. package. For example
  4294. @example
  4295. * The nerd meeting on every 2nd Thursday of the month
  4296. <%%(diary-float t 4 2)>
  4297. @end example
  4298. @item Time/Date range
  4299. @cindex timerange
  4300. @cindex date range
  4301. Two timestamps connected by @samp{--} denote a range. The headline
  4302. will be shown on the first and last day of the range, and on any dates
  4303. that are displayed and fall in the range. Here is an example:
  4304. @example
  4305. ** Meeting in Amsterdam
  4306. <2004-08-23 Mon>--<2004-08-26 Thu>
  4307. @end example
  4308. @item Inactive timestamp
  4309. @cindex timestamp, inactive
  4310. @cindex inactive timestamp
  4311. Just like a plain timestamp, but with square brackets instead of
  4312. angular ones. These timestamps are inactive in the sense that they do
  4313. @emph{not} trigger an entry to show up in the agenda.
  4314. @example
  4315. * Gillian comes late for the fifth time [2006-11-01 Wed]
  4316. @end example
  4317. @end table
  4318. @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
  4319. @section Creating timestamps
  4320. @cindex creating timestamps
  4321. @cindex timestamps, creating
  4322. For Org mode to recognize timestamps, they need to be in the specific
  4323. format. All commands listed below produce timestamps in the correct
  4324. format.
  4325. @table @kbd
  4326. @kindex C-c .
  4327. @item C-c .
  4328. Prompt for a date and insert a corresponding timestamp. When the cursor is
  4329. at an existing timestamp in the buffer, the command is used to modify this
  4330. timestamp instead of inserting a new one. When this command is used twice in
  4331. succession, a time range is inserted.
  4332. @c
  4333. @kindex C-c !
  4334. @item C-c !
  4335. Like @kbd{C-c .}, but insert an inactive timestamp that will not cause
  4336. an agenda entry.
  4337. @c
  4338. @kindex C-u C-c .
  4339. @kindex C-u C-c !
  4340. @item C-u C-c .
  4341. @itemx C-u C-c !
  4342. @vindex org-time-stamp-rounding-minutes
  4343. Like @kbd{C-c .} and @kbd{C-c !}, but use the alternative format which
  4344. contains date and time. The default time can be rounded to multiples of 5
  4345. minutes, see the option @code{org-time-stamp-rounding-minutes}.
  4346. @c
  4347. @kindex C-c <
  4348. @item C-c <
  4349. Insert a timestamp corresponding to the cursor date in the Calendar.
  4350. @c
  4351. @kindex C-c >
  4352. @item C-c >
  4353. Access the Emacs calendar for the current date. If there is a
  4354. timestamp in the current line, go to the corresponding date
  4355. instead.
  4356. @c
  4357. @kindex C-c C-o
  4358. @item C-c C-o
  4359. Access the agenda for the date given by the timestamp or -range at
  4360. point (@pxref{Weekly/daily agenda}).
  4361. @c
  4362. @kindex S-@key{left}
  4363. @kindex S-@key{right}
  4364. @item S-@key{left}
  4365. @itemx S-@key{right}
  4366. Change date at cursor by one day. These key bindings conflict with
  4367. shift-selection and related modes (@pxref{Conflicts}).
  4368. @c
  4369. @kindex S-@key{up}
  4370. @kindex S-@key{down}
  4371. @item S-@key{up}
  4372. @itemx S-@key{down}
  4373. Change the item under the cursor in a timestamp. The cursor can be on a
  4374. year, month, day, hour or minute. When the timestamp contains a time range
  4375. like @samp{15:30-16:30}, modifying the first time will also shift the second,
  4376. shifting the time block with constant length. To change the length, modify
  4377. the second time. Note that if the cursor is in a headline and not at a
  4378. timestamp, these same keys modify the priority of an item.
  4379. (@pxref{Priorities}). The key bindings also conflict with shift-selection and
  4380. related modes (@pxref{Conflicts}).
  4381. @c
  4382. @kindex C-c C-y
  4383. @cindex evaluate time range
  4384. @item C-c C-y
  4385. Evaluate a time range by computing the difference between start and end.
  4386. With a prefix argument, insert result after the time range (in a table: into
  4387. the following column).
  4388. @end table
  4389. @menu
  4390. * The date/time prompt:: How Org mode helps you entering date and time
  4391. * Custom time format:: Making dates look different
  4392. @end menu
  4393. @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
  4394. @subsection The date/time prompt
  4395. @cindex date, reading in minibuffer
  4396. @cindex time, reading in minibuffer
  4397. @vindex org-read-date-prefer-future
  4398. When Org mode prompts for a date/time, the default is shown in default
  4399. date/time format, and the prompt therefore seems to ask for a specific
  4400. format. But it will in fact accept any string containing some date and/or
  4401. time information, and it is really smart about interpreting your input. You
  4402. can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
  4403. copied from an email message. Org mode will find whatever information is in
  4404. there and derive anything you have not specified from the @emph{default date
  4405. and time}. The default is usually the current date and time, but when
  4406. modifying an existing timestamp, or when entering the second stamp of a
  4407. range, it is taken from the stamp in the buffer. When filling in
  4408. information, Org mode assumes that most of the time you will want to enter a
  4409. date in the future: if you omit the month/year and the given day/month is
  4410. @i{before} today, it will assume that you mean a future date@footnote{See the
  4411. variable @code{org-read-date-prefer-future}. You may set that variable to
  4412. the symbol @code{time} to even make a time before now shift the date to
  4413. tomorrow.}. If the date has been automatically shifted into the future, the
  4414. time prompt will show this with @samp{(=>F).}
  4415. For example, let's assume that today is @b{June 13, 2006}. Here is how
  4416. various inputs will be interpreted, the items filled in by Org mode are
  4417. in @b{bold}.
  4418. @example
  4419. 3-2-5 --> 2003-02-05
  4420. 2/5/3 --> 2003-02-05
  4421. 14 --> @b{2006}-@b{06}-14
  4422. 12 --> @b{2006}-@b{07}-12
  4423. 2/5 --> @b{2003}-02-05
  4424. Fri --> nearest Friday (defaultdate or later)
  4425. sep 15 --> @b{2006}-09-15
  4426. feb 15 --> @b{2007}-02-15
  4427. sep 12 9 --> 2009-09-12
  4428. 12:45 --> @b{2006}-@b{06}-@b{13} 12:45
  4429. 22 sept 0:34 --> @b{2006}-09-22 0:34
  4430. w4 --> ISO week for of the current year @b{2006}
  4431. 2012 w4 fri --> Friday of ISO week 4 in 2012
  4432. 2012-w04-5 --> Same as above
  4433. @end example
  4434. Furthermore you can specify a relative date by giving, as the
  4435. @emph{first} thing in the input: a plus/minus sign, a number and a
  4436. letter ([dwmy]) to indicate change in days, weeks, months, or years. With a
  4437. single plus or minus, the date is always relative to today. With a
  4438. double plus or minus, it is relative to the default date. If instead of
  4439. a single letter, you use the abbreviation of day name, the date will be
  4440. the nth such day. E.g.
  4441. @example
  4442. +0 --> today
  4443. . --> today
  4444. +4d --> four days from today
  4445. +4 --> same as above
  4446. +2w --> two weeks from today
  4447. ++5 --> five days from default date
  4448. +2tue --> second Tuesday from now.
  4449. @end example
  4450. @vindex parse-time-months
  4451. @vindex parse-time-weekdays
  4452. The function understands English month and weekday abbreviations. If
  4453. you want to use unabbreviated names and/or other languages, configure
  4454. the variables @code{parse-time-months} and @code{parse-time-weekdays}.
  4455. @cindex calendar, for selecting date
  4456. @vindex org-popup-calendar-for-date-prompt
  4457. Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
  4458. you don't need/want the calendar, configure the variable
  4459. @code{org-popup-calendar-for-date-prompt}.}. When you exit the date
  4460. prompt, either by clicking on a date in the calendar, or by pressing
  4461. @key{RET}, the date selected in the calendar will be combined with the
  4462. information entered at the prompt. You can control the calendar fully
  4463. from the minibuffer:
  4464. @kindex <
  4465. @kindex >
  4466. @kindex mouse-1
  4467. @kindex S-@key{right}
  4468. @kindex S-@key{left}
  4469. @kindex S-@key{down}
  4470. @kindex S-@key{up}
  4471. @kindex M-S-@key{right}
  4472. @kindex M-S-@key{left}
  4473. @kindex @key{RET}
  4474. @example
  4475. > / < @r{Scroll calendar forward/backward by one month.}
  4476. mouse-1 @r{Select date by clicking on it.}
  4477. S-@key{right}/@key{left} @r{One day forward/backward.}
  4478. S-@key{down}/@key{up} @r{One week forward/backward.}
  4479. M-S-@key{right}/@key{left} @r{One month forward/backward.}
  4480. @key{RET} @r{Choose date in calendar.}
  4481. @end example
  4482. @vindex org-read-date-display-live
  4483. The actions of the date/time prompt may seem complex, but I assure you they
  4484. will grow on you, and you will start getting annoyed by pretty much any other
  4485. way of entering a date/time out there. To help you understand what is going
  4486. on, the current interpretation of your input will be displayed live in the
  4487. minibuffer@footnote{If you find this distracting, turn the display of with
  4488. @code{org-read-date-display-live}.}.
  4489. @node Custom time format, , The date/time prompt, Creating timestamps
  4490. @subsection Custom time format
  4491. @cindex custom date/time format
  4492. @cindex time format, custom
  4493. @cindex date format, custom
  4494. @vindex org-display-custom-times
  4495. @vindex org-time-stamp-custom-formats
  4496. Org mode uses the standard ISO notation for dates and times as it is
  4497. defined in ISO 8601. If you cannot get used to this and require another
  4498. representation of date and time to keep you happy, you can get it by
  4499. customizing the variables @code{org-display-custom-times} and
  4500. @code{org-time-stamp-custom-formats}.
  4501. @table @kbd
  4502. @kindex C-c C-x C-t
  4503. @item C-c C-x C-t
  4504. Toggle the display of custom formats for dates and times.
  4505. @end table
  4506. @noindent
  4507. Org mode needs the default format for scanning, so the custom date/time
  4508. format does not @emph{replace} the default format---instead it is put
  4509. @emph{over} the default format using text properties. This has the
  4510. following consequences:
  4511. @itemize @bullet
  4512. @item
  4513. You cannot place the cursor onto a timestamp anymore, only before or
  4514. after.
  4515. @item
  4516. The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
  4517. each component of a timestamp. If the cursor is at the beginning of
  4518. the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
  4519. just like @kbd{S-@key{left}/@key{right}}. At the end of the stamp, the
  4520. time will be changed by one minute.
  4521. @item
  4522. If the timestamp contains a range of clock times or a repeater, these
  4523. will not be overlayed, but remain in the buffer as they were.
  4524. @item
  4525. When you delete a timestamp character-by-character, it will only
  4526. disappear from the buffer after @emph{all} (invisible) characters
  4527. belonging to the ISO timestamp have been removed.
  4528. @item
  4529. If the custom timestamp format is longer than the default and you are
  4530. using dates in tables, table alignment will be messed up. If the custom
  4531. format is shorter, things do work as expected.
  4532. @end itemize
  4533. @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
  4534. @section Deadlines and scheduling
  4535. A timestamp may be preceded by special keywords to facilitate planning:
  4536. @table @var
  4537. @item DEADLINE
  4538. @cindex DEADLINE keyword
  4539. Meaning: the task (most likely a TODO item, though not necessarily) is supposed
  4540. to be finished on that date.
  4541. @vindex org-deadline-warning-days
  4542. On the deadline date, the task will be listed in the agenda. In
  4543. addition, the agenda for @emph{today} will carry a warning about the
  4544. approaching or missed deadline, starting
  4545. @code{org-deadline-warning-days} before the due date, and continuing
  4546. until the entry is marked DONE. An example:
  4547. @example
  4548. *** TODO write article about the Earth for the Guide
  4549. The editor in charge is [[bbdb:Ford Prefect]]
  4550. DEADLINE: <2004-02-29 Sun>
  4551. @end example
  4552. You can specify a different lead time for warnings for a specific
  4553. deadlines using the following syntax. Here is an example with a warning
  4554. period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
  4555. @item SCHEDULED
  4556. @cindex SCHEDULED keyword
  4557. Meaning: you are planning to start working on that task on the given
  4558. date.
  4559. @vindex org-agenda-skip-scheduled-if-done
  4560. The headline will be listed under the given date@footnote{It will still
  4561. be listed on that date after it has been marked DONE. If you don't like
  4562. this, set the variable @code{org-agenda-skip-scheduled-if-done}.}. In
  4563. addition, a reminder that the scheduled date has passed will be present
  4564. in the compilation for @emph{today}, until the entry is marked DONE.
  4565. I.e. the task will automatically be forwarded until completed.
  4566. @example
  4567. *** TODO Call Trillian for a date on New Years Eve.
  4568. SCHEDULED: <2004-12-25 Sat>
  4569. @end example
  4570. @noindent
  4571. @b{Important:} Scheduling an item in Org mode should @i{not} be
  4572. understood in the same way that we understand @i{scheduling a meeting}.
  4573. Setting a date for a meeting is just a simple appointment, you should
  4574. mark this entry with a simple plain timestamp, to get this item shown
  4575. on the date where it applies. This is a frequent misunderstanding by
  4576. Org users. In Org mode, @i{scheduling} means setting a date when you
  4577. want to start working on an action item.
  4578. @end table
  4579. You may use timestamps with repeaters in scheduling and deadline
  4580. entries. Org mode will issue early and late warnings based on the
  4581. assumption that the timestamp represents the @i{nearest instance} of
  4582. the repeater. However, the use of diary sexp entries like
  4583. @c
  4584. @code{<%%(diary-float t 42)>}
  4585. @c
  4586. in scheduling and deadline timestamps is limited. Org mode does not
  4587. know enough about the internals of each sexp function to issue early and
  4588. late warnings. However, it will show the item on each day where the
  4589. sexp entry matches.
  4590. @menu
  4591. * Inserting deadline/schedule:: Planning items
  4592. * Repeated tasks:: Items that show up again and again
  4593. @end menu
  4594. @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
  4595. @subsection Inserting deadlines or schedules
  4596. The following commands allow you to quickly insert a deadline or to schedule
  4597. an item:
  4598. @table @kbd
  4599. @c
  4600. @kindex C-c C-d
  4601. @item C-c C-d
  4602. Insert @samp{DEADLINE} keyword along with a stamp. The insertion will happen
  4603. in the line directly following the headline. When called with a prefix arg,
  4604. an existing deadline will be removed from the entry. Depending on the
  4605. variable @code{org-log-redeadline}@footnote{with corresponding
  4606. @code{#+STARTUP} keywords @code{logredeadline}, @code{lognoteredeadline},
  4607. and @code{nologredeadline}}, a note will be taken when changing an existing
  4608. deadline.
  4609. @c FIXME Any CLOSED timestamp will be removed.????????
  4610. @c
  4611. @kindex C-c C-s
  4612. @item C-c C-s
  4613. Insert @samp{SCHEDULED} keyword along with a stamp. The insertion will
  4614. happen in the line directly following the headline. Any CLOSED timestamp
  4615. will be removed. When called with a prefix argument, remove the scheduling
  4616. date from the entry. Depending on the variable
  4617. @code{org-log-reschedule}@footnote{with corresponding @code{#+STARTUP}
  4618. keywords @code{logredeadline}, @code{lognoteredeadline}, and
  4619. @code{nologredeadline}}, a note will be taken when changing an existing
  4620. scheduling time.
  4621. @c
  4622. @kindex C-c C-x C-k
  4623. @kindex k a
  4624. @kindex k s
  4625. @item C-c C-x C-k
  4626. Mark the current entry for agenda action. After you have marked the entry
  4627. like this, you can open the agenda or the calendar to find an appropriate
  4628. date. With the cursor on the selected date, press @kbd{k s} or @kbd{k d} to
  4629. schedule the marked item.
  4630. @c
  4631. @kindex C-c / d
  4632. @cindex sparse tree, for deadlines
  4633. @item C-c / d
  4634. @vindex org-deadline-warning-days
  4635. Create a sparse tree with all deadlines that are either past-due, or
  4636. which will become due within @code{org-deadline-warning-days}.
  4637. With @kbd{C-u} prefix, show all deadlines in the file. With a numeric
  4638. prefix, check that many days. For example, @kbd{C-1 C-c / d} shows
  4639. all deadlines due tomorrow.
  4640. @c
  4641. @kindex C-c / b
  4642. @item C-c / b
  4643. Sparse tree for deadlines and scheduled items before a given date.
  4644. @c
  4645. @kindex C-c / a
  4646. @item C-c / a
  4647. Sparse tree for deadlines and scheduled items after a given date.
  4648. @end table
  4649. @node Repeated tasks, , Inserting deadline/schedule, Deadlines and scheduling
  4650. @subsection Repeated tasks
  4651. @cindex tasks, repeated
  4652. @cindex repeated tasks
  4653. Some tasks need to be repeated again and again. Org mode helps to
  4654. organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
  4655. or plain timestamp. In the following example
  4656. @example
  4657. ** TODO Pay the rent
  4658. DEADLINE: <2005-10-01 Sat +1m>
  4659. @end example
  4660. @noindent
  4661. the @code{+1m} is a repeater; the intended interpretation is that the task
  4662. has a deadline on <2005-10-01> and repeats itself every (one) month starting
  4663. from that time. If you need both a repeater and a special warning period in
  4664. a deadline entry, the repeater should come first and the warning period last:
  4665. @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
  4666. Deadlines and scheduled items produce entries in the agenda when they
  4667. are over-due, so it is important to be able to mark such an entry as
  4668. completed once you have done so. When you mark a DEADLINE or a SCHEDULE
  4669. with the TODO keyword DONE, it will no longer produce entries in the
  4670. agenda. The problem with this is, however, that then also the
  4671. @emph{next} instance of the repeated entry will not be active. Org mode
  4672. deals with this in the following way: When you try to mark such an entry
  4673. DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
  4674. timestamp by the repeater interval, and immediately set the entry state
  4675. back to TODO. In the example above, setting the state to DONE would
  4676. actually switch the date like this:
  4677. @example
  4678. ** TODO Pay the rent
  4679. DEADLINE: <2005-11-01 Tue +1m>
  4680. @end example
  4681. @vindex org-log-repeat
  4682. A timestamp@footnote{You can change this using the option
  4683. @code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat},
  4684. @code{lognoterepeat}, and @code{nologrepeat}. With @code{lognoterepeat}, you
  4685. will also be prompted for a note.} will be added under the deadline, to keep
  4686. a record that you actually acted on the previous instance of this deadline.
  4687. As a consequence of shifting the base date, this entry will no longer be
  4688. visible in the agenda when checking past dates, but all future instances
  4689. will be visible.
  4690. With the @samp{+1m} cookie, the date shift will always be exactly one
  4691. month. So if you have not paid the rent for three months, marking this
  4692. entry DONE will still keep it as an overdue deadline. Depending on the
  4693. task, this may not be the best way to handle it. For example, if you
  4694. forgot to call you father for 3 weeks, it does not make sense to call
  4695. him 3 times in a single day to make up for it. Finally, there are tasks
  4696. like changing batteries which should always repeat a certain time
  4697. @i{after} the last time you did it. For these tasks, Org mode has
  4698. special repeaters markers with @samp{++} and @samp{.+}. For example:
  4699. @example
  4700. ** TODO Call Father
  4701. DEADLINE: <2008-02-10 Sun ++1w>
  4702. Marking this DONE will shift the date by at least one week,
  4703. but also by as many weeks as it takes to get this date into
  4704. the future. However, it stays on a Sunday, even if you called
  4705. and marked it done on Saturday.
  4706. ** TODO Check the batteries in the smoke detectors
  4707. DEADLINE: <2005-11-01 Tue .+1m>
  4708. Marking this DONE will shift the date to one month after
  4709. today.
  4710. @end example
  4711. You may have both scheduling and deadline information for a specific
  4712. task---just make sure that the repeater intervals on both are the same.
  4713. An alternative to using a repeater is to create a number of copies of a task
  4714. subtree, with dates shifted in each copy. The command @kbd{C-c C-x c} was
  4715. created for this purpose, it is described in @ref{Structure editing}.
  4716. @node Clocking work time, Resolving idle time, Deadlines and scheduling, Dates and Times
  4717. @section Clocking work time
  4718. Org mode allows you to clock the time you spend on specific tasks in a
  4719. project. When you start working on an item, you can start the clock.
  4720. When you stop working on that task, or when you mark the task done, the
  4721. clock is stopped and the corresponding time interval is recorded. It
  4722. also computes the total time spent on each subtree of a project. And it
  4723. remembers a history or tasks recently clocked, to that you can jump quickly
  4724. between a number of tasks absorbing your time.
  4725. To save the clock history across Emacs sessions, use
  4726. @lisp
  4727. (setq org-clock-persist 'history)
  4728. (org-clock-persistence-insinuate)
  4729. @end lisp
  4730. When you clock into a new task after resuming Emacs, the incomplete
  4731. clock@footnote{To resume the clock under the assumption that you have worked
  4732. on this task while outside Emacs, use @code{(setq org-clock-persist t)}.}
  4733. will be found (@pxref{Resolving idle time}) and you will be prompted about
  4734. what to do with it.
  4735. @table @kbd
  4736. @kindex C-c C-x C-i
  4737. @item C-c C-x C-i
  4738. @vindex org-clock-into-drawer
  4739. Start the clock on the current item (clock-in). This inserts the CLOCK
  4740. keyword together with a timestamp. If this is not the first clocking of
  4741. this item, the multiple CLOCK lines will be wrapped into a
  4742. @code{:LOGBOOK:} drawer (see also the variable
  4743. @code{org-clock-into-drawer}). When called with a @kbd{C-u} prefix argument,
  4744. select the task from a list of recently clocked tasks. With two @kbd{C-u
  4745. C-u} prefixes, clock into the task at point and mark it as the default task.
  4746. The default task will always be available when selecting a clocking task,
  4747. with letter @kbd{d}.@*
  4748. @cindex property: CLOCK_MODELINE_TOTAL
  4749. @cindex property: LAST_REPEAT
  4750. @vindex org-clock-modeline-total
  4751. While the clock is running, the current clocking time is shown in the mode
  4752. line, along with the title of the task. The clock time shown will be all
  4753. time ever clocked for this task and its children. If the task has an effort
  4754. estimate (@pxref{Effort estimates}), the mode line displays the current
  4755. clocking time against it@footnote{To add an effort estimate ``on the fly'',
  4756. hook a function doing this to @code{org-clock-in-prepare-hook}.} If the task
  4757. is a repeating one (@pxref{Repeated tasks}), only the time since the last
  4758. reset of the task @footnote{as recorded by the @code{LAST_REPEAT} property}
  4759. will be shown. More control over what time is shown can be exercised with
  4760. the @code{CLOCK_MODELINE_TOTAL} property. It may have the values
  4761. @code{current} to show only the current clocking instance, @code{today} to
  4762. show all time clocked on this tasks today (see also the variable
  4763. @code{org-extend-today-until}), @code{all} to include all time, or
  4764. @code{auto} which is the default@footnote{See also the variable
  4765. @code{org-clock-modeline-total}.}.@* Clicking with @kbd{mouse-1} onto the
  4766. mode line entry will pop up a menu with clocking options.
  4767. @kindex C-c C-x C-o
  4768. @item C-c C-x C-o
  4769. @vindex org-log-note-clock-out
  4770. Stop the clock (clock-out). This inserts another timestamp at the same
  4771. location where the clock was last started. It also directly computes
  4772. the resulting time in inserts it after the time range as @samp{=>
  4773. HH:MM}. See the variable @code{org-log-note-clock-out} for the
  4774. possibility to record an additional note together with the clock-out
  4775. timestamp@footnote{The corresponding in-buffer setting is:
  4776. @code{#+STARTUP: lognoteclock-out}}.
  4777. @kindex C-c C-x C-e
  4778. @item C-c C-x C-e
  4779. Update the effort estimate for the current clock task.
  4780. @kindex C-c C-y
  4781. @kindex C-c C-c
  4782. @item C-c C-y @ @ @r{or}@ @ C-c C-c
  4783. Recompute the time interval after changing one of the timestamps. This
  4784. is only necessary if you edit the timestamps directly. If you change
  4785. them with @kbd{S-@key{cursor}} keys, the update is automatic.
  4786. @kindex C-c C-t
  4787. @item C-c C-t
  4788. Changing the TODO state of an item to DONE automatically stops the clock
  4789. if it is running in this same item.
  4790. @kindex C-c C-x C-x
  4791. @item C-c C-x C-x
  4792. Cancel the current clock. This is useful if a clock was started by
  4793. mistake, or if you ended up working on something else.
  4794. @kindex C-c C-x C-j
  4795. @item C-c C-x C-j
  4796. Jump to the entry that contains the currently running clock. With a
  4797. @kbd{C-u} prefix arg, select the target task from a list of recently clocked
  4798. tasks.
  4799. @kindex C-c C-x C-d
  4800. @item C-c C-x C-d
  4801. @vindex org-remove-highlights-with-change
  4802. Display time summaries for each subtree in the current buffer. This
  4803. puts overlays at the end of each headline, showing the total time
  4804. recorded under that heading, including the time of any subheadings. You
  4805. can use visibility cycling to study the tree, but the overlays disappear
  4806. when you change the buffer (see variable
  4807. @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
  4808. @kindex C-c C-x C-r
  4809. @item C-c C-x C-r
  4810. Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
  4811. report as an Org-mode table into the current file. When the cursor is
  4812. at an existing clock table, just update it. When called with a prefix
  4813. argument, jump to the first clock report in the current document and
  4814. update it.
  4815. @cindex #+BEGIN, clocktable
  4816. @example
  4817. #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
  4818. #+END: clocktable
  4819. @end example
  4820. @noindent
  4821. If such a block already exists at point, its content is replaced by the
  4822. new table. The @samp{BEGIN} line can specify options:
  4823. @example
  4824. :maxlevel @r{Maximum level depth to which times are listed in the table.}
  4825. :emphasize @r{When @code{t}, emphasize level one and level two items.}
  4826. :scope @r{The scope to consider. This can be any of the following:}
  4827. nil @r{the current buffer or narrowed region}
  4828. file @r{the full current buffer}
  4829. subtree @r{the subtree where the clocktable is located}
  4830. tree@var{N} @r{the surrounding level @var{N} tree, for example @code{tree3}}
  4831. tree @r{the surrounding level 1 tree}
  4832. agenda @r{all agenda files}
  4833. ("file"..) @r{scan these files}
  4834. file-with-archives @r{current file and its archives}
  4835. agenda-with-archives @r{all agenda files, including archives}
  4836. :block @r{The time block to consider. This block is specified either}
  4837. @r{absolute, or relative to the current time and may be any of}
  4838. @r{these formats:}
  4839. 2007-12-31 @r{New year eve 2007}
  4840. 2007-12 @r{December 2007}
  4841. 2007-W50 @r{ISO-week 50 in 2007}
  4842. 2007 @r{the year 2007}
  4843. today, yesterday, today-@var{N} @r{a relative day}
  4844. thisweek, lastweek, thisweek-@var{N} @r{a relative week}
  4845. thismonth, lastmonth, thismonth-@var{N} @r{a relative month}
  4846. thisyear, lastyear, thisyear-@var{N} @r{a relative year}
  4847. @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
  4848. :tstart @r{A time string specifying when to start considering times.}
  4849. :tend @r{A time string specifying when to stop considering times.}
  4850. :step @r{@code{week} or @code{day}, to split the table into chunks.}
  4851. @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
  4852. :link @r{Link the item headlines in the table to their origins.}
  4853. :formula @r{Content of a @code{#+TBLFM} line to be added and evaluated.}
  4854. @r{As a special case, @samp{:formula %} adds a column with % time.}
  4855. @r{If you do not specify a formula here, any existing formula.}
  4856. @r{below the clock table will survive updates and be evaluated.}
  4857. :timestamp @r{A timestamp for the entry, when available. Look for SCHEDULED,}
  4858. @r{DEADLINE, TIMESTAMP and TIMESTAMP_IA, in this order.}
  4859. @end example
  4860. To get a clock summary of the current level 1 tree, for the current
  4861. day, you could write
  4862. @example
  4863. #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
  4864. #+END: clocktable
  4865. @end example
  4866. @noindent
  4867. and to use a specific time range you could write@footnote{Note that all
  4868. parameters must be specified in a single line---the line is broken here
  4869. only to fit it into the manual.}
  4870. @example
  4871. #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
  4872. :tend "<2006-08-10 Thu 12:00>"
  4873. #+END: clocktable
  4874. @end example
  4875. A summary of the current subtree with % times would be
  4876. @example
  4877. #+BEGIN: clocktable :scope subtree :link t :formula %
  4878. #+END: clocktable
  4879. @end example
  4880. @kindex C-c C-c
  4881. @item C-c C-c
  4882. @kindex C-c C-x C-u
  4883. @itemx C-c C-x C-u
  4884. Update dynamic block at point. The cursor needs to be in the
  4885. @code{#+BEGIN} line of the dynamic block.
  4886. @kindex C-u C-c C-x C-u
  4887. @item C-u C-c C-x C-u
  4888. Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
  4889. you have several clock table blocks in a buffer.
  4890. @kindex S-@key{left}
  4891. @kindex S-@key{right}
  4892. @item S-@key{left}
  4893. @itemx S-@key{right}
  4894. Shift the current @code{:block} interval and update the table. The cursor
  4895. needs to be in the @code{#+BEGIN: clocktable} line for this command. If
  4896. @code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
  4897. @end table
  4898. The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
  4899. the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
  4900. worked on or closed during a day.
  4901. @node Resolving idle time, Effort estimates, Clocking work time, Dates and Times
  4902. @section Resolving idle time
  4903. @cindex resolve idle time
  4904. @cindex idle, resolve, dangling
  4905. If you clock in on a work item, and then walk away from your
  4906. computer---perhaps to take a phone call---you often need to ``resolve'' the
  4907. time you were away by either subtracting it from the current clock, or
  4908. applying it to another one.
  4909. @vindex org-clock-idle-time
  4910. By customizing the variable @code{org-clock-idle-time} to some integer, such
  4911. as 10 or 15, Emacs can alert you when you get back to your computer after
  4912. being idle for that many minutes@footnote{On computers using Mac OS X,
  4913. idleness is based on actual user idleness, not just Emacs' idle time. For
  4914. X11, you can install a utility program @file{x11idle.c}, available in the
  4915. UTILITIES directory of the Org git distribution, to get the same general
  4916. treatment of idleness. On other systems, idle time refers to Emacs idle time
  4917. only.}, and ask what you want to do with the idle time. There will be a
  4918. question waiting for you when you get back, indicating how much idle time has
  4919. passed (constantly updated with the current amount), as well as a set of
  4920. choices to correct the discrepancy:
  4921. @table @kbd
  4922. @item k
  4923. To keep some or all of the minutes and stay clocked in, press @kbd{k}. Org
  4924. will ask how many of the minutes to keep. Press @key{RET} to keep them all,
  4925. effectively changing nothing, or enter a number to keep that many minutes.
  4926. @item K
  4927. If you use the shift key and press @kbd{K}, it will keep however many minutes
  4928. you request and then immediately clock out of that task. If you keep all of
  4929. the minutes, this is the same as just clocking out of the current task.
  4930. @item s
  4931. To keep none of the minutes, use @kbd{s} to subtract all the away time from
  4932. the clock, and then check back in from the moment you returned.
  4933. @item S
  4934. To keep none of the minutes and just clock out at the start of the away time,
  4935. use the shift key and press @kbd{S}. Remember that using shift will always
  4936. leave you clocked out, no matter which option you choose.
  4937. @item C
  4938. To cancel the clock altogether, use @kbd{C}. Note that if instead of
  4939. cancelling you subtract the away time, and the resulting clock amount is less
  4940. than a minute, the clock will still be cancelled rather than clutter up the
  4941. log with an empty entry.
  4942. @end table
  4943. What if you subtracted those away minutes from the current clock, and now
  4944. want to apply them to a new clock? Simply clock in to any task immediately
  4945. after the subtraction. Org will notice that you have subtracted time ``on
  4946. the books'', so to speak, and will ask if you want to apply those minutes to
  4947. the next task you clock in on.
  4948. There is one other instance when this clock resolution magic occurs. Say you
  4949. were clocked in and hacking away, and suddenly your cat chased a mouse who
  4950. scared a hamster that crashed into your UPS's power button! You suddenly
  4951. lose all your buffers, but thanks to auto-save you still have your recent Org
  4952. mode changes, including your last clock in.
  4953. If you restart Emacs and clock into any task, Org will notice that you have a
  4954. dangling clock which was never clocked out from your last session. Using
  4955. that clock's starting time as the beginning of the unaccounted-for period,
  4956. Org will ask how you want to resolve that time. The logic and behavior is
  4957. identical to dealing with away time due to idleness, it's just happening due
  4958. to a recovery event rather than a set amount of idle time.
  4959. You can also check all the files visited by your Org agenda for dangling
  4960. clocks at any time using @kbd{M-x org-resolve-clocks}.
  4961. @node Effort estimates, Relative timer, Resolving idle time, Dates and Times
  4962. @section Effort estimates
  4963. @cindex effort estimates
  4964. @cindex property, Effort
  4965. @vindex org-effort-property
  4966. If you want to plan your work in a very detailed way, or if you need to
  4967. produce offers with quotations of the estimated work effort, you may want to
  4968. assign effort estimates to entries. If you are also clocking your work, you
  4969. may later want to compare the planned effort with the actual working time, a
  4970. great way to improve planning estimates. Effort estimates are stored in a
  4971. special property @samp{Effort}@footnote{You may change the property being
  4972. used with the variable @code{org-effort-property}.}. You can set the effort
  4973. for an entry with the following commands:
  4974. @table @kbd
  4975. @kindex C-c C-x e
  4976. @item C-c C-x e
  4977. Set the effort estimate for the current entry. With a numeric prefix
  4978. argument, set it to the NTH allowed value (see below). This command is also
  4979. accessible from the agenda with the @kbd{e} key.
  4980. @kindex C-c C-x C-e
  4981. @item C-c C-x C-e
  4982. Modify the effort estimate of the item currently being clocked.
  4983. @end table
  4984. Clearly the best way to work with effort estimates is through column view
  4985. (@pxref{Column view}). You should start by setting up discrete values for
  4986. effort estimates, and a @code{COLUMNS} format that displays these values
  4987. together with clock sums (if you want to clock your time). For a specific
  4988. buffer you can use
  4989. @example
  4990. #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00
  4991. #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
  4992. @end example
  4993. @noindent
  4994. @vindex org-global-properties
  4995. @vindex org-columns-default-format
  4996. or, even better, you can set up these values globally by customizing the
  4997. variables @code{org-global-properties} and @code{org-columns-default-format}.
  4998. In particular if you want to use this setup also in the agenda, a global
  4999. setup may be advised.
  5000. The way to assign estimates to individual items is then to switch to column
  5001. mode, and to use @kbd{S-@key{right}} and @kbd{S-@key{left}} to change the
  5002. value. The values you enter will immediately be summed up in the hierarchy.
  5003. In the column next to it, any clocked time will be displayed.
  5004. @vindex org-agenda-columns-add-appointments-to-effort-sum
  5005. If you switch to column view in the daily/weekly agenda, the effort column
  5006. will summarize the estimated work effort for each day@footnote{Please note
  5007. the pitfalls of summing hierarchical data in a flat list (@pxref{Agenda
  5008. column view}).}, and you can use this to find space in your schedule. To get
  5009. an overview of the entire part of the day that is committed, you can set the
  5010. option @code{org-agenda-columns-add-appointments-to-effort-sum}. The
  5011. appointments on a day that take place over a specified time interval will
  5012. then also be added to the load estimate of the day.
  5013. Effort estimates can be used in secondary agenda filtering that is triggered
  5014. with the @kbd{/} key in the agenda (@pxref{Agenda commands}). If you have
  5015. these estimates defined consistently, two or three key presses will narrow
  5016. down the list to stuff that fits into an available time slot.
  5017. @node Relative timer, , Effort estimates, Dates and Times
  5018. @section Taking notes with a relative timer
  5019. @cindex relative timer
  5020. When taking notes during, for example, a meeting or a video viewing, it can
  5021. be useful to have access to times relative to a starting time. Org provides
  5022. such a relative timer and make it easy to create timed notes.
  5023. @table @kbd
  5024. @kindex C-c C-x .
  5025. @item C-c C-x .
  5026. Insert a relative time into the buffer. The first time you use this, the
  5027. timer will be started. When called with a prefix argument, the timer is
  5028. restarted.
  5029. @kindex C-c C-x -
  5030. @item C-c C-x -
  5031. Insert a description list item with the current relative time. With a prefix
  5032. argument, first reset the timer to 0.
  5033. @kindex M-@key{RET}
  5034. @item M-@key{RET}
  5035. Once the timer list is started, you can also use @kbd{M-@key{RET}} to insert
  5036. new timer items.
  5037. @kindex C-c C-x ,
  5038. @item C-c C-x ,
  5039. Pause the timer, or continue it if it is already paused.
  5040. @c removed the sentence because it is redundant to the following item
  5041. @kindex C-u C-c C-x ,
  5042. @item C-u C-c C-x ,
  5043. Stop the timer. After this, you can only start a new timer, not continue the
  5044. old one. This command also removes the timer from the mode line.
  5045. @kindex C-c C-x 0
  5046. @item C-c C-x 0
  5047. Reset the timer without inserting anything into the buffer. By default, the
  5048. timer is reset to 0. When called with a @kbd{C-u} prefix, reset the timer to
  5049. specific starting offset. The user is prompted for the offset, with a
  5050. default taken from a timer string at point, if any, So this can be used to
  5051. restart taking notes after a break in the process. When called with a double
  5052. prefix argument @kbd{C-c C-u}, change all timer strings in the active region
  5053. by a certain amount. This can be used to fix timer strings if the timer was
  5054. not started at exactly the right moment.
  5055. @end table
  5056. @node Capture - Refile - Archive, Agenda Views, Dates and Times, Top
  5057. @chapter Capture - Refile - Archive
  5058. @cindex capture
  5059. An important part of any organization system is the ability to quickly
  5060. capture new ideas and tasks, and to associate reference material with them.
  5061. Org uses the @file{remember.el} package to create tasks, and stores files
  5062. related to a task (@i{attachments}) in a special directory. Once in the
  5063. system, tasks and projects need to be moved around. Moving completed project
  5064. trees to an archive file keeps the system compact and fast.
  5065. @menu
  5066. * Remember:: Capture new tasks/ideas with little interruption
  5067. * Attachments:: Add files to tasks.
  5068. * RSS Feeds:: Getting input from RSS feeds
  5069. * Protocols:: External (e.g. Browser) access to Emacs and Org
  5070. * Refiling notes:: Moving a tree from one place to another
  5071. * Archiving:: What to do with finished projects
  5072. @end menu
  5073. @node Remember, Attachments, Capture - Refile - Archive, Capture - Refile - Archive
  5074. @section Remember
  5075. @cindex @file{remember.el}
  5076. The Remember package by John Wiegley lets you store quick notes with little
  5077. interruption of your work flow. It is an excellent way to add new notes and
  5078. tasks to Org files. The @code{remember.el} package is part of Emacs 23, not
  5079. Emacs 22. See @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for
  5080. more information.
  5081. Org significantly expands the possibilities of Remember: you may define
  5082. templates for different note types, and associate target files and headlines
  5083. with specific templates. It also allows you to select the location where a
  5084. note should be stored interactively, on the fly.
  5085. @menu
  5086. * Setting up Remember for Org:: Some code for .emacs to get things going
  5087. * Remember templates:: Define the outline of different note types
  5088. * Storing notes:: Directly get the note to where it belongs
  5089. @end menu
  5090. @node Setting up Remember for Org, Remember templates, Remember, Remember
  5091. @subsection Setting up Remember for Org
  5092. The following customization will tell Remember to use Org files as
  5093. target, and to create annotations compatible with Org links.
  5094. @example
  5095. (org-remember-insinuate)
  5096. (setq org-directory "~/path/to/my/orgfiles/")
  5097. (setq org-default-notes-file (concat org-directory "/notes.org"))
  5098. (define-key global-map "\C-cr" 'org-remember)
  5099. @end example
  5100. @noindent
  5101. The last line binds the command @code{org-remember} to a global
  5102. key@footnote{Please select your own key, @kbd{C-c r} is only a
  5103. suggestion.}. @code{org-remember} basically just calls Remember,
  5104. but it makes a few things easier: if there is an active region, it will
  5105. automatically copy the region into the Remember buffer. It also allows
  5106. to jump to the buffer and location where Remember notes are being
  5107. stored: just call @code{org-remember} with a prefix argument. If you
  5108. use two prefix arguments, Org jumps to the location where the last
  5109. remember note was stored.
  5110. The Remember buffer will actually use @code{org-mode} as its major mode, so
  5111. that all editing features of Org mode are available. In addition to this, a
  5112. minor mode @code{org-remember-mode} is turned on, for the single purpose that
  5113. you can use its keymap @code{org-remember-mode-map} to overwrite some of
  5114. Org mode's key bindings.
  5115. You can also call @code{org-remember} in a special way from the agenda,
  5116. using the @kbd{k r} key combination. With this access, any timestamps
  5117. inserted by the selected Remember template (see below) will default to
  5118. the cursor date in the agenda, rather than to the current date.
  5119. @node Remember templates, Storing notes, Setting up Remember for Org, Remember
  5120. @subsection Remember templates
  5121. @cindex templates, for Remember
  5122. In combination with Org, you can use templates to generate
  5123. different types of Remember notes. For example, if you would like
  5124. to use one template to create general TODO entries, another one for
  5125. journal entries, and a third one for collecting random ideas, you could
  5126. use:
  5127. @example
  5128. (setq org-remember-templates
  5129. '(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks")
  5130. ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
  5131. ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
  5132. @end example
  5133. @vindex org-remember-default-headline
  5134. @vindex org-directory
  5135. @noindent In these entries, the first string is just a name, and the
  5136. character specifies how to select the template. It is useful if the
  5137. character is also the first letter of the name. The next string specifies
  5138. the template. Two more (optional) strings give the file in which, and the
  5139. headline under which, the new note should be stored. The file (if not
  5140. present or @code{nil}) defaults to @code{org-default-notes-file}, the heading
  5141. to @code{org-remember-default-headline}. If the file name is not an absolute
  5142. path, it will be interpreted relative to @code{org-directory}.
  5143. The heading can also be the symbols @code{top} or @code{bottom} to send notes
  5144. as level 1 entries to the beginning or end of the file, respectively. It may
  5145. also be the symbol @code{date-tree}. Then, a tree with year on level 1,
  5146. month on level 2 and day on level three will be build in the file, and the
  5147. entry will be filed into the tree under the current date@footnote{If the file
  5148. contains an entry with a @code{DATE_TREE} property, the entire date tree will
  5149. be build under that entry.}
  5150. An optional sixth element specifies the contexts in which the user can select
  5151. the template. This element can be a list of major modes or a function.
  5152. @code{org-remember} will first check whether the function returns @code{t} or
  5153. if we are in any of the listed major modes, and exclude templates for which
  5154. this condition is not fulfilled. Templates that do not specify this element
  5155. at all, or that use @code{nil} or @code{t} as a value will always be
  5156. selectable.
  5157. So for example:
  5158. @example
  5159. (setq org-remember-templates
  5160. '(("Bug" ?b "* BUG %?\n %i\n %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
  5161. ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org" "X" my-check)
  5162. ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
  5163. @end example
  5164. @noindent
  5165. The first template will only be available when invoking @code{org-remember}
  5166. from an buffer in @code{emacs-lisp-mode}. The second template will only be
  5167. available when the function @code{my-check} returns @code{t}. The third
  5168. template will be proposed in any context.
  5169. When you call @kbd{M-x org-remember} (or @kbd{M-x remember}) to remember
  5170. something, Org will prompt for a key to select the template (if you have
  5171. more than one template) and then prepare the buffer like
  5172. @example
  5173. * TODO
  5174. [[file:@var{link to where you called remember}]]
  5175. @end example
  5176. @noindent
  5177. During expansion of the template, special @kbd{%}-escapes@footnote{If you
  5178. need one of these sequences literally, escape the @kbd{%} with a backslash.}
  5179. allow dynamic insertion of content:
  5180. @example
  5181. %^@{@var{prompt}@} @r{prompt the user for a string and replace this sequence with it.}
  5182. @r{You may specify a default value and a completion table with}
  5183. @r{%^@{prompt|default|completion2|completion3...@}}
  5184. @r{The arrow keys access a prompt-specific history.}
  5185. %a @r{annotation, normally the link created with @code{org-store-link}}
  5186. %A @r{like @code{%a}, but prompt for the description part}
  5187. %i @r{initial content, the region when remember is called with C-u.}
  5188. @r{The entire text will be indented like @code{%i} itself.}
  5189. %t @r{timestamp, date only}
  5190. %T @r{timestamp with date and time}
  5191. %u, %U @r{like the above, but inactive timestamps}
  5192. %^t @r{like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}}
  5193. @r{You may define a prompt like @code{%^@{Birthday@}t}}
  5194. %n @r{user name (taken from @code{user-full-name})}
  5195. %c @r{Current kill ring head.}
  5196. %x @r{Content of the X clipboard.}
  5197. %^C @r{Interactive selection of which kill or clip to use.}
  5198. %^L @r{Like @code{%^C}, but insert as link.}
  5199. %^g @r{prompt for tags, with completion on tags in target file.}
  5200. %k @r{title of currently clocked task}
  5201. %K @r{link to currently clocked task}
  5202. %^G @r{prompt for tags, with completion all tags in all agenda files.}
  5203. %^@{@var{prop}@}p @r{Prompt the user for a value for property @var{prop}}
  5204. %:keyword @r{specific information for certain link types, see below}
  5205. %[@var{file}] @r{insert the contents of the file given by @var{file}}
  5206. %(@var{sexp}) @r{evaluate Elisp @var{sexp} and replace with the result}
  5207. %! @r{immediately store note after completing the template}
  5208. @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
  5209. %& @r{jump to target location immediately after storing note}
  5210. @end example
  5211. @noindent
  5212. For specific link types, the following keywords will be
  5213. defined@footnote{If you define your own link types (@pxref{Adding
  5214. hyperlink types}), any property you store with
  5215. @code{org-store-link-props} can be accessed in remember templates in a
  5216. similar way.}:
  5217. @vindex org-from-is-user-regexp
  5218. @example
  5219. Link type | Available keywords
  5220. -------------------+----------------------------------------------
  5221. bbdb | %:name %:company
  5222. bbdb | %::server %:port %:nick
  5223. vm, wl, mh, rmail | %:type %:subject %:message-id
  5224. | %:from %:fromname %:fromaddress
  5225. | %:to %:toname %:toaddress
  5226. | %: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}.}}
  5227. gnus | %:group, @r{for messages also all email fields}
  5228. w3, w3m | %:url
  5229. info | %:file %:node
  5230. calendar | %:date"
  5231. @end example
  5232. @noindent
  5233. To place the cursor after template expansion use:
  5234. @example
  5235. %? @r{After completing the template, position cursor here.}
  5236. @end example
  5237. @noindent
  5238. If you change your mind about which template to use, call
  5239. @code{org-remember} in the remember buffer. You may then select a new
  5240. template that will be filled with the previous context information.
  5241. @node Storing notes, , Remember templates, Remember
  5242. @subsection Storing notes
  5243. @vindex org-remember-clock-out-on-exit
  5244. When you are finished preparing a note with Remember, you have to press
  5245. @kbd{C-c C-c} to file the note away. If you have started the clock in the
  5246. Remember buffer, you will first be asked if you want to clock out
  5247. now@footnote{To avoid this query, configure the variable
  5248. @code{org-remember-clock-out-on-exit}.}. If you answer @kbd{n}, the clock
  5249. will continue to run after the note was filed away.
  5250. The handler will then store the note in the file and under the headline
  5251. specified in the template, or it will use the default file and headline. The
  5252. window configuration will be restored, sending you back to the working
  5253. context before the call to Remember. To re-use the location found during the
  5254. last call to Remember, exit the Remember buffer with @kbd{C-0 C-c C-c},
  5255. i.e. specify a zero prefix argument to @kbd{C-c C-c}. Another special case
  5256. is @kbd{C-2 C-c C-c} which files the note as a child of the currently clocked
  5257. item, and @kbd{C-3 C-c C-c} files as a sibling of the currently clocked item.
  5258. @vindex org-remember-store-without-prompt
  5259. If you want to store the note directly to a different place, use
  5260. @kbd{C-1 C-c C-c} instead to exit Remember@footnote{Configure the
  5261. variable @code{org-remember-store-without-prompt} to make this behavior
  5262. the default.}. The handler will then first prompt for a target file---if
  5263. you press @key{RET}, the value specified for the template is used.
  5264. Then the command offers the headings tree of the selected file, with the
  5265. cursor position at the default headline (if you specified one in the
  5266. template). You can either immediately press @key{RET} to get the note
  5267. placed there. Or you can use the following keys to find a different
  5268. location:
  5269. @example
  5270. @key{TAB} @r{Cycle visibility.}
  5271. @key{down} / @key{up} @r{Next/previous visible headline.}
  5272. n / p @r{Next/previous visible headline.}
  5273. f / b @r{Next/previous headline same level.}
  5274. u @r{One level up.}
  5275. @c 0-9 @r{Digit argument.}
  5276. @end example
  5277. @noindent
  5278. Pressing @key{RET} or @key{left} or @key{right}
  5279. then leads to the following result.
  5280. @vindex org-reverse-note-order
  5281. @multitable @columnfractions 0.2 0.15 0.65
  5282. @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
  5283. @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor, first or last
  5284. @item @tab @tab depending on @code{org-reverse-note-order}.
  5285. @item @tab @key{left}/@key{right} @tab as same level, before/after current heading
  5286. @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
  5287. @item @tab @tab depending on @code{org-reverse-note-order}.
  5288. @item not on headline @tab @key{RET}
  5289. @tab at cursor position, level taken from context.
  5290. @end multitable
  5291. Before inserting the text into a tree, the function ensures that the text has
  5292. a headline, i.e. a first line that starts with a @samp{*}. If not, a
  5293. headline is constructed from the current date. If you have indented the text
  5294. of the note below the headline, the indentation will be adapted if inserting
  5295. the note into the tree requires demotion from level 1.
  5296. @node Attachments, RSS Feeds, Remember, Capture - Refile - Archive
  5297. @section Attachments
  5298. @cindex attachments
  5299. @vindex org-attach-directory
  5300. It is often useful to associate reference material with an outline node/task.
  5301. Small chunks of plain text can simply be stored in the subtree of a project.
  5302. Hyperlinks (@pxref{Hyperlinks}) can be used to establish associations with
  5303. files that live elsewhere on your computer or in the cloud, like emails or
  5304. source code files belonging to a project. Another method is @i{attachments},
  5305. which are files located in a directory belonging to an outline node. Org
  5306. uses directories named by the unique ID of each entry. These directories are
  5307. located in the @file{data} directory which lives in the same directory where
  5308. your Org file lives@footnote{If you move entries or Org files from one
  5309. directory to another, you may want to configure @code{org-attach-directory}
  5310. to contain an absolute path.}. If you initialize this directory with
  5311. @code{git init}, Org will automatically commit changes when it sees them.
  5312. The attachment system has been contributed to Org by John Wiegley.
  5313. In cases where it seems better to do so, you can also attach a directory of your
  5314. choice to an entry. You can also make children inherit the attachment
  5315. directory from a parent, so that an entire subtree uses the same attached
  5316. directory.
  5317. @noindent The following commands deal with attachments.
  5318. @table @kbd
  5319. @kindex C-c C-a
  5320. @item C-c C-a
  5321. The dispatcher for commands related to the attachment system. After these
  5322. keys, a list of commands is displayed and you need to press an additional key
  5323. to select a command:
  5324. @table @kbd
  5325. @kindex C-c C-a a
  5326. @item a
  5327. @vindex org-attach-method
  5328. Select a file and move it into the task's attachment directory. The file
  5329. will be copied, moved, or linked, depending on @code{org-attach-method}.
  5330. Note that hard links are not supported on all systems.
  5331. @kindex C-c C-a c
  5332. @kindex C-c C-a m
  5333. @kindex C-c C-a l
  5334. @item c/m/l
  5335. Attach a file using the copy/move/link method.
  5336. Note that hard links are not supported on all systems.
  5337. @kindex C-c C-a n
  5338. @item n
  5339. Create a new attachment as an Emacs buffer.
  5340. @kindex C-c C-a z
  5341. @item z
  5342. Synchronize the current task with its attachment directory, in case you added
  5343. attachments yourself.
  5344. @kindex C-c C-a o
  5345. @item o
  5346. @vindex org-file-apps
  5347. Open current task's attachment. If there are more than one, prompt for a
  5348. file name first. Opening will follow the rules set by @code{org-file-apps}.
  5349. For more details, see the information on following hyperlinks
  5350. (@pxref{Handling links}).
  5351. @kindex C-c C-a O
  5352. @item O
  5353. Also open the attachment, but force opening the file in Emacs.
  5354. @kindex C-c C-a f
  5355. @item f
  5356. Open the current task's attachment directory.
  5357. @kindex C-c C-a F
  5358. @item F
  5359. Also open the directory, but force using @command{dired} in Emacs.
  5360. @kindex C-c C-a d
  5361. @item d
  5362. Select and delete a single attachment.
  5363. @kindex C-c C-a D
  5364. @item D
  5365. Delete all of a task's attachments. A safer way is to open the directory in
  5366. @command{dired} and delete from there.
  5367. @kindex C-c C-a s
  5368. @item C-c C-a s
  5369. @cindex property, ATTACH_DIR
  5370. Set a specific directory as the entry's attachment directory. This works by
  5371. putting the directory path into the @code{ATTACH_DIR} property.
  5372. @kindex C-c C-a i
  5373. @item C-c C-a i
  5374. @cindex property, ATTACH_DIR_INHERIT
  5375. Set the @code{ATTACH_DIR_INHERIT} property, so that children will use the
  5376. same directory for attachments as the parent does.
  5377. @end table
  5378. @end table
  5379. @node RSS Feeds, Protocols, Attachments, Capture - Refile - Archive
  5380. @section RSS feeds
  5381. @cindex RSS feeds
  5382. Org has the capability to add and change entries based on information found in
  5383. RSS feeds. You could use this to make a task out of each new podcast in a
  5384. podcast feed. Or you could use a phone-based note-creating service on the
  5385. web to import tasks into Org. To access feeds, you need to configure the
  5386. variable @code{org-feed-alist}. The docstring of this variable has detailed
  5387. information. Here is just an example:
  5388. @example
  5389. (setq org-feed-alist
  5390. '(("ReQall" "http://www.reqall.com/user/feeds/rss/a1b2c3....."
  5391. "~/org/feeds.org" "ReQall Entries")
  5392. @end example
  5393. @noindent
  5394. will configure that new items from the feed provided by @file{reqall.com}
  5395. will result in new entries in the file @file{~/org/feeds.org} under the
  5396. heading @samp{ReQall Entries}, whenever the following command is used:
  5397. @table @kbd
  5398. @kindex C-c C-x g
  5399. @item C-c C-x g
  5400. Collect items from the feeds configured in @code{org-feed-alist} and act upon
  5401. them.
  5402. @kindex C-c C-x G
  5403. @item C-c C-x G
  5404. Prompt for a feed name and go to the inbox configured for this feed.
  5405. @end table
  5406. Under the same headline, Org will create a drawer @samp{FEEDSTATUS} in which
  5407. it will store information about the status of items in the feed, to avoid
  5408. adding the same item several times. You should add @samp{FEEDSTATUS} to the
  5409. list of drawers in that file:
  5410. @example
  5411. #+DRAWERS: LOGBOOK PROPERTIES FEEDSTATUS
  5412. @end example
  5413. For more information, see @file{org-feed.el} and the docstring of
  5414. @code{org-feed-alist}.
  5415. @node Protocols, Refiling notes, RSS Feeds, Capture - Refile - Archive
  5416. @section Protocols for external access
  5417. @cindex protocols, for external access
  5418. @cindex emacsserver
  5419. You can set up Org for handling protocol calls from outside applications that
  5420. are passed to Emacs through the @file{emacsserver}. For example, you can
  5421. configure bookmarks in your web browser to send a link to the current page to
  5422. Org and create a note from it using Remember (@pxref{Remember}). Or you
  5423. could create a bookmark that will tell Emacs to open the local source file of
  5424. a remote website you are looking at with the browser. See
  5425. @uref{http://orgmode.org/worg/org-contrib/org-protocol.php} for detailed
  5426. documentation and setup instructions.
  5427. @node Refiling notes, Archiving, Protocols, Capture - Refile - Archive
  5428. @section Refiling notes
  5429. @cindex refiling notes
  5430. When reviewing the captured data, you may want to refile some of the entries
  5431. into a different list, for example into a project. Cutting, finding the
  5432. right location, and then pasting the note is cumbersome. To simplify this
  5433. process, you can use the following special command:
  5434. @table @kbd
  5435. @kindex C-c C-w
  5436. @item C-c C-w
  5437. @vindex org-reverse-note-order
  5438. @vindex org-refile-targets
  5439. @vindex org-refile-use-outline-path
  5440. @vindex org-outline-path-complete-in-steps
  5441. @vindex org-refile-allow-creating-parent-nodes
  5442. Refile the entry or region at point. This command offers possible locations
  5443. for refiling the entry and lets you select one with completion. The item (or
  5444. all items in the region) is filed below the target heading as a subitem.
  5445. Depending on @code{org-reverse-note-order}, it will be either the first or
  5446. last subitem.@*
  5447. By default, all level 1 headlines in the current buffer are considered to be
  5448. targets, but you can have more complex definitions across a number of files.
  5449. See the variable @code{org-refile-targets} for details. If you would like to
  5450. select a location via a file-path-like completion along the outline path, see
  5451. the variables @code{org-refile-use-outline-path} and
  5452. @code{org-outline-path-complete-in-steps}. If you would like to be able to
  5453. create new nodes as new parents for refiling on the fly, check the
  5454. variable @code{org-refile-allow-creating-parent-nodes}.
  5455. @kindex C-u C-c C-w
  5456. @item C-u C-c C-w
  5457. Use the refile interface to jump to a heading.
  5458. @kindex C-u C-u C-c C-w
  5459. @item C-u C-u C-c C-w
  5460. Jump to the location where @code{org-refile} last moved a tree to.
  5461. @item C-2 C-c C-w
  5462. Refile as the child of the item currently being clocked.
  5463. @end table
  5464. @node Archiving, , Refiling notes, Capture - Refile - Archive
  5465. @section Archiving
  5466. @cindex archiving
  5467. When a project represented by a (sub)tree is finished, you may want
  5468. to move the tree out of the way and to stop it from contributing to the
  5469. agenda. Archiving is important to keep your working files compact and global
  5470. searches like the construction of agenda views fast.
  5471. @table @kbd
  5472. @kindex C-c C-x C-a
  5473. @item C-c C-x C-a
  5474. @vindex org-archive-default-command
  5475. Archive the current entry using the command specified in the variable
  5476. @code{org-archive-default-command}.
  5477. @end table
  5478. @menu
  5479. * Moving subtrees:: Moving a tree to an archive file
  5480. * Internal archiving:: Switch off a tree but keep i in the file
  5481. @end menu
  5482. @node Moving subtrees, Internal archiving, Archiving, Archiving
  5483. @subsection Moving a tree to the archive file
  5484. @cindex external archiving
  5485. The most common archiving action is to move a project tree to another file,
  5486. the archive file.
  5487. @table @kbd
  5488. @kindex C-c $
  5489. @kindex C-c C-x C-s
  5490. @item C-c C-x C-s@ @r{or short} @ C-c $
  5491. @vindex org-archive-location
  5492. Archive the subtree starting at the cursor position to the location
  5493. given by @code{org-archive-location}.
  5494. @kindex C-u C-c C-x C-s
  5495. @item C-u C-c C-x C-s
  5496. Check if any direct children of the current headline could be moved to
  5497. the archive. To do this, each subtree is checked for open TODO entries.
  5498. If none are found, the command offers to move it to the archive
  5499. location. If the cursor is @emph{not} on a headline when this command
  5500. is invoked, the level 1 trees will be checked.
  5501. @end table
  5502. @cindex archive locations
  5503. The default archive location is a file in the same directory as the
  5504. current file, with the name derived by appending @file{_archive} to the
  5505. current file name. For information and examples on how to change this,
  5506. see the documentation string of the variable
  5507. @code{org-archive-location}. There is also an in-buffer option for
  5508. setting this variable, for example@footnote{For backward compatibility,
  5509. the following also works: If there are several such lines in a file,
  5510. each specifies the archive location for the text below it. The first
  5511. such line also applies to any text before its definition. However,
  5512. using this method is @emph{strongly} deprecated as it is incompatible
  5513. with the outline structure of the document. The correct method for
  5514. setting multiple archive locations in a buffer is using properties.}:
  5515. @cindex #+ARCHIVE
  5516. @example
  5517. #+ARCHIVE: %s_done::
  5518. @end example
  5519. @cindex property, ARCHIVE
  5520. @noindent
  5521. If you would like to have a special ARCHIVE location for a single entry
  5522. or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
  5523. location as the value (@pxref{Properties and Columns}).
  5524. @vindex org-archive-save-context-info
  5525. When a subtree is moved, it receives a number of special properties that
  5526. record context information like the file from where the entry came, its
  5527. outline path the archiving time etc. Configure the variable
  5528. @code{org-archive-save-context-info} to adjust the amount of information
  5529. added.
  5530. @node Internal archiving, , Moving subtrees, Archiving
  5531. @subsection Internal archiving
  5532. If you want to just switch off (for agenda views) certain subtrees without
  5533. moving them to a different file, you can use the @code{ARCHIVE tag}.
  5534. A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
  5535. its location in the outline tree, but behaves in the following way:
  5536. @itemize @minus
  5537. @item
  5538. @vindex org-cycle-open-archived-trees
  5539. It does not open when you attempt to do so with a visibility cycling
  5540. command (@pxref{Visibility cycling}). You can force cycling archived
  5541. subtrees with @kbd{C-@key{TAB}}, or by setting the option
  5542. @code{org-cycle-open-archived-trees}. Also normal outline commands like
  5543. @code{show-all} will open archived subtrees.
  5544. @item
  5545. @vindex org-sparse-tree-open-archived-trees
  5546. During sparse tree construction (@pxref{Sparse trees}), matches in
  5547. archived subtrees are not exposed, unless you configure the option
  5548. @code{org-sparse-tree-open-archived-trees}.
  5549. @item
  5550. @vindex org-agenda-skip-archived-trees
  5551. During agenda view construction (@pxref{Agenda Views}), the content of
  5552. archived trees is ignored unless you configure the option
  5553. @code{org-agenda-skip-archived-trees}, in which case these trees will always
  5554. be included. In the agenda you can press @kbd{v a} to get archives
  5555. temporarily included.
  5556. @item
  5557. @vindex org-export-with-archived-trees
  5558. Archived trees are not exported (@pxref{Exporting}), only the headline
  5559. is. Configure the details using the variable
  5560. @code{org-export-with-archived-trees}.
  5561. @item
  5562. @vindex org-columns-skip-arrchived-trees
  5563. Archived trees are excluded from column view unless the variable
  5564. @code{org-columns-skip-arrchived-trees} is configured to @code{nil}.
  5565. @end itemize
  5566. The following commands help managing the ARCHIVE tag:
  5567. @table @kbd
  5568. @kindex C-c C-x a
  5569. @item C-c C-x a
  5570. Toggle the ARCHIVE tag for the current headline. When the tag is set,
  5571. the headline changes to a shadowed face, and the subtree below it is
  5572. hidden.
  5573. @kindex C-u C-c C-x a
  5574. @item C-u C-c C-x a
  5575. Check if any direct children of the current headline should be archived.
  5576. To do this, each subtree is checked for open TODO entries. If none are
  5577. found, the command offers to set the ARCHIVE tag for the child. If the
  5578. cursor is @emph{not} on a headline when this command is invoked, the
  5579. level 1 trees will be checked.
  5580. @kindex C-@kbd{TAB}
  5581. @item C-@kbd{TAB}
  5582. Cycle a tree even if it is tagged with ARCHIVE.
  5583. @kindex C-c C-x A
  5584. @item C-c C-x A
  5585. Move the current entry to the @emph{Archive Sibling}. This is a sibling of
  5586. the entry with the heading @samp{Archive} and the tag @samp{ARCHIVE}. The
  5587. entry becomes a child of that sibling and in this way retains a lot of its
  5588. original context, including inherited tags and approximate position in the
  5589. outline.
  5590. @end table
  5591. @node Agenda Views, Markup, Capture - Refile - Archive, Top
  5592. @chapter Agenda Views
  5593. @cindex agenda views
  5594. Due to the way Org works, TODO items, time-stamped items, and
  5595. tagged headlines can be scattered throughout a file or even a number of
  5596. files. To get an overview of open action items, or of events that are
  5597. important for a particular date, this information must be collected,
  5598. sorted and displayed in an organized way.
  5599. Org can select items based on various criteria and display them
  5600. in a separate buffer. Seven different view types are provided:
  5601. @itemize @bullet
  5602. @item
  5603. an @emph{agenda} that is like a calendar and shows information
  5604. for specific dates,
  5605. @item
  5606. a @emph{TODO list} that covers all unfinished
  5607. action items,
  5608. @item
  5609. a @emph{match view}, showings headlines based on the tags, properties, and
  5610. TODO state associated with them,
  5611. @item
  5612. a @emph{timeline view} that shows all events in a single Org file,
  5613. in time-sorted view,
  5614. @item
  5615. a @emph{text search view} that shows all entries from multiple files
  5616. that contain specified keywords,
  5617. @item
  5618. a @emph{stuck projects view} showing projects that currently don't move
  5619. along, and
  5620. @item
  5621. @emph{custom views} that are special searches and combinations of different
  5622. views.
  5623. @end itemize
  5624. @noindent
  5625. The extracted information is displayed in a special @emph{agenda
  5626. buffer}. This buffer is read-only, but provides commands to visit the
  5627. corresponding locations in the original Org files, and even to
  5628. edit these files remotely.
  5629. @vindex org-agenda-window-setup
  5630. @vindex org-agenda-restore-windows-after-quit
  5631. Two variables control how the agenda buffer is displayed and whether the
  5632. window configuration is restored when the agenda exits:
  5633. @code{org-agenda-window-setup} and
  5634. @code{org-agenda-restore-windows-after-quit}.
  5635. @menu
  5636. * Agenda files:: Files being searched for agenda information
  5637. * Agenda dispatcher:: Keyboard access to agenda views
  5638. * Built-in agenda views:: What is available out of the box?
  5639. * Presentation and sorting:: How agenda items are prepared for display
  5640. * Agenda commands:: Remote editing of Org trees
  5641. * Custom agenda views:: Defining special searches and views
  5642. * Exporting Agenda Views:: Writing a view to a file
  5643. * Agenda column view:: Using column view for collected entries
  5644. @end menu
  5645. @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
  5646. @section Agenda files
  5647. @cindex agenda files
  5648. @cindex files for agenda
  5649. @vindex org-agenda-files
  5650. The information to be shown is normally collected from all @emph{agenda
  5651. files}, the files listed in the variable
  5652. @code{org-agenda-files}@footnote{If the value of that variable is not a
  5653. list, but a single file name, then the list of agenda files will be
  5654. maintained in that external file.}. If a directory is part of this list,
  5655. all files with the extension @file{.org} in this directory will be part
  5656. of the list.
  5657. Thus, even if you only work with a single Org file, that file should
  5658. be put into the list@footnote{When using the dispatcher, pressing
  5659. @kbd{<} before selecting a command will actually limit the command to
  5660. the current file, and ignore @code{org-agenda-files} until the next
  5661. dispatcher command.}. You can customize @code{org-agenda-files}, but
  5662. the easiest way to maintain it is through the following commands
  5663. @cindex files, adding to agenda list
  5664. @table @kbd
  5665. @kindex C-c [
  5666. @item C-c [
  5667. Add current file to the list of agenda files. The file is added to
  5668. the front of the list. If it was already in the list, it is moved to
  5669. the front. With a prefix argument, file is added/moved to the end.
  5670. @kindex C-c ]
  5671. @item C-c ]
  5672. Remove current file from the list of agenda files.
  5673. @kindex C-,
  5674. @kindex C-'
  5675. @item C-,
  5676. @itemx C-'
  5677. Cycle through agenda file list, visiting one file after the other.
  5678. @kindex M-x org-iswitchb
  5679. @item M-x org-iswitchb
  5680. Command to use an @code{iswitchb}-like interface to switch to and between Org
  5681. buffers.
  5682. @end table
  5683. @noindent
  5684. The Org menu contains the current list of files and can be used
  5685. to visit any of them.
  5686. If you would like to focus the agenda temporarily on a file not in
  5687. this list, or on just one file in the list, or even on only a subtree in a
  5688. file, then this can be done in different ways. For a single agenda command,
  5689. you may press @kbd{<} once or several times in the dispatcher
  5690. (@pxref{Agenda dispatcher}). To restrict the agenda scope for an
  5691. extended period, use the following commands:
  5692. @table @kbd
  5693. @kindex C-c C-x <
  5694. @item C-c C-x <
  5695. Permanently restrict the agenda to the current subtree. When with a
  5696. prefix argument, or with the cursor before the first headline in a file,
  5697. the agenda scope is set to the entire file. This restriction remains in
  5698. effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
  5699. or @kbd{>} in the agenda dispatcher. If there is a window displaying an
  5700. agenda view, the new restriction takes effect immediately.
  5701. @kindex C-c C-x >
  5702. @item C-c C-x >
  5703. Remove the permanent restriction created by @kbd{C-c C-x <}.
  5704. @end table
  5705. @noindent
  5706. When working with @file{speedbar.el}, you can use the following commands in
  5707. the Speedbar frame:
  5708. @table @kbd
  5709. @kindex <
  5710. @item < @r{in the speedbar frame}
  5711. Permanently restrict the agenda to the item---either an Org file or a subtree
  5712. in such a file---at the cursor in the Speedbar frame.
  5713. If there is a window displaying an agenda view, the new restriction takes
  5714. effect immediately.
  5715. @kindex >
  5716. @item > @r{in the speedbar frame}
  5717. Lift the restriction.
  5718. @end table
  5719. @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
  5720. @section The agenda dispatcher
  5721. @cindex agenda dispatcher
  5722. @cindex dispatching agenda commands
  5723. The views are created through a dispatcher, which should be bound to a
  5724. global key---for example @kbd{C-c a} (@pxref{Installation}). In the
  5725. following we will assume that @kbd{C-c a} is indeed how the dispatcher
  5726. is accessed and list keyboard access to commands accordingly. After
  5727. pressing @kbd{C-c a}, an additional letter is required to execute a
  5728. command. The dispatcher offers the following default commands:
  5729. @table @kbd
  5730. @item a
  5731. Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
  5732. @item t @r{/} T
  5733. Create a list of all TODO items (@pxref{Global TODO list}).
  5734. @item m @r{/} M
  5735. Create a list of headlines matching a TAGS expression (@pxref{Matching
  5736. tags and properties}).
  5737. @item L
  5738. Create the timeline view for the current buffer (@pxref{Timeline}).
  5739. @item s
  5740. Create a list of entries selected by a boolean expression of keywords
  5741. and/or regular expressions that must or must not occur in the entry.
  5742. @item /
  5743. @vindex org-agenda-text-search-extra-files
  5744. Search for a regular expression in all agenda files and additionally in
  5745. the files listed in @code{org-agenda-text-search-extra-files}. This
  5746. uses the Emacs command @code{multi-occur}. A prefix argument can be
  5747. used to specify the number of context lines for each match, default is
  5748. 1.
  5749. @item # @r{/} !
  5750. Create a list of stuck projects (@pxref{Stuck projects}).
  5751. @item <
  5752. Restrict an agenda command to the current buffer@footnote{For backward
  5753. compatibility, you can also press @kbd{1} to restrict to the current
  5754. buffer.}. After pressing @kbd{<}, you still need to press the character
  5755. selecting the command.
  5756. @item < <
  5757. If there is an active region, restrict the following agenda command to
  5758. the region. Otherwise, restrict it to the current subtree@footnote{For
  5759. backward compatibility, you can also press @kbd{0} to restrict to the
  5760. current region/subtree.}. After pressing @kbd{< <}, you still need to press the
  5761. character selecting the command.
  5762. @end table
  5763. You can also define custom commands that will be accessible through the
  5764. dispatcher, just like the default commands. This includes the
  5765. possibility to create extended agenda buffers that contain several
  5766. blocks together, for example the weekly agenda, the global TODO list and
  5767. a number of special tags matches. @xref{Custom agenda views}.
  5768. @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
  5769. @section The built-in agenda views
  5770. In this section we describe the built-in views.
  5771. @menu
  5772. * Weekly/daily agenda:: The calendar page with current tasks
  5773. * Global TODO list:: All unfinished action items
  5774. * Matching tags and properties:: Structured information with fine-tuned search
  5775. * Timeline:: Time-sorted view for single file
  5776. * Search view:: Find entries by searching for text
  5777. * Stuck projects:: Find projects you need to review
  5778. @end menu
  5779. @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
  5780. @subsection The weekly/daily agenda
  5781. @cindex agenda
  5782. @cindex weekly agenda
  5783. @cindex daily agenda
  5784. The purpose of the weekly/daily @emph{agenda} is to act like a page of a
  5785. paper agenda, showing all the tasks for the current week or day.
  5786. @table @kbd
  5787. @cindex org-agenda, command
  5788. @kindex C-c a a
  5789. @item C-c a a
  5790. @vindex org-agenda-ndays
  5791. Compile an agenda for the current week from a list of Org files. The agenda
  5792. shows the entries for each day. With a numeric prefix@footnote{For backward
  5793. compatibility, the universal prefix @kbd{C-u} causes all TODO entries to be
  5794. listed before the agenda. This feature is deprecated, use the dedicated TODO
  5795. list, or a block agenda instead (@pxref{Block agenda}).} (like @kbd{C-u 2 1
  5796. C-c a a}) you may set the number of days to be displayed (see also the
  5797. variable @code{org-agenda-ndays})
  5798. @end table
  5799. Remote editing from the agenda buffer means, for example, that you can
  5800. change the dates of deadlines and appointments from the agenda buffer.
  5801. The commands available in the Agenda buffer are listed in @ref{Agenda
  5802. commands}.
  5803. @subsubheading Calendar/Diary integration
  5804. @cindex calendar integration
  5805. @cindex diary integration
  5806. Emacs contains the calendar and diary by Edward M. Reingold. The
  5807. calendar displays a three-month calendar with holidays from different
  5808. countries and cultures. The diary allows you to keep track of
  5809. anniversaries, lunar phases, sunrise/set, recurrent appointments
  5810. (weekly, monthly) and more. In this way, it is quite complementary to
  5811. Org. It can be very useful to combine output from Org with
  5812. the diary.
  5813. In order to include entries from the Emacs diary into Org mode's
  5814. agenda, you only need to customize the variable
  5815. @lisp
  5816. (setq org-agenda-include-diary t)
  5817. @end lisp
  5818. @noindent After that, everything will happen automatically. All diary
  5819. entries including holidays, anniversaries, etc., will be included in the
  5820. agenda buffer created by Org mode. @key{SPC}, @key{TAB}, and
  5821. @key{RET} can be used from the agenda buffer to jump to the diary
  5822. file in order to edit existing diary entries. The @kbd{i} command to
  5823. insert new entries for the current date works in the agenda buffer, as
  5824. well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
  5825. Sunrise/Sunset times, show lunar phases and to convert to other
  5826. calendars, respectively. @kbd{c} can be used to switch back and forth
  5827. between calendar and agenda.
  5828. If you are using the diary only for sexp entries and holidays, it is
  5829. faster to not use the above setting, but instead to copy or even move
  5830. the entries into an Org file. Org mode evaluates diary-style sexp
  5831. entries, and does it faster because there is no overhead for first
  5832. creating the diary display. Note that the sexp entries must start at
  5833. the left margin, no whitespace is allowed before them. For example,
  5834. the following segment of an Org file will be processed and entries
  5835. will be made in the agenda:
  5836. @example
  5837. * Birthdays and similar stuff
  5838. #+CATEGORY: Holiday
  5839. %%(org-calendar-holiday) ; special function for holiday names
  5840. #+CATEGORY: Ann
  5841. %%(diary-anniversary 5 14 1956)@footnote{Note that the order of the arguments (month, day, year) depends on the setting of @code{calendar-date-style}.} Arthur Dent is %d years old
  5842. %%(diary-anniversary 10 2 1869) Mahatma Gandhi would be %d years old
  5843. @end example
  5844. @subsubheading Anniversaries from BBDB
  5845. @cindex BBDB, anniversaries
  5846. @cindex anniversaries, from BBDB
  5847. If you are using the Big Brothers Database to store your contacts, you will
  5848. very likely prefer to store anniversaries in BBDB rather than in a
  5849. separate Org or diary file. Org supports this and will show BBDB
  5850. anniversaries as part of the agenda. All you need to do is to add the
  5851. following to one your your agenda files:
  5852. @example
  5853. * Anniversaries
  5854. :PROPERTIES:
  5855. :CATEGORY: Anniv
  5856. :END
  5857. %%(org-bbdb-anniversaries)
  5858. @end example
  5859. You can then go ahead and define anniversaries for a BBDB record. Basically,
  5860. you need to press @kbd{C-o anniversary @key{RET}} with the cursor in a BBDB
  5861. record and then add the date in the format @code{YYYY-MM-DD}, followed by a
  5862. space and the class of the anniversary (@samp{birthday} or @samp{wedding}, or
  5863. a format string). If you omit the class, it will default to @samp{birthday}.
  5864. Here are a few examples, the header for the file @file{org-bbdb.el} contains
  5865. more detailed information.
  5866. @example
  5867. 1973-06-22
  5868. 1955-08-02 wedding
  5869. 2008-04-14 %s released version 6.01 of org-mode, %d years ago
  5870. @end example
  5871. After a change to BBDB, or for the first agenda display during an Emacs
  5872. session, the agenda display will suffer a short delay as Org updates its
  5873. hash with anniversaries. However, from then on things will be very fast---much
  5874. faster in fact than a long list of @samp{%%(diary-anniversary)} entries
  5875. in an Org or Diary file.
  5876. @subsubheading Appointment reminders
  5877. @cindex @file{appt.el}
  5878. @cindex appointment reminders
  5879. Org can interact with Emacs appointments notification facility. To add all
  5880. the appointments of your agenda files, use the command
  5881. @code{org-agenda-to-appt}. This command also lets you filter through the
  5882. list of your appointments and add only those belonging to a specific category
  5883. or matching a regular expression. See the docstring for details.
  5884. @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
  5885. @subsection The global TODO list
  5886. @cindex global TODO list
  5887. @cindex TODO list, global
  5888. The global TODO list contains all unfinished TODO items formatted and
  5889. collected into a single place.
  5890. @table @kbd
  5891. @kindex C-c a t
  5892. @item C-c a t
  5893. Show the global TODO list. This collects the TODO items from all
  5894. agenda files (@pxref{Agenda Views}) into a single buffer. The buffer is in
  5895. @code{agenda-mode}, so there are commands to examine and manipulate
  5896. the TODO entries directly from that buffer (@pxref{Agenda commands}).
  5897. @kindex C-c a T
  5898. @item C-c a T
  5899. @cindex TODO keyword matching
  5900. @vindex org-todo-keywords
  5901. Like the above, but allows selection of a specific TODO keyword. You
  5902. can also do this by specifying a prefix argument to @kbd{C-c a t}. With
  5903. a @kbd{C-u} prefix you are prompted for a keyword, and you may also
  5904. specify several keywords by separating them with @samp{|} as the boolean OR
  5905. operator. With a numeric prefix, the nth keyword in
  5906. @code{org-todo-keywords} is selected.
  5907. @kindex r
  5908. The @kbd{r} key in the agenda buffer regenerates it, and you can give
  5909. a prefix argument to this command to change the selected TODO keyword,
  5910. for example @kbd{3 r}. If you often need a search for a specific
  5911. keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
  5912. Matching specific TODO keywords can also be done as part of a tags
  5913. search (@pxref{Tag searches}).
  5914. @end table
  5915. Remote editing of TODO items means that you can change the state of a
  5916. TODO entry with a single key press. The commands available in the
  5917. TODO list are described in @ref{Agenda commands}.
  5918. @cindex sublevels, inclusion into TODO list
  5919. Normally the global TODO list simply shows all headlines with TODO
  5920. keywords. This list can become very long. There are two ways to keep
  5921. it more compact:
  5922. @itemize @minus
  5923. @item
  5924. @vindex org-agenda-todo-ignore-scheduled
  5925. @vindex org-agenda-todo-ignore-deadlines
  5926. @vindex org-agenda-todo-ignore-with-date
  5927. Some people view a TODO item that has been @emph{scheduled} for execution or
  5928. have a @emph{deadline} (@pxref{Timestamps}) as no longer @emph{open}.
  5929. Configure the variables @code{org-agenda-todo-ignore-scheduled},
  5930. @code{org-agenda-todo-ignore-deadlines}, and/or
  5931. @code{org-agenda-todo-ignore-with-date} to exclude such items from the
  5932. global TODO list.
  5933. @item
  5934. @vindex org-agenda-todo-list-sublevels
  5935. TODO items may have sublevels to break up the task into subtasks. In
  5936. such cases it may be enough to list only the highest level TODO headline
  5937. and omit the sublevels from the global list. Configure the variable
  5938. @code{org-agenda-todo-list-sublevels} to get this behavior.
  5939. @end itemize
  5940. @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
  5941. @subsection Matching tags and properties
  5942. @cindex matching, of tags
  5943. @cindex matching, of properties
  5944. @cindex tags view
  5945. @cindex match view
  5946. If headlines in the agenda files are marked with @emph{tags} (@pxref{Tags}),
  5947. or have properties (@pxref{Properties and Columns}), you can select headlines
  5948. based on this metadata and collect them into an agenda buffer. The match
  5949. syntax described here also applies when creating sparse trees with @kbd{C-c /
  5950. m}.
  5951. @table @kbd
  5952. @kindex C-c a m
  5953. @item C-c a m
  5954. Produce a list of all headlines that match a given set of tags. The
  5955. command prompts for a selection criterion, which is a boolean logic
  5956. expression with tags, like @samp{+work+urgent-withboss} or
  5957. @samp{work|home} (@pxref{Tags}). If you often need a specific search,
  5958. define a custom command for it (@pxref{Agenda dispatcher}).
  5959. @kindex C-c a M
  5960. @item C-c a M
  5961. @vindex org-tags-match-list-sublevels
  5962. @vindex org-agenda-tags-todo-honor-ignore-options
  5963. Like @kbd{C-c a m}, but only select headlines that are also TODO items and
  5964. force checking subitems (see variable @code{org-tags-match-list-sublevels}).
  5965. To exclude scheduled/deadline items, see the variable
  5966. @code{org-agenda-tags-todo-honor-ignore-options}. Matching specific TODO
  5967. keywords together with a tags match is also possible, see @ref{Tag searches}.
  5968. @end table
  5969. The commands available in the tags list are described in @ref{Agenda
  5970. commands}.
  5971. @subsubheading Match syntax
  5972. @cindex Boolean logic, for tag/property searches
  5973. A search string can use Boolean operators @samp{&} for AND and @samp{|} for
  5974. OR. @samp{&} binds more strongly than @samp{|}. Parentheses are currently
  5975. not implemented. Each element in the search is either a tag, a regular
  5976. expression matching tags, or an expression like @code{PROPERTY OPERATOR
  5977. VALUE} with a comparison operator, accessing a property value. Each element
  5978. may be preceded by @samp{-}, to select against it, and @samp{+} is syntactic
  5979. sugar for positive selection. The AND operator @samp{&} is optional when
  5980. @samp{+} or @samp{-} is present. Here are some examples, using only tags.
  5981. @table @samp
  5982. @item +work-boss
  5983. Select headlines tagged @samp{:work:}, but discard those also tagged
  5984. @samp{:boss:}.
  5985. @item work|laptop
  5986. Selects lines tagged @samp{:work:} or @samp{:laptop:}.
  5987. @item work|laptop+night
  5988. Like before, but require the @samp{:laptop:} lines to be tagged also
  5989. @samp{:night:}.
  5990. @end table
  5991. @cindex regular expressions, with tags search
  5992. Instead of a tag, you may also specify a regular expression enclosed in curly
  5993. braces. For example,
  5994. @samp{work+@{^boss.*@}} matches headlines that contain the tag
  5995. @samp{:work:} and any tag @i{starting} with @samp{boss}.
  5996. @cindex TODO keyword matching, with tags search
  5997. @cindex level, require for tags/property match
  5998. @cindex category, require for tags/property match
  5999. @vindex org-odd-levels-only
  6000. You may also test for properties (@pxref{Properties and Columns}) at the same
  6001. time as matching tags. The properties may be real properties, or special
  6002. properties that represent other metadata (@pxref{Special properties}). For
  6003. example, the ``property'' @code{TODO} represents the TODO keyword of the
  6004. entry. Or, the ``property'' @code{LEVEL} represents the level of an entry.
  6005. So a search @samp{+LEVEL=3+boss-TODO="DONE"} lists all level three headlines
  6006. that have the tag @samp{boss} and are @emph{not} marked with the TODO keyword
  6007. DONE. In buffers with @code{org-odd-levels-only} set, @samp{LEVEL} does not
  6008. count the number of stars, but @samp{LEVEL=2} will correspond to 3 stars etc.
  6009. Here are more examples:
  6010. @table @samp
  6011. @item work+TODO="WAITING"
  6012. Select @samp{:work:}-tagged TODO lines with the specific TODO
  6013. keyword @samp{WAITING}.
  6014. @item work+TODO="WAITING"|home+TODO="WAITING"
  6015. Waiting tasks both at work and at home.
  6016. @end table
  6017. When matching properties, a number of different operators can be used to test
  6018. the value of a property. Here is a complex example:
  6019. @example
  6020. +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2 \
  6021. +With=@{Sarah\|Denny@}+SCHEDULED>="<2008-10-11>"
  6022. @end example
  6023. @noindent
  6024. The type of comparison will depend on how the comparison value is written:
  6025. @itemize @minus
  6026. @item
  6027. If the comparison value is a plain number, a numerical comparison is done,
  6028. and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=},
  6029. @samp{>=}, and @samp{<>}.
  6030. @item
  6031. If the comparison value is enclosed in double-quotes,
  6032. a string comparison is done, and the same operators are allowed.
  6033. @item
  6034. If the comparison value is enclosed in double-quotes @emph{and} angular
  6035. brackets (like @samp{DEADLINE<="<2008-12-24 18:30>"}), both values are
  6036. assumed to be date/time specifications in the standard Org way, and the
  6037. comparison will be done accordingly. Special values that will be recognized
  6038. are @code{"<now>"} for now (including time), and @code{"<today>"}, and
  6039. @code{"<tomorrow>"} for these days at 0:00 hours, i.e. without a time
  6040. specification. Also strings like @code{"<+5d>"} or @code{"<-2m>"} with units
  6041. @code{d}, @code{w}, @code{m}, and @code{y} for day, week, month, and year,
  6042. respectively, can be used.
  6043. @item
  6044. If the comparison value is enclosed
  6045. in curly braces, a regexp match is performed, with @samp{=} meaning that the
  6046. regexp matches the property value, and @samp{<>} meaning that it does not
  6047. match.
  6048. @end itemize
  6049. So the search string in the example finds entries tagged @samp{:work:} but
  6050. not @samp{:boss:}, which also have a priority value @samp{A}, a
  6051. @samp{:Coffee:} property with the value @samp{unlimited}, an @samp{Effort}
  6052. property that is numerically smaller than 2, a @samp{:With:} property that is
  6053. matched by the regular expression @samp{Sarah\|Denny}, and that are scheduled
  6054. on or after October 11, 2008.
  6055. Accessing TODO, LEVEL, and CATEGORY during a search is fast. Accessing any
  6056. other properties will slow down the search. However, once you have paid the
  6057. price by accessing one property, testing additional properties is cheap
  6058. again.
  6059. You can configure Org mode to use property inheritance during a search, but
  6060. beware that this can slow down searches considerably. See @ref{Property
  6061. inheritance}, for details.
  6062. For backward compatibility, and also for typing speed, there is also a
  6063. different way to test TODO states in a search. For this, terminate the
  6064. tags/property part of the search string (which may include several terms
  6065. connected with @samp{|}) with a @samp{/} and then specify a Boolean
  6066. expression just for TODO keywords. The syntax is then similar to that for
  6067. tags, but should be applied with care: for example, a positive
  6068. selection on several TODO keywords cannot meaningfully be combined with
  6069. boolean AND. However, @emph{negative selection} combined with AND can be
  6070. meaningful. To make sure that only lines are checked that actually have any
  6071. TODO keyword (resulting in a speed-up), use @kbd{C-c a M}, or equivalently
  6072. start the TODO part after the slash with @samp{!}. Examples:
  6073. @table @samp
  6074. @item work/WAITING
  6075. Same as @samp{work+TODO="WAITING"}
  6076. @item work/!-WAITING-NEXT
  6077. Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
  6078. nor @samp{NEXT}
  6079. @item work/!+WAITING|+NEXT
  6080. Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
  6081. @samp{NEXT}.
  6082. @end table
  6083. @node Timeline, Search view, Matching tags and properties, Built-in agenda views
  6084. @subsection Timeline for a single file
  6085. @cindex timeline, single file
  6086. @cindex time-sorted view
  6087. The timeline summarizes all time-stamped items from a single Org mode
  6088. file in a @emph{time-sorted view}. The main purpose of this command is
  6089. to give an overview over events in a project.
  6090. @table @kbd
  6091. @kindex C-c a L
  6092. @item C-c a L
  6093. Show a time-sorted view of the Org file, with all time-stamped items.
  6094. When called with a @kbd{C-u} prefix, all unfinished TODO entries
  6095. (scheduled or not) are also listed under the current date.
  6096. @end table
  6097. @noindent
  6098. The commands available in the timeline buffer are listed in
  6099. @ref{Agenda commands}.
  6100. @node Search view, Stuck projects, Timeline, Built-in agenda views
  6101. @subsection Search view
  6102. @cindex search view
  6103. @cindex text search
  6104. @cindex searching, for text
  6105. This agenda view is a general text search facility for Org mode entries.
  6106. It is particularly useful to find notes.
  6107. @table @kbd
  6108. @kindex C-c a s
  6109. @item C-c a s
  6110. This is a special search that lets you select entries by matching a substring
  6111. or specific words using a boolean logic.
  6112. @end table
  6113. For example, the search string @samp{computer equipment} will find entries
  6114. that contain @samp{computer equipment} as a substring. If the two words are
  6115. separated by more space or a line break, the search will still match.
  6116. Search view can also search for specific keywords in the entry, using Boolean
  6117. logic. The search string @samp{+computer +wifi -ethernet -@{8\.11[bg]@}}
  6118. will search for note entries that contain the keywords @code{computer}
  6119. and @code{wifi}, but not the keyword @code{ethernet}, and which are also
  6120. not matched by the regular expression @code{8\.11[bg]}, meaning to
  6121. exclude both 8.11b and 8.11g. The first @samp{+} is necessary to turn on
  6122. word search, other @samp{+} characters are optional. For more details, see
  6123. the docstring of the command @code{org-search-view}.
  6124. @vindex org-agenda-text-search-extra-files
  6125. Note that in addition to the agenda files, this command will also search
  6126. the files listed in @code{org-agenda-text-search-extra-files}.
  6127. @node Stuck projects, , Search view, Built-in agenda views
  6128. @subsection Stuck projects
  6129. If you are following a system like David Allen's GTD to organize your
  6130. work, one of the ``duties'' you have is a regular review to make sure
  6131. that all projects move along. A @emph{stuck} project is a project that
  6132. has no defined next actions, so it will never show up in the TODO lists
  6133. Org mode produces. During the review, you need to identify such
  6134. projects and define next actions for them.
  6135. @table @kbd
  6136. @kindex C-c a #
  6137. @item C-c a #
  6138. List projects that are stuck.
  6139. @kindex C-c a !
  6140. @item C-c a !
  6141. @vindex org-stuck-projects
  6142. Customize the variable @code{org-stuck-projects} to define what a stuck
  6143. project is and how to find it.
  6144. @end table
  6145. You almost certainly will have to configure this view before it will
  6146. work for you. The built-in default assumes that all your projects are
  6147. level-2 headlines, and that a project is not stuck if it has at least
  6148. one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
  6149. Let's assume that you, in your own way of using Org mode, identify
  6150. projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
  6151. indicate a project that should not be considered yet. Let's further
  6152. assume that the TODO keyword DONE marks finished projects, and that NEXT
  6153. and TODO indicate next actions. The tag @@SHOP indicates shopping and
  6154. is a next action even without the NEXT tag. Finally, if the project
  6155. contains the special word IGNORE anywhere, it should not be listed
  6156. either. In this case you would start by identifying eligible projects
  6157. with a tags/todo match@footnote{@xref{Tag searches}.}
  6158. @samp{+PROJECT/-MAYBE-DONE}, and then check for TODO, NEXT, @@SHOP, and
  6159. IGNORE in the subtree to identify projects that are not stuck. The
  6160. correct customization for this is
  6161. @lisp
  6162. (setq org-stuck-projects
  6163. '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
  6164. "\\<IGNORE\\>"))
  6165. @end lisp
  6166. Note that if a project is identified as non-stuck, the subtree of this entry
  6167. will still be searched for stuck projects.
  6168. @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
  6169. @section Presentation and sorting
  6170. @cindex presentation, of agenda items
  6171. @vindex org-agenda-prefix-format
  6172. Before displaying items in an agenda view, Org mode visually prepares
  6173. the items and sorts them. Each item occupies a single line. The line
  6174. starts with a @emph{prefix} that contains the @emph{category}
  6175. (@pxref{Categories}) of the item and other important information. You can
  6176. customize the prefix using the option @code{org-agenda-prefix-format}.
  6177. The prefix is followed by a cleaned-up version of the outline headline
  6178. associated with the item.
  6179. @menu
  6180. * Categories:: Not all tasks are equal
  6181. * Time-of-day specifications:: How the agenda knows the time
  6182. * Sorting of agenda items:: The order of things
  6183. @end menu
  6184. @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
  6185. @subsection Categories
  6186. @cindex category
  6187. The category is a broad label assigned to each agenda item. By default,
  6188. the category is simply derived from the file name, but you can also
  6189. specify it with a special line in the buffer, like this@footnote{For
  6190. backward compatibility, the following also works: if there are several
  6191. such lines in a file, each specifies the category for the text below it.
  6192. The first category also applies to any text before the first CATEGORY
  6193. line. However, using this method is @emph{strongly} deprecated as it is
  6194. incompatible with the outline structure of the document. The correct
  6195. method for setting multiple categories in a buffer is using a
  6196. property.}:
  6197. @example
  6198. #+CATEGORY: Thesis
  6199. @end example
  6200. @noindent
  6201. @cindex property, CATEGORY
  6202. If you would like to have a special CATEGORY for a single entry or a
  6203. (sub)tree, give the entry a @code{:CATEGORY:} property with the
  6204. special category you want to apply as the value.
  6205. @noindent
  6206. The display in the agenda buffer looks best if the category is not
  6207. longer than 10 characters.
  6208. @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
  6209. @subsection Time-of-day specifications
  6210. @cindex time-of-day specification
  6211. Org mode checks each agenda item for a time-of-day specification. The
  6212. time can be part of the timestamp that triggered inclusion into the
  6213. agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time
  6214. ranges can be specified with two timestamps, like
  6215. @c
  6216. @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
  6217. In the headline of the entry itself, a time(range) may also appear as
  6218. plain text (like @samp{12:45} or a @samp{8:30-1pm}). If the agenda
  6219. integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
  6220. specifications in diary entries are recognized as well.
  6221. For agenda display, Org mode extracts the time and displays it in a
  6222. standard 24 hour format as part of the prefix. The example times in
  6223. the previous paragraphs would end up in the agenda like this:
  6224. @example
  6225. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  6226. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  6227. 19:00...... The Vogon reads his poem
  6228. 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
  6229. @end example
  6230. @cindex time grid
  6231. If the agenda is in single-day mode, or for the display of today, the
  6232. timed entries are embedded in a time grid, like
  6233. @example
  6234. 8:00...... ------------------
  6235. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  6236. 10:00...... ------------------
  6237. 12:00...... ------------------
  6238. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  6239. 14:00...... ------------------
  6240. 16:00...... ------------------
  6241. 18:00...... ------------------
  6242. 19:00...... The Vogon reads his poem
  6243. 20:00...... ------------------
  6244. 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
  6245. @end example
  6246. @vindex org-agenda-use-time-grid
  6247. @vindex org-agenda-time-grid
  6248. The time grid can be turned on and off with the variable
  6249. @code{org-agenda-use-time-grid}, and can be configured with
  6250. @code{org-agenda-time-grid}.
  6251. @node Sorting of agenda items, , Time-of-day specifications, Presentation and sorting
  6252. @subsection Sorting of agenda items
  6253. @cindex sorting, of agenda items
  6254. @cindex priorities, of agenda items
  6255. Before being inserted into a view, the items are sorted. How this is
  6256. done depends on the type of view.
  6257. @itemize @bullet
  6258. @item
  6259. @vindex org-agenda-files
  6260. For the daily/weekly agenda, the items for each day are sorted. The
  6261. default order is to first collect all items containing an explicit
  6262. time-of-day specification. These entries will be shown at the beginning
  6263. of the list, as a @emph{schedule} for the day. After that, items remain
  6264. grouped in categories, in the sequence given by @code{org-agenda-files}.
  6265. Within each category, items are sorted by priority (@pxref{Priorities}),
  6266. which is composed of the base priority (2000 for priority @samp{A}, 1000
  6267. for @samp{B}, and 0 for @samp{C}), plus additional increments for
  6268. overdue scheduled or deadline items.
  6269. @item
  6270. For the TODO list, items remain in the order of categories, but within
  6271. each category, sorting takes place according to priority
  6272. (@pxref{Priorities}). The priority used for sorting derives from the
  6273. priority cookie, with additions depending on how close an item is to its due
  6274. or scheduled date.
  6275. @item
  6276. For tags matches, items are not sorted at all, but just appear in the
  6277. sequence in which they are found in the agenda files.
  6278. @end itemize
  6279. @vindex org-agenda-sorting-strategy
  6280. Sorting can be customized using the variable
  6281. @code{org-agenda-sorting-strategy}, and may also include criteria based on
  6282. the estimated effort of an entry (@pxref{Effort estimates}).
  6283. @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
  6284. @section Commands in the agenda buffer
  6285. @cindex commands, in agenda buffer
  6286. Entries in the agenda buffer are linked back to the Org file or diary
  6287. file where they originate. You are not allowed to edit the agenda
  6288. buffer itself, but commands are provided to show and jump to the
  6289. original entry location, and to edit the Org files ``remotely'' from
  6290. the agenda buffer. In this way, all information is stored only once,
  6291. removing the risk that your agenda and note files may diverge.
  6292. Some commands can be executed with mouse clicks on agenda lines. For
  6293. the other commands, the cursor needs to be in the desired line.
  6294. @table @kbd
  6295. @tsubheading{Motion}
  6296. @cindex motion commands in agenda
  6297. @kindex n
  6298. @item n
  6299. Next line (same as @key{up} and @kbd{C-p}).
  6300. @kindex p
  6301. @item p
  6302. Previous line (same as @key{down} and @kbd{C-n}).
  6303. @tsubheading{View/Go to Org file}
  6304. @kindex mouse-3
  6305. @kindex @key{SPC}
  6306. @item mouse-3
  6307. @itemx @key{SPC}
  6308. Display the original location of the item in another window.
  6309. With prefix arg, make sure that the entire entry is made visible in the
  6310. outline, not only the heading.
  6311. @c
  6312. @kindex L
  6313. @item L
  6314. Display original location and recenter that window.
  6315. @c
  6316. @kindex mouse-2
  6317. @kindex mouse-1
  6318. @kindex @key{TAB}
  6319. @item mouse-2
  6320. @itemx mouse-1
  6321. @itemx @key{TAB}
  6322. Go to the original location of the item in another window. Under Emacs
  6323. 22, @kbd{mouse-1} will also works for this.
  6324. @c
  6325. @kindex @key{RET}
  6326. @itemx @key{RET}
  6327. Go to the original location of the item and delete other windows.
  6328. @c
  6329. @kindex F
  6330. @item F
  6331. @vindex org-agenda-start-with-follow-mode
  6332. Toggle Follow mode. In Follow mode, as you move the cursor through
  6333. the agenda buffer, the other window always shows the corresponding
  6334. location in the Org file. The initial setting for this mode in new
  6335. agenda buffers can be set with the variable
  6336. @code{org-agenda-start-with-follow-mode}.
  6337. @c
  6338. @kindex C-c C-x b
  6339. @item C-c C-x b
  6340. Display the entire subtree of the current item in an indirect buffer. With a
  6341. numeric prefix argument N, go up to level N and then take that tree. If N is
  6342. negative, go up that many levels. With a @kbd{C-u} prefix, do not remove the
  6343. previously used indirect buffer.
  6344. @kindex C-c C-o
  6345. @item C-c C-o
  6346. Follow a link in the entry. This will offer a selection of any links in the
  6347. text belonging to the referenced Org node. If there is only one link, it
  6348. will be followed without a selection prompt.
  6349. @tsubheading{Change display}
  6350. @cindex display changing, in agenda
  6351. @kindex o
  6352. @item o
  6353. Delete other windows.
  6354. @c
  6355. @kindex v d
  6356. @kindex d
  6357. @kindex v w
  6358. @kindex w
  6359. @kindex v m
  6360. @kindex v y
  6361. @item v d @ @r{or short} @ d
  6362. @itemx v w @ @r{or short} @ w
  6363. @itemx v m
  6364. @itemx v y
  6365. Switch to day/week/month/year view. When switching to day or week view,
  6366. this setting becomes the default for subsequent agenda commands. Since
  6367. month and year views are slow to create, they do not become the default.
  6368. A numeric prefix argument may be used to jump directly to a specific day
  6369. of the year, ISO week, month, or year, respectively. For example,
  6370. @kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9. When
  6371. setting day, week, or month view, a year may be encoded in the prefix
  6372. argument as well. For example, @kbd{200712 w} will jump to week 12 in
  6373. 2007. If such a year specification has only one or two digits, it will
  6374. be mapped to the interval 1938-2037.
  6375. @c
  6376. @kindex f
  6377. @item f
  6378. @vindex org-agenda-ndays
  6379. Go forward in time to display the following @code{org-agenda-ndays} days.
  6380. For example, if the display covers a week, switch to the following week.
  6381. With prefix arg, go forward that many times @code{org-agenda-ndays} days.
  6382. @c
  6383. @kindex b
  6384. @item b
  6385. Go backward in time to display earlier dates.
  6386. @c
  6387. @kindex .
  6388. @item .
  6389. Go to today.
  6390. @c
  6391. @kindex j
  6392. @item j
  6393. Prompt for a date and go there.
  6394. @c
  6395. @kindex D
  6396. @item D
  6397. Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
  6398. @c
  6399. @kindex v l
  6400. @kindex v L
  6401. @kindex l
  6402. @item v l @ @r{or short} @ l
  6403. @vindex org-log-done
  6404. @vindex org-agenda-log-mode-items
  6405. Toggle Logbook mode. In Logbook mode, entries that were marked DONE while
  6406. logging was on (variable @code{org-log-done}) are shown in the agenda, as are
  6407. entries that have been clocked on that day. You can configure the entry
  6408. types that should be included in log mode using the variable
  6409. @code{org-agenda-log-mode-items}. When called with a @kbd{C-u} prefix, show
  6410. all possible logbook entries, including state changes. When called with two
  6411. prefix args @kbd{C-u C-u}, show only logging information, nothing else.
  6412. @kbd{v L} is equivalent to @kbd{C-u v l}.
  6413. @c
  6414. @kindex v [
  6415. @kindex [
  6416. @item v [ @ @r{or short} @ [
  6417. Include inactive timestamps into the current view. Only for weekly/daily
  6418. agenda and timeline views.
  6419. @c
  6420. @kindex v a
  6421. @kindex v A
  6422. @item v a
  6423. @itemx v A
  6424. Toggle Archives mode. In Archives mode, trees that are marked
  6425. @code{ARCHIVED} are also scanned when producing the agenda. When you use the
  6426. capital @kbd{A}, even all archive files are included. To exit archives mode,
  6427. press @kbd{v a} again.
  6428. @c
  6429. @kindex v R
  6430. @kindex R
  6431. @item v R @ @r{or short} @ R
  6432. @vindex org-agenda-start-with-clockreport-mode
  6433. Toggle Clockreport mode. In Clockreport mode, the daily/weekly agenda will
  6434. always show a table with the clocked times for the timespan and file scope
  6435. covered by the current agenda view. The initial setting for this mode in new
  6436. agenda buffers can be set with the variable
  6437. @code{org-agenda-start-with-clockreport-mode}.
  6438. @c
  6439. @kindex v E
  6440. @kindex E
  6441. @item v E @ @r{or short} @ E
  6442. @vindex org-agenda-start-with-entry-text-mode
  6443. @vindex org-agenda-entry-text-maxlines
  6444. Toggle entry text mode. In entry text mode, a number of lines from the Org
  6445. outline node referenced by an agenda line will be displayed below the line.
  6446. The maximum number of lines is given by the variable
  6447. @code{org-agenda-entry-text-maxlines}. Calling this command with a numeric
  6448. prefix argument will temporarily modify that number to the prefix value.
  6449. @c
  6450. @kindex G
  6451. @item G
  6452. @vindex org-agenda-use-time-grid
  6453. @vindex org-agenda-time-grid
  6454. Toggle the time grid on and off. See also the variables
  6455. @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
  6456. @c
  6457. @kindex r
  6458. @item r
  6459. Recreate the agenda buffer, for example to reflect the changes after
  6460. modification of the timestamps of items with @kbd{S-@key{left}} and
  6461. @kbd{S-@key{right}}. When the buffer is the global TODO list, a prefix
  6462. argument is interpreted to create a selective list for a specific TODO
  6463. keyword.
  6464. @kindex g
  6465. @item g
  6466. Same as @kbd{r}.
  6467. @c
  6468. @kindex s
  6469. @kindex C-x C-s
  6470. @item s
  6471. @itemx C-x C-s
  6472. Save all Org buffers in the current Emacs session, and also the locations of
  6473. IDs.
  6474. @c
  6475. @kindex C-c C-x C-c
  6476. @item C-c C-x C-c
  6477. @vindex org-columns-default-format
  6478. Invoke column view (@pxref{Column view}) in the agenda buffer. The column
  6479. view format is taken from the entry at point, or (if there is no entry at
  6480. point), from the first entry in the agenda view. So whatever the format for
  6481. that entry would be in the original buffer (taken from a property, from a
  6482. @code{#+COLUMNS} line, or from the default variable
  6483. @code{org-columns-default-format}), will be used in the agenda.
  6484. @kindex C-c C-x >
  6485. @item C-c C-x >
  6486. Remove the restriction lock on the agenda, if it is currently restricted to a
  6487. file or subtree (@pxref{Agenda files}).
  6488. @tsubheading{Secondary filtering and query editing}
  6489. @cindex filtering, by tag and effort, in agenda
  6490. @cindex tag filtering, in agenda
  6491. @cindex effort filtering, in agenda
  6492. @cindex query editing, in agenda
  6493. @kindex /
  6494. @item /
  6495. @vindex org-agenda-filter-preset
  6496. Filter the current agenda view with respect to a tag and/or effort estimates.
  6497. The difference between this and a custom agenda command is that filtering is
  6498. very fast, so that you can switch quickly between different filters without
  6499. having to recreate the agenda@footnote{Custom commands can preset a filter by
  6500. binding the variable @code{org-agenda-filter-preset} as an option. This
  6501. filter will then be applied to the view and persist as a basic filter through
  6502. refreshes and more secondary filtering.}
  6503. You will be prompted for a tag selection letter, SPC will mean any tag at
  6504. all. Pressing @key{TAB} at that prompt will offer use completion to select a
  6505. tag (including any tags that do not have a selection character). The command
  6506. then hides all entries that do not contain or inherit this tag. When called
  6507. with prefix arg, remove the entries that @emph{do} have the tag. A second
  6508. @kbd{/} at the prompt will turn off the filter and unhide any hidden entries.
  6509. If the first key you press is either @kbd{+} or @kbd{-}, the previous filter
  6510. will be narrowed by requiring or forbidding the selected additional tag.
  6511. Instead of pressing @kbd{+} or @kbd{-} after @kbd{/}, you can also
  6512. immediately use the @kbd{\} command.
  6513. @vindex org-sort-agenda-noeffort-is-high
  6514. In order to filter for effort estimates, you should set-up allowed
  6515. efforts globally, for example
  6516. @lisp
  6517. (setq org-global-properties
  6518. '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
  6519. @end lisp
  6520. You can then filter for an effort by first typing an operator, one of
  6521. @kbd{<}, @kbd{>}, and @kbd{=}, and then the one-digit index of an effort
  6522. estimate in your array of allowed values, where @kbd{0} means the 10th value.
  6523. The filter will then restrict to entries with effort smaller-or-equal, equal,
  6524. or larger-or-equal than the selected value. If the digits 0-9 are not used
  6525. as fast access keys to tags, you can also simply press the index digit
  6526. directly without an operator. In this case, @kbd{<} will be assumed. For
  6527. application of the operator, entries without a defined effort will be treated
  6528. according to the value of @code{org-sort-agenda-noeffort-is-high}. To filter
  6529. for tasks without effort definition, press @kbd{?} as the operator.
  6530. Org also supports automatic, context-aware tag filtering. If the variable
  6531. @code{org-agenda-auto-exclude-function} is set to a user-defined function,
  6532. that function can decide which tags should be excluded from the agenda
  6533. automatically. Once this is set, the @kbd{/} command then accepts @kbd{RET}
  6534. as a sub-option key and runs the auto exclusion logic. For example, let's
  6535. say you use a @code{Net} tag to identify tasks which need network access, an
  6536. @code{Errand} tag for errands in town, and a @code{Call} tag for making phone
  6537. calls. You could auto-exclude these tags based on the availability of the
  6538. Internet, and outside of business hours, with something like this:
  6539. @lisp
  6540. @group
  6541. (defun org-my-auto-exclude-function (tag)
  6542. (and (cond
  6543. ((string= tag "Net")
  6544. (/= 0 (call-process "/sbin/ping" nil nil nil
  6545. "-c1" "-q" "-t1" "mail.gnu.org")))
  6546. ((or (string= tag "Errand") (string= tag "Call"))
  6547. (let ((hour (nth 2 (decode-time))))
  6548. (or (< hour 8) (> hour 21)))))
  6549. (concat "-" tag)))
  6550. (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
  6551. @end group
  6552. @end lisp
  6553. @kindex \
  6554. @item \
  6555. Narrow the current agenda filter by an additional condition. When called with
  6556. prefix arg, remove the entries that @emph{do} have the tag, or that do match
  6557. the effort criterion. You can achieve the same effect by pressing @kbd{+} or
  6558. @kbd{-} as the first key after the @kbd{/} command.
  6559. @kindex [
  6560. @kindex ]
  6561. @kindex @{
  6562. @kindex @}
  6563. @item [ ] @{ @}
  6564. @table @i
  6565. @item @r{in} search view
  6566. add new search words (@kbd{[} and @kbd{]}) or new regular expressions
  6567. (@kbd{@{} and @kbd{@}}) to the query string. The opening bracket/brace will
  6568. add a positive search term prefixed by @samp{+}, indicating that this search
  6569. term @i{must} occur/match in the entry. The closing bracket/brace will add a
  6570. negative search term which @i{must not} occur/match in the entry for it to be
  6571. selected.
  6572. @end table
  6573. @page
  6574. @tsubheading{Remote editing}
  6575. @cindex remote editing, from agenda
  6576. @item 0-9
  6577. Digit argument.
  6578. @c
  6579. @cindex undoing remote-editing events
  6580. @cindex remote editing, undo
  6581. @kindex C-_
  6582. @item C-_
  6583. Undo a change due to a remote editing command. The change is undone
  6584. both in the agenda buffer and in the remote buffer.
  6585. @c
  6586. @kindex t
  6587. @item t
  6588. Change the TODO state of the item, both in the agenda and in the
  6589. original org file.
  6590. @c
  6591. @kindex C-S-@key{right}
  6592. @kindex C-S-@key{left}
  6593. @item C-S-@key{right}@r{/}@key{left}
  6594. Switch to the next/previous set of TODO keywords.
  6595. @c
  6596. @kindex C-k
  6597. @item C-k
  6598. @vindex org-agenda-confirm-kill
  6599. Delete the current agenda item along with the entire subtree belonging
  6600. to it in the original Org file. If the text to be deleted remotely
  6601. is longer than one line, the kill needs to be confirmed by the user. See
  6602. variable @code{org-agenda-confirm-kill}.
  6603. @c
  6604. @kindex C-c C-w
  6605. @item C-c C-w
  6606. Refile the entry at point.
  6607. @c
  6608. @kindex C-c C-x C-a
  6609. @kindex a
  6610. @item C-c C-x C-a @ @r{or short} @ a
  6611. @vindex org-archive-default-command
  6612. Archive the subtree corresponding to the entry at point using the default
  6613. archiving command set in @code{org-archive-default-command}. When using the
  6614. @code{a} key, confirmation will be required.
  6615. @c
  6616. @kindex C-c C-x a
  6617. @item C-c C-x a
  6618. Toggle the ARCHIVE tag for the current headline.
  6619. @c
  6620. @kindex C-c C-x A
  6621. @item C-c C-x A
  6622. Move the subtree corresponding to the current entry to its @emph{archive
  6623. sibling}.
  6624. @c
  6625. @kindex $
  6626. @kindex C-c C-x C-s
  6627. @item C-c C-x C-s @ @r{or short} @ $
  6628. Archive the subtree corresponding to the current headline. This means the
  6629. entry will be moved to the configured archive location, most likely a
  6630. different file.
  6631. @c
  6632. @kindex T
  6633. @item T
  6634. @vindex org-agenda-show-inherited-tags
  6635. Show all tags associated with the current item. This is useful if you have
  6636. turned off @code{org-agenda-show-inherited-tags}, but still want to see all
  6637. tags of a headline occasionally.
  6638. @c
  6639. @kindex :
  6640. @item :
  6641. Set tags for the current headline. If there is an active region in the
  6642. agenda, change a tag for all headings in the region.
  6643. @c
  6644. @kindex ,
  6645. @item ,
  6646. Set the priority for the current item. Org mode prompts for the
  6647. priority character. If you reply with @key{SPC}, the priority cookie
  6648. is removed from the entry.
  6649. @c
  6650. @kindex P
  6651. @item P
  6652. Display weighted priority of current item.
  6653. @c
  6654. @kindex +
  6655. @kindex S-@key{up}
  6656. @item +
  6657. @itemx S-@key{up}
  6658. Increase the priority of the current item. The priority is changed in
  6659. the original buffer, but the agenda is not resorted. Use the @kbd{r}
  6660. key for this.
  6661. @c
  6662. @kindex -
  6663. @kindex S-@key{down}
  6664. @item -
  6665. @itemx S-@key{down}
  6666. Decrease the priority of the current item.
  6667. @c
  6668. @kindex z
  6669. @item z
  6670. @vindex org-log-into-drawer
  6671. Add a note to the entry. This note will be recorded, and then files to the
  6672. same location where state change notes are put. Depending on
  6673. @code{org-log-into-drawer}, this maybe inside a drawer.
  6674. @c
  6675. @kindex C-c C-a
  6676. @item C-c C-a
  6677. Dispatcher for all command related to attachments.
  6678. @c
  6679. @kindex C-c C-s
  6680. @item C-c C-s
  6681. Schedule this item, with prefix arg remove the scheduling timestamp
  6682. @c
  6683. @kindex C-c C-d
  6684. @item C-c C-d
  6685. Set a deadline for this item, with prefix arg remove the deadline.
  6686. @c
  6687. @kindex k
  6688. @item k
  6689. Agenda actions, to set dates for selected items to the cursor date.
  6690. This command also works in the calendar! The command prompts for an
  6691. additional key:
  6692. @example
  6693. m @r{Mark the entry at point for action. You can also make entries}
  6694. @r{in Org files with @kbd{C-c C-x C-k}.}
  6695. d @r{Set the deadline of the marked entry to the date at point.}
  6696. s @r{Schedule the marked entry at the date at point.}
  6697. r @r{Call @code{org-remember} with the cursor date as default date.}
  6698. @end example
  6699. @noindent
  6700. Press @kbd{r} afterward to refresh the agenda and see the effect of the
  6701. command.
  6702. @c
  6703. @kindex S-@key{right}
  6704. @item S-@key{right}
  6705. Change the timestamp associated with the current line by one day into the
  6706. future. With a numeric prefix argument, change it by that many days. For
  6707. example, @kbd{3 6 5 S-@key{right}} will change it by a year. With a
  6708. @kbd{C-u} prefix, change the time by one hour. If you immediately repeat the
  6709. command, it will continue to change hours even without the prefix arg. With
  6710. a double @kbd{C-u C-u} prefix, do the same for changing minutes. The stamp
  6711. is changed in the original Org file, but the change is not directly reflected
  6712. in the agenda buffer. Use @kbd{r} or @kbd{g} to update the buffer.
  6713. @c
  6714. @kindex S-@key{left}
  6715. @item S-@key{left}
  6716. Change the timestamp associated with the current line by one day
  6717. into the past.
  6718. @c
  6719. @kindex >
  6720. @item >
  6721. Change the timestamp associated with the current line. The key @kbd{>} has
  6722. been chosen, because it is the same as @kbd{S-.} on my keyboard.
  6723. @c
  6724. @kindex I
  6725. @item I
  6726. Start the clock on the current item. If a clock is running already, it
  6727. is stopped first.
  6728. @c
  6729. @kindex O
  6730. @item O
  6731. Stop the previously started clock.
  6732. @c
  6733. @kindex X
  6734. @item X
  6735. Cancel the currently running clock.
  6736. @kindex J
  6737. @item J
  6738. Jump to the running clock in another window.
  6739. @tsubheading{Bulk remote editing selected entries}
  6740. @cindex remote editing, bulk, from agenda
  6741. @kindex m
  6742. @item m
  6743. Mark the entry at point for bulk action.
  6744. @kindex u
  6745. @item u
  6746. Unmark entry for bulk action.
  6747. @kindex U
  6748. @item U
  6749. Unmark all marked entries for bulk action.
  6750. @kindex B
  6751. @item B
  6752. Bulk action: act on all marked entries in the agenda. This will prompt for
  6753. another key to select the action to be applied. The prefix arg to @kbd{B}
  6754. will be passed through to the @kbd{s} and @kbd{d} commands, to bulk-remove
  6755. these special timestamps.
  6756. @example
  6757. r @r{Prompt for a single refile target and move all entries. The entries}
  6758. @r{will no longer be in the agenda, refresh (@kbd{g}) to bring them back.}
  6759. $ @r{Archive all selected entries.}
  6760. A @r{Archive entries by moving them to their respective archive siblings.}
  6761. t @r{Change TODO state. This prompts for a single TODO keyword and}
  6762. @r{changes the state of all selected entries, bypassing blocking and}
  6763. @r{suppressing logging notes (but not time stamps).}
  6764. + @r{Add a tag to all selected entries.}
  6765. - @r{Remove a tag from all selected entries.}
  6766. s @r{Schedule all items to a new date. To shift existing schedule dates}
  6767. @r{by a fixed number of days, use something starting with double plus}
  6768. @r{at the prompt, for example @samp{++8d} or @samp{++2w}.}
  6769. d @r{Set deadline to a specific date.}
  6770. @end example
  6771. @tsubheading{Calendar commands}
  6772. @cindex calendar commands, from agenda
  6773. @kindex c
  6774. @item c
  6775. Open the Emacs calendar and move to the date at the agenda cursor.
  6776. @c
  6777. @item c
  6778. When in the calendar, compute and show the Org mode agenda for the
  6779. date at the cursor.
  6780. @c
  6781. @cindex diary entries, creating from agenda
  6782. @kindex i
  6783. @item i
  6784. @vindex org-agenda-diary-file
  6785. Insert a new entry into the diary, using the date at the cursor and (for
  6786. block entries) the date at the mark. This will add to the Emacs diary
  6787. file@footnote{This file is parsed for the agenda when
  6788. @code{org-agenda-include-diary} is set.}, in a way similar to the @kbd{i}
  6789. command in the calendar. The diary file will pop up in another window, where
  6790. you can add the entry.
  6791. If you configure @code{org-agenda-diary-file} to point to an Org-mode file,
  6792. Org will create entries (in org-mode syntax) in that file instead. Most
  6793. entries will be stored in a date-based outline tree that will later make it
  6794. easy to archive appointments from previous months/years. The tree will be
  6795. build under an entry with a @code{DATE_TREE} property, or else with years as
  6796. top-level entries. Emacs will prompt you for the entry text - if you specify
  6797. it, the entry will be created in @code{org-agenda-diary-file} without further
  6798. interaction. If you directly press @key{RET} at the prompt without typing
  6799. text, the target file will be shown in another window for you to finish the
  6800. entry there. See also the @kbd{k r} command.
  6801. @c
  6802. @kindex M
  6803. @item M
  6804. Show the phases of the moon for the three months around current date.
  6805. @c
  6806. @kindex S
  6807. @item S
  6808. Show sunrise and sunset times. The geographical location must be set
  6809. with calendar variables, see the documentation for the Emacs calendar.
  6810. @c
  6811. @kindex C
  6812. @item C
  6813. Convert the date at cursor into many other cultural and historic
  6814. calendars.
  6815. @c
  6816. @kindex H
  6817. @item H
  6818. Show holidays for three months around the cursor date.
  6819. @item M-x org-export-icalendar-combine-agenda-files
  6820. Export a single iCalendar file containing entries from all agenda files.
  6821. This is a globally available command, and also available in the agenda menu.
  6822. @tsubheading{Exporting to a file}
  6823. @kindex C-x C-w
  6824. @item C-x C-w
  6825. @cindex exporting agenda views
  6826. @cindex agenda views, exporting
  6827. @vindex org-agenda-exporter-settings
  6828. Write the agenda view to a file. Depending on the extension of the selected
  6829. file name, the view will be exported as HTML (extension @file{.html} or
  6830. @file{.htm}), Postscript (extension @file{.ps}), PDF (extension @file{.pdf}),
  6831. and plain text (any other extension). When called with a @kbd{C-u} prefix
  6832. argument, immediately open the newly created file. Use the variable
  6833. @code{org-agenda-exporter-settings} to set options for @file{ps-print} and
  6834. for @file{htmlize} to be used during export.
  6835. @tsubheading{Quit and Exit}
  6836. @kindex q
  6837. @item q
  6838. Quit agenda, remove the agenda buffer.
  6839. @c
  6840. @kindex x
  6841. @cindex agenda files, removing buffers
  6842. @item x
  6843. Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
  6844. for the compilation of the agenda. Buffers created by the user to
  6845. visit Org files will not be removed.
  6846. @end table
  6847. @node Custom agenda views, Exporting Agenda Views, Agenda commands, Agenda Views
  6848. @section Custom agenda views
  6849. @cindex custom agenda views
  6850. @cindex agenda views, custom
  6851. Custom agenda commands serve two purposes: to store and quickly access
  6852. frequently used TODO and tags searches, and to create special composite
  6853. agenda buffers. Custom agenda commands will be accessible through the
  6854. dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
  6855. @menu
  6856. * Storing searches:: Type once, use often
  6857. * Block agenda:: All the stuff you need in a single buffer
  6858. * Setting Options:: Changing the rules
  6859. @end menu
  6860. @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
  6861. @subsection Storing searches
  6862. The first application of custom searches is the definition of keyboard
  6863. shortcuts for frequently used searches, either creating an agenda
  6864. buffer, or a sparse tree (the latter covering of course only the current
  6865. buffer).
  6866. @kindex C-c a C
  6867. @vindex org-agenda-custom-commands
  6868. Custom commands are configured in the variable
  6869. @code{org-agenda-custom-commands}. You can customize this variable, for
  6870. example by pressing @kbd{C-c a C}. You can also directly set it with
  6871. Emacs Lisp in @file{.emacs}. The following example contains all valid
  6872. search types:
  6873. @lisp
  6874. @group
  6875. (setq org-agenda-custom-commands
  6876. '(("w" todo "WAITING")
  6877. ("W" todo-tree "WAITING")
  6878. ("u" tags "+boss-urgent")
  6879. ("v" tags-todo "+boss-urgent")
  6880. ("U" tags-tree "+boss-urgent")
  6881. ("f" occur-tree "\\<FIXME\\>")
  6882. ("h" . "HOME+Name tags searches") ; description for "h" prefix
  6883. ("hl" tags "+home+Lisa")
  6884. ("hp" tags "+home+Peter")
  6885. ("hk" tags "+home+Kim")))
  6886. @end group
  6887. @end lisp
  6888. @noindent
  6889. The initial string in each entry defines the keys you have to press
  6890. after the dispatcher command @kbd{C-c a} in order to access the command.
  6891. Usually this will be just a single character, but if you have many
  6892. similar commands, you can also define two-letter combinations where the
  6893. first character is the same in several combinations and serves as a
  6894. prefix key@footnote{You can provide a description for a prefix key by
  6895. inserting a cons cell with the prefix and the description.}. The second
  6896. parameter is the search type, followed by the string or regular
  6897. expression to be used for the matching. The example above will
  6898. therefore define:
  6899. @table @kbd
  6900. @item C-c a w
  6901. as a global search for TODO entries with @samp{WAITING} as the TODO
  6902. keyword
  6903. @item C-c a W
  6904. as the same search, but only in the current buffer and displaying the
  6905. results as a sparse tree
  6906. @item C-c a u
  6907. as a global tags search for headlines marked @samp{:boss:} but not
  6908. @samp{:urgent:}
  6909. @item C-c a v
  6910. as the same search as @kbd{C-c a u}, but limiting the search to
  6911. headlines that are also TODO items
  6912. @item C-c a U
  6913. as the same search as @kbd{C-c a u}, but only in the current buffer and
  6914. displaying the result as a sparse tree
  6915. @item C-c a f
  6916. to create a sparse tree (again: current buffer only) with all entries
  6917. containing the word @samp{FIXME}
  6918. @item C-c a h
  6919. as a prefix command for a HOME tags search where you have to press an
  6920. additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
  6921. Peter, or Kim) as additional tag to match.
  6922. @end table
  6923. @node Block agenda, Setting Options, Storing searches, Custom agenda views
  6924. @subsection Block agenda
  6925. @cindex block agenda
  6926. @cindex agenda, with block views
  6927. Another possibility is the construction of agenda views that comprise
  6928. the results of @emph{several} commands, each of which creates a block in
  6929. the agenda buffer. The available commands include @code{agenda} for the
  6930. daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
  6931. for the global TODO list (as constructed with @kbd{C-c a t}), and the
  6932. matching commands discussed above: @code{todo}, @code{tags}, and
  6933. @code{tags-todo}. Here are two examples:
  6934. @lisp
  6935. @group
  6936. (setq org-agenda-custom-commands
  6937. '(("h" "Agenda and Home-related tasks"
  6938. ((agenda "")
  6939. (tags-todo "home")
  6940. (tags "garden")))
  6941. ("o" "Agenda and Office-related tasks"
  6942. ((agenda "")
  6943. (tags-todo "work")
  6944. (tags "office")))))
  6945. @end group
  6946. @end lisp
  6947. @noindent
  6948. This will define @kbd{C-c a h} to create a multi-block view for stuff
  6949. you need to attend to at home. The resulting agenda buffer will contain
  6950. your agenda for the current week, all TODO items that carry the tag
  6951. @samp{home}, and also all lines tagged with @samp{garden}. Finally the
  6952. command @kbd{C-c a o} provides a similar view for office tasks.
  6953. @node Setting Options, , Block agenda, Custom agenda views
  6954. @subsection Setting options for custom commands
  6955. @cindex options, for custom agenda views
  6956. @vindex org-agenda-custom-commands
  6957. Org mode contains a number of variables regulating agenda construction
  6958. and display. The global variables define the behavior for all agenda
  6959. commands, including the custom commands. However, if you want to change
  6960. some settings just for a single custom view, you can do so. Setting
  6961. options requires inserting a list of variable names and values at the
  6962. right spot in @code{org-agenda-custom-commands}. For example:
  6963. @lisp
  6964. @group
  6965. (setq org-agenda-custom-commands
  6966. '(("w" todo "WAITING"
  6967. ((org-agenda-sorting-strategy '(priority-down))
  6968. (org-agenda-prefix-format " Mixed: ")))
  6969. ("U" tags-tree "+boss-urgent"
  6970. ((org-show-following-heading nil)
  6971. (org-show-hierarchy-above nil)))
  6972. ("N" search ""
  6973. ((org-agenda-files '("~org/notes.org"))
  6974. (org-agenda-text-search-extra-files nil)))))
  6975. @end group
  6976. @end lisp
  6977. @noindent
  6978. Now the @kbd{C-c a w} command will sort the collected entries only by
  6979. priority, and the prefix format is modified to just say @samp{ Mixed: }
  6980. instead of giving the category of the entry. The sparse tags tree of
  6981. @kbd{C-c a U} will now turn out ultra-compact, because neither the
  6982. headline hierarchy above the match, nor the headline following the match
  6983. will be shown. The command @kbd{C-c a N} will do a text search limited
  6984. to only a single file.
  6985. @vindex org-agenda-custom-commands
  6986. For command sets creating a block agenda,
  6987. @code{org-agenda-custom-commands} has two separate spots for setting
  6988. options. You can add options that should be valid for just a single
  6989. command in the set, and options that should be valid for all commands in
  6990. the set. The former are just added to the command entry, the latter
  6991. must come after the list of command entries. Going back to the block
  6992. agenda example (@pxref{Block agenda}), let's change the sorting strategy
  6993. for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
  6994. the results for GARDEN tags query in the opposite order,
  6995. @code{priority-up}. This would look like this:
  6996. @lisp
  6997. @group
  6998. (setq org-agenda-custom-commands
  6999. '(("h" "Agenda and Home-related tasks"
  7000. ((agenda)
  7001. (tags-todo "home")
  7002. (tags "garden"
  7003. ((org-agenda-sorting-strategy '(priority-up)))))
  7004. ((org-agenda-sorting-strategy '(priority-down))))
  7005. ("o" "Agenda and Office-related tasks"
  7006. ((agenda)
  7007. (tags-todo "work")
  7008. (tags "office")))))
  7009. @end group
  7010. @end lisp
  7011. As you see, the values and parentheses setting is a little complex.
  7012. When in doubt, use the customize interface to set this variable---it
  7013. fully supports its structure. Just one caveat: when setting options in
  7014. this interface, the @emph{values} are just Lisp expressions. So if the
  7015. value is a string, you need to add the double-quotes around the value
  7016. yourself.
  7017. @node Exporting Agenda Views, Agenda column view, Custom agenda views, Agenda Views
  7018. @section Exporting Agenda Views
  7019. @cindex agenda views, exporting
  7020. If you are away from your computer, it can be very useful to have a printed
  7021. version of some agenda views to carry around. Org mode can export custom
  7022. agenda views as plain text, HTML@footnote{You need to install Hrvoje Niksic's
  7023. @file{htmlize.el}.}, Postscript, PDF@footnote{To create PDF output, the
  7024. ghostscript @file{ps2pdf} utility must be installed on the system. Selecting
  7025. a PDF file with also create the postscript file.}, and iCalendar files. If
  7026. you want to do this only occasionally, use the command
  7027. @table @kbd
  7028. @kindex C-x C-w
  7029. @item C-x C-w
  7030. @cindex exporting agenda views
  7031. @cindex agenda views, exporting
  7032. @vindex org-agenda-exporter-settings
  7033. Write the agenda view to a file. Depending on the extension of the selected
  7034. file name, the view will be exported as HTML (extension @file{.html} or
  7035. @file{.htm}), Postscript (extension @file{.ps}), iCalendar (extension
  7036. @file{.ics}), or plain text (any other extension). Use the variable
  7037. @code{org-agenda-exporter-settings} to set options for @file{ps-print} and
  7038. for @file{htmlize} to be used during export, for example
  7039. @vindex org-agenda-add-entry-text-maxlines
  7040. @vindex htmlize-output-type
  7041. @vindex ps-number-of-columns
  7042. @vindex ps-landscape-mode
  7043. @lisp
  7044. (setq org-agenda-exporter-settings
  7045. '((ps-number-of-columns 2)
  7046. (ps-landscape-mode t)
  7047. (org-agenda-add-entry-text-maxlines 5)
  7048. (htmlize-output-type 'css)))
  7049. @end lisp
  7050. @end table
  7051. If you need to export certain agenda views frequently, you can associate
  7052. any custom agenda command with a list of output file names
  7053. @footnote{If you want to store standard views like the weekly agenda
  7054. or the global TODO list as well, you need to define custom commands for
  7055. them in order to be able to specify file names.}. Here is an example
  7056. that first defines custom commands for the agenda and the global
  7057. TODO list, together with a number of files to which to export them.
  7058. Then we define two block agenda commands and specify file names for them
  7059. as well. File names can be relative to the current working directory,
  7060. or absolute.
  7061. @lisp
  7062. @group
  7063. (setq org-agenda-custom-commands
  7064. '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  7065. ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  7066. ("h" "Agenda and Home-related tasks"
  7067. ((agenda "")
  7068. (tags-todo "home")
  7069. (tags "garden"))
  7070. nil
  7071. ("~/views/home.html"))
  7072. ("o" "Agenda and Office-related tasks"
  7073. ((agenda)
  7074. (tags-todo "work")
  7075. (tags "office"))
  7076. nil
  7077. ("~/views/office.ps" "~/calendars/office.ics"))))
  7078. @end group
  7079. @end lisp
  7080. The extension of the file name determines the type of export. If it is
  7081. @file{.html}, Org mode will use the @file{htmlize.el} package to convert
  7082. the buffer to HTML and save it to this file name. If the extension is
  7083. @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
  7084. Postscript output. If the extension is @file{.ics}, iCalendar export is
  7085. run export over all files that were used to construct the agenda, and
  7086. limit the export to entries listed in the agenda. Any other
  7087. extension produces a plain ASCII file.
  7088. The export files are @emph{not} created when you use one of those
  7089. commands interactively because this might use too much overhead.
  7090. Instead, there is a special command to produce @emph{all} specified
  7091. files in one step:
  7092. @table @kbd
  7093. @kindex C-c a e
  7094. @item C-c a e
  7095. Export all agenda views that have export file names associated with
  7096. them.
  7097. @end table
  7098. You can use the options section of the custom agenda commands to also
  7099. set options for the export commands. For example:
  7100. @lisp
  7101. (setq org-agenda-custom-commands
  7102. '(("X" agenda ""
  7103. ((ps-number-of-columns 2)
  7104. (ps-landscape-mode t)
  7105. (org-agenda-prefix-format " [ ] ")
  7106. (org-agenda-with-colors nil)
  7107. (org-agenda-remove-tags t))
  7108. ("theagenda.ps"))))
  7109. @end lisp
  7110. @noindent
  7111. This command sets two options for the Postscript exporter, to make it
  7112. print in two columns in landscape format---the resulting page can be cut
  7113. in two and then used in a paper agenda. The remaining settings modify
  7114. the agenda prefix to omit category and scheduling information, and
  7115. instead include a checkbox to check off items. We also remove the tags
  7116. to make the lines compact, and we don't want to use colors for the
  7117. black-and-white printer. Settings specified in
  7118. @code{org-agenda-exporter-settings} will also apply, but the settings
  7119. in @code{org-agenda-custom-commands} take precedence.
  7120. @noindent
  7121. From the command line you may also use
  7122. @example
  7123. emacs -f org-batch-store-agenda-views -kill
  7124. @end example
  7125. @noindent
  7126. or, if you need to modify some parameters@footnote{Quoting depends on the
  7127. system you use, please check the FAQ for examples.}
  7128. @example
  7129. emacs -eval '(org-batch-store-agenda-views \
  7130. org-agenda-ndays 30 \
  7131. org-agenda-start-day "2007-11-01" \
  7132. org-agenda-include-diary nil \
  7133. org-agenda-files (quote ("~/org/project.org")))' \
  7134. -kill
  7135. @end example
  7136. @noindent
  7137. which will create the agenda views restricted to the file
  7138. @file{~/org/project.org}, without diary entries and with a 30-day
  7139. extent.
  7140. You can also extract agenda information in a way that allows further
  7141. processing by other programs. See @ref{Extracting agenda information}, for
  7142. more information.
  7143. @node Agenda column view, , Exporting Agenda Views, Agenda Views
  7144. @section Using column view in the agenda
  7145. @cindex column view, in agenda
  7146. @cindex agenda, column view
  7147. Column view (@pxref{Column view}) is normally used to view and edit
  7148. properties embedded in the hierarchical structure of an Org file. It can be
  7149. quite useful to use column view also from the agenda, where entries are
  7150. collected by certain criteria.
  7151. @table @kbd
  7152. @kindex C-c C-x C-c
  7153. @item C-c C-x C-c
  7154. Turn on column view in the agenda.
  7155. @end table
  7156. To understand how to use this properly, it is important to realize that the
  7157. entries in the agenda are no longer in their proper outline environment.
  7158. This causes the following issues:
  7159. @enumerate
  7160. @item
  7161. @vindex org-columns-default-format
  7162. @vindex org-overriding-columns-format
  7163. Org needs to make a decision which @code{COLUMNS} format to use. Since the
  7164. entries in the agenda are collected from different files, and different files
  7165. may have different @code{COLUMNS} formats, this is a non-trivial problem.
  7166. Org first checks if the variable @code{org-overriding-columns-format} is
  7167. currently set, and if so, takes the format from there. Otherwise it takes
  7168. the format associated with the first item in the agenda, or, if that item
  7169. does not have a specific format (defined in a property, or in its file), it
  7170. uses @code{org-columns-default-format}.
  7171. @item
  7172. @cindex property, special, CLOCKSUM
  7173. If any of the columns has a summary type defined (@pxref{Column attributes}),
  7174. turning on column view in the agenda will visit all relevant agenda files and
  7175. make sure that the computations of this property are up to date. This is
  7176. also true for the special @code{CLOCKSUM} property. Org will then sum the
  7177. values displayed in the agenda. In the daily/weekly agenda, the sums will
  7178. cover a single day, in all other views they cover the entire block. It is
  7179. vital to realize that the agenda may show the same entry @emph{twice} (for
  7180. example as scheduled and as a deadline), and it may show two entries from the
  7181. same hierarchy (for example a @emph{parent} and its @emph{child}). In these
  7182. cases, the summation in the agenda will lead to incorrect results because
  7183. some values will count double.
  7184. @item
  7185. When the column view in the agenda shows the @code{CLOCKSUM}, that is always
  7186. the entire clocked time for this item. So even in the daily/weekly agenda,
  7187. the clocksum listed in column view may originate from times outside the
  7188. current view. This has the advantage that you can compare these values with
  7189. a column listing the planned total effort for a task---one of the major
  7190. applications for column view in the agenda. If you want information about
  7191. clocked time in the displayed period use clock table mode (press @kbd{R} in
  7192. the agenda).
  7193. @end enumerate
  7194. @node Markup, Exporting, Agenda Views, Top
  7195. @chapter Markup for rich export
  7196. When exporting Org-mode documents, the exporter tries to reflect the
  7197. structure of the document as accurately as possible in the backend. Since
  7198. export targets like HTML, La@TeX{}, or DocBook allow much richer formatting,
  7199. Org mode has rules on how to prepare text for rich export. This section
  7200. summarizes the markup rules used in an Org-mode buffer.
  7201. @menu
  7202. * Structural markup elements:: The basic structure as seen by the exporter
  7203. * Images and tables:: Tables and Images will be included
  7204. * Literal examples:: Source code examples with special formatting
  7205. * Include files:: Include additional files into a document
  7206. * Macro replacement:: Use macros to create complex output
  7207. * Embedded LaTeX:: LaTeX can be freely used inside Org documents
  7208. @end menu
  7209. @node Structural markup elements, Images and tables, Markup, Markup
  7210. @section Structural markup elements
  7211. @menu
  7212. * Document title:: Where the title is taken from
  7213. * Headings and sections:: The document structure as seen by the exporter
  7214. * Table of contents:: The if and where of the table of contents
  7215. * Initial text:: Text before the first heading?
  7216. * Lists:: Lists
  7217. * Paragraphs:: Paragraphs
  7218. * Footnote markup:: Footnotes
  7219. * Emphasis and monospace:: Bold, italic, etc.
  7220. * Horizontal rules:: Make a line
  7221. * Comment lines:: What will *not* be exported
  7222. @end menu
  7223. @node Document title, Headings and sections, Structural markup elements, Structural markup elements
  7224. @subheading Document title
  7225. @cindex document title, markup rules
  7226. @noindent
  7227. The title of the exported document is taken from the special line
  7228. @cindex #+TITLE
  7229. @example
  7230. #+TITLE: This is the title of the document
  7231. @end example
  7232. @noindent
  7233. If this line does not exist, the title is derived from the first non-empty,
  7234. non-comment line in the buffer. If no such line exists, or if you have
  7235. turned off exporting of the text before the first headline (see below), the
  7236. title will be the file name without extension.
  7237. @cindex property, EXPORT_TITLE
  7238. If you are exporting only a subtree by marking is as the region, the heading
  7239. of the subtree will become the title of the document. If the subtree has a
  7240. property @code{EXPORT_TITLE}, that will take precedence.
  7241. @node Headings and sections, Table of contents, Document title, Structural markup elements
  7242. @subheading Headings and sections
  7243. @cindex headings and sections, markup rules
  7244. @vindex org-export-headline-levels
  7245. The outline structure of the document as described in @ref{Document
  7246. Structure}, forms the basis for defining sections of the exported document.
  7247. However, since the outline structure is also used for (for example) lists of
  7248. tasks, only the first three outline levels will be used as headings. Deeper
  7249. levels will become itemized lists. You can change the location of this
  7250. switch globally by setting the variable @code{org-export-headline-levels}, or on a
  7251. per-file basis with a line
  7252. @cindex #+OPTIONS
  7253. @example
  7254. #+OPTIONS: H:4
  7255. @end example
  7256. @node Table of contents, Initial text, Headings and sections, Structural markup elements
  7257. @subheading Table of contents
  7258. @cindex table of contents, markup rules
  7259. @vindex org-export-with-toc
  7260. The table of contents is normally inserted directly before the first headline
  7261. of the file. If you would like to get it to a different location, insert the
  7262. string @code{[TABLE-OF-CONTENTS]} on a line by itself at the desired
  7263. location. The depth of the table of contents is by default the same as the
  7264. number of headline levels, but you can choose a smaller number, or turn off
  7265. the table of contents entirely, by configuring the variable
  7266. @code{org-export-with-toc}, or on a per-file basis with a line like
  7267. @example
  7268. #+OPTIONS: toc:2 (only to two levels in TOC)
  7269. #+OPTIONS: toc:nil (no TOC at all)
  7270. @end example
  7271. @node Initial text, Lists, Table of contents, Structural markup elements
  7272. @subheading Text before the first headline
  7273. @cindex text before first headline, markup rules
  7274. @cindex #+TEXT
  7275. Org mode normally exports the text before the first headline, and even uses
  7276. the first line as the document title. The text will be fully marked up. If
  7277. you need to include literal HTML, La@TeX{}, or DocBook code, use the special
  7278. constructs described below in the sections for the individual exporters.
  7279. @vindex org-export-skip-text-before-1st-heading
  7280. Some people like to use the space before the first headline for setup and
  7281. internal links and therefore would like to control the exported text before
  7282. the first headline in a different way. You can do so by setting the variable
  7283. @code{org-export-skip-text-before-1st-heading} to @code{t}. On a per-file
  7284. basis, you can get the same effect with @samp{#+OPTIONS: skip:t}.
  7285. @noindent
  7286. If you still want to have some text before the first headline, use the
  7287. @code{#+TEXT} construct:
  7288. @example
  7289. #+OPTIONS: skip:t
  7290. #+TEXT: This text will go before the *first* headline.
  7291. #+TEXT: [TABLE-OF-CONTENTS]
  7292. #+TEXT: This goes between the table of contents and the first headline
  7293. @end example
  7294. @node Lists, Paragraphs, Initial text, Structural markup elements
  7295. @subheading Lists
  7296. @cindex lists, markup rules
  7297. Plain lists as described in @ref{Plain lists}, are translated to the backend's
  7298. syntax for such lists. Most backends support unordered, ordered, and
  7299. description lists.
  7300. @node Paragraphs, Footnote markup, Lists, Structural markup elements
  7301. @subheading Paragraphs, line breaks, and quoting
  7302. @cindex paragraphs, markup rules
  7303. Paragraphs are separated by at least one empty line. If you need to enforce
  7304. a line break within a paragraph, use @samp{\\} at the end of a line.
  7305. To keep the line breaks in a region, but otherwise use normal formatting, you
  7306. can use this construct, which can also be used to format poetry.
  7307. @cindex #+BEGIN_VERSE
  7308. @example
  7309. #+BEGIN_VERSE
  7310. Great clouds overhead
  7311. Tiny black birds rise and fall
  7312. Snow covers Emacs
  7313. -- AlexSchroeder
  7314. #+END_VERSE
  7315. @end example
  7316. When quoting a passage from another document, it is customary to format this
  7317. as a paragraph that is indented on both the left and the right margin. You
  7318. can include quotations in Org-mode documents like this:
  7319. @cindex #+BEGIN_QUOTE
  7320. @example
  7321. #+BEGIN_QUOTE
  7322. Everything should be made as simple as possible,
  7323. but not any simpler -- Albert Einstein
  7324. #+END_QUOTE
  7325. @end example
  7326. If you would like to center some text, do it like this:
  7327. @cindex #+BEGIN_CENTER
  7328. @example
  7329. #+BEGIN_CENTER
  7330. Everything should be made as simple as possible, \\
  7331. but not any simpler
  7332. #+END_CENTER
  7333. @end example
  7334. @node Footnote markup, Emphasis and monospace, Paragraphs, Structural markup elements
  7335. @subheading Footnote markup
  7336. @cindex footnotes, markup rules
  7337. @cindex @file{footnote.el}
  7338. Footnotes defined in the way described in @ref{Footnotes}, will be exported by
  7339. all backends. Org allows multiple references to the same note, and
  7340. different backends support this to varying degrees.
  7341. @node Emphasis and monospace, Horizontal rules, Footnote markup, Structural markup elements
  7342. @subheading Emphasis and monospace
  7343. @cindex underlined text, markup rules
  7344. @cindex bold text, markup rules
  7345. @cindex italic text, markup rules
  7346. @cindex verbatim text, markup rules
  7347. @cindex code text, markup rules
  7348. @cindex strike-through text, markup rules
  7349. You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
  7350. and @code{~verbatim~}, and, if you must, @samp{+strike-through+}. Text
  7351. in the code and verbatim string is not processed for Org-mode specific
  7352. syntax, it is exported verbatim.
  7353. @node Horizontal rules, Comment lines, Emphasis and monospace, Structural markup elements
  7354. @subheading Horizontal rules
  7355. @cindex horizontal rules, markup rules
  7356. A line consisting of only dashes, and at least 5 of them, will be
  7357. exported as a horizontal line (@samp{<hr/>} in HTML).
  7358. @node Comment lines, , Horizontal rules, Structural markup elements
  7359. @subheading Comment lines
  7360. @cindex comment lines
  7361. @cindex exporting, not
  7362. @cindex #+BEGIN_COMMENT
  7363. Lines starting with @samp{#} in column zero are treated as comments and will
  7364. never be exported. If you want an indented line to be treated as a comment,
  7365. start it with @samp{#+ }. Also entire subtrees starting with the word
  7366. @samp{COMMENT} will never be exported. Finally, regions surrounded by
  7367. @samp{#+BEGIN_COMMENT} ... @samp{#+END_COMMENT} will not be exported.
  7368. @table @kbd
  7369. @kindex C-c ;
  7370. @item C-c ;
  7371. Toggle the COMMENT keyword at the beginning of an entry.
  7372. @end table
  7373. @node Images and tables, Literal examples, Structural markup elements, Markup
  7374. @section Images and Tables
  7375. @cindex tables, markup rules
  7376. @cindex #+CAPTION
  7377. @cindex #+LABEL
  7378. Both the native Org mode tables (@pxref{Tables}) and tables formatted with
  7379. the @file{table.el} package will be exported properly. For Org mode tables,
  7380. the lines before the first horizontal separator line will become table header
  7381. lines. You can use the following lines somewhere before the table to assign
  7382. a caption and a label for cross references:
  7383. @example
  7384. #+CAPTION: This is the caption for the next table (or link)
  7385. #+LABEL: tbl:basic-data
  7386. | ... | ...|
  7387. |-----|----|
  7388. @end example
  7389. @cindex inlined images, markup rules
  7390. Some backends (HTML, La@TeX{}, and DocBook) allow you to directly include
  7391. images into the exported document. Org does this, if a link to an image
  7392. files does not have a description part, for example @code{[[./img/a.jpg]]}.
  7393. If you wish to define a caption for the image and maybe a label for internal
  7394. cross references, you sure that the link is on a line by itself precede it
  7395. with:
  7396. @example
  7397. #+CAPTION: This is the caption for the next figure link (or table)
  7398. #+LABEL: fig:SED-HR4049
  7399. [[./img/a.jpg]]
  7400. @end example
  7401. You may also define additional attributes for the figure. As this is
  7402. backend-specific, see the sections about the individual backends for more
  7403. information.
  7404. @node Literal examples, Include files, Images and tables, Markup
  7405. @section Literal examples
  7406. @cindex literal examples, markup rules
  7407. @cindex code line references, markup rules
  7408. You can include literal examples that should not be subjected to
  7409. markup. Such examples will be typeset in monospace, so this is well suited
  7410. for source code and similar examples.
  7411. @cindex #+BEGIN_EXAMPLE
  7412. @example
  7413. #+BEGIN_EXAMPLE
  7414. Some example from a text file.
  7415. #+END_EXAMPLE
  7416. @end example
  7417. Note that such blocks may be @i{indented} in order to align nicely with
  7418. indented text and in particular with plain list structure (@pxref{Plain
  7419. lists}). For simplicity when using small examples, you can also start the
  7420. example lines with a colon followed by a space. There may also be additional
  7421. whitespace before the colon:
  7422. @example
  7423. Here is an example
  7424. : Some example from a text file.
  7425. @end example
  7426. @cindex formatting source code, markup rules
  7427. If the example is source code from a programming language, or any other text
  7428. that can be marked up by font-lock in Emacs, you can ask for the example to
  7429. look like the fontified Emacs buffer@footnote{Currently this works for the
  7430. HTML backend, and requires the @file{htmlize.el} package version 1.34 or
  7431. later. It also works for LaTeX with the listings package, if you turn on the
  7432. option @code{org-export-latex-listings} and make sure that the listings
  7433. package is included by the LaTeX header.}. This is done with the @samp{src}
  7434. block, where you also need to specify the name of the major mode that should
  7435. be used to fontify the example:
  7436. @cindex #+BEGIN_SRC
  7437. @example
  7438. #+BEGIN_SRC emacs-lisp
  7439. (defun org-xor (a b)
  7440. "Exclusive or."
  7441. (if a (not b) b))
  7442. #+END_SRC
  7443. @end example
  7444. Both in @code{example} and in @code{src} snippets, you can add a @code{-n}
  7445. switch to the end of the @code{BEGIN} line, to get the lines of the example
  7446. numbered. If you use a @code{+n} switch, the numbering from the previous
  7447. numbered snippet will be continued in the current one. In literal examples,
  7448. Org will interpret strings like @samp{(ref:name)} as labels, and use them as
  7449. targets for special hyperlinks like @code{[[(name)]]} (i.e. the reference name
  7450. enclosed in single parenthesis). In HTML, hovering the mouse over such a
  7451. link will remote-highlight the corresponding code line, which is kind of
  7452. cool.
  7453. You can also add a @code{-r} switch which @i{removes} the labels from the
  7454. source code@footnote{Adding @code{-k} to @code{-n -r} will @i{keep} the
  7455. labels in the source code while using line numbers for the links, which might
  7456. be useful to explain those in an org-mode example code.}. With the @code{-n}
  7457. switch, links to these references will be labeled by the line numbers from
  7458. the code listing, otherwise links will use the labels with no parentheses.
  7459. Here is an example:
  7460. @example
  7461. #+BEGIN_SRC emacs-lisp -n -r
  7462. (save-excursion (ref:sc)
  7463. (goto-char (point-min)) (ref:jump)
  7464. #+END_SRC
  7465. In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
  7466. jumps to point-min.
  7467. @end example
  7468. @vindex org-coderef-label-format
  7469. If the syntax for the label format conflicts with the language syntax, use a
  7470. @code{-l} switch to change the format, for example @samp{#+BEGIN_SRC pascal
  7471. -n -r -l "((%s))"}. See also the variable @code{org-coderef-label-format}.
  7472. HTML export also allows examples to be published as text areas, @xref{Text
  7473. areas in HTML export}.
  7474. @table @kbd
  7475. @kindex C-c '
  7476. @item C-c '
  7477. Edit the source code example at point in its native mode. This works by
  7478. switching to a temporary buffer with the source code. You need to exit by
  7479. pressing @kbd{C-c '} again@footnote{Upon exit, lines starting with @samp{*}
  7480. or @samp{#} will get a comma prepended, to keep them from being interpreted
  7481. by Org as outline nodes or special comments. These commas will be striped
  7482. for editing with @kbd{C-c '}, and also for export.}, the edited version will
  7483. then replace the old version in the Org buffer. Fixed-width regions
  7484. (where each line starts with a colon followed by a space) will be edited
  7485. using @code{artist-mode}@footnote{You may select a different-mode with the
  7486. variable @code{org-edit-fixed-width-region-mode}.} to allow creating ASCII
  7487. drawings easily. Using this command in an empty line will create a new
  7488. fixed-width region.
  7489. @kindex C-c l
  7490. @item C-c l
  7491. Calling @code{org-store-link} while editing a source code example in a
  7492. temporary buffer created with @kbd{C-c '} will prompt for a label, make sure
  7493. that it is unique in the current buffer, and insert it with the proper
  7494. formatting like @samp{(ref:label)} at the end of the current line. Then the
  7495. label is stored as a link @samp{(label)}, for retrieval with @kbd{C-c C-l}.
  7496. @end table
  7497. @node Include files, Macro replacement, Literal examples, Markup
  7498. @section Include files
  7499. @cindex include files, markup rules
  7500. During export, you can include the content of another file. For example, to
  7501. include your @file{.emacs} file, you could use:
  7502. @cindex #+INCLUDE
  7503. @example
  7504. #+INCLUDE: "~/.emacs" src emacs-lisp
  7505. @end example
  7506. @noindent
  7507. The optional second and third parameter are the markup (e.g. @samp{quote},
  7508. @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
  7509. language for formatting the contents. The markup is optional, if it is not
  7510. given, the text will be assumed to be in Org mode format and will be
  7511. processed normally. The include line will also allow additional keyword
  7512. parameters @code{:prefix1} and @code{:prefix} to specify prefixes for the
  7513. first line and for each following line, as well as any options accepted by
  7514. the selected markup. For example, to include a file as an item, use
  7515. @example
  7516. #+INCLUDE: "~/snippets/xx" :prefix1 " + " :prefix " "
  7517. @end example
  7518. @table @kbd
  7519. @kindex C-c '
  7520. @item C-c '
  7521. Visit the include file at point.
  7522. @end table
  7523. @node Macro replacement, Embedded LaTeX, Include files, Markup
  7524. @section Macro replacement
  7525. @cindex macro replacement, during export
  7526. @cindex #+MACRO
  7527. You can define text snippets with
  7528. @example
  7529. #+MACRO: name replacement text $1, $2 are arguments
  7530. @end example
  7531. @noindent which can be referenced anywhere in the document (even in
  7532. code examples) with @code{@{@{@{name(arg1,arg2)@}@}@}}. In addition to
  7533. defined macros, @code{@{@{@{title@}@}@}}, @code{@{@{@{author@}@}@}}, etc.,
  7534. will reference information set by the @code{#+TITLE:}, @code{#+AUTHOR:}, and
  7535. similar lines. Also, @code{@{@{@{date(@var{FORMAT})@}@}@}} and
  7536. @code{@{@{@{modification-time(@var{FORMAT})@}@}@}} refer to current date time
  7537. and to the modification time of the file being exported, respectively.
  7538. @var{FORMAT} should be a format string understood by
  7539. @code{format-time-string}.
  7540. Macro expansion takes place during export, and some people use it to
  7541. construct complex HTML code.
  7542. @node Embedded LaTeX, , Macro replacement, Markup
  7543. @section Embedded La@TeX{}
  7544. @cindex @TeX{} interpretation
  7545. @cindex La@TeX{} interpretation
  7546. Plain ASCII is normally sufficient for almost all note taking. One
  7547. exception, however, are scientific notes which need to be able to contain
  7548. mathematical symbols and the occasional formula. La@TeX{}@footnote{La@TeX{}
  7549. is a macro system based on Donald E. Knuth's @TeX{} system. Many of the
  7550. features described here as ``La@TeX{}'' are really from @TeX{}, but for
  7551. simplicity I am blurring this distinction.} is widely used to typeset
  7552. scientific documents. Org mode supports embedding La@TeX{} code into its
  7553. files, because many academics are used to reading La@TeX{} source code, and
  7554. because it can be readily processed into images for HTML production.
  7555. It is not necessary to mark La@TeX{} macros and code in any special way.
  7556. If you observe a few conventions, Org mode knows how to find it and what
  7557. to do with it.
  7558. @menu
  7559. * Special symbols:: Greek letters and other symbols
  7560. * Subscripts and superscripts:: Simple syntax for raising/lowering text
  7561. * LaTeX fragments:: Complex formulas made easy
  7562. * Previewing LaTeX fragments:: What will this snippet look like?
  7563. * CDLaTeX mode:: Speed up entering of formulas
  7564. @end menu
  7565. @node Special symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
  7566. @subsection Special symbols
  7567. @cindex math symbols
  7568. @cindex special symbols
  7569. @cindex @TeX{} macros
  7570. @cindex La@TeX{} fragments, markup rules
  7571. @cindex HTML entities
  7572. @cindex La@TeX{} entities
  7573. You can use La@TeX{} macros to insert special symbols like @samp{\alpha} to
  7574. indicate the Greek letter, or @samp{\to} to indicate an arrow. Completion
  7575. for these macros is available, just type @samp{\} and maybe a few letters,
  7576. and press @kbd{M-@key{TAB}} to see possible completions. Unlike La@TeX{}
  7577. code, Org mode allows these macros to be present without surrounding math
  7578. delimiters, for example:
  7579. @example
  7580. Angles are written as Greek letters \alpha, \beta and \gamma.
  7581. @end example
  7582. @vindex org-html-entities
  7583. During export, these symbols will be transformed into the native format of
  7584. the exporter backend. Strings like @code{\alpha} will be exported as
  7585. @code{&alpha;} in the HTML output, and as @code{$\alpha$} in the La@TeX{}
  7586. output. Similarly, @code{\nbsp} will become @code{&nbsp;} in HTML and
  7587. @code{~} in La@TeX{}. If you need such a symbol inside a word, terminate it
  7588. like this: @samp{\Aacute@{@}stor}.
  7589. A large number of entities is provided, with names taken from both HTML and
  7590. La@TeX{}, see the variable @code{org-html-entities} for the complete list.
  7591. @samp{\-} is treated as a shy hyphen, and @samp{--}, @samp{---}, and
  7592. @samp{...} are all converted into special commands creating hyphens of
  7593. different lengths or a compact set of dots.
  7594. @node Subscripts and superscripts, LaTeX fragments, Special symbols, Embedded LaTeX
  7595. @subsection Subscripts and superscripts
  7596. @cindex subscript
  7597. @cindex superscript
  7598. Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
  7599. and subscripts. Again, these can be used without embedding them in
  7600. math-mode delimiters. To increase the readability of ASCII text, it is
  7601. not necessary (but OK) to surround multi-character sub- and superscripts
  7602. with curly braces. For example
  7603. @example
  7604. The mass if the sun is M_sun = 1.989 x 10^30 kg. The radius of
  7605. the sun is R_@{sun@} = 6.96 x 10^8 m.
  7606. @end example
  7607. @vindex org-export-with-sub-superscripts
  7608. To avoid interpretation as raised or lowered text, you can quote @samp{^} and
  7609. @samp{_} with a backslash: @samp{\^} and @samp{\_}. If you write a text
  7610. where the underscore is often used in a different context, Org's convention
  7611. to always interpret these as subscripts can get in your way. Configure the
  7612. variable @code{org-export-with-sub-superscripts} to globally change this
  7613. convention, or use, on a per-file basis:
  7614. @example
  7615. #+OPTIONS: ^:@{@}
  7616. @end example
  7617. @node LaTeX fragments, Previewing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
  7618. @subsection La@TeX{} fragments
  7619. @cindex La@TeX{} fragments
  7620. @vindex org-format-latex-header
  7621. With symbols, sub- and superscripts, HTML is pretty much at its end when
  7622. it comes to representing mathematical formulas@footnote{Yes, there is
  7623. MathML, but that is not yet fully supported by many browsers, and there
  7624. is no decent converter for turning La@TeX{} or ASCII representations of
  7625. formulas into MathML. So for the time being, converting formulas into
  7626. images seems the way to go.}. More complex expressions need a dedicated
  7627. formula processor. To this end, Org mode can contain arbitrary La@TeX{}
  7628. fragments. It provides commands to preview the typeset result of these
  7629. fragments, and upon export to HTML, all fragments will be converted to
  7630. images and inlined into the HTML document@footnote{The La@TeX{} export
  7631. will not use images for displaying La@TeX{} fragments but include these
  7632. fragments directly into the La@TeX{} code.}. For this to work you
  7633. need to be on a system with a working La@TeX{} installation. You also
  7634. need the @file{dvipng} program, available at
  7635. @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
  7636. will be used when processing a fragment can be configured with the
  7637. variable @code{org-format-latex-header}.
  7638. La@TeX{} fragments don't need any special marking at all. The following
  7639. snippets will be identified as La@TeX{} source code:
  7640. @itemize @bullet
  7641. @item
  7642. Environments of any kind. The only requirement is that the
  7643. @code{\begin} statement appears on a new line, preceded by only
  7644. whitespace.
  7645. @item
  7646. Text within the usual La@TeX{} math delimiters. To avoid conflicts with
  7647. currency specifications, single @samp{$} characters are only recognized as
  7648. math delimiters if the enclosed text contains at most two line breaks, is
  7649. directly attached to the @samp{$} characters with no whitespace in between,
  7650. and if the closing @samp{$} is followed by whitespace, punctuation or a dash.
  7651. For the other delimiters, there is no such restriction, so when in doubt, use
  7652. @samp{\(...\)} as inline math delimiters.
  7653. @end itemize
  7654. @noindent For example:
  7655. @example
  7656. \begin@{equation@} % arbitrary environments,
  7657. x=\sqrt@{b@} % even tables, figures
  7658. \end@{equation@} % etc
  7659. If $a^2=b$ and \( b=2 \), then the solution must be
  7660. either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
  7661. @end example
  7662. @noindent
  7663. @vindex org-format-latex-options
  7664. If you need any of the delimiter ASCII sequences for other purposes, you
  7665. can configure the option @code{org-format-latex-options} to deselect the
  7666. ones you do not wish to have interpreted by the La@TeX{} converter.
  7667. @node Previewing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
  7668. @subsection Previewing LaTeX fragments
  7669. @cindex LaTeX fragments, preview
  7670. La@TeX{} fragments can be processed to produce preview images of the
  7671. typeset expressions:
  7672. @table @kbd
  7673. @kindex C-c C-x C-l
  7674. @item C-c C-x C-l
  7675. Produce a preview image of the La@TeX{} fragment at point and overlay it
  7676. over the source code. If there is no fragment at point, process all
  7677. fragments in the current entry (between two headlines). When called
  7678. with a prefix argument, process the entire subtree. When called with
  7679. two prefix arguments, or when the cursor is before the first headline,
  7680. process the entire buffer.
  7681. @kindex C-c C-c
  7682. @item C-c C-c
  7683. Remove the overlay preview images.
  7684. @end table
  7685. @vindex org-format-latex-options
  7686. You can customize the variable @code{org-format-latex-options} to influence
  7687. some aspects of the preview. In particular, the @code{:scale} (and for HTML
  7688. export, @code{:html-scale}) property can be used to adjust the size of the
  7689. preview images.
  7690. During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
  7691. converted into images and inlined into the document if the following
  7692. setting is active:
  7693. @lisp
  7694. (setq org-export-with-LaTeX-fragments t)
  7695. @end lisp
  7696. @node CDLaTeX mode, , Previewing LaTeX fragments, Embedded LaTeX
  7697. @subsection Using CDLa@TeX{} to enter math
  7698. @cindex CDLa@TeX{}
  7699. CDLa@TeX{} mode is a minor mode that is normally used in combination with a
  7700. major La@TeX{} mode like AUC@TeX{} in order to speed-up insertion of
  7701. environments and math templates. Inside Org mode, you can make use of
  7702. some of the features of CDLa@TeX{} mode. You need to install
  7703. @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
  7704. AUC@TeX{}) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
  7705. Don't use CDLa@TeX{} mode itself under Org mode, but use the light
  7706. version @code{org-cdlatex-mode} that comes as part of Org mode. Turn it
  7707. on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
  7708. Org files with
  7709. @lisp
  7710. (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
  7711. @end lisp
  7712. When this mode is enabled, the following features are present (for more
  7713. details see the documentation of CDLa@TeX{} mode):
  7714. @itemize @bullet
  7715. @kindex C-c @{
  7716. @item
  7717. Environment templates can be inserted with @kbd{C-c @{}.
  7718. @item
  7719. @kindex @key{TAB}
  7720. The @key{TAB} key will do template expansion if the cursor is inside a
  7721. La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
  7722. inside such a fragment, see the documentation of the function
  7723. @code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will
  7724. expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
  7725. correctly inside the first brace. Another @key{TAB} will get you into
  7726. the second brace. Even outside fragments, @key{TAB} will expand
  7727. environment abbreviations at the beginning of a line. For example, if
  7728. you write @samp{equ} at the beginning of a line and press @key{TAB},
  7729. this abbreviation will be expanded to an @code{equation} environment.
  7730. To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
  7731. @item
  7732. @kindex _
  7733. @kindex ^
  7734. @vindex cdlatex-simplify-sub-super-scripts
  7735. Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
  7736. characters together with a pair of braces. If you use @key{TAB} to move
  7737. out of the braces, and if the braces surround only a single character or
  7738. macro, they are removed again (depending on the variable
  7739. @code{cdlatex-simplify-sub-super-scripts}).
  7740. @item
  7741. @kindex `
  7742. Pressing the backquote @kbd{`} followed by a character inserts math
  7743. macros, also outside La@TeX{} fragments. If you wait more than 1.5 seconds
  7744. after the backquote, a help window will pop up.
  7745. @item
  7746. @kindex '
  7747. Pressing the single-quote @kbd{'} followed by another character modifies
  7748. the symbol before point with an accent or a font. If you wait more than
  7749. 1.5 seconds after the backquote, a help window will pop up. Character
  7750. modification will work only inside La@TeX{} fragments, outside the quote
  7751. is normal.
  7752. @end itemize
  7753. @node Exporting, Publishing, Markup, Top
  7754. @chapter Exporting
  7755. @cindex exporting
  7756. Org-mode documents can be exported into a variety of other formats. For
  7757. printing and sharing of notes, ASCII export produces a readable and simple
  7758. version of an Org file. HTML export allows you to publish a notes file on
  7759. the web, while the XOXO format provides a solid base for exchange with a
  7760. broad range of other applications. La@TeX{} export lets you use Org mode and
  7761. its structured editing functions to easily create La@TeX{} files. DocBook
  7762. export makes it possible to convert Org files to many other formats using
  7763. DocBook tools. To incorporate entries with associated times like deadlines
  7764. or appointments into a desktop calendar program like iCal, Org mode can also
  7765. produce extracts in the iCalendar format. Currently Org mode only supports
  7766. export, not import of these different formats.
  7767. Org supports export of selected regions when @code{transient-mark-mode} is
  7768. enabled (default in Emacs 23).
  7769. @menu
  7770. * Selective export:: Using tags to select and exclude trees
  7771. * Export options:: Per-file export settings
  7772. * The export dispatcher:: How to access exporter commands
  7773. * ASCII export:: Exporting to plain ASCII
  7774. * HTML export:: Exporting to HTML
  7775. * LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF
  7776. * DocBook export:: Exporting to DocBook
  7777. * Freemind export:: Exporting to Freemind mind maps
  7778. * XOXO export:: Exporting to XOXO
  7779. * iCalendar export:: Exporting in iCalendar format
  7780. @end menu
  7781. @node Selective export, Export options, Exporting, Exporting
  7782. @section Selective export
  7783. @cindex export, selective by tags
  7784. @vindex org-export-select-tags
  7785. @vindex org-export-exclude-tags
  7786. You may use tags to select the parts of a document that should be exported,
  7787. or to exclude parts from export. This behavior is governed by two variables:
  7788. @code{org-export-select-tags} and @code{org-export-exclude-tags}.
  7789. Org first checks if any of the @emph{select} tags is present in the buffer.
  7790. If yes, all trees that do not carry one of these tags will be excluded. If a
  7791. selected tree is a subtree, the heading hierarchy above it will also be
  7792. selected for export, but not the text below those headings.
  7793. @noindent
  7794. If none of the select tags is found, the whole buffer will be selected for
  7795. export.
  7796. @noindent
  7797. Finally, all subtrees that are marked by any of the @emph{exclude} tags will
  7798. be removed from the export buffer.
  7799. @node Export options, The export dispatcher, Selective export, Exporting
  7800. @section Export options
  7801. @cindex options, for export
  7802. @cindex completion, of option keywords
  7803. The exporter recognizes special lines in the buffer which provide
  7804. additional information. These lines may be put anywhere in the file.
  7805. The whole set of lines can be inserted into the buffer with @kbd{C-c
  7806. C-e t}. For individual lines, a good way to make sure the keyword is
  7807. correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
  7808. (@pxref{Completion}). For a summary of other in-buffer settings not
  7809. specifically related to export, see @ref{In-buffer settings}.
  7810. In particular, note that you can place commonly-used (export) options in
  7811. a separate file which can be included using @code{#+SETUPFILE}.
  7812. @table @kbd
  7813. @kindex C-c C-e t
  7814. @item C-c C-e t
  7815. Insert template with export options, see example below.
  7816. @end table
  7817. @cindex #+TITLE
  7818. @cindex #+AUTHOR
  7819. @cindex #+DATE
  7820. @cindex #+EMAIL
  7821. @cindex #+DESCRIPTION
  7822. @cindex #+KEYWORDS
  7823. @cindex #+LANGUAGE
  7824. @cindex #+TEXT
  7825. @cindex #+OPTIONS
  7826. @cindex #+BIND
  7827. @cindex #+LINK_UP
  7828. @cindex #+LINK_HOME
  7829. @cindex #+EXPORT_SELECT_TAGS
  7830. @cindex #+EXPORT_EXCLUDE_TAGS
  7831. @cindex #+LATEX_HEADER
  7832. @vindex user-full-name
  7833. @vindex user-mail-address
  7834. @vindex org-export-default-language
  7835. @example
  7836. #+TITLE: the title to be shown (default is the buffer name)
  7837. #+AUTHOR: the author (default taken from @code{user-full-name})
  7838. #+DATE: a date, fixed, of a format string for @code{format-time-string}
  7839. #+EMAIL: his/her email address (default from @code{user-mail-address})
  7840. #+DESCRIPTION: the page description, e.g. for the XHTML meta tag
  7841. #+KEYWORDS: the page keywords, e.g. for the XHTML meta tag
  7842. #+LANGUAGE: language for HTML, e.g. @samp{en} (@code{org-export-default-language})
  7843. #+TEXT: Some descriptive text to be inserted at the beginning.
  7844. #+TEXT: Several lines may be given.
  7845. #+OPTIONS: H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
  7846. #+BIND: lisp-var lisp-val, e.g.: org-export-latex-low-levels itemize
  7847. @r{You need to confirm using these, or configure @code{org-export-allow-BIND}}
  7848. #+LINK_UP: the ``up'' link of an exported page
  7849. #+LINK_HOME: the ``home'' link of an exported page
  7850. #+LATEX_HEADER: extra line(s) for the LaTeX header, like \usepackage@{xyz@}
  7851. #+EXPORT_SELECT_TAGS: Tags that select a tree for export
  7852. #+EXPORT_EXCLUDE_TAGS: Tags that exclude a tree from export
  7853. @end example
  7854. @noindent
  7855. The OPTIONS line is a compact@footnote{If you want to configure many options
  7856. this way, you can use several OPTIONS lines.} form to specify export settings. Here
  7857. you can:
  7858. @cindex headline levels
  7859. @cindex section-numbers
  7860. @cindex table of contents
  7861. @cindex line-break preservation
  7862. @cindex quoted HTML tags
  7863. @cindex fixed-width sections
  7864. @cindex tables
  7865. @cindex @TeX{}-like syntax for sub- and superscripts
  7866. @cindex footnotes
  7867. @cindex special strings
  7868. @cindex emphasized text
  7869. @cindex @TeX{} macros
  7870. @cindex La@TeX{} fragments
  7871. @cindex author info, in export
  7872. @cindex time info, in export
  7873. @example
  7874. H: @r{set the number of headline levels for export}
  7875. num: @r{turn on/off section-numbers}
  7876. toc: @r{turn on/off table of contents, or set level limit (integer)}
  7877. \n: @r{turn on/off line-break-preservation (DOES NOT WORK)}
  7878. @@: @r{turn on/off quoted HTML tags}
  7879. :: @r{turn on/off fixed-width sections}
  7880. |: @r{turn on/off tables}
  7881. ^: @r{turn on/off @TeX{}-like syntax for sub- and superscripts. If}
  7882. @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
  7883. @r{the simple @code{a_b} will be left as it is.}
  7884. -: @r{turn on/off conversion of special strings.}
  7885. f: @r{turn on/off footnotes like this[1].}
  7886. todo: @r{turn on/off inclusion of TODO keywords into exported text}
  7887. pri: @r{turn on/off priority cookies}
  7888. tags: @r{turn on/off inclusion of tags, may also be @code{not-in-toc}}
  7889. <: @r{turn on/off inclusion of any time/date stamps like DEADLINES}
  7890. *: @r{turn on/off emphasized text (bold, italic, underlined)}
  7891. TeX: @r{turn on/off simple @TeX{} macros in plain text}
  7892. LaTeX: @r{turn on/off La@TeX{} fragments}
  7893. skip: @r{turn on/off skipping the text before the first heading}
  7894. author: @r{turn on/off inclusion of author name/email into exported file}
  7895. creator: @r{turn on/off inclusion of creator info into exported file}
  7896. timestamp: @r{turn on/off inclusion creation time into exported file}
  7897. d: @r{turn on/off inclusion of drawers}
  7898. @end example
  7899. @noindent
  7900. These options take effect in both the HTML and La@TeX{} export, except
  7901. for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
  7902. @code{nil} for the La@TeX{} export.
  7903. When exporting only a single subtree by selecting it with @kbd{C-c @@} before
  7904. calling an export command, the subtree can overrule some of the file's export
  7905. settings with properties @code{EXPORT_FILE_NAME}, @code{EXPORT_TITLE},
  7906. @code{EXPORT_TEXT}, @code{EXPORT_AUTHOR}, @code{EXPORT_DATE}, and
  7907. @code{EXPORT_OPTIONS}.
  7908. @node The export dispatcher, ASCII export, Export options, Exporting
  7909. @section The export dispatcher
  7910. @cindex dispatcher, for export commands
  7911. All export commands can be reached using the export dispatcher, which is a
  7912. prefix key that prompts for an additional key specifying the command.
  7913. Normally the entire file is exported, but if there is an active region that
  7914. contains one outline tree, the first heading is used as document title and
  7915. the subtrees are exported.
  7916. @table @kbd
  7917. @kindex C-c C-e
  7918. @item C-c C-e
  7919. @vindex org-export-run-in-background
  7920. Dispatcher for export and publishing commands. Displays a help-window
  7921. listing the additional key(s) needed to launch an export or publishing
  7922. command. The prefix arg is passed through to the exporter. A double prefix
  7923. @kbd{C-u C-u} causes most commands to be executed in the background, in a
  7924. separate Emacs process@footnote{To make this behavior the default, customize
  7925. the variable @code{org-export-run-in-background}.}.
  7926. @kindex C-c C-e v
  7927. @item C-c C-e v
  7928. Like @kbd{C-c C-e}, but only export the text that is currently visible
  7929. (i.e. not hidden by outline visibility).
  7930. @kindex C-u C-u C-c C-e
  7931. @item C-u C-u C-c C-e
  7932. @vindex org-export-run-in-background
  7933. Call an the exporter, but reverse the setting of
  7934. @code{org-export-run-in-background}, i.e. request background processing if
  7935. not set, or force processing in the current Emacs process if set.
  7936. @end table
  7937. @node ASCII export, HTML export, The export dispatcher, Exporting
  7938. @section ASCII export
  7939. @cindex ASCII export
  7940. ASCII export produces a simple and very readable version of an Org-mode
  7941. file.
  7942. @cindex region, active
  7943. @cindex active region
  7944. @cindex transient-mark-mode
  7945. @table @kbd
  7946. @kindex C-c C-e a
  7947. @item C-c C-e a
  7948. @cindex property, EXPORT_FILE_NAME
  7949. Export as ASCII file. For an Org file, @file{myfile.org}, the ASCII file
  7950. will be @file{myfile.txt}. The file will be overwritten without
  7951. warning. If there is an active region@footnote{This requires
  7952. @code{transient-mark-mode} be turned on.}, only the region will be
  7953. exported. If the selected region is a single tree@footnote{To select the
  7954. current subtree, use @kbd{C-c @@}.}, the tree head will
  7955. become the document title. If the tree head entry has or inherits an
  7956. @code{EXPORT_FILE_NAME} property, that name will be used for the
  7957. export.
  7958. @kindex C-c C-e A
  7959. @item C-c C-e A
  7960. Export to a temporary buffer, do not create a file.
  7961. @kindex C-c C-e v a
  7962. @item C-c C-e v a
  7963. Export only the visible part of the document.
  7964. @end table
  7965. @cindex headline levels, for exporting
  7966. In the exported version, the first 3 outline levels will become
  7967. headlines, defining a general document structure. Additional levels
  7968. will be exported as itemized lists. If you want that transition to occur
  7969. at a different level, specify it with a prefix argument. For example,
  7970. @example
  7971. @kbd{C-1 C-c C-e a}
  7972. @end example
  7973. @noindent
  7974. creates only top level headlines and does the rest as items. When
  7975. headlines are converted to items, the indentation of the text following
  7976. the headline is changed to fit nicely under the item. This is done with
  7977. the assumption that the first body line indicates the base indentation of
  7978. the body text. Any indentation larger than this is adjusted to preserve
  7979. the layout relative to the first line. Should there be lines with less
  7980. indentation than the first, these are left alone.
  7981. @vindex org-export-ascii-links-to-notes
  7982. Links will be exported in a footnote-like style, with the descriptive part in
  7983. the text and the link in a note before the next heading. See the variable
  7984. @code{org-export-ascii-links-to-notes} for details and other options.
  7985. @node HTML export, LaTeX and PDF export, ASCII export, Exporting
  7986. @section HTML export
  7987. @cindex HTML export
  7988. Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
  7989. HTML formatting, in ways similar to John Gruber's @emph{markdown}
  7990. language, but with additional support for tables.
  7991. @menu
  7992. * HTML Export commands:: How to invoke HTML export
  7993. * Quoting HTML tags:: Using direct HTML in Org mode
  7994. * Links in HTML export:: How links will be interpreted and formatted
  7995. * Tables in HTML export:: How to modify the formatting of tables
  7996. * Images in HTML export:: How to insert figures into HTML output
  7997. * Text areas in HTML export:: An alternative way to show an example
  7998. * CSS support:: Changing the appearance of the output
  7999. * Javascript support:: Info and Folding in a web browser
  8000. @end menu
  8001. @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
  8002. @subsection HTML export commands
  8003. @cindex region, active
  8004. @cindex active region
  8005. @cindex transient-mark-mode
  8006. @table @kbd
  8007. @kindex C-c C-e h
  8008. @item C-c C-e h
  8009. @cindex property, EXPORT_FILE_NAME
  8010. Export as HTML file @file{myfile.html}. For an Org file @file{myfile.org},
  8011. the ASCII file will be @file{myfile.html}. The file will be overwritten
  8012. without warning. If there is an active region@footnote{This requires
  8013. @code{transient-mark-mode} be turned on.}, only the region will be
  8014. exported. If the selected region is a single tree@footnote{To select the
  8015. current subtree, use @kbd{C-c @@}.}, the tree head will become the document
  8016. title. If the tree head entry has, or inherits, an @code{EXPORT_FILE_NAME}
  8017. property, that name will be used for the export.
  8018. @kindex C-c C-e b
  8019. @item C-c C-e b
  8020. Export as HTML file and immediately open it with a browser.
  8021. @kindex C-c C-e H
  8022. @item C-c C-e H
  8023. Export to a temporary buffer, do not create a file.
  8024. @kindex C-c C-e R
  8025. @item C-c C-e R
  8026. Export the active region to a temporary buffer. With a prefix argument, do
  8027. not produce the file header and footer, but just the plain HTML section for
  8028. the region. This is good for cut-and-paste operations.
  8029. @kindex C-c C-e v h
  8030. @kindex C-c C-e v b
  8031. @kindex C-c C-e v H
  8032. @kindex C-c C-e v R
  8033. @item C-c C-e v h
  8034. @item C-c C-e v b
  8035. @item C-c C-e v H
  8036. @item C-c C-e v R
  8037. Export only the visible part of the document.
  8038. @item M-x org-export-region-as-html
  8039. Convert the region to HTML under the assumption that it was Org-mode
  8040. syntax before. This is a global command that can be invoked in any
  8041. buffer.
  8042. @item M-x org-replace-region-by-HTML
  8043. Replace the active region (assumed to be in Org-mode syntax) by HTML
  8044. code.
  8045. @end table
  8046. @cindex headline levels, for exporting
  8047. In the exported version, the first 3 outline levels will become headlines,
  8048. defining a general document structure. Additional levels will be exported as
  8049. itemized lists. If you want that transition to occur at a different level,
  8050. specify it with a numeric prefix argument. For example,
  8051. @example
  8052. @kbd{C-2 C-c C-e b}
  8053. @end example
  8054. @noindent
  8055. creates two levels of headings and does the rest as items.
  8056. @node Quoting HTML tags, Links in HTML export, HTML Export commands, HTML export
  8057. @subsection Quoting HTML tags
  8058. Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
  8059. @samp{&gt;} in HTML export. If you want to include simple HTML tags
  8060. which should be interpreted as such, mark them with @samp{@@} as in
  8061. @samp{@@<b>bold text@@</b>}. Note that this really works only for
  8062. simple tags. For more extensive HTML that should be copied verbatim to
  8063. the exported file use either
  8064. @cindex #+HTML
  8065. @cindex #+BEGIN_HTML
  8066. @example
  8067. #+HTML: Literal HTML code for export
  8068. @end example
  8069. @noindent or
  8070. @cindex #+BEGIN_HTML
  8071. @example
  8072. #+BEGIN_HTML
  8073. All lines between these markers are exported literally
  8074. #+END_HTML
  8075. @end example
  8076. @node Links in HTML export, Tables in HTML export, Quoting HTML tags, HTML export
  8077. @subsection Links in HTML export
  8078. @cindex links, in HTML export
  8079. @cindex internal links, in HTML export
  8080. @cindex external links, in HTML export
  8081. Internal links (@pxref{Internal links}) will continue to work in HTML. This
  8082. includes automatic links created by radio targets (@pxref{Radio
  8083. targets}). Links to external files will still work if the target file is on
  8084. the same @i{relative} path as the published Org file. Links to other
  8085. @file{.org} files will be translated into HTML links under the assumption
  8086. that an HTML version also exists of the linked file, at the same relative
  8087. path. @samp{id:} links can then be used to jump to specific entries across
  8088. files. For information related to linking files while publishing them to a
  8089. publishing directory see @ref{Publishing links}.
  8090. If you want to specify attributes for links, you can do so using a special
  8091. @code{#+ATTR_HTML} line to define attributes that will be added to the
  8092. @code{<a>} or @code{<img>} tags. Here is an example that sets @code{title}
  8093. and @code{style} attributes for a link:
  8094. @cindex #+ATTR_HTML
  8095. @example
  8096. #+ATTR_HTML: title="The Org-mode homepage" style="color:red;"
  8097. [[http://orgmode.org]]
  8098. @end example
  8099. @node Tables in HTML export, Images in HTML export, Links in HTML export, HTML export
  8100. @subsection Tables
  8101. @cindex tables, in HTML
  8102. @vindex org-export-html-table-tag
  8103. Org-mode tables are exported to HTML using the table tag defined in
  8104. @code{org-export-html-table-tag}. The default setting makes tables without
  8105. cell borders and frame. If you would like to change this for individual
  8106. tables, place somthing like the following before the table:
  8107. @cindex #+CAPTION
  8108. @cindex #+ATTR_HTML
  8109. @example
  8110. #+CAPTION: This is a table with lines around and between cells
  8111. #+ATTR_HTML: border="2" rules="all" frame="all"
  8112. @end example
  8113. @node Images in HTML export, Text areas in HTML export, Tables in HTML export, HTML export
  8114. @subsection Images in HTML export
  8115. @cindex images, inline in HTML
  8116. @cindex inlining images in HTML
  8117. @vindex org-export-html-inline-images
  8118. HTML export can inline images given as links in the Org file, and
  8119. it can make an image the clickable part of a link. By
  8120. default@footnote{But see the variable
  8121. @code{org-export-html-inline-images}.}, images are inlined if a link does
  8122. not have a description. So @samp{[[file:myimg.jpg]]} will be inlined,
  8123. while @samp{[[file:myimg.jpg][the image]]} will just produce a link
  8124. @samp{the image} that points to the image. If the description part
  8125. itself is a @code{file:} link or a @code{http:} URL pointing to an
  8126. image, this image will be inlined and activated so that clicking on the
  8127. image will activate the link. For example, to include a thumbnail that
  8128. will link to a high resolution version of the image, you could use:
  8129. @example
  8130. [[file:highres.jpg][file:thumb.jpg]]
  8131. @end example
  8132. If you need to add attributes to an inlines image, use a @code{#+ATTR_HTML}.
  8133. In the example below we specify the @code{alt} and @code{title} attributes to
  8134. support text viewers and accessibility, and align it to the right.
  8135. @cindex #+CAPTION
  8136. @cindex #+ATTR_HTML
  8137. @example
  8138. #+CAPTION: A black cat stalking a spider
  8139. #+ATTR_HTML: alt="cat/spider image" title="Action!" align="right"
  8140. [[./img/a.jpg]]
  8141. @end example
  8142. @noindent
  8143. and you could use @code{http} addresses just as well.
  8144. @node Text areas in HTML export, CSS support, Images in HTML export, HTML export
  8145. @subsection Text areas in HTML export
  8146. @cindex text areas, in HTML
  8147. An alternative way to publish literal code examples in HTML is to use text
  8148. areas, where the example can even be edited before pasting it into an
  8149. application. It is triggered by a @code{-t} switch at an @code{example} or
  8150. @code{src} block. Using this switch disables any options for syntax and
  8151. label highlighting, and line numbering, which may be present. You may also
  8152. use @code{-h} and @code{-w} switches to specify the height and width of the
  8153. text area, which default to the number of lines in the example, and 80,
  8154. respectively. For example
  8155. @example
  8156. #+BEGIN_EXAMPLE -t -w 40
  8157. (defun org-xor (a b)
  8158. "Exclusive or."
  8159. (if a (not b) b))
  8160. #+END_EXAMPLE
  8161. @end example
  8162. @node CSS support, Javascript support, Text areas in HTML export, HTML export
  8163. @subsection CSS support
  8164. @cindex CSS, for HTML export
  8165. @cindex HTML export, CSS
  8166. @vindex org-export-html-todo-kwd-class-prefix
  8167. @vindex org-export-html-tag-class-prefix
  8168. You can also give style information for the exported file. The HTML exporter
  8169. assigns the following special CSS classes@footnote{If the classes on TODO
  8170. keywords and tags lead to conflicts, use the variables
  8171. @code{org-export-html-todo-kwd-class-prefix} and
  8172. @code{org-export-html-tag-class-prefix} to make them unique.} to appropriate
  8173. parts of the document---your style specifications may change these, in
  8174. addition to any of the standard classes like for headlines, tables, etc.
  8175. @example
  8176. p.author @r{author information, including email}
  8177. p.date @r{publishing date}
  8178. p.creator @r{creator info, about org-mode version}
  8179. .title @r{document title}
  8180. .todo @r{TODO keywords, all not-done states}
  8181. .done @r{the DONE keywords, all stated the count as done}
  8182. .WAITING @r{each TODO keyword also uses a class named after itself}
  8183. .timestamp @r{timestamp}
  8184. .timestamp-kwd @r{keyword associated with a timestamp, like SCHEDULED}
  8185. .timestamp-wrapper @r{span around keyword plus timestamp}
  8186. .tag @r{tag in a headline}
  8187. ._HOME @r{each tag uses itself as a class, "@@" replaced by "_"}
  8188. .target @r{target for links}
  8189. .linenr @r{the line number in a code example}
  8190. .code-highlighted @r{for highlighting referenced code lines}
  8191. div.outline-N @r{div for outline level N (headline plus text))}
  8192. div.outline-text-N @r{extra div for text at outline level N}
  8193. .section-number-N @r{section number in headlines, different for each level}
  8194. div.figure @r{how to format an inlined image}
  8195. pre.src @r{formatted source code}
  8196. pre.example @r{normal example}
  8197. p.verse @r{verse paragraph}
  8198. div.footnotes @r{footnote section headline}
  8199. p.footnote @r{footnote definition paragraph, containing a footnote}
  8200. .footref @r{a footnote reference number (always a <sup>)}
  8201. .footnum @r{footnote number in footnote definition (always <sup>)}
  8202. @end example
  8203. @vindex org-export-html-style-default
  8204. @vindex org-export-html-style-include-default
  8205. @vindex org-export-html-style
  8206. @vindex org-export-html-extra
  8207. @vindex org-export-html-style-default
  8208. Each exported file contains a compact default style that defines these
  8209. classes in a basic way@footnote{This style is defined in the constant
  8210. @code{org-export-html-style-default}, which you should not modify. To turn
  8211. inclusion of these defaults off, customize
  8212. @code{org-export-html-style-include-default}}. You may overwrite these
  8213. settings, or add to them by using the variables @code{org-export-html-style}
  8214. (for Org-wide settings) and @code{org-export-html-style-extra} (for more
  8215. granular settings, like file-local settings). To set the latter variable
  8216. individually for each file, you can use
  8217. @cindex #+STYLE
  8218. @example
  8219. #+STYLE: <link rel="stylesheet" type="text/css" href="stylesheet.css" />
  8220. @end example
  8221. @noindent
  8222. For longer style definitions, you can use several such lines. You could also
  8223. directly write a @code{<style>} @code{</style>} section in this way, without
  8224. referring to an external file.
  8225. @c FIXME: More about header and footer styles
  8226. @c FIXME: Talk about links and targets.
  8227. @node Javascript support, , CSS support, HTML export
  8228. @subsection Javascript supported display of web pages
  8229. @cindex Rose, Sebastian
  8230. Sebastian Rose has written a JavaScript program especially designed to
  8231. enhance the web viewing experience of HTML files created with Org. This
  8232. program allows you to view large files in two different ways. The first one
  8233. is an @emph{Info}-like mode where each section is displayed separately and
  8234. navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
  8235. as well, press @kbd{?} for an overview of the available keys). The second
  8236. view type is a @emph{folding} view much like Org provides inside Emacs. The
  8237. script is available at @url{http://orgmode.org/org-info.js} and you can find
  8238. the documentation for it at @url{http://orgmode.org/worg/code/org-info-js/}.
  8239. We host the script at our site, but if you use it a lot, you might
  8240. not want to be dependent on @url{orgmode.org} and prefer to install a local
  8241. copy on your own web server.
  8242. To use the script, you need to make sure that the @file{org-jsinfo.el} module
  8243. gets loaded. It should be loaded by default, but you can try @kbd{M-x
  8244. customize-variable @key{RET} org-modules @key{RET}} to convince yourself that
  8245. this is indeed the case. All it then takes to make use of the program is
  8246. adding a single line to the Org file:
  8247. @cindex #+INFOJS_OPT
  8248. @example
  8249. #+INFOJS_OPT: view:info toc:nil
  8250. @end example
  8251. @noindent
  8252. If this line is found, the HTML header will automatically contain the code
  8253. needed to invoke the script. Using the line above, you can set the following
  8254. viewing options:
  8255. @example
  8256. path: @r{The path to the script. The default is to grab the script from}
  8257. @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
  8258. @r{a local copy and use a path like @samp{../scripts/org-info.js}.}
  8259. view: @r{Initial view when website is first shown. Possible values are:}
  8260. info @r{Info-like interface with one section per page.}
  8261. overview @r{Folding interface, initially showing only top-level.}
  8262. content @r{Folding interface, starting with all headlines visible.}
  8263. showall @r{Folding interface, all headlines and text visible.}
  8264. sdepth: @r{Maximum headline level that will still become an independent}
  8265. @r{section for info and folding modes. The default is taken from}
  8266. @r{@code{org-export-headline-levels} (= the @code{H} switch in @code{#+OPTIONS}).}
  8267. @r{If this is smaller than in @code{org-export-headline-levels}, each}
  8268. @r{info/folding section can still contain child headlines.}
  8269. toc: @r{Should the table of content @emph{initially} be visible?}
  8270. @r{Even when @code{nil}, you can always get to the "toc" with @kbd{i}.}
  8271. tdepth: @r{The depth of the table of contents. The defaults are taken from}
  8272. @r{the variables @code{org-export-headline-levels} and @code{org-export-with-toc}.}
  8273. ftoc: @r{Does the css of the page specify a fixed position for the "toc"?}
  8274. @r{If yes, the toc will never be displayed as a section.}
  8275. ltoc: @r{Should there be short contents (children) in each section?}
  8276. @r{Make this @code{above} if the section should be above initial text.}
  8277. mouse: @r{Headings are highlighted when the mouse is over them. Should be}
  8278. @r{@samp{underline} (default) or a background color like @samp{#cccccc}.}
  8279. buttons: @r{Should view-toggle buttons be everywhere? When @code{nil} (the}
  8280. @r{default), only one such button will be present.}
  8281. @end example
  8282. @noindent
  8283. @vindex org-infojs-options
  8284. @vindex org-export-html-use-infojs
  8285. You can choose default values for these options by customizing the variable
  8286. @code{org-infojs-options}. If you always want to apply the script to your
  8287. pages, configure the variable @code{org-export-html-use-infojs}.
  8288. @node LaTeX and PDF export, DocBook export, HTML export, Exporting
  8289. @section La@TeX{} and PDF export
  8290. @cindex La@TeX{} export
  8291. @cindex PDF export
  8292. @cindex Guerry, Bastien
  8293. Org mode contains a La@TeX{} exporter written by Bastien Guerry. With
  8294. further processing, this backend is also used to produce PDF output. Since
  8295. the La@TeX{} output uses @file{hyperref} to implement links and cross
  8296. references, the PDF output file will be fully linked.
  8297. @menu
  8298. * LaTeX/PDF export commands:: Which key invokes which commands
  8299. * Quoting LaTeX code:: Incorporating literal La@TeX{} code
  8300. * Sectioning structure:: Changing sectioning in La@TeX{} output
  8301. * Tables in LaTeX export:: Options for exporting tables to La@TeX{}
  8302. * Images in LaTeX export:: How to insert figures into La@TeX{} output
  8303. * Beamer class export:: Turning the file into a presentation
  8304. @end menu
  8305. @node LaTeX/PDF export commands, Quoting LaTeX code, LaTeX and PDF export, LaTeX and PDF export
  8306. @subsection La@TeX{} export commands
  8307. @cindex region, active
  8308. @cindex active region
  8309. @cindex transient-mark-mode
  8310. @table @kbd
  8311. @kindex C-c C-e l
  8312. @item C-c C-e l
  8313. @cindex property EXPORT_FILE_NAME
  8314. Export as La@TeX{} file @file{myfile.tex}. For an Org file
  8315. @file{myfile.org}, the ASCII file will be @file{myfile.tex}. The file will
  8316. be overwritten without warning. If there is an active region@footnote{This
  8317. requires @code{transient-mark-mode} be turned on.}, only the region will be
  8318. exported. If the selected region is a single tree@footnote{To select the
  8319. current subtree, use @kbd{C-c @@}.}, the tree head will become the document
  8320. title. If the tree head entry has or inherits an @code{EXPORT_FILE_NAME}
  8321. property, that name will be used for the export.
  8322. @kindex C-c C-e L
  8323. @item C-c C-e L
  8324. Export to a temporary buffer, do not create a file.
  8325. @kindex C-c C-e v l
  8326. @kindex C-c C-e v L
  8327. @item C-c C-e v l
  8328. @item C-c C-e v L
  8329. Export only the visible part of the document.
  8330. @item M-x org-export-region-as-latex
  8331. Convert the region to La@TeX{} under the assumption that it was Org mode
  8332. syntax before. This is a global command that can be invoked in any
  8333. buffer.
  8334. @item M-x org-replace-region-by-latex
  8335. Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
  8336. code.
  8337. @kindex C-c C-e p
  8338. @item C-c C-e p
  8339. Export as La@TeX{} and then process to PDF.
  8340. @kindex C-c C-e d
  8341. @item C-c C-e d
  8342. Export as La@TeX{} and then process to PDF, then open the resulting PDF file.
  8343. @end table
  8344. @cindex headline levels, for exporting
  8345. @vindex org-latex-low-levels
  8346. In the exported version, the first 3 outline levels will become
  8347. headlines, defining a general document structure. Additional levels
  8348. will be exported as description lists. The exporter can ignore them or
  8349. convert them to a custom string depending on
  8350. @code{org-latex-low-levels}.
  8351. If you want that transition to occur at a different level, specify it
  8352. with a numeric prefix argument. For example,
  8353. @example
  8354. @kbd{C-2 C-c C-e l}
  8355. @end example
  8356. @noindent
  8357. creates two levels of headings and does the rest as items.
  8358. @node Quoting LaTeX code, Sectioning structure, LaTeX/PDF export commands, LaTeX and PDF export
  8359. @subsection Quoting La@TeX{} code
  8360. Embedded La@TeX{} as described in @ref{Embedded LaTeX}, will be correctly
  8361. inserted into the La@TeX{} file. This includes simple macros like
  8362. @samp{\ref@{LABEL@}} to create a cross reference to a figure. Furthermore,
  8363. you can add special code that should only be present in La@TeX{} export with
  8364. the following constructs:
  8365. @cindex #+LaTeX
  8366. @cindex #+BEGIN_LaTeX
  8367. @example
  8368. #+LaTeX: Literal LaTeX code for export
  8369. @end example
  8370. @noindent or
  8371. @cindex #+BEGIN_LaTeX
  8372. @example
  8373. #+BEGIN_LaTeX
  8374. All lines between these markers are exported literally
  8375. #+END_LaTeX
  8376. @end example
  8377. @node Sectioning structure, Tables in LaTeX export, Quoting LaTeX code, LaTeX and PDF export
  8378. @subsection Sectioning structure
  8379. @cindex La@TeX{} class
  8380. @cindex La@TeX{} sectioning structure
  8381. By default, the La@TeX{} output uses the class @code{article}.
  8382. @vindex org-export-latex-default-class
  8383. @vindex org-export-latex-classes
  8384. @cindex #+LATEX_HEADER
  8385. @cindex #+LATEX_CLASS
  8386. @cindex #+LATEX_CLASS_OPTIONS
  8387. @cindex property, LATEX_CLASS
  8388. @cindex property, LATEX_CLASS_OPTIONS
  8389. You can change this globally by setting a different value for
  8390. @code{org-export-latex-default-class} or locally by adding an option like
  8391. @code{#+LaTeX_CLASS: myclass} in your file, or with a @code{:LaTeX_CLASS:}
  8392. property that applies when exporting a region containing only this (sub)tree.
  8393. The class should be listed in @code{org-export-latex-classes}, where you can
  8394. also define the sectioning structure for each class, as well as defining
  8395. additional classes. In a similar way, @code{#+LaTeX_CLASS_OPTIONS} or a
  8396. @code{LaTeX_CLASS_OPTIONS} property can specify the options for the
  8397. @code{\documentclass} macro. You can also use @code{#+LATEX_HEADER:
  8398. \usepackage@{xyz@}} to add lines to the header.
  8399. @node Tables in LaTeX export, Images in LaTeX export, Sectioning structure, LaTeX and PDF export
  8400. @subsection Tables in La@TeX{} export
  8401. @cindex tables, in La@TeX{} export
  8402. For La@TeX{} export of a table, you can specify a label and a caption
  8403. (@pxref{Images and tables}). You can also use the @code{ATTR_LaTeX} line to
  8404. request a longtable environment for the table, so that it may span several
  8405. pages. Finally, you can set the alignment string:
  8406. @cindex #+CAPTION
  8407. @cindex #+LABEL
  8408. @cindex #+ATTR_LaTeX
  8409. @example
  8410. #+CAPTION: A long table
  8411. #+LABEL: tbl:long
  8412. #+ATTR_LaTeX: longtable align=l|lp@{3cm@}r|l
  8413. | ..... | ..... |
  8414. | ..... | ..... |
  8415. @end example
  8416. @node Images in LaTeX export, Beamer class export, Tables in LaTeX export, LaTeX and PDF export
  8417. @subsection Images in La@TeX{} export
  8418. @cindex images, inline in La@TeX{}
  8419. @cindex inlining images in La@TeX{}
  8420. Images that are linked to without a description part in the link, like
  8421. @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]} will be inserted into the PDF
  8422. output file resulting from La@TeX{} processing. Org will use an
  8423. @code{\includegraphics} macro to insert the image. If you have specified a
  8424. caption and/or a label as described in @ref{Images and tables}, the figure
  8425. will be wrapped into a @code{figure} environment and thus become a floating
  8426. element. You can use an @code{#+ATTR_LaTeX:} line to specify the various
  8427. options that can be used in the optional argument of the
  8428. @code{\includegraphics} macro. To modify the placement option of the
  8429. @code{figure} environment, add something like @samp{placement=[h!]} to the
  8430. Attributes.
  8431. If you'd like to let text flow around the image, add the word @samp{wrap} to
  8432. the @code{#+ATTR_LaTeX:} line, which will make the figure occupy the left
  8433. half of the page. To fine-tune, the @code{placement} field will be the
  8434. set of additional arguments needed by the @code{wrapfigure} environment.
  8435. Note that if you change the size of the image, you need to use compatible
  8436. settings for @code{\includegraphics} and @code{wrapfigure}.
  8437. @cindex #+CAPTION
  8438. @cindex #+LABEL
  8439. @cindex #+ATTR_LaTeX
  8440. @example
  8441. #+CAPTION: The black-body emission of the disk around HR 4049
  8442. #+LABEL: fig:SED-HR4049
  8443. #+ATTR_LaTeX: width=5cm,angle=90
  8444. [[./img/sed-hr4049.pdf]]
  8445. #+ATTR_LaTeX: width=0.38\textwidth wrap placement=@{r@}@{0.4\textwidth@}
  8446. [[./img/hst.png]]
  8447. @end example
  8448. If you need references to a label created in this way, write
  8449. @samp{\ref@{fig:SED-HR4049@}} just like in La@TeX{}.
  8450. @node Beamer class export, , Images in LaTeX export, LaTeX and PDF export
  8451. @subsection Beamer class export
  8452. The LaTeX class @file{beamer} allows to produce high quality presentations
  8453. using LaTeX and pdf processing. Org-mode has special support for turning an
  8454. Org-mode file or tree into a @file{beamer} presentation.
  8455. When the LaTeX class for the current buffer (as set with @code{#+LaTeX_CLASS:
  8456. beamer}) or subtree (set with a @code{LaTeX_CLASS} property) is
  8457. @code{beamer}, a special export mode will turn the file or tree into a beamer
  8458. presentation. Any tree with not-to-deep level nesting should in principle be
  8459. exportable as a beamer presentation. By default, the top-level entries (or
  8460. the first level below the selected subtree heading) will be turned into
  8461. frames, and the outline structure below this level will become itemize lists.
  8462. You can also configure the variable @code{org-beamer-frame-level} to a
  8463. different level - then the hierarchy above frames will produce the sectioning
  8464. structure of the presentation.
  8465. A template for useful in-buffer settings or properties can be inserted into
  8466. the buffer with @kbd{M-x org-beamer-settings-template}. Among other things,
  8467. this will install a column view format which is very handy for editing
  8468. special properties used by beamer.
  8469. You can influence the structure of the presentation using the following
  8470. properties:
  8471. @table @code
  8472. @item BEAMER_env
  8473. The environment that should be used to format this entry. Valid environments
  8474. are defined in the constant @code{org-beamer-environments-default}, and you
  8475. can define more in @code{org-beamer-environments-extra}. If this property is
  8476. set, the entry will also get a @code{:B_environment:} tag to make this
  8477. visible. This tag has no semantic meaning, it is only a visual aid.
  8478. @item BEAMER_envargs
  8479. The beamer-special arguments that should be used for the environment, like
  8480. @code{[t]} or @code{[<+->]} of @code{<2-3>}. If the @code{BEAMER_col}
  8481. property is also set, something like @code{C[t]} can be added here as well to
  8482. set an options argument for the implied @code{columns} environment.
  8483. @code{c[t]} will set an option for the implied @code{column} environment.
  8484. @item BEAMER_col
  8485. The width of a column that should start with this entry. If this property is
  8486. set, the entry will also get a @code{:BMCOL:} property to make this visible.
  8487. Also this tag is only a visual aid. When his is a plain number, it will be
  8488. interpreted as a fraction of @code{\textwidth}. Otherwise it will be assumed
  8489. that you have specified the units, like @samp{3cm}. The first such property
  8490. in a frame will start a @code{columns} environment to surround the columns.
  8491. This environment is closed when an entry has a @code{BEAMER_col} property
  8492. with value 0 or 1, or automatically at the end of the frame.
  8493. @item BEAMER_extra
  8494. Additional commands that should be inserted after the environment has been
  8495. opened. For example, when creating a frame, this can be used to specify
  8496. transitions.
  8497. @end table
  8498. Frames will automatically receive a @code{fragile} option if they contain
  8499. source code that uses the verbatim environment. Special @file{beamer}
  8500. specific code can be inserted using @code{#+BEAMER:} and
  8501. @code{#+BEGIN_beamer...#+end_beamer} constructs, similar to other export
  8502. backends, but with the difference that @code{#+LaTeX:} stuff will be included
  8503. in the presentation as well.
  8504. Outline nodes with @code{BEAMER_env} property value @samp{note} or
  8505. @samp{noteNH} will be formatted as beamer notes, i,e, they will be wrapped
  8506. into @code{\note@{...@}}. The former will include the heading as part of the
  8507. note text, the latter will ignore the heading of that node. To simplify note
  8508. generation, it is actually enough to mark the note with a @emph{tag} (either
  8509. @code{:B_note:} or @code{:B_noteNH:}) instead of creating the
  8510. @code{BEAMER_env} property.
  8511. You can turn on a special minor mode @code{org-beamer-mode} for editing
  8512. support with
  8513. @example
  8514. #+STARTUP: beamer
  8515. @end example
  8516. @table @kbd
  8517. @kindex C-c C-b
  8518. @item C-c C-b
  8519. In @code{org-beamer-mode}, this key offers fast selection of a beamer
  8520. environment or the @code{BEAMER_col} property.
  8521. @end table
  8522. Column view provides a great way to set the environment of a node and other
  8523. important parameters. Make sure you are using a COLUMN format that is geared
  8524. toward this special purpose. The command @kbd{M-x
  8525. org-beamer-settings-template} does define such a format.
  8526. Here is a simple example Org document that is intended for beamer export.
  8527. @smallexample
  8528. #+LaTeX_CLASS: beamer
  8529. #+TITLE: Example Presentation
  8530. #+AUTHOR: Carsten Dominik
  8531. #+LaTeX_CLASS_OPTIONS: [presentation]
  8532. #+BEAMER_FRAME_LEVEL: 2
  8533. #+BEAMER_HEADER_EXTRA: \usetheme@{Madrid@}\usecolortheme@{default@}
  8534. #+COLUMNS: %35ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Args) %4BEAMER_col(Col) %8BEAMER_extra(Ex)
  8535. * This is the first structural section
  8536. ** Frame 1 \\ with a subtitle
  8537. *** Thanks to Eric Fraga :BMCOL:B_block:
  8538. :PROPERTIES:
  8539. :BEAMER_env: block
  8540. :BEAMER_envargs: C[t]
  8541. :BEAMER_col: 0.5
  8542. :END:
  8543. for the first viable beamer setup in Org
  8544. *** Thanks to everyone else :BMCOL:B_block:
  8545. :PROPERTIES:
  8546. :BEAMER_col: 0.5
  8547. :BEAMER_env: block
  8548. :BEAMER_envargs: <2->
  8549. :END:
  8550. for contributing to the discussion
  8551. **** This will be formatted as a beamer note :B_note:
  8552. ** Frame 2 \\ where we will not use columns
  8553. *** Request :B_block:
  8554. Please test this stuff!
  8555. @end smallexample
  8556. For more information, see the documentation on Worg.
  8557. @node DocBook export, Freemind export, LaTeX and PDF export, Exporting
  8558. @section DocBook export
  8559. @cindex DocBook export
  8560. @cindex PDF export
  8561. @cindex Cui, Baoqui
  8562. Org contains a DocBook exporter written by Baoqiu Cui. Once an Org file is
  8563. exported to DocBook format, it can be further processed to produce other
  8564. formats, including PDF, HTML, man pages, etc., using many available DocBook
  8565. tools and stylesheets.
  8566. Currently DocBook exporter only supports DocBook V5.0.
  8567. @menu
  8568. * DocBook export commands:: How to invoke DocBook export
  8569. * Quoting DocBook code:: Incorporating DocBook code in Org files
  8570. * Recursive sections:: Recursive sections in DocBook
  8571. * Tables in DocBook export:: Tables are exported as HTML tables
  8572. * Images in DocBook export:: How to insert figures into DocBook output
  8573. * Special characters:: How to handle special characters
  8574. @end menu
  8575. @node DocBook export commands, Quoting DocBook code, DocBook export, DocBook export
  8576. @subsection DocBook export commands
  8577. @cindex region, active
  8578. @cindex active region
  8579. @cindex transient-mark-mode
  8580. @table @kbd
  8581. @kindex C-c C-e D
  8582. @item C-c C-e D
  8583. @cindex property EXPORT_FILE_NAME
  8584. Export as DocBook file. For an Org file, @file{myfile.org}, the DocBook XML
  8585. file will be @file{myfile.xml}. The file will be overwritten without
  8586. warning. If there is an active region@footnote{This requires
  8587. @code{transient-mark-mode} to be turned on}, only the region will be
  8588. exported. If the selected region is a single tree@footnote{To select the
  8589. current subtree, use @kbd{C-c @@}.}, the tree head will become the document
  8590. title. If the tree head entry has, or inherits, an @code{EXPORT_FILE_NAME}
  8591. property, that name will be used for the export.
  8592. @kindex C-c C-e V
  8593. @item C-c C-e V
  8594. Export as DocBook file, process to PDF, then open the resulting PDF file.
  8595. @vindex org-export-docbook-xslt-proc-command
  8596. @vindex org-export-docbook-xsl-fo-proc-command
  8597. Note that, in order to produce PDF output based on exported DocBook file, you
  8598. need to have XSLT processor and XSL-FO processor software installed on your
  8599. system. Check variables @code{org-export-docbook-xslt-proc-command} and
  8600. @code{org-export-docbook-xsl-fo-proc-command}.
  8601. @kindex C-c C-e v D
  8602. @item C-c C-e v D
  8603. Export only the visible part of the document.
  8604. @end table
  8605. @node Quoting DocBook code, Recursive sections, DocBook export commands, DocBook export
  8606. @subsection Quoting DocBook code
  8607. You can quote DocBook code in Org files and copy it verbatim into exported
  8608. DocBook file with the following constructs:
  8609. @cindex #+DOCBOOK
  8610. @cindex #+BEGIN_DOCBOOK
  8611. @example
  8612. #+DOCBOOK: Literal DocBook code for export
  8613. @end example
  8614. @noindent or
  8615. @cindex #+BEGIN_DOCBOOK
  8616. @example
  8617. #+BEGIN_DOCBOOK
  8618. All lines between these markers are exported by DocBook exporter
  8619. literally.
  8620. #+END_DOCBOOK
  8621. @end example
  8622. For example, you can use the following lines to include a DocBook warning
  8623. admonition. As to what this warning says, you should pay attention to the
  8624. document context when quoting DocBook code in Org files. You may make
  8625. exported DocBook XML files invalid by not quoting DocBook code correctly.
  8626. @example
  8627. #+BEGIN_DOCBOOK
  8628. <warning>
  8629. <para>You should know what you are doing when quoting DocBook XML code
  8630. in your Org file. Invalid DocBook XML file may be generated by
  8631. DocBook exporter if you are not careful!</para>
  8632. </warning>
  8633. #+END_DOCBOOK
  8634. @end example
  8635. @node Recursive sections, Tables in DocBook export, Quoting DocBook code, DocBook export
  8636. @subsection Recursive sections
  8637. @cindex DocBook recursive sections
  8638. DocBook exporter exports Org files as articles using the @code{article}
  8639. element in DocBook. Recursive sections, i.e. @code{section} elements, are
  8640. used in exported articles. Top level headlines in Org files are exported as
  8641. top level sections, and lower level headlines are exported as nested
  8642. sections. The entire structure of Org files will be exported completely, no
  8643. matter how many nested levels of headlines there are.
  8644. Using recursive sections makes it easy to port and reuse exported DocBook
  8645. code in other DocBook document types like @code{book} or @code{set}.
  8646. @node Tables in DocBook export, Images in DocBook export, Recursive sections, DocBook export
  8647. @subsection Tables in DocBook export
  8648. @cindex tables, in DocBook export
  8649. Tables in Org files are exported as HTML tables, which have been supported since
  8650. DocBook V4.3.
  8651. If a table does not have a caption, an informal table is generated using the
  8652. @code{informaltable} element; otherwise, a formal table will be generated
  8653. using the @code{table} element.
  8654. @node Images in DocBook export, Special characters, Tables in DocBook export, DocBook export
  8655. @subsection Images in DocBook export
  8656. @cindex images, inline in DocBook
  8657. @cindex inlining images in DocBook
  8658. Images that are linked to without a description part in the link, like
  8659. @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]}, will be exported to DocBook
  8660. using @code{mediaobject} elements. Each @code{mediaobject} element contains
  8661. an @code{imageobject} that wraps an @code{imagedata} element. If you have
  8662. specified a caption for an image as described in @ref{Images and tables}, a
  8663. @code{caption} element will be added in @code{mediaobject}. If a label is
  8664. also specified, it will be exported as an @code{xml:id} attribute of the
  8665. @code{mediaobject} element.
  8666. @vindex org-export-docbook-default-image-attributes
  8667. Image attributes supported by the @code{imagedata} element, like @code{align}
  8668. or @code{width}, can be specified in two ways: you can either customize
  8669. variable @code{org-export-docbook-default-image-attributes} or use the
  8670. @code{#+ATTR_DOCBOOK:} line. Attributes specified in variable
  8671. @code{org-export-docbook-default-image-attributes} are applied to all inline
  8672. images in the Org file to be exported (unless they are overwritten by image
  8673. attributes specified in @code{#+ATTR_DOCBOOK:} lines).
  8674. The @code{#+ATTR_DOCBOOK:} line can be used to specify additional image
  8675. attributes or overwrite default image attributes for individual images. If
  8676. the same attribute appears in both the @code{#+ATTR_DOCBOOK:} line and
  8677. variable @code{org-export-docbook-default-image-attributes}, the former
  8678. overwrites the latter. Here is an example about how image attributes can be
  8679. set:
  8680. @cindex #+CAPTION
  8681. @cindex #+LABEL
  8682. @cindex #+ATTR_DOCBOOK
  8683. @example
  8684. #+CAPTION: The logo of Org mode
  8685. #+LABEL: unicorn-svg
  8686. #+ATTR_DOCBOOK: scalefit="1" width="100%" depth="100%"
  8687. [[./img/org-mode-unicorn.svg]]
  8688. @end example
  8689. @vindex org-export-docbook-inline-image-extensions
  8690. By default, DocBook exporter recognizes the following image file types:
  8691. @file{jpeg}, @file{jpg}, @file{png}, @file{gif}, and @file{svg}. You can
  8692. customize variable @code{org-export-docbook-inline-image-extensions} to add
  8693. more types to this list as long as DocBook supports them.
  8694. @node Special characters, , Images in DocBook export, DocBook export
  8695. @subsection Special characters in DocBook export
  8696. @cindex Special characters in DocBook export
  8697. @vindex org-export-docbook-doctype
  8698. @vindex org-html-entities
  8699. Special characters that are written in @TeX{}-like syntax, such as @code{\alpha},
  8700. @code{\Gamma}, and @code{\Zeta}, are supported by DocBook exporter. These
  8701. characters are rewritten to XML entities, like @code{&alpha;},
  8702. @code{&Gamma;}, and @code{&Zeta;}, based on the list saved in variable
  8703. @code{org-html-entities}. As long as the generated DocBook file includes the
  8704. corresponding entities, these special characters are recognized.
  8705. You can customize variable @code{org-export-docbook-doctype} to include the
  8706. entities you need. For example, you can set variable
  8707. @code{org-export-docbook-doctype} to the following value to recognize all
  8708. special characters included in XHTML entities:
  8709. @example
  8710. "<!DOCTYPE article [
  8711. <!ENTITY % xhtml1-symbol PUBLIC
  8712. \"-//W3C//ENTITIES Symbol for HTML//EN//XML\"
  8713. \"http://www.w3.org/2003/entities/2007/xhtml1-symbol.ent\"
  8714. >
  8715. %xhtml1-symbol;
  8716. ]>
  8717. "
  8718. @end example
  8719. @node Freemind export, XOXO export, DocBook export, Exporting
  8720. @section Freemind export
  8721. @cindex Freemind export
  8722. @cindex mind map
  8723. The freemind exporter was written by Lennart Borgman.
  8724. @table @kbd
  8725. @kindex C-c C-e m
  8726. @item C-c C-e m
  8727. Export as Freemind mind map @file{myfile.mm}.
  8728. @end table
  8729. @node XOXO export, iCalendar export, Freemind export, Exporting
  8730. @section XOXO export
  8731. @cindex XOXO export
  8732. Org mode contains an exporter that produces XOXO-style output.
  8733. Currently, this exporter only handles the general outline structure and
  8734. does not interpret any additional Org-mode features.
  8735. @table @kbd
  8736. @kindex C-c C-e x
  8737. @item C-c C-e x
  8738. Export as XOXO file @file{myfile.html}.
  8739. @kindex C-c C-e v
  8740. @item C-c C-e v x
  8741. Export only the visible part of the document.
  8742. @end table
  8743. @node iCalendar export, , XOXO export, Exporting
  8744. @section iCalendar export
  8745. @cindex iCalendar export
  8746. @vindex org-icalendar-include-todo
  8747. @vindex org-icalendar-use-deadline
  8748. @vindex org-icalendar-use-scheduled
  8749. @vindex org-icalendar-categories
  8750. Some people use Org mode for keeping track of projects, but still prefer a
  8751. standard calendar application for anniversaries and appointments. In this
  8752. case it can be useful to show deadlines and other time-stamped items in Org
  8753. files in the calendar application. Org mode can export calendar information
  8754. in the standard iCalendar format. If you also want to have TODO entries
  8755. included in the export, configure the variable
  8756. @code{org-icalendar-include-todo}. Plain timestamps are exported as VEVENT,
  8757. and TODO items as VTODO. It will also create events from deadlines that are
  8758. in non-TODO items. Deadlines and scheduling dates in TODO items will be used
  8759. to set the start and due dates for the TODO entry@footnote{See the variables
  8760. @code{org-icalendar-use-deadline} and @code{org-icalendar-use-scheduled}.}.
  8761. As categories, it will use the tags locally defined in the heading, and the
  8762. file/tree category@footnote{To add inherited tags or the TODO state,
  8763. configure the variable @code{org-icalendar-categories}.}.
  8764. @vindex org-icalendar-store-UID
  8765. @cindex property, ID
  8766. The iCalendar standard requires each entry to have a globally unique
  8767. identifier (UID). Org creates these identifiers during export. If you set
  8768. the variable @code{org-icalendar-store-UID}, the UID will be stored in the
  8769. @code{:ID:} property of the entry and re-used next time you report this
  8770. entry. Since a single entry can give rise to multiple iCalendar entries (as
  8771. a timestamp, a deadline, a scheduled item, and as a TODO item), Org adds
  8772. prefixes to the UID, depending on what triggered the inclusion of the entry.
  8773. In this way the UID remains unique, but a synchronization program can still
  8774. figure out from which entry all the different instances originate.
  8775. @table @kbd
  8776. @kindex C-c C-e i
  8777. @item C-c C-e i
  8778. Create iCalendar entries for the current file and store them in the same
  8779. directory, using a file extension @file{.ics}.
  8780. @kindex C-c C-e I
  8781. @item C-c C-e I
  8782. @vindex org-agenda-files
  8783. Like @kbd{C-c C-e i}, but do this for all files in
  8784. @code{org-agenda-files}. For each of these files, a separate iCalendar
  8785. file will be written.
  8786. @kindex C-c C-e c
  8787. @item C-c C-e c
  8788. @vindex org-combined-agenda-icalendar-file
  8789. Create a single large iCalendar file from all files in
  8790. @code{org-agenda-files} and write it to the file given by
  8791. @code{org-combined-agenda-icalendar-file}.
  8792. @end table
  8793. @vindex org-use-property-inheritance
  8794. @vindex org-icalendar-include-body
  8795. @cindex property, SUMMARY
  8796. @cindex property, DESCRIPTION
  8797. @cindex property, LOCATION
  8798. The export will honor SUMMARY, DESCRIPTION and LOCATION@footnote{The LOCATION
  8799. property can be inherited from higher in the hierarchy if you configure
  8800. @code{org-use-property-inheritance} accordingly.} properties if the selected
  8801. entries have them. If not, the summary will be derived from the headline,
  8802. and the description from the body (limited to
  8803. @code{org-icalendar-include-body} characters).
  8804. How this calendar is best read and updated, depends on the application
  8805. you are using. The FAQ covers this issue.
  8806. @node Publishing, Miscellaneous, Exporting, Top
  8807. @chapter Publishing
  8808. @cindex publishing
  8809. @cindex O'Toole, David
  8810. Org includes a publishing management system that allows you to configure
  8811. automatic HTML conversion of @emph{projects} composed of interlinked org
  8812. files. You can also configure Org to automatically upload your exported HTML
  8813. pages and related attachments, such as images and source code files, to a web
  8814. server.
  8815. You can also use Org to convert files into PDF, or even combine HTML and PDF
  8816. conversion so that files are available in both formats on the server.
  8817. Publishing has been contributed to Org by David O'Toole.
  8818. @menu
  8819. * Configuration:: Defining projects
  8820. * Uploading files:: How to get files up on the server
  8821. * Sample configuration:: Example projects
  8822. * Triggering publication:: Publication commands
  8823. @end menu
  8824. @node Configuration, Uploading files, Publishing, Publishing
  8825. @section Configuration
  8826. Publishing needs significant configuration to specify files, destination
  8827. and many other properties of a project.
  8828. @menu
  8829. * Project alist:: The central configuration variable
  8830. * Sources and destinations:: From here to there
  8831. * Selecting files:: What files are part of the project?
  8832. * Publishing action:: Setting the function doing the publishing
  8833. * Publishing options:: Tweaking HTML export
  8834. * Publishing links:: Which links keep working after publishing?
  8835. * Project page index:: Publishing a list of project files
  8836. @end menu
  8837. @node Project alist, Sources and destinations, Configuration, Configuration
  8838. @subsection The variable @code{org-publish-project-alist}
  8839. @cindex org-publish-project-alist
  8840. @cindex projects, for publishing
  8841. @vindex org-publish-project-alist
  8842. Publishing is configured almost entirely through setting the value of one
  8843. variable, called @code{org-publish-project-alist}. Each element of the list
  8844. configures one project, and may be in one of the two following forms:
  8845. @lisp
  8846. ("project-name" :property value :property value ...)
  8847. @r{or}
  8848. ("project-name" :components ("project-name" "project-name" ...))
  8849. @end lisp
  8850. In both cases, projects are configured by specifying property values. A
  8851. project defines the set of files that will be published, as well as the
  8852. publishing configuration to use when publishing those files. When a project
  8853. takes the second form listed above, the individual members of the
  8854. @code{:components} property are taken to be sub-projects, which group
  8855. together files requiring different publishing options. When you publish such
  8856. a ``meta-project'', all the components will also be published, in the
  8857. sequence given.
  8858. @node Sources and destinations, Selecting files, Project alist, Configuration
  8859. @subsection Sources and destinations for files
  8860. @cindex directories, for publishing
  8861. Most properties are optional, but some should always be set. In
  8862. particular, Org needs to know where to look for source files,
  8863. and where to put published files.
  8864. @multitable @columnfractions 0.3 0.7
  8865. @item @code{:base-directory}
  8866. @tab Directory containing publishing source files
  8867. @item @code{:publishing-directory}
  8868. @tab Directory where output files will be published. You can directly
  8869. publish to a webserver using a file name syntax appropriate for
  8870. the Emacs @file{tramp} package. Or you can publish to a local directory and
  8871. use external tools to upload your website (@pxref{Uploading files}).
  8872. @item @code{:preparation-function}
  8873. @tab Function called before starting the publishing process, for example, to
  8874. run @code{make} for updating files to be published. The project property
  8875. list is scoped into this call as the variable @code{project-plist}.
  8876. @item @code{:completion-function}
  8877. @tab Function called after finishing the publishing process, for example, to
  8878. change permissions of the resulting files. The project property list is
  8879. scoped into this call as the variable @code{project-plist}.
  8880. @end multitable
  8881. @noindent
  8882. @node Selecting files, Publishing action, Sources and destinations, Configuration
  8883. @subsection Selecting files
  8884. @cindex files, selecting for publishing
  8885. By default, all files with extension @file{.org} in the base directory
  8886. are considered part of the project. This can be modified by setting the
  8887. properties
  8888. @multitable @columnfractions 0.25 0.75
  8889. @item @code{:base-extension}
  8890. @tab Extension (without the dot!) of source files. This actually is a
  8891. regular expression. Set this to the symbol @code{any} if you want to get all
  8892. files in @code{:base-directory}, even without extension.
  8893. @item @code{:exclude}
  8894. @tab Regular expression to match file names that should not be
  8895. published, even though they have been selected on the basis of their
  8896. extension.
  8897. @item @code{:include}
  8898. @tab List of files to be included regardless of @code{:base-extension}
  8899. and @code{:exclude}.
  8900. @end multitable
  8901. @node Publishing action, Publishing options, Selecting files, Configuration
  8902. @subsection Publishing action
  8903. @cindex action, for publishing
  8904. Publishing means that a file is copied to the destination directory and
  8905. possibly transformed in the process. The default transformation is to export
  8906. Org files as HTML files, and this is done by the function
  8907. @code{org-publish-org-to-html} which calls the HTML exporter (@pxref{HTML
  8908. export}). But you also can publish your content as PDF files using
  8909. @code{org-publish-org-to-pdf}. If you want to publish the Org file itself,
  8910. but with @i{archived}, @i{commented}, and @i{tag-excluded} trees removed, use
  8911. @code{org-publish-org-to-org} and set the parameters @code{:plain-source}
  8912. and/or @code{:htmlized-source}. This will produce @file{file.org} and
  8913. @file{file.org.html} in the publishing
  8914. directory@footnote{@file{file-source.org} and @file{file-source.org.html} if
  8915. source and publishing directories are equal. Note that with this kind of
  8916. setup, you need to add @code{:exclude "-source\\.org"} to the project
  8917. definition in @code{org-publish-project-alist} to avoid that the published
  8918. source files will be considered as new org files the next time the project is
  8919. published.}. Other files like images only
  8920. need to be copied to the publishing destination, for this you may use
  8921. @code{org-publish-attachment}. For non-Org files, you always need to
  8922. specify the publishing function:
  8923. @multitable @columnfractions 0.3 0.7
  8924. @item @code{:publishing-function}
  8925. @tab Function executing the publication of a file. This may also be a
  8926. list of functions, which will all be called in turn.
  8927. @item @code{:plain-source}
  8928. @tab Non-nil means, publish plain source.
  8929. @item @code{:htmlized-source}
  8930. @tab Non-nil means, publish htmlized source.
  8931. @end multitable
  8932. The function must accept three arguments: a property list containing at least
  8933. a @code{:publishing-directory} property, the name of the file to be
  8934. published, and the path to the publishing directory of the output file. It
  8935. should take the specified file, make the necessary transformation (if any)
  8936. and place the result into the destination folder.
  8937. @node Publishing options, Publishing links, Publishing action, Configuration
  8938. @subsection Options for the HTML/La@TeX{} exporters
  8939. @cindex options, for publishing
  8940. The property list can be used to set many export options for the HTML
  8941. and La@TeX{} exporters. In most cases, these properties correspond to user
  8942. variables in Org. The table below lists these properties along
  8943. with the variable they belong to. See the documentation string for the
  8944. respective variable for details.
  8945. @vindex org-export-html-link-up
  8946. @vindex org-export-html-link-home
  8947. @vindex org-export-default-language
  8948. @vindex org-display-custom-times
  8949. @vindex org-export-headline-levels
  8950. @vindex org-export-with-section-numbers
  8951. @vindex org-export-section-number-format
  8952. @vindex org-export-with-toc
  8953. @vindex org-export-preserve-breaks
  8954. @vindex org-export-with-archived-trees
  8955. @vindex org-export-with-emphasize
  8956. @vindex org-export-with-sub-superscripts
  8957. @vindex org-export-with-special-strings
  8958. @vindex org-export-with-footnotes
  8959. @vindex org-export-with-drawers
  8960. @vindex org-export-with-tags
  8961. @vindex org-export-with-todo-keywords
  8962. @vindex org-export-with-priority
  8963. @vindex org-export-with-TeX-macros
  8964. @vindex org-export-with-LaTeX-fragments
  8965. @vindex org-export-skip-text-before-1st-heading
  8966. @vindex org-export-with-fixed-width
  8967. @vindex org-export-with-timestamps
  8968. @vindex org-export-author-info
  8969. @vindex org-export-creator-info
  8970. @vindex org-export-with-tables
  8971. @vindex org-export-highlight-first-table-line
  8972. @vindex org-export-html-style-include-default
  8973. @vindex org-export-html-style
  8974. @vindex org-export-html-style-extra
  8975. @vindex org-export-html-link-org-files-as-html
  8976. @vindex org-export-html-inline-images
  8977. @vindex org-export-html-extension
  8978. @vindex org-export-html-table-tag
  8979. @vindex org-export-html-expand
  8980. @vindex org-export-html-with-timestamp
  8981. @vindex org-export-publishing-directory
  8982. @vindex org-export-html-preamble
  8983. @vindex org-export-html-postamble
  8984. @vindex org-export-html-auto-preamble
  8985. @vindex org-export-html-auto-postamble
  8986. @vindex user-full-name
  8987. @vindex user-mail-address
  8988. @vindex org-export-select-tags
  8989. @vindex org-export-exclude-tags
  8990. @multitable @columnfractions 0.32 0.68
  8991. @item @code{:link-up} @tab @code{org-export-html-link-up}
  8992. @item @code{:link-home} @tab @code{org-export-html-link-home}
  8993. @item @code{:language} @tab @code{org-export-default-language}
  8994. @item @code{:customtime} @tab @code{org-display-custom-times}
  8995. @item @code{:headline-levels} @tab @code{org-export-headline-levels}
  8996. @item @code{:section-numbers} @tab @code{org-export-with-section-numbers}
  8997. @item @code{:section-number-format} @tab @code{org-export-section-number-format}
  8998. @item @code{:table-of-contents} @tab @code{org-export-with-toc}
  8999. @item @code{:preserve-breaks} @tab @code{org-export-preserve-breaks}
  9000. @item @code{:archived-trees} @tab @code{org-export-with-archived-trees}
  9001. @item @code{:emphasize} @tab @code{org-export-with-emphasize}
  9002. @item @code{:sub-superscript} @tab @code{org-export-with-sub-superscripts}
  9003. @item @code{:special-strings} @tab @code{org-export-with-special-strings}
  9004. @item @code{:footnotes} @tab @code{org-export-with-footnotes}
  9005. @item @code{:drawers} @tab @code{org-export-with-drawers}
  9006. @item @code{:tags} @tab @code{org-export-with-tags}
  9007. @item @code{:todo-keywords} @tab @code{org-export-with-todo-keywords}
  9008. @item @code{:priority} @tab @code{org-export-with-priority}
  9009. @item @code{:TeX-macros} @tab @code{org-export-with-TeX-macros}
  9010. @item @code{:LaTeX-fragments} @tab @code{org-export-with-LaTeX-fragments}
  9011. @item @code{:latex-listings} @tab @code{org-export-latex-listings}
  9012. @item @code{:skip-before-1st-heading} @tab @code{org-export-skip-text-before-1st-heading}
  9013. @item @code{:fixed-width} @tab @code{org-export-with-fixed-width}
  9014. @item @code{:timestamps} @tab @code{org-export-with-timestamps}
  9015. @item @code{:author-info} @tab @code{org-export-author-info}
  9016. @item @code{:creator-info} @tab @code{org-export-creator-info}
  9017. @item @code{:tables} @tab @code{org-export-with-tables}
  9018. @item @code{:table-auto-headline} @tab @code{org-export-highlight-first-table-line}
  9019. @item @code{:style-include-default} @tab @code{org-export-html-style-include-default}
  9020. @item @code{:style} @tab @code{org-export-html-style}
  9021. @item @code{:style-extra} @tab @code{org-export-html-style-extra}
  9022. @item @code{:convert-org-links} @tab @code{org-export-html-link-org-files-as-html}
  9023. @item @code{:inline-images} @tab @code{org-export-html-inline-images}
  9024. @item @code{:html-extension} @tab @code{org-export-html-extension}
  9025. @item @code{:xml-declaration} @tab @code{org-export-html-xml-declaration}
  9026. @item @code{:html-table-tag} @tab @code{org-export-html-table-tag}
  9027. @item @code{:expand-quoted-html} @tab @code{org-export-html-expand}
  9028. @item @code{:timestamp} @tab @code{org-export-html-with-timestamp}
  9029. @item @code{:publishing-directory} @tab @code{org-export-publishing-directory}
  9030. @item @code{:preamble} @tab @code{org-export-html-preamble}
  9031. @item @code{:postamble} @tab @code{org-export-html-postamble}
  9032. @item @code{:auto-preamble} @tab @code{org-export-html-auto-preamble}
  9033. @item @code{:auto-postamble} @tab @code{org-export-html-auto-postamble}
  9034. @item @code{:author} @tab @code{user-full-name}
  9035. @item @code{:email} @tab @code{user-mail-address} : @code{addr;addr;..}
  9036. @item @code{:select-tags} @tab @code{org-export-select-tags}
  9037. @item @code{:exclude-tags} @tab @code{org-export-exclude-tags}
  9038. @item @code{:latex-image-options} @tab @code{org-export-latex-image-default-option}
  9039. @end multitable
  9040. Most of the @code{org-export-with-*} variables have the same effect in
  9041. both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
  9042. @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
  9043. La@TeX{} export.
  9044. @vindex org-publish-project-alist
  9045. When a property is given a value in @code{org-publish-project-alist},
  9046. its setting overrides the value of the corresponding user variable (if
  9047. any) during publishing. Options set within a file (@pxref{Export
  9048. options}), however, override everything.
  9049. @node Publishing links, Project page index, Publishing options, Configuration
  9050. @subsection Links between published files
  9051. @cindex links, publishing
  9052. To create a link from one Org file to another, you would use
  9053. something like @samp{[[file:foo.org][The foo]]} or simply
  9054. @samp{file:foo.org.} (@pxref{Hyperlinks}). When published, this link
  9055. becomes a link to @file{foo.html}. In this way, you can interlink the
  9056. pages of your "org web" project and the links will work as expected when
  9057. you publish them to HTML. If you also publish the Org source file and want
  9058. to link to that, use an @code{http:} link instead of a @code{file:} link,
  9059. because @code{file:} links are converted to link to the corresponding
  9060. @file{html} file.
  9061. You may also link to related files, such as images. Provided you are careful
  9062. with relative file names, and provided you have also configured Org to upload
  9063. the related files, these links will work too. See @ref{Complex example}, for
  9064. an example of this usage.
  9065. Sometimes an Org file to be published may contain links that are
  9066. only valid in your production environment, but not in the publishing
  9067. location. In this case, use the property
  9068. @multitable @columnfractions 0.4 0.6
  9069. @item @code{:link-validation-function}
  9070. @tab Function to validate links
  9071. @end multitable
  9072. @noindent
  9073. to define a function for checking link validity. This function must
  9074. accept two arguments, the file name and a directory relative to which
  9075. the file name is interpreted in the production environment. If this
  9076. function returns @code{nil}, then the HTML generator will only insert a
  9077. description into the HTML file, but no link. One option for this
  9078. function is @code{org-publish-validate-link} which checks if the given
  9079. file is part of any project in @code{org-publish-project-alist}.
  9080. @node Project page index, , Publishing links, Configuration
  9081. @subsection Project page index
  9082. @cindex index, of published pages
  9083. The following properties may be used to control publishing of an
  9084. index of files or a summary page for a given project.
  9085. @multitable @columnfractions 0.25 0.75
  9086. @item @code{:auto-index}
  9087. @tab When non-nil, publish an index during @code{org-publish-current-project}
  9088. or @code{org-publish-all}.
  9089. @item @code{:index-filename}
  9090. @tab Filename for output of index. Defaults to @file{sitemap.org} (which
  9091. becomes @file{sitemap.html}).
  9092. @item @code{:index-title}
  9093. @tab Title of index page. Defaults to name of file.
  9094. @item @code{:index-function}
  9095. @tab Plug-in function to use for generation of index.
  9096. Defaults to @code{org-publish-org-index}, which generates a plain list
  9097. of links to all files in the project.
  9098. @end multitable
  9099. @node Uploading files, Sample configuration, Configuration, Publishing
  9100. @section Uploading files
  9101. @cindex rsync
  9102. @cindex unison
  9103. For those people already utilizing third party sync tools such as
  9104. @command{rsync} or @command{unison}, it might be preferable not to use the built in
  9105. @i{remote} publishing facilities of Org mode which rely heavily on
  9106. Tramp. Tramp, while very useful and powerful, tends not to be
  9107. so efficient for multiple file transfer and has been known to cause problems
  9108. under heavy usage.
  9109. Specialized synchronization utilities offer several advantages. In addition
  9110. to timestamp comparison, they also do content and permissions/attribute
  9111. checks. For this reason you might prefer to publish your web to a local
  9112. directory (possibly even @i{in place} with your Org files) and then use
  9113. @file{unison} or @file{rsync} to do the synchronization with the remote host.
  9114. Since Unison (for example) can be configured as to which files to transfer to
  9115. a certain remote destination, it can greatly simplify the project publishing
  9116. definition. Simply keep all files in the correct location, process your Org
  9117. files with @code{org-publish} and let the synchronization tool do the rest.
  9118. You do not need, in this scenario, to include attachments such as @file{jpg},
  9119. @file{css} or @file{gif} files in the project definition since the 3rd party
  9120. tool syncs them.
  9121. Publishing to a local directory is also much faster than to a remote one, so
  9122. that you can afford more easily to republish entire projects. If you set
  9123. @code{org-publish-use-timestamps-flag} to @code{nil}, you gain the main
  9124. benefit of re-including any changed external files such as source example
  9125. files you might include with @code{#+INCLUDE}. The timestamp mechanism in
  9126. Org is not smart enough to detect if included files have been modified.
  9127. @node Sample configuration, Triggering publication, Uploading files, Publishing
  9128. @section Sample configuration
  9129. Below we provide two example configurations. The first one is a simple
  9130. project publishing only a set of Org files. The second example is
  9131. more complex, with a multi-component project.
  9132. @menu
  9133. * Simple example:: One-component publishing
  9134. * Complex example:: A multi-component publishing example
  9135. @end menu
  9136. @node Simple example, Complex example, Sample configuration, Sample configuration
  9137. @subsection Example: simple publishing configuration
  9138. This example publishes a set of Org files to the @file{public_html}
  9139. directory on the local machine.
  9140. @lisp
  9141. (setq org-publish-project-alist
  9142. '(("org"
  9143. :base-directory "~/org/"
  9144. :publishing-directory "~/public_html"
  9145. :section-numbers nil
  9146. :table-of-contents nil
  9147. :style "<link rel=\"stylesheet\"
  9148. href=\"../other/mystyle.css\"
  9149. type=\"text/css\"/>")))
  9150. @end lisp
  9151. @node Complex example, , Simple example, Sample configuration
  9152. @subsection Example: complex publishing configuration
  9153. This more complicated example publishes an entire website, including
  9154. Org files converted to HTML, image files, Emacs Lisp source code, and
  9155. style sheets. The publishing directory is remote and private files are
  9156. excluded.
  9157. To ensure that links are preserved, care should be taken to replicate
  9158. your directory structure on the web server, and to use relative file
  9159. paths. For example, if your Org files are kept in @file{~/org} and your
  9160. publishable images in @file{~/images}, you'd link to an image with
  9161. @c
  9162. @example
  9163. file:../images/myimage.png
  9164. @end example
  9165. @c
  9166. On the web server, the relative path to the image should be the
  9167. same. You can accomplish this by setting up an "images" folder in the
  9168. right place on the web server, and publishing images to it.
  9169. @lisp
  9170. (setq org-publish-project-alist
  9171. '(("orgfiles"
  9172. :base-directory "~/org/"
  9173. :base-extension "org"
  9174. :publishing-directory "/ssh:user@@host:~/html/notebook/"
  9175. :publishing-function org-publish-org-to-html
  9176. :exclude "PrivatePage.org" ;; regexp
  9177. :headline-levels 3
  9178. :section-numbers nil
  9179. :table-of-contents nil
  9180. :style "<link rel=\"stylesheet\"
  9181. href=\"../other/mystyle.css\" type=\"text/css\"/>"
  9182. :auto-preamble t
  9183. :auto-postamble nil)
  9184. ("images"
  9185. :base-directory "~/images/"
  9186. :base-extension "jpg\\|gif\\|png"
  9187. :publishing-directory "/ssh:user@@host:~/html/images/"
  9188. :publishing-function org-publish-attachment)
  9189. ("other"
  9190. :base-directory "~/other/"
  9191. :base-extension "css\\|el"
  9192. :publishing-directory "/ssh:user@@host:~/html/other/"
  9193. :publishing-function org-publish-attachment)
  9194. ("website" :components ("orgfiles" "images" "other"))))
  9195. @end lisp
  9196. @node Triggering publication, , Sample configuration, Publishing
  9197. @section Triggering publication
  9198. Once properly configured, Org can publish with the following commands:
  9199. @table @kbd
  9200. @kindex C-c C-e C
  9201. @item C-c C-e C
  9202. Prompt for a specific project and publish all files that belong to it.
  9203. @kindex C-c C-e P
  9204. @item C-c C-e P
  9205. Publish the project containing the current file.
  9206. @kindex C-c C-e F
  9207. @item C-c C-e F
  9208. Publish only the current file.
  9209. @kindex C-c C-e E
  9210. @item C-c C-e E
  9211. Publish every project.
  9212. @end table
  9213. @vindex org-publish-use-timestamps-flag
  9214. Org uses timestamps to track when a file has changed. The above functions
  9215. normally only publish changed files. You can override this and force
  9216. publishing of all files by giving a prefix argument to any of the commands
  9217. above, or by customizing the variable @code{org-publish-use-timestamps-flag}.
  9218. This may be necessary in particular if files include other files via
  9219. @code{#+SETUPFILE:} or @code{#+INCLUDE:}.
  9220. @node Miscellaneous, Hacking, Publishing, Top
  9221. @chapter Miscellaneous
  9222. @menu
  9223. * Completion:: M-TAB knows what you need
  9224. * Speed keys:: Electic commands at the beginning of a headline
  9225. * Customization:: Adapting Org to your taste
  9226. * In-buffer settings:: Overview of the #+KEYWORDS
  9227. * The very busy C-c C-c key:: When in doubt, press C-c C-c
  9228. * Clean view:: Getting rid of leading stars in the outline
  9229. * TTY keys:: Using Org on a tty
  9230. * Interaction:: Other Emacs packages
  9231. @end menu
  9232. @node Completion, Speed keys, Miscellaneous, Miscellaneous
  9233. @section Completion
  9234. @cindex completion, of @TeX{} symbols
  9235. @cindex completion, of TODO keywords
  9236. @cindex completion, of dictionary words
  9237. @cindex completion, of option keywords
  9238. @cindex completion, of tags
  9239. @cindex completion, of property keys
  9240. @cindex completion, of link abbreviations
  9241. @cindex @TeX{} symbol completion
  9242. @cindex TODO keywords completion
  9243. @cindex dictionary word completion
  9244. @cindex option keyword completion
  9245. @cindex tag completion
  9246. @cindex link abbreviations, completion of
  9247. Emacs would not be Emacs without completion, and Org-mode uses it whenever it
  9248. makes sense. If you prefer an @i{iswitchb}- or @i{ido}-like interface for
  9249. some of the completion prompts, you can specify your preference by setting at
  9250. most one of the variables @code{org-completion-use-iswitchb}
  9251. @code{org-completion-use-ido}.
  9252. Org supports in-buffer completion. This type of completion does
  9253. not make use of the minibuffer. You simply type a few letters into
  9254. the buffer and use the key to complete text right there.
  9255. @table @kbd
  9256. @kindex M-@key{TAB}
  9257. @item M-@key{TAB}
  9258. Complete word at point
  9259. @itemize @bullet
  9260. @item
  9261. At the beginning of a headline, complete TODO keywords.
  9262. @item
  9263. After @samp{\}, complete @TeX{} symbols supported by the exporter.
  9264. @item
  9265. After @samp{*}, complete headlines in the current buffer so that they
  9266. can be used in search links like @samp{[[*find this headline]]}.
  9267. @item
  9268. After @samp{:} in a headline, complete tags. The list of tags is taken
  9269. from the variable @code{org-tag-alist} (possibly set through the
  9270. @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
  9271. dynamically from all tags used in the current buffer.
  9272. @item
  9273. After @samp{:} and not in a headline, complete property keys. The list
  9274. of keys is constructed dynamically from all keys used in the current
  9275. buffer.
  9276. @item
  9277. After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
  9278. @item
  9279. After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
  9280. @samp{OPTIONS} which set file-specific options for Org mode. When the
  9281. option keyword is already complete, pressing @kbd{M-@key{TAB}} again
  9282. will insert example settings for this keyword.
  9283. @item
  9284. In the line after @samp{#+STARTUP: }, complete startup keywords,
  9285. i.e. valid keys for this line.
  9286. @item
  9287. Elsewhere, complete dictionary words using Ispell.
  9288. @end itemize
  9289. @end table
  9290. @node Speed keys, Customization, Completion, Miscellaneous
  9291. @section Speed keys
  9292. @cindex speed keys
  9293. @vindex org-use-speed-commands
  9294. @vindex org-speed-commands-user
  9295. Single keys can be made to execute commands when the cursor is at the
  9296. beginning of a headline, i.e. before the first star. Configure the variable
  9297. @code{org-use-speed-commands} to activate this feature. There is a
  9298. pre-defined list of commands, and you can add more such commands using the
  9299. variable @code{org-speed-commands-user}. Speed keys do not only speed up
  9300. navigation and other commands, but they also provide an alternative way to
  9301. execute commands bound to keys that are not or not easily available on a tty,
  9302. or on a small mobile device with a limited keyboard.
  9303. To see which commands are available, activate the feature and press @kbd{?}
  9304. with the cursor at the beginning of a headline.
  9305. @node Customization, In-buffer settings, Speed keys, Miscellaneous
  9306. @section Customization
  9307. @cindex customization
  9308. @cindex options, for customization
  9309. @cindex variables, for customization
  9310. There are more than 180 variables that can be used to customize
  9311. Org. For the sake of compactness of the manual, I am not
  9312. describing the variables here. A structured overview of customization
  9313. variables is available with @kbd{M-x org-customize}. Or select
  9314. @code{Browse Org Group} from the @code{Org->Customization} menu. Many
  9315. settings can also be activated on a per-file basis, by putting special
  9316. lines into the buffer (@pxref{In-buffer settings}).
  9317. @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
  9318. @section Summary of in-buffer settings
  9319. @cindex in-buffer settings
  9320. @cindex special keywords
  9321. Org mode uses special lines in the buffer to define settings on a
  9322. per-file basis. These lines start with a @samp{#+} followed by a
  9323. keyword, a colon, and then individual words defining a setting. Several
  9324. setting words can be in the same line, but you can also have multiple
  9325. lines for the keyword. While these settings are described throughout
  9326. the manual, here is a summary. After changing any of those lines in the
  9327. buffer, press @kbd{C-c C-c} with the cursor still in the line to
  9328. activate the changes immediately. Otherwise they become effective only
  9329. when the file is visited again in a new Emacs session.
  9330. @vindex org-archive-location
  9331. @table @kbd
  9332. @item #+ARCHIVE: %s_done::
  9333. This line sets the archive location for the agenda file. It applies for
  9334. all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
  9335. of the file. The first such line also applies to any entries before it.
  9336. The corresponding variable is @code{org-archive-location}.
  9337. @item #+CATEGORY:
  9338. This line sets the category for the agenda file. The category applies
  9339. for all subsequent lines until the next @samp{#+CATEGORY} line, or the
  9340. end of the file. The first such line also applies to any entries before it.
  9341. @item #+COLUMNS: %25ITEM .....
  9342. @cindex property, COLUMNS
  9343. Set the default format for columns view. This format applies when
  9344. columns view is invoked in locations where no @code{COLUMNS} property
  9345. applies.
  9346. @item #+CONSTANTS: name1=value1 ...
  9347. @vindex org-table-formula-constants
  9348. @vindex org-table-formula
  9349. Set file-local values for constants to be used in table formulas. This
  9350. line set the local variable @code{org-table-formula-constants-local}.
  9351. The global version of this variable is
  9352. @code{org-table-formula-constants}.
  9353. @item #+FILETAGS: :tag1:tag2:tag3:
  9354. Set tags that can be inherited by any entry in the file, including the
  9355. top-level entries.
  9356. @item #+DRAWERS: NAME1 .....
  9357. @vindex org-drawers
  9358. Set the file-local set of drawers. The corresponding global variable is
  9359. @code{org-drawers}.
  9360. @item #+LINK: linkword replace
  9361. @vindex org-link-abbrev-alist
  9362. These lines (several are allowed) specify link abbreviations.
  9363. @xref{Link abbreviations}. The corresponding variable is
  9364. @code{org-link-abbrev-alist}.
  9365. @item #+PRIORITIES: highest lowest default
  9366. @vindex org-highest-priority
  9367. @vindex org-lowest-priority
  9368. @vindex org-default-priority
  9369. This line sets the limits and the default for the priorities. All three
  9370. must be either letters A-Z or numbers 0-9. The highest priority must
  9371. have a lower ASCII number that the lowest priority.
  9372. @item #+PROPERTY: Property_Name Value
  9373. This line sets a default inheritance value for entries in the current
  9374. buffer, most useful for specifying the allowed values of a property.
  9375. @cindex #+SETUPFILE
  9376. @item #+SETUPFILE: file
  9377. This line defines a file that holds more in-buffer setup. Normally this is
  9378. entirely ignored. Only when the buffer is parsed for option-setting lines
  9379. (i.e. when starting Org mode for a file, when pressing @kbd{C-c C-c} in a
  9380. settings line, or when exporting), then the contents of this file are parsed
  9381. as if they had been included in the buffer. In particular, the file can be
  9382. any other Org mode file with internal setup. You can visit the file the
  9383. cursor is in the line with @kbd{C-c '}.
  9384. @item #+STARTUP:
  9385. @cindex #+STARTUP:
  9386. This line sets options to be used at startup of Org mode, when an
  9387. Org file is being visited.
  9388. The first set of options deals with the initial visibility of the outline
  9389. tree. The corresponding variable for global default settings is
  9390. @code{org-startup-folded}, with a default value @code{t}, which means
  9391. @code{overview}.
  9392. @vindex org-startup-folded
  9393. @cindex @code{overview}, STARTUP keyword
  9394. @cindex @code{content}, STARTUP keyword
  9395. @cindex @code{showall}, STARTUP keyword
  9396. @cindex @code{showeverything}, STARTUP keyword
  9397. @example
  9398. overview @r{top-level headlines only}
  9399. content @r{all headlines}
  9400. showall @r{no folding of any entries}
  9401. showeverything @r{show even drawer contents}
  9402. @end example
  9403. @vindex org-startup-indented
  9404. @cindex @code{indent}, STARTUP keyword
  9405. @cindex @code{noindent}, STARTUP keyword
  9406. Dynamic virtual indentation is controlled by the variable
  9407. @code{org-startup-indented}@footnote{Emacs 23 and Org-mode 6.29 are required}
  9408. @example
  9409. indent @r{start with @code{org-indent-mode} turned on}
  9410. noindent @r{start with @code{org-indent-mode} turned off}
  9411. @end example
  9412. @vindex org-startup-align-all-tables
  9413. Then there are options for aligning tables upon visiting a file. This
  9414. is useful in files containing narrowed table columns. The corresponding
  9415. variable is @code{org-startup-align-all-tables}, with a default value
  9416. @code{nil}.
  9417. @cindex @code{align}, STARTUP keyword
  9418. @cindex @code{noalign}, STARTUP keyword
  9419. @example
  9420. align @r{align all tables}
  9421. noalign @r{don't align tables on startup}
  9422. @end example
  9423. @vindex org-log-done
  9424. @vindex org-log-note-clock-out
  9425. @vindex org-log-repeat
  9426. Logging the closing and reopening of TODO items and clock intervals can be
  9427. configured using these options (see variables @code{org-log-done},
  9428. @code{org-log-note-clock-out} and @code{org-log-repeat})
  9429. @cindex @code{logdone}, STARTUP keyword
  9430. @cindex @code{lognotedone}, STARTUP keyword
  9431. @cindex @code{nologdone}, STARTUP keyword
  9432. @cindex @code{lognoteclock-out}, STARTUP keyword
  9433. @cindex @code{nolognoteclock-out}, STARTUP keyword
  9434. @cindex @code{logrepeat}, STARTUP keyword
  9435. @cindex @code{lognoterepeat}, STARTUP keyword
  9436. @cindex @code{nologrepeat}, STARTUP keyword
  9437. @cindex @code{logreschedule}, STARTUP keyword
  9438. @cindex @code{lognotereschedule}, STARTUP keyword
  9439. @cindex @code{nologreschedule}, STARTUP keyword
  9440. @cindex @code{logredeadline}, STARTUP keyword
  9441. @cindex @code{lognoteredeadline}, STARTUP keyword
  9442. @cindex @code{nologredeadline}, STARTUP keyword
  9443. @example
  9444. logdone @r{record a timestamp when an item is marked DONE}
  9445. lognotedone @r{record timestamp and a note when DONE}
  9446. nologdone @r{don't record when items are marked DONE}
  9447. logrepeat @r{record a time when reinstating a repeating item}
  9448. lognoterepeat @r{record a note when reinstating a repeating item}
  9449. nologrepeat @r{do not record when reinstating repeating item}
  9450. lognoteclock-out @r{record a note when clocking out}
  9451. nolognoteclock-out @r{don't record a note when clocking out}
  9452. logreschedule @r{record a timestamp when scheduling time changes}
  9453. lognotereschedule @r{record a note when scheduling time changes}
  9454. nologreschedule @r{do not record when a scheduling date changes}
  9455. logredeadline @r{record a timestamp when deadline changes}
  9456. lognoteredeadline @r{record a note when deadline changes}
  9457. nologredeadline @r{do not record when a deadline date changes}
  9458. @end example
  9459. @vindex org-hide-leading-stars
  9460. @vindex org-odd-levels-only
  9461. Here are the options for hiding leading stars in outline headings, and for
  9462. indenting outlines. The corresponding variables are
  9463. @code{org-hide-leading-stars} and @code{org-odd-levels-only}, both with a
  9464. default setting @code{nil} (meaning @code{showstars} and @code{oddeven}).
  9465. @cindex @code{hidestars}, STARTUP keyword
  9466. @cindex @code{showstars}, STARTUP keyword
  9467. @cindex @code{odd}, STARTUP keyword
  9468. @cindex @code{even}, STARTUP keyword
  9469. @example
  9470. hidestars @r{make all but one of the stars starting a headline invisible.}
  9471. showstars @r{show all stars starting a headline}
  9472. indent @r{virtual indentation according to outline level}
  9473. noindent @r{no virtual indentation according to outline level}
  9474. odd @r{allow only odd outline levels (1,3,...)}
  9475. oddeven @r{allow all outline levels}
  9476. @end example
  9477. @vindex org-put-time-stamp-overlays
  9478. @vindex org-time-stamp-overlay-formats
  9479. To turn on custom format overlays over timestamps (variables
  9480. @code{org-put-time-stamp-overlays} and
  9481. @code{org-time-stamp-overlay-formats}), use
  9482. @cindex @code{customtime}, STARTUP keyword
  9483. @example
  9484. customtime @r{overlay custom time format}
  9485. @end example
  9486. @vindex constants-unit-system
  9487. The following options influence the table spreadsheet (variable
  9488. @code{constants-unit-system}).
  9489. @cindex @code{constcgs}, STARTUP keyword
  9490. @cindex @code{constSI}, STARTUP keyword
  9491. @example
  9492. constcgs @r{@file{constants.el} should use the c-g-s unit system}
  9493. constSI @r{@file{constants.el} should use the SI unit system}
  9494. @end example
  9495. @vindex org-footnote-define-inline
  9496. @vindex org-footnote-auto-label
  9497. @vindex org-footnote-auto-adjust
  9498. To influence footnote settings, use the following keywords. The
  9499. corresponding variables are @code{org-footnote-define-inline},
  9500. @code{org-footnote-auto-label}, and @code{org-footnote-auto-adjust}.
  9501. @cindex @code{fninline}, STARTUP keyword
  9502. @cindex @code{nofninline}, STARTUP keyword
  9503. @cindex @code{fnlocal}, STARTUP keyword
  9504. @cindex @code{fnprompt}, STARTUP keyword
  9505. @cindex @code{fnauto}, STARTUP keyword
  9506. @cindex @code{fnconfirm}, STARTUP keyword
  9507. @cindex @code{fnplain}, STARTUP keyword
  9508. @cindex @code{fnadjust}, STARTUP keyword
  9509. @cindex @code{nofnadjust}, STARTUP keyword
  9510. @example
  9511. fninline @r{define footnotes inline}
  9512. fnnoinline @r{define footnotes in separate section}
  9513. fnlocal @r{define footnotes near first reference, but not inline}
  9514. fnprompt @r{prompt for footnote labels}
  9515. fnauto @r{create [fn:1]-like labels automatically (default)}
  9516. fnconfirm @r{offer automatic label for editing or confirmation}
  9517. fnplain @r{create [1]-like labels automatically}
  9518. fnadjust @r{automatically renumber and sort footnotes}
  9519. nofnadjust @r{do not renumber and sort automatically}
  9520. @end example
  9521. @cindex org-hide-block-startup
  9522. To hide blocks on startup, use these keywords. The corresponding variable is
  9523. @code{org-hide-block-startup}.
  9524. @cindex @code{hideblocks}, STARTUP keyword
  9525. @cindex @code{nohideblocks}, STARTUP keyword
  9526. @example
  9527. hideblocks @r{Hide all begin/end blocks on startup}
  9528. nohideblocks @r{Do not hide blocks on startup}
  9529. @end example
  9530. @item #+TAGS: TAG1(c1) TAG2(c2)
  9531. @vindex org-tag-alist
  9532. These lines (several such lines are allowed) specify the valid tags in
  9533. this file, and (potentially) the corresponding @emph{fast tag selection}
  9534. keys. The corresponding variable is @code{org-tag-alist}.
  9535. @item #+TBLFM:
  9536. This line contains the formulas for the table directly above the line.
  9537. @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+DATE:,
  9538. @itemx #+OPTIONS:, #+BIND:
  9539. @itemx #+DESCRIPTION:, #+KEYWORDS:
  9540. @itemx #+LATEX_HEADER:, #+STYLE:, #+LINK_UP:, #+LINK_HOME:,
  9541. @itemx #+EXPORT_SELECT_TAGS:, #+EXPORT_EXCLUDE_TAGS:
  9542. These lines provide settings for exporting files. For more details see
  9543. @ref{Export options}.
  9544. @item #+TODO: #+SEQ_TODO: #+TYP_TODO:
  9545. @vindex org-todo-keywords
  9546. These lines set the TODO keywords and their interpretation in the
  9547. current file. The corresponding variable is @code{org-todo-keywords}.
  9548. @end table
  9549. @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
  9550. @section The very busy C-c C-c key
  9551. @kindex C-c C-c
  9552. @cindex C-c C-c, overview
  9553. The key @kbd{C-c C-c} has many purposes in Org, which are all
  9554. mentioned scattered throughout this manual. One specific function of
  9555. this key is to add @emph{tags} to a headline (@pxref{Tags}). In many
  9556. other circumstances it means something like @emph{``Hey Org, look
  9557. here and update according to what you see here''}. Here is a summary of
  9558. what this means in different contexts.
  9559. @itemize @minus
  9560. @item
  9561. If there are highlights in the buffer from the creation of a sparse
  9562. tree, or from clock display, remove these highlights.
  9563. @item
  9564. If the cursor is in one of the special @code{#+KEYWORD} lines, this
  9565. triggers scanning the buffer for these lines and updating the
  9566. information.
  9567. @item
  9568. If the cursor is inside a table, realign the table. This command
  9569. works even if the automatic table editor has been turned off.
  9570. @item
  9571. If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
  9572. the entire table.
  9573. @item
  9574. If the current buffer is a Remember buffer, close the note and file it.
  9575. With a prefix argument, file it, without further interaction, to the
  9576. default location.
  9577. @item
  9578. If the cursor is on a @code{<<<target>>>}, update radio targets and
  9579. corresponding links in this buffer.
  9580. @item
  9581. If the cursor is in a property line or at the start or end of a property
  9582. drawer, offer property commands.
  9583. @item
  9584. If the cursor is at a footnote reference, go to the corresponding
  9585. definition, and vice versa.
  9586. @item
  9587. If the cursor is on a statistics cookie, update it.
  9588. @item
  9589. If the cursor is in a plain list item with a checkbox, toggle the status
  9590. of the checkbox.
  9591. @item
  9592. If the cursor is on a numbered item in a plain list, renumber the
  9593. ordered list.
  9594. @item
  9595. If the cursor is on the @code{#+BEGIN} line of a dynamic block, the
  9596. block is updated.
  9597. @end itemize
  9598. @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
  9599. @section A cleaner outline view
  9600. @cindex hiding leading stars
  9601. @cindex dynamic indentation
  9602. @cindex odd-levels-only outlines
  9603. @cindex clean outline view
  9604. Some people find it noisy and distracting that the Org headlines start with a
  9605. potentially large number of stars, and that text below the headlines is not
  9606. indented. While this is no problem when writing a @emph{book-like} document
  9607. where the outline headings are really section headings, in a more
  9608. @emph{list-oriented} outline, indented structure is a lot cleaner:
  9609. @example
  9610. @group
  9611. * Top level headline | * Top level headline
  9612. ** Second level | * Second level
  9613. *** 3rd level | * 3rd level
  9614. some text | some text
  9615. *** 3rd level | * 3rd level
  9616. more text | more text
  9617. * Another top level headline | * Another top level headline
  9618. @end group
  9619. @end example
  9620. @noindent
  9621. If you are using at least Emacs 23.1.50.3 and version 6.29 of Org, this kind
  9622. of view can be achieved dynamically at display time using
  9623. @code{org-indent-mode}. In this minor mode, all lines are prefixed for
  9624. display with the necessary amount of space@footnote{@code{org-indent-mode}
  9625. also sets the @code{wrap-prefix} property, such that @code{visual-line-mode}
  9626. (or purely setting @code{word-wrap}) wraps long lines (including headlines)
  9627. correctly indented. }. Also headlines are prefixed with additional stars,
  9628. so that the amount of indentation shifts by two@footnote{See the variable
  9629. @code{org-indent-indentation-per-level}.} spaces per level. All headline
  9630. stars but the last one are made invisible using the @code{org-hide}
  9631. face@footnote{Turning on @code{org-indent-mode} sets
  9632. @code{org-hide-leading-stars} to @code{t} and @code{org-adapt-indentation} to
  9633. @code{nil}.} - see below under @samp{2.} for more information on how this
  9634. works. You can turn on @code{org-indent-mode} for all files by customizing
  9635. the variable @code{org-startup-indented}, or you can turn it on for
  9636. individual files using
  9637. @example
  9638. #+STARTUP: indent
  9639. @end example
  9640. If you want a similar effect in earlier version of Emacs and/or Org, or if
  9641. you want the indentation to be hard space characters so that the plain text
  9642. file looks as similar as possible to the Emacs display, Org supports you in
  9643. the following way:
  9644. @enumerate
  9645. @item
  9646. @emph{Indentation of text below headlines}@*
  9647. You may indent text below each headline to make the left boundary line up
  9648. with the headline, like
  9649. @example
  9650. *** 3rd level
  9651. more text, now indented
  9652. @end example
  9653. @vindex org-adapt-indentation
  9654. Org supports this with paragraph filling, line wrapping, and structure
  9655. editing@footnote{See also the variable @code{org-adapt-indentation}.},
  9656. preserving or adapting the indentation as appropriate.
  9657. @item
  9658. @vindex org-hide-leading-stars
  9659. @emph{Hiding leading stars}@* You can modify the display in such a way that
  9660. all leading stars become invisible. To do this in a global way, configure
  9661. the variable @code{org-hide-leading-stars} or change this on a per-file basis
  9662. with
  9663. @example
  9664. #+STARTUP: hidestars
  9665. #+STARTUP: showstars
  9666. @end example
  9667. With hidden stars, the tree becomes:
  9668. @example
  9669. @group
  9670. * Top level headline
  9671. * Second level
  9672. * 3rd level
  9673. ...
  9674. @end group
  9675. @end example
  9676. @noindent
  9677. @vindex org-hide @r{(face)}
  9678. The leading stars are not truly replaced by whitespace, they are only
  9679. fontified with the face @code{org-hide} that uses the background color as
  9680. font color. If you are not using either white or black background, you may
  9681. have to customize this face to get the wanted effect. Another possibility is
  9682. to set this font such that the extra stars are @i{almost} invisible, for
  9683. example using the color @code{grey90} on a white background.
  9684. @item
  9685. @vindex org-odd-levels-only
  9686. Things become cleaner still if you skip all the even levels and use only odd
  9687. levels 1, 3, 5..., effectively adding two stars to go from one outline level
  9688. to the next@footnote{When you need to specify a level for a property search
  9689. or refile targets, @samp{LEVEL=2} will correspond to 3 stars, etc@.}. In this
  9690. way we get the outline view shown at the beginning of this section. In order
  9691. to make the structure editing and export commands handle this convention
  9692. correctly, configure the variable @code{org-odd-levels-only}, or set this on
  9693. a per-file basis with one of the following lines:
  9694. @example
  9695. #+STARTUP: odd
  9696. #+STARTUP: oddeven
  9697. @end example
  9698. You can convert an Org file from single-star-per-level to the
  9699. double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
  9700. RET} in that file. The reverse operation is @kbd{M-x
  9701. org-convert-to-oddeven-levels}.
  9702. @end enumerate
  9703. @node TTY keys, Interaction, Clean view, Miscellaneous
  9704. @section Using Org on a tty
  9705. @cindex tty key bindings
  9706. Because Org contains a large number of commands, by default many of
  9707. Org's core commands are bound to keys that are generally not
  9708. accessible on a tty, such as the cursor keys (@key{left}, @key{right},
  9709. @key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
  9710. together with modifiers like @key{Meta} and/or @key{Shift}. To access
  9711. these commands on a tty when special keys are unavailable, the following
  9712. alternative bindings can be used. The tty bindings below will likely be
  9713. more cumbersome; you may find for some of the bindings below that a
  9714. customized workaround suits you better. For example, changing a timestamp
  9715. is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
  9716. tty you would rather use @kbd{C-c .} to re-insert the timestamp.
  9717. @multitable @columnfractions 0.15 0.2 0.1 0.2
  9718. @item @b{Default} @tab @b{Alternative 1} @tab @b{Speed key} @tab @b{Alternative 2}
  9719. @item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab @kbd{C} @tab
  9720. @item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{l} @tab @kbd{@key{Esc} @key{left}}
  9721. @item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab @kbd{L} @tab
  9722. @item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{r} @tab @kbd{@key{Esc} @key{right}}
  9723. @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab @kbd{R} @tab
  9724. @item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{ } @tab @kbd{@key{Esc} @key{up}}
  9725. @item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab @kbd{U} @tab
  9726. @item @kbd{M-@key{down}} @tab @kbd{C-c C-x d} @tab @kbd{ } @tab @kbd{@key{Esc} @key{down}}
  9727. @item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab @kbd{D} @tab
  9728. @item @kbd{S-@key{RET}} @tab @kbd{C-c C-x c} @tab @kbd{ } @tab
  9729. @item @kbd{M-@key{RET}} @tab @kbd{C-c C-x m} @tab @kbd{ } @tab @kbd{@key{Esc} @key{RET}}
  9730. @item @kbd{M-S-@key{RET}} @tab @kbd{C-c C-x M} @tab @kbd{ } @tab
  9731. @item @kbd{S-@key{left}} @tab @kbd{C-c @key{left}} @tab @kbd{ } @tab
  9732. @item @kbd{S-@key{right}} @tab @kbd{C-c @key{right}} @tab @kbd{ } @tab
  9733. @item @kbd{S-@key{up}} @tab @kbd{C-c @key{up}} @tab @kbd{ } @tab
  9734. @item @kbd{S-@key{down}} @tab @kbd{C-c @key{down}} @tab @kbd{ } @tab
  9735. @item @kbd{C-S-@key{left}} @tab @kbd{C-c C-x @key{left}} @tab @kbd{ } @tab
  9736. @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab @kbd{ } @tab
  9737. @end multitable
  9738. @node Interaction, , TTY keys, Miscellaneous
  9739. @section Interaction with other packages
  9740. @cindex packages, interaction with other
  9741. Org lives in the world of GNU Emacs and interacts in various ways
  9742. with other code out there.
  9743. @menu
  9744. * Cooperation:: Packages Org cooperates with
  9745. * Conflicts:: Packages that lead to conflicts
  9746. @end menu
  9747. @node Cooperation, Conflicts, Interaction, Interaction
  9748. @subsection Packages that Org cooperates with
  9749. @table @asis
  9750. @cindex @file{calc.el}
  9751. @cindex Gillespie, Dave
  9752. @item @file{calc.el} by Dave Gillespie
  9753. Org uses the Calc package for implementing spreadsheet
  9754. functionality in its tables (@pxref{The spreadsheet}). Org
  9755. checks for the availability of Calc by looking for the function
  9756. @code{calc-eval} which will have been autoloaded during setup if Calc has
  9757. been installed properly. As of Emacs 22, Calc is part of the Emacs
  9758. distribution. Another possibility for interaction between the two
  9759. packages is using Calc for embedded calculations. @xref{Embedded Mode,
  9760. , Embedded Mode, Calc, GNU Emacs Calc Manual}.
  9761. @item @file{constants.el} by Carsten Dominik
  9762. @cindex @file{constants.el}
  9763. @cindex Dominik, Carsten
  9764. @vindex org-table-formula-constants
  9765. In a table formula (@pxref{The spreadsheet}), it is possible to use
  9766. names for natural constants or units. Instead of defining your own
  9767. constants in the variable @code{org-table-formula-constants}, install
  9768. the @file{constants} package which defines a large number of constants
  9769. and units, and lets you use unit prefixes like @samp{M} for
  9770. @samp{Mega}, etc@. You will need version 2.0 of this package, available
  9771. at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
  9772. the function @code{constants-get}, which has to be autoloaded in your
  9773. setup. See the installation instructions in the file
  9774. @file{constants.el}.
  9775. @item @file{cdlatex.el} by Carsten Dominik
  9776. @cindex @file{cdlatex.el}
  9777. @cindex Dominik, Carsten
  9778. Org mode can make use of the CDLa@TeX{} package to efficiently enter
  9779. La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}.
  9780. @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
  9781. @cindex @file{imenu.el}
  9782. Imenu allows menu access to an index of items in a file. Org mode
  9783. supports Imenu---all you need to do to get the index is the following:
  9784. @lisp
  9785. (add-hook 'org-mode-hook
  9786. (lambda () (imenu-add-to-menubar "Imenu")))
  9787. @end lisp
  9788. @vindex org-imenu-depth
  9789. By default the index is two levels deep---you can modify the depth using
  9790. the option @code{org-imenu-depth}.
  9791. @item @file{remember.el} by John Wiegley
  9792. @cindex @file{remember.el}
  9793. @cindex Wiegley, John
  9794. Org cooperates with remember, see @ref{Remember}.
  9795. As of Emacs 23, @file{Remember.el} is part of the Emacs distribution.
  9796. @item @file{speedbar.el} by Eric M. Ludlam
  9797. @cindex @file{speedbar.el}
  9798. @cindex Ludlam, Eric M.
  9799. Speedbar is a package that creates a special frame displaying files and
  9800. index items in files. Org mode supports Speedbar and allows you to
  9801. drill into Org files directly from the Speedbar. It also allows you to
  9802. restrict the scope of agenda commands to a file or a subtree by using
  9803. the command @kbd{<} in the Speedbar frame.
  9804. @cindex @file{table.el}
  9805. @item @file{table.el} by Takaaki Ota
  9806. @kindex C-c C-c
  9807. @cindex table editor, @file{table.el}
  9808. @cindex @file{table.el}
  9809. @cindex Ota, Takaaki
  9810. Complex ASCII tables with automatic line wrapping, column- and row-spanning,
  9811. and alignment can be created using the Emacs table package by Takaaki Ota
  9812. (@uref{http://sourceforge.net/projects/table}, and also part of Emacs 22).
  9813. Org-mode will recognize these tables and export them properly. Because of
  9814. interference with other Org-mode functionality, you unfortunately cannot edit
  9815. these tables directly in the buffer. Instead, you need to use the command
  9816. @kbd{C-c '} to edit them, similar to source code snippets.
  9817. @table @kbd
  9818. @kindex C-c '
  9819. @item C-c '
  9820. Edit a @file{table.el} table. Works when the cursor is in a table.el table.
  9821. @c
  9822. @kindex C-c ~
  9823. @item C-c ~
  9824. Insert a @file{table.el} table. If there is already a table at point, this
  9825. command converts it between the @file{table.el} format and the Org-mode
  9826. format. See the documentation string of the command
  9827. @code{org-convert-table} for the restrictions under which this is
  9828. possible.
  9829. @end table
  9830. @file{table.el} is part of Emacs since Emacs 22.
  9831. @item @file{footnote.el} by Steven L. Baur
  9832. @cindex @file{footnote.el}
  9833. @cindex Baur, Steven L.
  9834. Org mode recognizes numerical footnotes as provided by this package.
  9835. However, Org mode also has its own footnote support (@pxref{Footnotes}),
  9836. which makes using @file{footnote.el} unnecessary.
  9837. @end table
  9838. @node Conflicts, , Cooperation, Interaction
  9839. @subsection Packages that lead to conflicts with Org mode
  9840. @table @asis
  9841. @cindex @code{shift-selection-mode}
  9842. @vindex org-support-shift-select
  9843. In Emacs 23, @code{shift-selection-mode} is on by default, meaning that
  9844. cursor motions combined with the shift key should start or enlarge regions.
  9845. This conflicts with the use of @kbd{S-@key{cursor}} commands in Org to change
  9846. timestamps, TODO keywords, priorities, and item bullet types if the cursor is
  9847. at such a location. By default, @kbd{S-@key{cursor}} commands outside
  9848. special contexts don't do anything, but you can customize the variable
  9849. @code{org-support-shift-select}. Org mode then tries to accommodate shift
  9850. selection by (i) using it outside of the special contexts where special
  9851. commands apply, and by (ii) extending an existing active region even if the
  9852. cursor moves across a special context.
  9853. @item @file{CUA.el} by Kim. F. Storm
  9854. @cindex @file{CUA.el}
  9855. @cindex Storm, Kim. F.
  9856. @vindex org-replace-disputed-keys
  9857. Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by CUA mode
  9858. (as well as @code{pc-select-mode} and @code{s-region-mode}) to select and extend the
  9859. region. In fact, Emacs 23 has this built-in in the form of
  9860. @code{shift-selection-mode}, see previous paragraph. If you are using Emacs
  9861. 23, you probably don't want to use another package for this purpose. However,
  9862. if you prefer to leave these keys to a different package while working in
  9863. Org mode, configure the variable @code{org-replace-disputed-keys}. When set,
  9864. Org will move the following key bindings in Org files, and in the agenda
  9865. buffer (but not during date selection).
  9866. @example
  9867. S-UP -> M-p S-DOWN -> M-n
  9868. S-LEFT -> M-- S-RIGHT -> M-+
  9869. C-S-LEFT -> M-S-- C-S-RIGHT -> M-S-+
  9870. @end example
  9871. @vindex org-disputed-keys
  9872. Yes, these are unfortunately more difficult to remember. If you want
  9873. to have other replacement keys, look at the variable
  9874. @code{org-disputed-keys}.
  9875. @item @file{yasnippet.el}
  9876. @cindex @file{yasnippet.el}
  9877. The way Org-mode binds the TAB key (binding to @code{[tab]} instead of
  9878. @code{"\t"}) overrules yasnippets' access to this key. The following code
  9879. fixed this problem:
  9880. @lisp
  9881. (add-hook 'org-mode-hook
  9882. (lambda ()
  9883. (org-set-local 'yas/trigger-key [tab])
  9884. (define-key yas/keymap [tab] 'yas/next-field-group)))
  9885. @end lisp
  9886. @item @file{windmove.el} by Hovav Shacham
  9887. @cindex @file{windmove.el}
  9888. This package also uses the @kbd{S-<cursor>} keys, so everything written
  9889. in the paragraph above about CUA mode also applies here.
  9890. @item @file{viper.el} by Michael Kifer
  9891. @cindex @file{viper.el}
  9892. @kindex C-c /
  9893. Viper uses @kbd{C-c /} and therefore makes this key not access the
  9894. corresponding Org-mode command @code{org-sparse-tree}. You need to find
  9895. another key for this command, or override the key in
  9896. @code{viper-vi-global-user-map} with
  9897. @lisp
  9898. (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
  9899. @end lisp
  9900. @end table
  9901. @node Hacking, MobileOrg, Miscellaneous, Top
  9902. @appendix Hacking
  9903. @cindex hacking
  9904. This appendix covers some aspects where users can extend the functionality of
  9905. Org.
  9906. @menu
  9907. * Hooks:: Who to reach into Org's internals
  9908. * Add-on packages:: Available extensions
  9909. * Adding hyperlink types:: New custom link types
  9910. * Context-sensitive commands:: How to add functionality to such commands
  9911. * Tables in arbitrary syntax:: Orgtbl for La@TeX{} and other programs
  9912. * Dynamic blocks:: Automatically filled blocks
  9913. * Special agenda views:: Customized views
  9914. * Extracting agenda information:: Postprocessing of agenda information
  9915. * Using the property API:: Writing programs that use entry properties
  9916. * Using the mapping API:: Mapping over all or selected entries
  9917. @end menu
  9918. @node Hooks, Add-on packages, Hacking, Hacking
  9919. @section Hooks
  9920. @cindex hooks
  9921. Org has a large number of hook variables that can be used to add
  9922. functionality. This appendix about hacking is going to illustrate the
  9923. use of some of them. A complete list of all hooks with documentation is
  9924. maintained by the Worg project and can be found at
  9925. @uref{http://orgmode.org/worg/org-configs/org-hooks.php}.
  9926. @node Add-on packages, Adding hyperlink types, Hooks, Hacking
  9927. @section Add-on packages
  9928. @cindex add-on packages
  9929. A large number of add-on packages have been written by various authors.
  9930. These packages are not part of Emacs, but they are distributed as contributed
  9931. packages with the separate release available at the Org mode home page at
  9932. @uref{http://orgmode.org}. The list of contributed packages, along with
  9933. documentation about each package, is maintained by the Worg project at
  9934. @uref{http://orgmode.org/worg/org-contrib/}.
  9935. @node Adding hyperlink types, Context-sensitive commands, Add-on packages, Hacking
  9936. @section Adding hyperlink types
  9937. @cindex hyperlinks, adding new types
  9938. Org has a large number of hyperlink types built-in
  9939. (@pxref{Hyperlinks}). If you would like to add new link types, Org
  9940. provides an interface for doing so. Let's look at an example file,
  9941. @file{org-man.el}, that will add support for creating links like
  9942. @samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
  9943. Emacs:
  9944. @lisp
  9945. ;;; org-man.el - Support for links to manpages in Org
  9946. (require 'org)
  9947. (org-add-link-type "man" 'org-man-open)
  9948. (add-hook 'org-store-link-functions 'org-man-store-link)
  9949. (defcustom org-man-command 'man
  9950. "The Emacs command to be used to display a man page."
  9951. :group 'org-link
  9952. :type '(choice (const man) (const woman)))
  9953. (defun org-man-open (path)
  9954. "Visit the manpage on PATH.
  9955. PATH should be a topic that can be thrown at the man command."
  9956. (funcall org-man-command path))
  9957. (defun org-man-store-link ()
  9958. "Store a link to a manpage."
  9959. (when (memq major-mode '(Man-mode woman-mode))
  9960. ;; This is a man page, we do make this link
  9961. (let* ((page (org-man-get-page-name))
  9962. (link (concat "man:" page))
  9963. (description (format "Manpage for %s" page)))
  9964. (org-store-link-props
  9965. :type "man"
  9966. :link link
  9967. :description description))))
  9968. (defun org-man-get-page-name ()
  9969. "Extract the page name from the buffer name."
  9970. ;; This works for both `Man-mode' and `woman-mode'.
  9971. (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  9972. (match-string 1 (buffer-name))
  9973. (error "Cannot create link to this man page")))
  9974. (provide 'org-man)
  9975. ;;; org-man.el ends here
  9976. @end lisp
  9977. @noindent
  9978. You would activate this new link type in @file{.emacs} with
  9979. @lisp
  9980. (require 'org-man)
  9981. @end lisp
  9982. @noindent
  9983. Let's go through the file and see what it does.
  9984. @enumerate
  9985. @item
  9986. It does @code{(require 'org)} to make sure that @file{org.el} has been
  9987. loaded.
  9988. @item
  9989. The next line calls @code{org-add-link-type} to define a new link type
  9990. with prefix @samp{man}. The call also contains the name of a function
  9991. that will be called to follow such a link.
  9992. @item
  9993. @vindex org-store-link-functions
  9994. The next line adds a function to @code{org-store-link-functions}, in
  9995. order to allow the command @kbd{C-c l} to record a useful link in a
  9996. buffer displaying a man page.
  9997. @end enumerate
  9998. The rest of the file defines the necessary variables and functions.
  9999. First there is a customization variable that determines which Emacs
  10000. command should be used to display man pages. There are two options,
  10001. @code{man} and @code{woman}. Then the function to follow a link is
  10002. defined. It gets the link path as an argument---in this case the link
  10003. path is just a topic for the manual command. The function calls the
  10004. value of @code{org-man-command} to display the man page.
  10005. Finally the function @code{org-man-store-link} is defined. When you try
  10006. to store a link with @kbd{C-c l}, this function will be called to
  10007. try to make a link. The function must first decide if it is supposed to
  10008. create the link for this buffer type; we do this by checking the value
  10009. of the variable @code{major-mode}. If not, the function must exit and
  10010. return the value @code{nil}. If yes, the link is created by getting the
  10011. manual topic from the buffer name and prefixing it with the string
  10012. @samp{man:}. Then it must call the command @code{org-store-link-props}
  10013. and set the @code{:type} and @code{:link} properties. Optionally you
  10014. can also set the @code{:description} property to provide a default for
  10015. the link description when the link is later inserted into an Org
  10016. buffer with @kbd{C-c C-l}.
  10017. When is makes sense for your new link type, you may also define a function
  10018. @code{org-PREFIX-complete-link} that implements special (e.g. completion)
  10019. support for inserting such a link with @kbd{C-c C-l}. Such a function should
  10020. not accept any arguments, and return the full link with prefix.
  10021. @node Context-sensitive commands, Tables in arbitrary syntax, Adding hyperlink types, Hacking
  10022. @section Context-sensitive commands
  10023. @cindex context-sensitive commands, hooks
  10024. @cindex add-ons, context-sensitive commands
  10025. @vindex org-ctrl-c-ctrl-c-hook
  10026. Org has several commands that act differently depending on context. The most
  10027. important example it the @kbd{C-c C-c} (@pxref{The very busy C-c C-c key}).
  10028. Also the @kbd{M-cursor} and @kbd{M-S-cursor} keys have this property.
  10029. Add-ons can tap into this functionality by providing a function that detects
  10030. special context for that add-on and executes functionality appropriate for
  10031. the context. Here is an example from Dan Davison's @file{org-R.el} which
  10032. allows you to evaluate commands based on the @file{R} programming language. For
  10033. this package, special contexts are lines that start with @code{#+R:} or
  10034. @code{#+RR:}.
  10035. @lisp
  10036. (defun org-R-apply-maybe ()
  10037. "Detect if this is context for org-R and execute R commands."
  10038. (if (save-excursion
  10039. (beginning-of-line 1)
  10040. (looking-at "#\\+RR?:"))
  10041. (progn (call-interactively 'org-R-apply)
  10042. t) ;; to signal that we took action
  10043. nil)) ;; to signal that we did not
  10044. (add-hook 'org-ctrl-c-ctrl-c-hook 'org-R-apply-maybe)
  10045. @end lisp
  10046. The function first checks if the cursor is in such a line. If that is the
  10047. case, @code{org-R-apply} is called and the function returns @code{t} to
  10048. signal that action was taken, and @kbd{C-c C-c} will stop looking for other
  10049. contexts. If the function finds it should do nothing locally, it returns @code{nil} so that other, similar functions can have a try.
  10050. @node Tables in arbitrary syntax, Dynamic blocks, Context-sensitive commands, Hacking
  10051. @section Tables and lists in arbitrary syntax
  10052. @cindex tables, in other modes
  10053. @cindex lists, in other modes
  10054. @cindex Orgtbl mode
  10055. Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
  10056. frequent feature request has been to make it work with native tables in
  10057. specific languages, for example La@TeX{}. However, this is extremely
  10058. hard to do in a general way, would lead to a customization nightmare,
  10059. and would take away much of the simplicity of the Orgtbl-mode table
  10060. editor.
  10061. This appendix describes a different approach. We keep the Orgtbl mode
  10062. table in its native format (the @i{source table}), and use a custom
  10063. function to @i{translate} the table to the correct syntax, and to
  10064. @i{install} it in the right location (the @i{target table}). This puts
  10065. the burden of writing conversion functions on the user, but it allows
  10066. for a very flexible system.
  10067. Bastien added the ability to do the same with lists. You can use Org's
  10068. facilities to edit and structure lists by turning @code{orgstruct-mode}
  10069. on, then locally exporting such lists in another format (HTML, La@TeX{}
  10070. or Texinfo.)
  10071. @menu
  10072. * Radio tables:: Sending and receiving radio tables
  10073. * A LaTeX example:: Step by step, almost a tutorial
  10074. * Translator functions:: Copy and modify
  10075. * Radio lists:: Doing the same for lists
  10076. @end menu
  10077. @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
  10078. @subsection Radio tables
  10079. @cindex radio tables
  10080. To define the location of the target table, you first need to create two
  10081. lines that are comments in the current mode, but contain magic words for
  10082. Orgtbl mode to find. Orgtbl mode will insert the translated table
  10083. between these lines, replacing whatever was there before. For example:
  10084. @example
  10085. /* BEGIN RECEIVE ORGTBL table_name */
  10086. /* END RECEIVE ORGTBL table_name */
  10087. @end example
  10088. @noindent
  10089. Just above the source table, we put a special line that tells
  10090. Orgtbl mode how to translate this table and where to install it. For
  10091. example:
  10092. @cindex #+ORGTBL
  10093. @example
  10094. #+ORGTBL: SEND table_name translation_function arguments....
  10095. @end example
  10096. @noindent
  10097. @code{table_name} is the reference name for the table that is also used
  10098. in the receiver lines. @code{translation_function} is the Lisp function
  10099. that does the translation. Furthermore, the line can contain a list of
  10100. arguments (alternating key and value) at the end. The arguments will be
  10101. passed as a property list to the translation function for
  10102. interpretation. A few standard parameters are already recognized and
  10103. acted upon before the translation function is called:
  10104. @table @code
  10105. @item :skip N
  10106. Skip the first N lines of the table. Hlines do count as separate lines for
  10107. this parameter!
  10108. @item :skipcols (n1 n2 ...)
  10109. List of columns that should be skipped. If the table has a column with
  10110. calculation marks, that column is automatically discarded as well.
  10111. Please note that the translator function sees the table @emph{after} the
  10112. removal of these columns, the function never knows that there have been
  10113. additional columns.
  10114. @end table
  10115. @noindent
  10116. The one problem remaining is how to keep the source table in the buffer
  10117. without disturbing the normal workings of the file, for example during
  10118. compilation of a C file or processing of a La@TeX{} file. There are a
  10119. number of different solutions:
  10120. @itemize @bullet
  10121. @item
  10122. The table could be placed in a block comment if that is supported by the
  10123. language. For example, in C mode you could wrap the table between
  10124. @samp{/*} and @samp{*/} lines.
  10125. @item
  10126. Sometimes it is possible to put the table after some kind of @i{END}
  10127. statement, for example @samp{\bye} in @TeX{} and @samp{\end@{document@}}
  10128. in La@TeX{}.
  10129. @item
  10130. You can just comment the table line-by-line whenever you want to process
  10131. the file, and uncomment it whenever you need to edit the table. This
  10132. only sounds tedious---the command @kbd{M-x orgtbl-toggle-comment}
  10133. makes this comment-toggling very easy, in particular if you bind it to a
  10134. key.
  10135. @end itemize
  10136. @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
  10137. @subsection A La@TeX{} example of radio tables
  10138. @cindex La@TeX{}, and Orgtbl mode
  10139. The best way to wrap the source table in La@TeX{} is to use the
  10140. @code{comment} environment provided by @file{comment.sty}. It has to be
  10141. activated by placing @code{\usepackage@{comment@}} into the document
  10142. header. Orgtbl mode can insert a radio table skeleton@footnote{By
  10143. default this works only for La@TeX{}, HTML, and Texinfo. Configure the
  10144. variable @code{orgtbl-radio-tables} to install templates for other
  10145. modes.} with the command @kbd{M-x orgtbl-insert-radio-table}. You will
  10146. be prompted for a table name, let's say we use @samp{salesfigures}. You
  10147. will then get the following template:
  10148. @cindex #+ORGTBL, SEND
  10149. @example
  10150. % BEGIN RECEIVE ORGTBL salesfigures
  10151. % END RECEIVE ORGTBL salesfigures
  10152. \begin@{comment@}
  10153. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  10154. | | |
  10155. \end@{comment@}
  10156. @end example
  10157. @noindent
  10158. @vindex La@TeX{}-verbatim-environments
  10159. The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
  10160. @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
  10161. into the receiver location with name @code{salesfigures}. You may now
  10162. fill in the table, feel free to use the spreadsheet features@footnote{If
  10163. the @samp{#+TBLFM} line contains an odd number of dollar characters,
  10164. this may cause problems with font-lock in La@TeX{} mode. As shown in the
  10165. example you can fix this by adding an extra line inside the
  10166. @code{comment} environment that is used to balance the dollar
  10167. expressions. If you are using AUC@TeX{} with the font-latex library, a
  10168. much better solution is to add the @code{comment} environment to the
  10169. variable @code{LaTeX-verbatim-environments}.}:
  10170. @example
  10171. % BEGIN RECEIVE ORGTBL salesfigures
  10172. % END RECEIVE ORGTBL salesfigures
  10173. \begin@{comment@}
  10174. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  10175. | Month | Days | Nr sold | per day |
  10176. |-------+------+---------+---------|
  10177. | Jan | 23 | 55 | 2.4 |
  10178. | Feb | 21 | 16 | 0.8 |
  10179. | March | 22 | 278 | 12.6 |
  10180. #+TBLFM: $4=$3/$2;%.1f
  10181. % $ (optional extra dollar to keep font-lock happy, see footnote)
  10182. \end@{comment@}
  10183. @end example
  10184. @noindent
  10185. When you are done, press @kbd{C-c C-c} in the table to get the converted
  10186. table inserted between the two marker lines.
  10187. Now let's assume you want to make the table header by hand, because you
  10188. want to control how columns are aligned, etc@. In this case we make sure
  10189. that the table translator skips the first 2 lines of the source
  10190. table, and tell the command to work as a @i{splice}, i.e. to not produce
  10191. header and footer commands of the target table:
  10192. @example
  10193. \begin@{tabular@}@{lrrr@}
  10194. Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
  10195. % BEGIN RECEIVE ORGTBL salesfigures
  10196. % END RECEIVE ORGTBL salesfigures
  10197. \end@{tabular@}
  10198. %
  10199. \begin@{comment@}
  10200. #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  10201. | Month | Days | Nr sold | per day |
  10202. |-------+------+---------+---------|
  10203. | Jan | 23 | 55 | 2.4 |
  10204. | Feb | 21 | 16 | 0.8 |
  10205. | March | 22 | 278 | 12.6 |
  10206. #+TBLFM: $4=$3/$2;%.1f
  10207. \end@{comment@}
  10208. @end example
  10209. The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
  10210. Orgtbl mode. It uses a @code{tabular} environment to typeset the table
  10211. and marks horizontal lines with @code{\hline}. Furthermore, it
  10212. interprets the following parameters (see also @pxref{Translator functions}):
  10213. @table @code
  10214. @item :splice nil/t
  10215. When set to t, return only table body lines, don't wrap them into a
  10216. tabular environment. Default is nil.
  10217. @item :fmt fmt
  10218. A format to be used to wrap each field, it should contain @code{%s} for the
  10219. original field value. For example, to wrap each field value in dollars,
  10220. you could use @code{:fmt "$%s$"}. This may also be a property list with
  10221. column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
  10222. A function of one argument can be used in place of the strings; the
  10223. function must return a formatted string.
  10224. @item :efmt efmt
  10225. Use this format to print numbers with exponentials. The format should
  10226. have @code{%s} twice for inserting mantissa and exponent, for example
  10227. @code{"%s\\times10^@{%s@}"}. The default is @code{"%s\\,(%s)"}. This
  10228. may also be a property list with column numbers and formats, for example
  10229. @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
  10230. @code{efmt} has been applied to a value, @code{fmt} will also be
  10231. applied. Similar to @code{fmt}, functions of two arguments can be
  10232. supplied instead of strings.
  10233. @end table
  10234. @node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
  10235. @subsection Translator functions
  10236. @cindex HTML, and Orgtbl mode
  10237. @cindex translator function
  10238. Orgtbl mode has several translator functions built-in: @code{orgtbl-to-csv}
  10239. (comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values)
  10240. @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and @code{orgtbl-to-texinfo}.
  10241. Except for @code{orgtbl-to-html}@footnote{The HTML translator uses the same
  10242. code that produces tables during HTML export.}, these all use a generic
  10243. translator, @code{orgtbl-to-generic}. For example, @code{orgtbl-to-latex}
  10244. itself is a very short function that computes the column definitions for the
  10245. @code{tabular} environment, defines a few field and line separators and then
  10246. hands processing over to the generic translator. Here is the entire code:
  10247. @lisp
  10248. @group
  10249. (defun orgtbl-to-latex (table params)
  10250. "Convert the Orgtbl mode TABLE to LaTeX."
  10251. (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
  10252. org-table-last-alignment ""))
  10253. (params2
  10254. (list
  10255. :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
  10256. :tend "\\end@{tabular@}"
  10257. :lstart "" :lend " \\\\" :sep " & "
  10258. :efmt "%s\\,(%s)" :hline "\\hline")))
  10259. (orgtbl-to-generic table (org-combine-plists params2 params))))
  10260. @end group
  10261. @end lisp
  10262. As you can see, the properties passed into the function (variable
  10263. @var{PARAMS}) are combined with the ones newly defined in the function
  10264. (variable @var{PARAMS2}). The ones passed into the function (i.e. the
  10265. ones set by the @samp{ORGTBL SEND} line) take precedence. So if you
  10266. would like to use the La@TeX{} translator, but wanted the line endings to
  10267. be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
  10268. overrule the default with
  10269. @example
  10270. #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  10271. @end example
  10272. For a new language, you can either write your own converter function in
  10273. analogy with the La@TeX{} translator, or you can use the generic function
  10274. directly. For example, if you have a language where a table is started
  10275. with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
  10276. started with @samp{!BL!}, ended with @samp{!EL!}, and where the field
  10277. separator is a TAB, you could call the generic translator like this (on
  10278. a single line!):
  10279. @example
  10280. #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
  10281. :lstart "!BL! " :lend " !EL!" :sep "\t"
  10282. @end example
  10283. @noindent
  10284. Please check the documentation string of the function
  10285. @code{orgtbl-to-generic} for a full list of parameters understood by
  10286. that function, and remember that you can pass each of them into
  10287. @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
  10288. using the generic function.
  10289. Of course you can also write a completely new function doing complicated
  10290. things the generic translator cannot do. A translator function takes
  10291. two arguments. The first argument is the table, a list of lines, each
  10292. line either the symbol @code{hline} or a list of fields. The second
  10293. argument is the property list containing all parameters specified in the
  10294. @samp{#+ORGTBL: SEND} line. The function must return a single string
  10295. containing the formatted table. If you write a generally useful
  10296. translator, please post it on @email{emacs-orgmode@@gnu.org} so that
  10297. others can benefit from your work.
  10298. @node Radio lists, , Translator functions, Tables in arbitrary syntax
  10299. @subsection Radio lists
  10300. @cindex radio lists
  10301. @cindex org-list-insert-radio-list
  10302. Sending and receiving radio lists works exactly the same way than sending and
  10303. receiving radio tables (@pxref{Radio tables}). As for radio tables, you can
  10304. insert radio lists templates in HTML, La@TeX{} and Texinfo modes by calling
  10305. @code{org-list-insert-radio-list}.
  10306. Here are the differences with radio tables:
  10307. @itemize @minus
  10308. @item
  10309. Use @code{ORGLST} instead of @code{ORGTBL}.
  10310. @item
  10311. The available translation functions for radio lists don't take
  10312. parameters.
  10313. @item
  10314. @kbd{C-c C-c} will work when pressed on the first item of the list.
  10315. @end itemize
  10316. Here is a La@TeX{} example. Let's say that you have this in your
  10317. La@TeX{} file:
  10318. @cindex #+ORGLIST
  10319. @example
  10320. % BEGIN RECEIVE ORGLST to-buy
  10321. % END RECEIVE ORGLST to-buy
  10322. \begin@{comment@}
  10323. #+ORGLIST: SEND to-buy orgtbl-to-latex
  10324. - a new house
  10325. - a new computer
  10326. + a new keyboard
  10327. + a new mouse
  10328. - a new life
  10329. \end@{comment@}
  10330. @end example
  10331. Pressing `C-c C-c' on @code{a new house} and will insert the converted
  10332. La@TeX{} list between the two marker lines.
  10333. @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Hacking
  10334. @section Dynamic blocks
  10335. @cindex dynamic blocks
  10336. Org documents can contain @emph{dynamic blocks}. These are
  10337. specially marked regions that are updated by some user-written function.
  10338. A good example for such a block is the clock table inserted by the
  10339. command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
  10340. Dynamic block are enclosed by a BEGIN-END structure that assigns a name
  10341. to the block and can also specify parameters for the function producing
  10342. the content of the block.
  10343. #+BEGIN:dynamic block
  10344. @example
  10345. #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  10346. #+END:
  10347. @end example
  10348. Dynamic blocks are updated with the following commands
  10349. @table @kbd
  10350. @kindex C-c C-x C-u
  10351. @item C-c C-x C-u
  10352. Update dynamic block at point.
  10353. @kindex C-u C-c C-x C-u
  10354. @item C-u C-c C-x C-u
  10355. Update all dynamic blocks in the current file.
  10356. @end table
  10357. Updating a dynamic block means to remove all the text between BEGIN and
  10358. END, parse the BEGIN line for parameters and then call the specific
  10359. writer function for this block to insert the new content. If you want
  10360. to use the original content in the writer function, you can use the
  10361. extra parameter @code{:content}.
  10362. For a block with name @code{myblock}, the writer function is
  10363. @code{org-dblock-write:myblock} with as only parameter a property list
  10364. with the parameters given in the begin line. Here is a trivial example
  10365. of a block that keeps track of when the block update function was last
  10366. run:
  10367. @example
  10368. #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  10369. #+END:
  10370. @end example
  10371. @noindent
  10372. The corresponding block writer function could look like this:
  10373. @lisp
  10374. (defun org-dblock-write:block-update-time (params)
  10375. (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  10376. (insert "Last block update at: "
  10377. (format-time-string fmt (current-time)))))
  10378. @end lisp
  10379. If you want to make sure that all dynamic blocks are always up-to-date,
  10380. you could add the function @code{org-update-all-dblocks} to a hook, for
  10381. example @code{before-save-hook}. @code{org-update-all-dblocks} is
  10382. written in a way such that it does nothing in buffers that are not in
  10383. @code{org-mode}.
  10384. @node Special agenda views, Extracting agenda information, Dynamic blocks, Hacking
  10385. @section Special agenda views
  10386. @cindex agenda views, user-defined
  10387. Org provides a special hook that can be used to narrow down the
  10388. selection made by any of the agenda views. You may specify a function
  10389. that is used at each match to verify if the match should indeed be part
  10390. of the agenda view, and if not, how much should be skipped.
  10391. Let's say you want to produce a list of projects that contain a WAITING
  10392. tag anywhere in the project tree. Let's further assume that you have
  10393. marked all tree headings that define a project with the TODO keyword
  10394. PROJECT. In this case you would run a TODO search for the keyword
  10395. PROJECT, but skip the match unless there is a WAITING tag anywhere in
  10396. the subtree belonging to the project line.
  10397. To achieve this, you must write a function that searches the subtree for
  10398. the tag. If the tag is found, the function must return @code{nil} to
  10399. indicate that this match should not be skipped. If there is no such
  10400. tag, return the location of the end of the subtree, to indicate that
  10401. search should continue from there.
  10402. @lisp
  10403. (defun my-skip-unless-waiting ()
  10404. "Skip trees that are not waiting"
  10405. (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  10406. (if (re-search-forward ":waiting:" subtree-end t)
  10407. nil ; tag found, do not skip
  10408. subtree-end))) ; tag not found, continue after end of subtree
  10409. @end lisp
  10410. Now you may use this function in an agenda custom command, for example
  10411. like this:
  10412. @lisp
  10413. (org-add-agenda-custom-command
  10414. '("b" todo "PROJECT"
  10415. ((org-agenda-skip-function 'my-skip-unless-waiting)
  10416. (org-agenda-overriding-header "Projects waiting for something: "))))
  10417. @end lisp
  10418. @vindex org-agenda-overriding-header
  10419. Note that this also binds @code{org-agenda-overriding-header} to get a
  10420. meaningful header in the agenda view.
  10421. @vindex org-odd-levels-only
  10422. @vindex org-agenda-skip-function
  10423. A general way to create custom searches is to base them on a search for
  10424. entries with a certain level limit. If you want to study all entries with
  10425. your custom search function, simply do a search for
  10426. @samp{LEVEL>0}@footnote{Note that, when using @code{org-odd-levels-only}, a
  10427. level number corresponds to order in the hierarchy, not to the number of
  10428. stars.}, and then use @code{org-agenda-skip-function} to select the entries
  10429. you really want to have.
  10430. You may also put a Lisp form into @code{org-agenda-skip-function}. In
  10431. particular, you may use the functions @code{org-agenda-skip-entry-if}
  10432. and @code{org-agenda-skip-subtree-if} in this form, for example:
  10433. @table @code
  10434. @item '(org-agenda-skip-entry-if 'scheduled)
  10435. Skip current entry if it has been scheduled.
  10436. @item '(org-agenda-skip-entry-if 'notscheduled)
  10437. Skip current entry if it has not been scheduled.
  10438. @item '(org-agenda-skip-entry-if 'deadline)
  10439. Skip current entry if it has a deadline.
  10440. @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
  10441. Skip current entry if it has a deadline, or if it is scheduled.
  10442. @item '(org-agenda-skip-entry-if 'timestamp)
  10443. Skip current entry if it has any timestamp, may also be deadline or scheduled.
  10444. @item '(org-agenda-skip-entry 'regexp "regular expression")
  10445. Skip current entry if the regular expression matches in the entry.
  10446. @item '(org-agenda-skip-entry 'notregexp "regular expression")
  10447. Skip current entry unless the regular expression matches.
  10448. @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
  10449. Same as above, but check and skip the entire subtree.
  10450. @end table
  10451. Therefore we could also have written the search for WAITING projects
  10452. like this, even without defining a special function:
  10453. @lisp
  10454. (org-add-agenda-custom-command
  10455. '("b" todo "PROJECT"
  10456. ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  10457. 'regexp ":waiting:"))
  10458. (org-agenda-overriding-header "Projects waiting for something: "))))
  10459. @end lisp
  10460. @node Extracting agenda information, Using the property API, Special agenda views, Hacking
  10461. @section Extracting agenda information
  10462. @cindex agenda, pipe
  10463. @cindex Scripts, for agenda processing
  10464. @vindex org-agenda-custom-commands
  10465. Org provides commands to access agenda information for the command
  10466. line in Emacs batch mode. This extracted information can be sent
  10467. directly to a printer, or it can be read by a program that does further
  10468. processing of the data. The first of these commands is the function
  10469. @code{org-batch-agenda}, that produces an agenda view and sends it as
  10470. ASCII text to STDOUT. The command takes a single string as parameter.
  10471. If the string has length 1, it is used as a key to one of the commands
  10472. you have configured in @code{org-agenda-custom-commands}, basically any
  10473. key you can use after @kbd{C-c a}. For example, to directly print the
  10474. current TODO list, you could use
  10475. @example
  10476. emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  10477. @end example
  10478. If the parameter is a string with 2 or more characters, it is used as a
  10479. tags/TODO match string. For example, to print your local shopping list
  10480. (all items with the tag @samp{shop}, but excluding the tag
  10481. @samp{NewYork}), you could use
  10482. @example
  10483. emacs -batch -l ~/.emacs \
  10484. -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  10485. @end example
  10486. @noindent
  10487. You may also modify parameters on the fly like this:
  10488. @example
  10489. emacs -batch -l ~/.emacs \
  10490. -eval '(org-batch-agenda "a" \
  10491. org-agenda-ndays 30 \
  10492. org-agenda-include-diary nil \
  10493. org-agenda-files (quote ("~/org/project.org")))' \
  10494. | lpr
  10495. @end example
  10496. @noindent
  10497. which will produce a 30-day agenda, fully restricted to the Org file
  10498. @file{~/org/projects.org}, not even including the diary.
  10499. If you want to process the agenda data in more sophisticated ways, you
  10500. can use the command @code{org-batch-agenda-csv} to get a comma-separated
  10501. list of values for each agenda item. Each line in the output will
  10502. contain a number of fields separated by commas. The fields in a line
  10503. are:
  10504. @example
  10505. category @r{The category of the item}
  10506. head @r{The headline, without TODO keyword, TAGS and PRIORITY}
  10507. type @r{The type of the agenda entry, can be}
  10508. todo @r{selected in TODO match}
  10509. tagsmatch @r{selected in tags match}
  10510. diary @r{imported from diary}
  10511. deadline @r{a deadline}
  10512. scheduled @r{scheduled}
  10513. timestamp @r{appointment, selected by timestamp}
  10514. closed @r{entry was closed on date}
  10515. upcoming-deadline @r{warning about nearing deadline}
  10516. past-scheduled @r{forwarded scheduled item}
  10517. block @r{entry has date block including date}
  10518. todo @r{The TODO keyword, if any}
  10519. tags @r{All tags including inherited ones, separated by colons}
  10520. date @r{The relevant date, like 2007-2-14}
  10521. time @r{The time, like 15:00-16:50}
  10522. extra @r{String with extra planning info}
  10523. priority-l @r{The priority letter if any was given}
  10524. priority-n @r{The computed numerical priority}
  10525. @end example
  10526. @noindent
  10527. Time and date will only be given if a timestamp (or deadline/scheduled)
  10528. led to the selection of the item.
  10529. A CSV list like this is very easy to use in a post-processing script.
  10530. For example, here is a Perl program that gets the TODO list from
  10531. Emacs/Org and prints all the items, preceded by a checkbox:
  10532. @example
  10533. #!/usr/bin/perl
  10534. # define the Emacs command to run
  10535. $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  10536. # run it and capture the output
  10537. $agenda = qx@{$cmd 2>/dev/null@};
  10538. # loop over all lines
  10539. foreach $line (split(/\n/,$agenda)) @{
  10540. # get the individual values
  10541. ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  10542. $priority_l,$priority_n) = split(/,/,$line);
  10543. # process and print
  10544. print "[ ] $head\n";
  10545. @}
  10546. @end example
  10547. @node Using the property API, Using the mapping API, Extracting agenda information, Hacking
  10548. @section Using the property API
  10549. @cindex API, for properties
  10550. @cindex properties, API
  10551. Here is a description of the functions that can be used to work with
  10552. properties.
  10553. @defun org-entry-properties &optional pom which
  10554. Get all properties of the entry at point-or-marker POM.@*
  10555. This includes the TODO keyword, the tags, time strings for deadline,
  10556. scheduled, and clocking, and any additional properties defined in the
  10557. entry. The return value is an alist, keys may occur multiple times
  10558. if the property key was used several times.@*
  10559. POM may also be nil, in which case the current entry is used.
  10560. If WHICH is nil or `all', get all properties. If WHICH is
  10561. `special' or `standard', only get that subclass.
  10562. @end defun
  10563. @vindex org-use-property-inheritance
  10564. @defun org-entry-get pom property &optional inherit
  10565. Get value of PROPERTY for entry at point-or-marker POM. By default,
  10566. this only looks at properties defined locally in the entry. If INHERIT
  10567. is non-nil and the entry does not have the property, then also check
  10568. higher levels of the hierarchy. If INHERIT is the symbol
  10569. @code{selective}, use inheritance if and only if the setting of
  10570. @code{org-use-property-inheritance} selects PROPERTY for inheritance.
  10571. @end defun
  10572. @defun org-entry-delete pom property
  10573. Delete the property PROPERTY from entry at point-or-marker POM.
  10574. @end defun
  10575. @defun org-entry-put pom property value
  10576. Set PROPERTY to VALUE for entry at point-or-marker POM.
  10577. @end defun
  10578. @defun org-buffer-property-keys &optional include-specials
  10579. Get all property keys in the current buffer.
  10580. @end defun
  10581. @defun org-insert-property-drawer
  10582. Insert a property drawer at point.
  10583. @end defun
  10584. @defun org-entry-put-multivalued-property pom property &rest values
  10585. Set PROPERTY at point-or-marker POM to VALUES. VALUES should be a list of
  10586. strings. They will be concatenated, with spaces as separators.
  10587. @end defun
  10588. @defun org-entry-get-multivalued-property pom property
  10589. Treat the value of the property PROPERTY as a whitespace-separated list of
  10590. values and return the values as a list of strings.
  10591. @end defun
  10592. @defun org-entry-add-to-multivalued-property pom property value
  10593. Treat the value of the property PROPERTY as a whitespace-separated list of
  10594. values and make sure that VALUE is in this list.
  10595. @end defun
  10596. @defun org-entry-remove-from-multivalued-property pom property value
  10597. Treat the value of the property PROPERTY as a whitespace-separated list of
  10598. values and make sure that VALUE is @emph{not} in this list.
  10599. @end defun
  10600. @defun org-entry-member-in-multivalued-property pom property value
  10601. Treat the value of the property PROPERTY as a whitespace-separated list of
  10602. values and check if VALUE is in this list.
  10603. @end defun
  10604. @defopt org-property-allowed-value-functions
  10605. Hook for functions supplying allowed values for specific.
  10606. The functions must take a single argument, the name of the property, and
  10607. return a flat list of allowed values. If @samp{:ETC} is one of
  10608. the values, use the values as completion help, but allow also other values
  10609. to be entered. The functions must return @code{nil} if they are not
  10610. responsible for this property.
  10611. @end defopt
  10612. @node Using the mapping API, , Using the property API, Hacking
  10613. @section Using the mapping API
  10614. @cindex API, for mapping
  10615. @cindex mapping entries, API
  10616. Org has sophisticated mapping capabilities to find all entries satisfying
  10617. certain criteria. Internally, this functionality is used to produce agenda
  10618. views, but there is also an API that can be used to execute arbitrary
  10619. functions for each or selected entries. The main entry point for this API
  10620. is:
  10621. @defun org-map-entries func &optional match scope &rest skip
  10622. Call FUNC at each headline selected by MATCH in SCOPE.
  10623. FUNC is a function or a Lisp form. The function will be called without
  10624. arguments, with the cursor positioned at the beginning of the headline.
  10625. The return values of all calls to the function will be collected and
  10626. returned as a list.
  10627. The call to FUNC will be wrapped into a save-excursion form, so FUNC
  10628. does not need to preserve point. After evaluation, the cursor will be
  10629. moved to the end of the line (presumably of the headline of the
  10630. processed entry) and search continues from there. Under some
  10631. circumstances, this may not produce the wanted results. For example,
  10632. if you have removed (e.g. archived) the current (sub)tree it could
  10633. mean that the next entry will be skipped entirely. In such cases, you
  10634. can specify the position from where search should continue by making
  10635. FUNC set the variable `org-map-continue-from' to the desired buffer
  10636. position.
  10637. MATCH is a tags/property/todo match as it is used in the agenda match view.
  10638. Only headlines that are matched by this query will be considered during
  10639. the iteration. When MATCH is nil or t, all headlines will be
  10640. visited by the iteration.
  10641. SCOPE determines the scope of this command. It can be any of:
  10642. @example
  10643. nil @r{the current buffer, respecting the restriction if any}
  10644. tree @r{the subtree started with the entry at point}
  10645. file @r{the current buffer, without restriction}
  10646. file-with-archives
  10647. @r{the current buffer, and any archives associated with it}
  10648. agenda @r{all agenda files}
  10649. agenda-with-archives
  10650. @r{all agenda files with any archive files associated with them}
  10651. (file1 file2 ...)
  10652. @r{if this is a list, all files in the list will be scanned}
  10653. @end example
  10654. @noindent
  10655. The remaining args are treated as settings for the skipping facilities of
  10656. the scanner. The following items can be given here:
  10657. @vindex org-agenda-skip-function
  10658. @example
  10659. archive @r{skip trees with the archive tag}
  10660. comment @r{skip trees with the COMMENT keyword}
  10661. function or Lisp form
  10662. @r{will be used as value for @code{org-agenda-skip-function},}
  10663. @r{so whenever the function returns t, FUNC}
  10664. @r{will not be called for that entry and search will}
  10665. @r{continue from the point where the function leaves it}
  10666. @end example
  10667. @end defun
  10668. The function given to that mapping routine can really do anything you like.
  10669. It can use the property API (@pxref{Using the property API}) to gather more
  10670. information about the entry, or in order to change metadata in the entry.
  10671. Here are a couple of functions that might be handy:
  10672. @defun org-todo &optional arg
  10673. Change the TODO state of the entry, see the docstring of the functions for
  10674. the many possible values for the argument ARG.
  10675. @end defun
  10676. @defun org-priority &optional action
  10677. Change the priority of the entry, see the docstring of this function for the
  10678. possible values for ACTION.
  10679. @end defun
  10680. @defun org-toggle-tag tag &optional onoff
  10681. Toggle the tag TAG in the current entry. Setting ONOFF to either @code{on}
  10682. or @code{off} will not toggle tag, but ensure that it is either on or off.
  10683. @end defun
  10684. @defun org-promote
  10685. Promote the current entry.
  10686. @end defun
  10687. @defun org-demote
  10688. Demote the current entry.
  10689. @end defun
  10690. Here is a simple example that will turn all entries in the current file with
  10691. a tag @code{TOMORROW} into TODO entries with the keyword @code{UPCOMING}.
  10692. Entries in comment trees and in archive trees will be ignored.
  10693. @lisp
  10694. (org-map-entries
  10695. '(org-todo "UPCOMING")
  10696. "+TOMORROW" 'file 'archive 'comment)
  10697. @end lisp
  10698. The following example counts the number of entries with TODO keyword
  10699. @code{WAITING}, in all agenda files.
  10700. @lisp
  10701. (length (org-map-entries t "/+WAITING" 'agenda))
  10702. @end lisp
  10703. @node MobileOrg, History and Acknowledgments, Hacking, Top
  10704. @appendix MobileOrg
  10705. @cindex iPhone
  10706. @cindex MobileOrg
  10707. @i{MobileOrg} is an application for the @i{iPhone/iPod Touch} series of
  10708. devices, developed by Richard Moreland. @i{MobileOrg} offers offline viewing
  10709. and capture support for an Org-mode system rooted on a ``real'' computer. It
  10710. does also allow you to record changes to existing entries. For information
  10711. about @i{MobileOrg}, see @uref{http://mobileorg.ncogni.to/}).
  10712. This appendix describes the support Org has for creating agenda views in a
  10713. format that can be displayed by @i{MobileOrg}, and for integrating notes
  10714. captured and changes made by @i{MobileOrg} into the main system.
  10715. For changing tags and TODO states in MobileOrg, you should have set up the
  10716. customization variables @code{org-todo-keywords} and @code{org-tags-alist} to
  10717. cover all important tags and todo keywords, even if individual files use only
  10718. part of these. MobileOrg will also offer you states and tags set up with
  10719. in-buffer settings, but it will understand the logistics of todo state
  10720. @i{sets} (@pxref{Per-file keywords}) and @i{mutually exclusive} tags
  10721. (@pxref{Setting tags}) only for those set in these variables.
  10722. @menu
  10723. * Setting up the staging area:: Where to interact with the mobile device
  10724. * Pushing to MobileOrg:: Uploading Org files and agendas
  10725. * Pulling from MobileOrg:: Integrating captured and flagged items
  10726. @end menu
  10727. @node Setting up the staging area, Pushing to MobileOrg, MobileOrg, MobileOrg
  10728. @section Setting up the staging area
  10729. Org-mode has commands to prepare a directory with files for @i{MobileOrg},
  10730. and to read captured notes from there. If Emacs can directly write to the
  10731. WebDAV directory accessed by @i{MobileOrg}, just point to this directory
  10732. using the variable @code{org-mobile-directory}. Using the @file{tramp}
  10733. method, @code{org-mobile-directory} may point to a remote directory
  10734. accessible through, for example,
  10735. @file{ssh/scp}:
  10736. @smallexample
  10737. (setq org-mobile-directory "/scpc:user@@remote.host:org/webdav/")
  10738. @end smallexample
  10739. If Emacs cannot access the WebDAV directory directly using a @file{tramp}
  10740. method, or you prefer to maintain a local copy, you can use a local directory
  10741. for staging. Other means must then be used to keep this directory in sync
  10742. with the WebDAV directory. In the following example, files are staged in
  10743. @file{~/stage}, and Org-mode hooks take care of moving files to and from the
  10744. WebDAV directory using @file{scp}.
  10745. @smallexample
  10746. (setq org-mobile-directory "~/stage/")
  10747. (add-hook 'org-mobile-post-push-hook
  10748. (lambda () (shell-command "scp -r ~/stage/* user@@wdhost:mobile/")))
  10749. (add-hook 'org-mobile-pre-pull-hook
  10750. (lambda () (shell-command "scp user@@wdhost:mobile/mobileorg.org ~/stage/ ")))
  10751. (add-hook 'org-mobile-post-pull-hook
  10752. (lambda () (shell-command "scp ~/stage/mobileorg.org user@@wdhost:mobile/")))
  10753. @end smallexample
  10754. @node Pushing to MobileOrg, Pulling from MobileOrg, Setting up the staging area, MobileOrg
  10755. @section Pushing to MobileOrg
  10756. This operation copies all files currently listed in @code{org-mobile-files}
  10757. to the directory @code{org-mobile-directory}. By default this list contains
  10758. all agenda files (as listed in @code{org-agenda-files}), but additional files
  10759. can be included by customizing @code{org-mobiles-files}. File names will be
  10760. staged with path relative to @code{org-directory}, so all files should be
  10761. inside this directory. The push operation also creates (in the same
  10762. directory) a special Org file @file{agendas.org}. This file is an Org-mode
  10763. style outline, containing every custom agenda view defined by the user.
  10764. While creating the agendas, Org-mode will force@footnote{See the variable
  10765. @code{org-mobile-force-id-on-agenda-items}.} an ID property on all entries
  10766. referenced by the agendas, so that these entries can be uniquely identified
  10767. if @i{MobileOrg} flags them for further action. Finally, Org writes the file
  10768. @file{index.org}, containing links to all other files. If @i{MobileOrg} is
  10769. configured to request this file from the WebDAV server, all agendas and Org
  10770. files will be downloaded to the device. To speed up the download, MobileOrg
  10771. will only read files whose checksums@footnote{stored automatically in the
  10772. file @file{checksums.dat}} have changed.
  10773. @node Pulling from MobileOrg, , Pushing to MobileOrg, MobileOrg
  10774. @section Pulling from MobileOrg
  10775. When @i{MobileOrg} synchronizes with the WebDAV server, it not only pulls the
  10776. Org files for viewing. It also appends captured entries and pointers to
  10777. flagged and changed entries to the file @file{mobileorg.org} on the server.
  10778. Org has a @emph{pull} operation that integrates this information into an
  10779. inbox file and operates on the pointers to flagged entries. Here is how it
  10780. works:
  10781. @enumerate
  10782. @item
  10783. Org moves all entries found in
  10784. @file{mobileorg.org}@footnote{@file{mobileorg.org} will be empty after this
  10785. operation.} and appends them to the file pointed to by the variable
  10786. @code{org-mobile-inbox-for-pull}. Each captured entry and each editing event
  10787. will be a top-level entry in the inbox file.
  10788. @item
  10789. After moving the entries, Org will attempt to implement the changes made in
  10790. @i{MobileOrg}. Some changes are applied directly and without user
  10791. interaction. Examples are all changes to tags, TODO state, headline and body
  10792. text that can be cleanly applied. Entries that have been flagged for further
  10793. action will receive a tag @code{:FLAGGED:}, so that they can be easily found
  10794. again. When there is a problem finding an entry or applying the change, the
  10795. pointer entry will remain in the inbox and will be marked with an error
  10796. message. You need to later resolve these issues by hand.
  10797. @item
  10798. Org will then generate an agenda view with all flagged entries. The user
  10799. should then go through these entries and do whatever actions are necessary.
  10800. If a note has been stored while flagging an entry in @i{MobileOrg}, that note
  10801. will be displayed in the echo area when the cursor is on the corresponding
  10802. agenda line.
  10803. @table @kbd
  10804. @kindex ?
  10805. @item ?
  10806. Pressing @kbd{?} in that special agenda will display the full flagging note in
  10807. another window and also push it onto the kill ring. So you could use @kbd{?
  10808. z C-y C-c C-c} to store that flagging note as a normal note in the entry.
  10809. Pressing @kbd{?} twice in succession will offer to remove the
  10810. @code{:FLAGGED:} tag along with the recorded flagging note (which is stored
  10811. in a property). In this way you indicate, that the intended processing for
  10812. this flagged entry is finished.
  10813. @end table
  10814. @end enumerate
  10815. @kindex C-c a ?
  10816. If you are not able to process all flagged entries directly, you can always
  10817. return to this agenda view using @kbd{C-c a ?}. Note, however, that there is
  10818. a subtle difference. The view created automatically by @kbd{M-x
  10819. org-mobile-pull RET} is guaranteed to search all files that have been
  10820. addressed by the last pull. This might include a file that is not currently
  10821. in your list of agenda files. If you later use @kbd{C-c a ?} to regenerate
  10822. the view, only the current agenda files will be searched.
  10823. @node History and Acknowledgments, Main Index, MobileOrg, Top
  10824. @appendix History and Acknowledgments
  10825. @cindex acknowledgements
  10826. @cindex history
  10827. @cindex thanks
  10828. Org was born in 2003, out of frustration over the user interface
  10829. of the Emacs Outline mode. I was trying to organize my notes and
  10830. projects, and using Emacs seemed to be the natural way to go. However,
  10831. having to remember eleven different commands with two or three keys per
  10832. command, only to hide and show parts of the outline tree, that seemed
  10833. entirely unacceptable to me. Also, when using outlines to take notes, I
  10834. constantly wanted to restructure the tree, organizing it parallel to my
  10835. thoughts and plans. @emph{Visibility cycling} and @emph{structure
  10836. editing} were originally implemented in the package
  10837. @file{outline-magic.el}, but quickly moved to the more general
  10838. @file{org.el}. As this environment became comfortable for project
  10839. planning, the next step was adding @emph{TODO entries}, basic
  10840. @emph{timestamps}, and @emph{table support}. These areas highlighted the two main
  10841. goals that Org still has today: to be a new, outline-based,
  10842. plain text mode with innovative and intuitive editing features, and to
  10843. incorporate project planning functionality directly into a notes file.
  10844. A special thanks goes to @i{Bastien Guerry} who has not only written a large
  10845. number of extensions to Org (most of them integrated into the core by now),
  10846. but who has also helped in the development and maintenance of Org so much that he
  10847. should be considered the main co-contributor to this package.
  10848. Since the first release, literally thousands of emails to me or to
  10849. @email{emacs-orgmode@@gnu.org} have provided a constant stream of bug
  10850. reports, feedback, new ideas, and sometimes patches and add-on code.
  10851. Many thanks to everyone who has helped to improve this package. I am
  10852. trying to keep here a list of the people who had significant influence
  10853. in shaping one or more aspects of Org. The list may not be
  10854. complete, if I have forgotten someone, please accept my apologies and
  10855. let me know.
  10856. @itemize @bullet
  10857. @item
  10858. @i{Russel Adams} came up with the idea for drawers.
  10859. @item
  10860. @i{Thomas Baumann} wrote @file{org-bbdb.el} and @file{org-mhe.el}.
  10861. @item
  10862. @i{Christophe Bataillon} created the great unicorn logo that we use on the
  10863. Org-mode website.
  10864. @item
  10865. @i{Alex Bochannek} provided a patch for rounding timestamps.
  10866. @item
  10867. @i{Jan Böcker} wrote @file{org-docview.el}.
  10868. @item
  10869. @i{Brad Bozarth} showed how to pull RSS feed data into Org-mode files.
  10870. @item
  10871. @i{Tom Breton} wrote @file{org-choose.el}.
  10872. @item
  10873. @i{Charles Cave}'s suggestion sparked the implementation of templates
  10874. for Remember.
  10875. @item
  10876. @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
  10877. specified time.
  10878. @item
  10879. @i{Gregory Chernov} patched support for Lisp forms into table
  10880. calculations and improved XEmacs compatibility, in particular by porting
  10881. @file{nouline.el} to XEmacs.
  10882. @item
  10883. @i{Sacha Chua} suggested copying some linking code from Planner.
  10884. @item
  10885. @i{Baoqiu Cui} contributed the DocBook exporter.
  10886. @item
  10887. @i{Dan Davison} wrote (together with @i{Eric Schulte}) Org Babel.
  10888. @item
  10889. @i{Eddward DeVilla} proposed and tested checkbox statistics. He also
  10890. came up with the idea of properties, and that there should be an API for
  10891. them.
  10892. @item
  10893. @i{Nick Dokos} tracked down several nasty bugs.
  10894. @item
  10895. @i{Kees Dullemond} used to edit projects lists directly in HTML and so
  10896. inspired some of the early development, including HTML export. He also
  10897. asked for a way to narrow wide table columns.
  10898. @item
  10899. @i{Christian Egli} converted the documentation into Texinfo format,
  10900. patched CSS formatting into the HTML exporter, and inspired the agenda.
  10901. @item
  10902. @i{David Emery} provided a patch for custom CSS support in exported
  10903. HTML agendas.
  10904. @item
  10905. @i{Nic Ferrier} contributed mailcap and XOXO support.
  10906. @item
  10907. @i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
  10908. @item
  10909. @i{John Foerch} figured out how to make incremental search show context
  10910. around a match in a hidden outline tree.
  10911. @item
  10912. @i{Raimar Finken} wrote @file{org-git-line.el}.
  10913. @item
  10914. @i{Mikael Fornius} works as a mailing list moderator.
  10915. @item
  10916. @i{Austin Frank} works as a mailing list moderator.
  10917. @item
  10918. @i{Niels Giesen} had the idea to automatically archive DONE trees.
  10919. @item
  10920. @i{Bastien Guerry} wrote the La@TeX{} exporter and @file{org-bibtex.el}, and
  10921. has been prolific with patches, ideas, and bug reports.
  10922. @item
  10923. @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
  10924. @item
  10925. @i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
  10926. task state change logging, and the clocktable. His clear explanations have
  10927. been critical when we started to adopt the Git version control system.
  10928. @item
  10929. @i{Manuel Hermenegildo} has contributed various ideas, small fixes and
  10930. patches.
  10931. @item
  10932. @i{Phil Jackson} wrote @file{org-irc.el}.
  10933. @item
  10934. @i{Scott Jaderholm} proposed footnotes, control over whitespace between
  10935. folded entries, and column view for properties.
  10936. @item
  10937. @i{Tokuya Kameshima} wrote @file{org-wl.el} and @file{org-mew.el}.
  10938. @item
  10939. @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it. He also
  10940. provided frequent feedback and some patches.
  10941. @item
  10942. @i{Matt Lundin} has proposed last-row references for table formulas and named
  10943. invisible anchors. He has also worked a lot on the FAQ.
  10944. @item
  10945. @i{Jason F. McBrayer} suggested agenda export to CSV format.
  10946. @item
  10947. @i{Max Mikhanosha} came up with the idea of refiling.
  10948. @item
  10949. @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
  10950. basis.
  10951. @item
  10952. @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
  10953. happy.
  10954. @item
  10955. @i{Richard Moreland} wrote @i{MobileOrg} for the iPhone.
  10956. @item
  10957. @i{Rick Moynihan} proposed allowing multiple TODO sequences in a file
  10958. and being able to quickly restrict the agenda to a subtree.
  10959. @item
  10960. @i{Todd Neal} provided patches for links to Info files and Elisp forms.
  10961. @item
  10962. @i{Greg Newman} refreshed the unicorn logo into its current form.
  10963. @item
  10964. @i{Tim O'Callaghan} suggested in-file links, search options for general
  10965. file links, and TAGS.
  10966. @item
  10967. @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
  10968. into Japanese.
  10969. @item
  10970. @i{Oliver Oppitz} suggested multi-state TODO items.
  10971. @item
  10972. @i{Scott Otterson} sparked the introduction of descriptive text for
  10973. links, among other things.
  10974. @item
  10975. @i{Pete Phillips} helped during the development of the TAGS feature, and
  10976. provided frequent feedback.
  10977. @item
  10978. @i{Martin Pohlack} provided the code snippet to bundle character insertion
  10979. into bundles of 20 for undo.
  10980. @item
  10981. @i{T.V. Raman} reported bugs and suggested improvements.
  10982. @item
  10983. @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
  10984. control.
  10985. @item
  10986. @i{Paul Rivier} provided the basic implementation of named footnotes. He
  10987. also acted as mailing list moderator for some time.
  10988. @item
  10989. @i{Kevin Rogers} contributed code to access VM files on remote hosts.
  10990. @item
  10991. @i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
  10992. webpages derived from Org using an Info-like or a folding interface with
  10993. single-key navigation.
  10994. @item
  10995. @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
  10996. conflict with @file{allout.el}.
  10997. @item
  10998. @i{Jason Riedy} generalized the send-receive mechanism for Orgtbl tables with
  10999. extensive patches.
  11000. @item
  11001. @i{Philip Rooke} created the Org reference card, provided lots
  11002. of feedback, developed and applied standards to the Org documentation.
  11003. @item
  11004. @i{Christian Schlauer} proposed angular brackets around links, among
  11005. other things.
  11006. @item
  11007. @i{Eric Schulte} wrote @file{org-plot.el} and (together with @i{Dan Davison})
  11008. Org Babel, and contributed various patches, small features and modules.
  11009. @item
  11010. @i{Paul Sexton} wrote @file{org-ctags.el}.
  11011. @item
  11012. Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s
  11013. @file{organizer-mode.el}.
  11014. @item
  11015. @i{Ilya Shlyakhter} proposed the Archive Sibling, line numbering in literal
  11016. examples, and remote highlighting for referenced code lines.
  11017. @item
  11018. @i{Stathis Sideris} wrote the @file{ditaa.jar} ASCII to PNG converter that is
  11019. now packaged into Org's @file{contrib} directory.
  11020. @item
  11021. @i{Daniel Sinder} came up with the idea of internal archiving by locking
  11022. subtrees.
  11023. @item
  11024. @i{Dale Smith} proposed link abbreviations.
  11025. @item
  11026. @i{James TD Smith} has contributed a large number of patches for useful
  11027. tweaks and features.
  11028. @item
  11029. @i{Adam Spiers} asked for global linking commands, inspired the link
  11030. extension system, added support for mairix, and proposed the mapping API.
  11031. @item
  11032. @i{Andy Stewart} contributed code to @file{org-w3m.el}, to copy HTML content
  11033. with links transformation to Org syntax.
  11034. @item
  11035. @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
  11036. chapter about publishing.
  11037. @item
  11038. @i{J@"urgen Vollmer} contributed code generating the table of contents
  11039. in HTML output.
  11040. @item
  11041. @i{Samuel Wales} has provided important feedback and bug reports.
  11042. @item
  11043. @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
  11044. keyword.
  11045. @item
  11046. @i{David Wainberg} suggested archiving, and improvements to the linking
  11047. system.
  11048. @item
  11049. @i{John Wiegley} wrote @file{emacs-wiki.el}, @file{planner.el}, and
  11050. @file{muse.el}, which have some overlap with Org. Initially the development
  11051. of Org was fully independent because I was not aware of the existence of
  11052. these packages. But with time I have occasionally looked at John's code and
  11053. learned a lot from it. John has also contributed a number of great ideas and
  11054. patches directly to Org, including the attachment system
  11055. (@file{org-attach.el}), integration with Apple Mail
  11056. (@file{org-mac-message.el}), hierarchical dependencies of TODO items, habit
  11057. tracking (@file{org-habits.el}).
  11058. @item
  11059. @i{Carsten Wimmer} suggested some changes and helped fix a bug in
  11060. linking to Gnus.
  11061. @item
  11062. @i{Roland Winkler} requested additional key bindings to make Org
  11063. work on a tty.
  11064. @item
  11065. @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
  11066. and contributed various ideas and code snippets.
  11067. @end itemize
  11068. @node Main Index, Key Index, History and Acknowledgments, Top
  11069. @unnumbered Concept Index
  11070. @printindex cp
  11071. @node Key Index, Variable Index, Main Index, Top
  11072. @unnumbered Key Index
  11073. @printindex ky
  11074. @node Variable Index, , Key Index, Top
  11075. @unnumbered Variable Index
  11076. This is not a complete index of variables and faces, only the ones that are
  11077. mentioned in the manual. For a more complete list, use @kbd{M-x
  11078. org-customize @key{RET}} and then click yourself through the tree.
  11079. @printindex vr
  11080. @bye
  11081. @ignore
  11082. arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
  11083. @end ignore
  11084. @c Local variables:
  11085. @c ispell-local-dictionary: "en_US-w_accents"
  11086. @c ispell-local-pdict: "./.aspell.org.pws"
  11087. @c fill-column: 77
  11088. @c End:
  11089. @c LocalWords: webdavhost pre