org.texi 763 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785
  1. \input texinfo @c -*- texinfo -*-
  2. @c %**start of header
  3. @setfilename org.info
  4. @settitle The Org Manual
  5. @documentencoding UTF-8
  6. @documentlanguage en
  7. @set txicodequoteundirected
  8. @set txicodequotebacktick
  9. @set MAINTAINERSITE @uref{https://orgmode.org,maintainers webpage}
  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. @copying
  15. This manual is for Org version 9.1.
  16. Copyright @copyright{} 2004--2018 Free Software Foundation, Inc.
  17. @quotation
  18. Permission is granted to copy, distribute and/or modify this document
  19. under the terms of the GNU Free Documentation License, Version 1.3 or
  20. any later version published by the Free Software Foundation; with no
  21. Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
  22. and with the Back-Cover Texts as in (a) below. A copy of the license
  23. is included in the section entitled ``GNU Free Documentation License.''
  24. (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
  25. modify this GNU manual.''
  26. @end quotation
  27. @end copying
  28. @dircategory Emacs editing modes
  29. @direntry
  30. * Org Mode: (org). Outline-based notes management and organizer.
  31. @end direntry
  32. @finalout
  33. @titlepage
  34. @title The Org Manual
  35. @subtitle Release 9.1
  36. @author by Carsten Dominik
  37. @author with contributions by Bastien Guerry, Nicolas Goaziou, Eric Schulte, Jambunathan K, Dan Davison, Thomas Dye, David O'Toole, and Philip Rooke.
  38. @page
  39. @vskip 0pt plus 1filll
  40. @insertcopying
  41. @end titlepage
  42. @contents
  43. @ifnottex
  44. @node Top
  45. @top The Org Manual
  46. @insertcopying
  47. @end ifnottex
  48. @menu
  49. * Introduction:: Getting started.
  50. * Document Structure:: A tree works like your brain.
  51. * Tables:: Pure magic for quick formatting.
  52. * Hyperlinks:: Notes in context.
  53. * TODO Items:: Every tree branch can be a TODO item.
  54. * Tags:: Tagging headlines and matching sets of tags.
  55. * Properties and Columns:: Storing information about an entry.
  56. * Dates and Times:: Making items useful for planning.
  57. * Capture, Refile, Archive: Capture Refile Archive. The ins and outs for projects.
  58. * Agenda Views:: Collecting information into views.
  59. * Markup:: Prepare text for rich export.
  60. * Exporting:: Sharing and publishing notes.
  61. * Publishing:: Create a web site of linked Org files.
  62. * Working with Source Code:: Export, evaluate, and tangle code blocks.
  63. * Miscellaneous:: All the rest which did not fit elsewhere.
  64. * Hacking:: How to hack your way around.
  65. * MobileOrg:: Viewing and capture on a mobile device.
  66. * History and Acknowledgments:: How Org came into being.
  67. * GNU Free Documentation License:: The license for this documentation.
  68. * Main Index:: An index of Org's concepts and features.
  69. * Key Index:: Key bindings and where they are described.
  70. * Command and Function Index:: Command names and some internal functions.
  71. * Variable Index:: Variables mentioned in the manual.
  72. @detailmenu
  73. --- The Detailed Node Listing ---
  74. Introduction
  75. * Summary:: Brief summary of what Org does.
  76. * Installation:: Installing Org.
  77. * Activation:: How to activate Org for certain buffers.
  78. * Feedback:: Bug reports, ideas, patches, etc.
  79. * Conventions:: Typesetting conventions used in this manual.
  80. Document Structure
  81. * Outlines:: Org is based on Outline mode.
  82. * Headlines:: How to typeset Org tree headlines.
  83. * Visibility Cycling:: Show and hide, much simplified.
  84. * Motion:: Jumping to other headlines.
  85. * Structure Editing:: Changing sequence and level of headlines.
  86. * Sparse Trees:: Matches embedded in context.
  87. * Plain Lists:: Additional structure within an entry.
  88. * Drawers:: Tucking stuff away.
  89. * Blocks:: Folding blocks.
  90. * Creating Footnotes:: How footnotes are defined in Org's syntax.
  91. * Org Syntax:: Formal description of Org's syntax.
  92. Visibility Cycling
  93. * Global and local cycling:: Cycling through various visibility states.
  94. * Initial visibility:: Setting the initial visibility state.
  95. * Catching invisible edits:: Preventing mistakes when editing invisible parts.
  96. Tables
  97. * Built-in Table Editor:: Simple tables.
  98. * Column Width and Alignment:: Overrule the automatic settings.
  99. * Column Groups:: Grouping to trigger vertical lines.
  100. * Orgtbl Mode:: The table editor as minor mode.
  101. * The spreadsheet:: The table editor has spreadsheet capabilities.
  102. * Org Plot:: Plotting from Org tables.
  103. The spreadsheet
  104. * References:: How to refer to another field or range.
  105. * Formula syntax for Calc:: Using Calc to compute stuff.
  106. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp.
  107. * Durations and time values:: How to compute durations and time values.
  108. * Field and range formulas:: Formula for specific (ranges of) fields.
  109. * Column formulas:: Formulas valid for an entire column.
  110. * Lookup functions:: Lookup functions for searching tables.
  111. * Editing and debugging formulas:: Fixing formulas.
  112. * Updating the table:: Recomputing all dependent fields.
  113. * Advanced features:: Field and column names, automatic recalculation...
  114. Hyperlinks
  115. * Link Format:: How links in Org are formatted.
  116. * Internal Links:: Links to other places in the current file.
  117. * Radio Targets:: Make targets trigger links in plain text.
  118. * External Links:: URL-like links to the world.
  119. * Handling Links:: Creating, inserting and following.
  120. * Using Links Outside Org:: Linking from my C source code?
  121. * Link Abbreviations:: Shortcuts for writing complex links.
  122. * Search Options:: Linking to a specific location.
  123. * Custom Searches:: When the default search is not enough.
  124. TODO Items
  125. * TODO Basics:: Marking and displaying TODO entries.
  126. * TODO Extensions:: Workflow and assignments.
  127. * Progress Logging:: Dates and notes for progress.
  128. * Priorities:: Some things are more important than others.
  129. * Breaking Down Tasks:: Splitting a task into manageable pieces.
  130. * Checkboxes:: Tick-off lists.
  131. TODO Extensions
  132. * Workflow states:: From TODO to DONE in steps.
  133. * TODO types:: I do this, Fred does the rest.
  134. * Multiple sets in one file:: Mixing it all, still finding your way.
  135. * Fast access to TODO states:: Single letter selection of state.
  136. * Per-file keywords:: Different files, different requirements.
  137. * Faces for TODO keywords:: Highlighting states.
  138. * TODO dependencies:: When one task needs to wait for others.
  139. Progress Logging
  140. * Closing items:: When was this entry marked DONE?
  141. * Tracking TODO state changes:: When did the status change?
  142. * Tracking your habits:: How consistent have you been?
  143. Tags
  144. * Tag Inheritance:: Tags use the tree structure of an outline.
  145. * Setting Tags:: How to assign tags to a headline.
  146. * Tag Hierarchy:: Create a hierarchy of tags.
  147. * Tag Searches:: Searching for combinations of tags.
  148. Properties and Columns
  149. * Property Syntax:: How properties are spelled out.
  150. * Special Properties:: Access to other Org mode features.
  151. * Property Searches:: Matching property values.
  152. * Property Inheritance:: Passing values down a tree.
  153. * Column View:: Tabular viewing and editing.
  154. Column View
  155. * Defining columns:: The COLUMNS format property.
  156. * Using column view:: How to create and use column view.
  157. * Capturing column view:: A dynamic block for column view.
  158. Defining columns
  159. * Scope of column definitions:: Where defined, where valid?
  160. * Column attributes:: Appearance and content of a column.
  161. Dates and Times
  162. * Timestamps:: Assigning a time to a tree entry.
  163. * Creating Timestamps:: Commands to insert timestamps.
  164. * Deadlines and Scheduling:: Planning your work.
  165. * Clocking Work Time:: Tracking how long you spend on a task.
  166. * Effort Estimates:: Planning work effort in advance.
  167. * Timers:: Notes with a running timer.
  168. Creating Timestamps
  169. * The date/time prompt:: How Org mode helps you enter dates and times.
  170. * Custom time format:: Making dates look different.
  171. Deadlines and Scheduling
  172. * Inserting deadline/schedule:: Planning items.
  173. * Repeated tasks:: Items that show up again and again.
  174. Clocking Work Time
  175. * Clocking commands:: Starting and stopping a clock.
  176. * The clock table:: Detailed reports.
  177. * Resolving idle time:: Resolving time when you've been idle.
  178. Capture, Refile, Archive
  179. * Capture:: Capturing new stuff.
  180. * Attachments:: Add files to tasks.
  181. * RSS Feeds:: Getting input from RSS feeds.
  182. * Protocols:: External access to Emacs and Org.
  183. * Refile and Copy:: Moving/copying a tree from one place to another.
  184. * Archiving:: What to do with finished products.
  185. Capture
  186. * Setting up capture:: Where notes will be stored.
  187. * Using capture:: Commands to invoke and terminate capture.
  188. * Capture templates:: Define the outline of different note types.
  189. Capture templates
  190. * Template elements:: What is needed for a complete template entry.
  191. * Template expansion:: Filling in information about time and context.
  192. * Templates in contexts:: Only show a template in a specific context.
  193. Protocols
  194. * @code{store-link} protocol:: Store a link, push URL to kill-ring.
  195. * @code{capture} protocol:: Fill a buffer with external information.
  196. * @code{open-source} protocol:: Edit published contents.
  197. Archiving
  198. * Moving subtrees:: Moving a tree to an archive file.
  199. * Internal archiving:: Switch off a tree but keep it in the file.
  200. Agenda Views
  201. * Agenda Files:: Files being searched for agenda information.
  202. * Agenda Dispatcher:: Keyboard access to agenda views.
  203. * Built-in Agenda Views:: What is available out of the box?
  204. * Presentation and Sorting:: How agenda items are prepared for display.
  205. * Agenda Commands:: Remote editing of Org trees.
  206. * Custom Agenda Views:: Defining special searches and views.
  207. * Exporting Agenda Views:: Writing a view to a file.
  208. * Agenda Column View:: Using column view for collected entries.
  209. Built-in Agenda Views
  210. * Weekly/daily agenda:: The calendar page with current tasks.
  211. * Global TODO list:: All unfinished action items.
  212. * Matching tags and properties:: Structured information with fine-tuned search.
  213. * Search view:: Find entries by searching for text.
  214. * Stuck projects:: Find projects you need to review.
  215. Presentation and Sorting
  216. * Categories:: Not all tasks are equal.
  217. * Time-of-day specifications:: How the agenda knows the time.
  218. * Sorting of agenda items:: The order of things.
  219. * Filtering/limiting agenda times:: Dynamically narrow the agenda.
  220. Custom Agenda Views
  221. * Storing searches:: Type once, use often.
  222. * Block agenda:: All the stuff you need in a single buffer.
  223. * Setting options:: Changing the rules.
  224. Markup
  225. * Paragraphs:: The basic unit of text.
  226. * Emphasis and Monospace:: Bold, italic, etc.
  227. * Horizontal Rules:: Make a line.
  228. * Images and Tables:: Images, tables and caption mechanism.
  229. * Literal Examples:: Source code examples with special formatting.
  230. * Special Symbols:: Greek letters and other symbols.
  231. * Subscripts and Superscripts:: Simple syntax for raising/lowering text.
  232. * Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents.
  233. Embedded @LaTeX{}
  234. * @LaTeX{} fragments:: Complex formulas made easy.
  235. * Previewing @LaTeX{} fragments:: What will this snippet look like?
  236. * CD@LaTeX{} mode:: Speed up entering of formulas.
  237. Exporting
  238. * The Export Dispatcher:: The main interface.
  239. * Export Settings:: Common export settings.
  240. * Table of Contents:: The if and where of the table of contents.
  241. * Include Files:: Include additional files into a document.
  242. * Macro Replacement:: Use macros to create templates.
  243. * Comment Lines:: What will not be exported.
  244. * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding.
  245. * Beamer Export::
  246. * HTML Export:: Exporting to HTML.
  247. * @LaTeX{} Export:: Exporting to @LaTeX{} and processing to PDF.
  248. * Markdown Export:: Exporting to Markdown.
  249. * OpenDocument Text Export:: Exporting to OpenDocument Text.
  250. * Org Export:: Exporting to Org.
  251. * Texinfo Export:: Exporting to Texinfo.
  252. * iCalendar Export:: Exporting to iCalendar.
  253. * Other Built-in Back-ends:: Exporting to a man page.
  254. * Advanced Configuration:: Fine-tuning the export output.
  255. * Export in Foreign Buffers:: Author tables and lists in Org syntax.
  256. Beamer Export
  257. * Beamer export commands:: For creating Beamer documents.
  258. * Beamer specific export settings:: For customizing Beamer export.
  259. * Frames and Blocks in Beamer:: For composing Beamer slides.
  260. * Beamer specific syntax:: For using in Org documents.
  261. * Editing support:: Editing support.
  262. * A Beamer example:: A complete presentation.
  263. HTML Export
  264. * HTML export commands:: Invoking HTML export.
  265. * HTML specific export settings:: Settings for HTML export.
  266. * HTML doctypes:: Exporting various (X)HTML flavors.
  267. * HTML preamble and postamble:: Inserting preamble and postamble.
  268. * Quoting HTML tags:: Using direct HTML in Org files.
  269. * Links in HTML export:: Inserting and formatting links.
  270. * Tables in HTML export:: How to modify the formatting of tables.
  271. * Images in HTML export:: How to insert figures into HTML output.
  272. * Math formatting in HTML export:: Beautiful math also on the web.
  273. * Text areas in HTML export:: An alternate way to show an example.
  274. * CSS support:: Changing the appearance of the output.
  275. * JavaScript support:: Info and folding in a web browser.
  276. @LaTeX{} Export
  277. * @LaTeX{}/PDF export commands:: For producing @LaTeX{} and PDF documents.
  278. * @LaTeX{} specific export settings:: Unique to this @LaTeX{} back-end.
  279. * @LaTeX{} header and sectioning:: Setting up the export file structure.
  280. * Quoting @LaTeX{} code:: Incorporating literal @LaTeX{} code.
  281. * Tables in @LaTeX{} export:: Options for exporting tables to @LaTeX{}.
  282. * Images in @LaTeX{} export:: How to insert figures into @LaTeX{} output.
  283. * Plain lists in @LaTeX{} export:: Attributes specific to lists.
  284. * Source blocks in @LaTeX{} export:: Attributes specific to source code blocks.
  285. * Example blocks in @LaTeX{} export:: Attributes specific to example blocks.
  286. * Special blocks in @LaTeX{} export:: Attributes specific to special blocks.
  287. * Horizontal rules in @LaTeX{} export:: Attributes specific to horizontal rules.
  288. OpenDocument Text Export
  289. * Pre-requisites for ODT export:: Required packages.
  290. * ODT export commands:: Invoking export.
  291. * ODT specific export settings:: Configuration options.
  292. * Extending ODT export:: Producing DOC, PDF files.
  293. * Applying custom styles:: Styling the output.
  294. * Links in ODT export:: Handling and formatting links.
  295. * Tables in ODT export:: Org tables conversions.
  296. * Images in ODT export:: Inserting images.
  297. * Math formatting in ODT export:: Formatting @LaTeX{} fragments.
  298. * Labels and captions in ODT export:: Rendering objects.
  299. * Literal examples in ODT export:: For source code and example blocks.
  300. * Advanced topics in ODT export:: For power users.
  301. Math formatting in ODT export
  302. * @LaTeX{} math snippets:: Embedding in @LaTeX{} format.
  303. * MathML and OpenDocument formula files:: Embedding in native format.
  304. Texinfo Export
  305. * Texinfo export commands:: Invoking commands.
  306. * Texinfo specific export settings:: Setting the environment.
  307. * Texinfo file header:: Generating the header.
  308. * Texinfo title and copyright page:: Creating preamble pages.
  309. * Info directory file:: Installing a manual in Info file hierarchy.
  310. * Headings and sectioning structure:: Building document structure.
  311. * Indices:: Creating indices.
  312. * Quoting Texinfo code:: Incorporating literal Texinfo code.
  313. * Plain lists in Texinfo export:: List attributes.
  314. * Tables in Texinfo export:: Table attributes.
  315. * Images in Texinfo export:: Image attributes.
  316. * Special blocks in Texinfo export:: Special block attributes.
  317. * A Texinfo example:: Processing Org to Texinfo.
  318. Publishing
  319. * Configuration:: Defining projects.
  320. * Uploading Files:: How to get files up on the server.
  321. * Sample Configuration:: Example projects.
  322. * Triggering Publication:: Publication commands.
  323. Configuration
  324. * Project alist:: The central configuration variable.
  325. * Sources and destinations:: From here to there.
  326. * Selecting files:: What files are part of the project?
  327. * Publishing action:: Setting the function doing the publishing.
  328. * Publishing options:: Tweaking HTML/@LaTeX{} export.
  329. * Publishing links:: Which links keep working after publishing?
  330. * Site map:: Generating a list of all pages.
  331. * Generating an index:: An index that reaches across pages.
  332. Sample Configuration
  333. * Simple example:: One-component publishing.
  334. * Complex example:: A multi-component publishing example.
  335. Working with Source Code
  336. * Structure of Code Blocks:: Code block syntax described.
  337. * Using Header Arguments:: Different ways to set header arguments.
  338. * Environment of a Code Block:: Arguments, sessions, working directory...
  339. * Evaluating Code Blocks:: Place results of evaluation in the Org buffer.
  340. * Results of Evaluation:: Choosing a results type, post-processing...
  341. * Exporting Code Blocks:: Export contents and/or results.
  342. * Extracting Source Code:: Create pure source code files.
  343. * Languages:: List of supported code block languages.
  344. * Editing Source Code:: Language major-mode editing.
  345. * Noweb Reference Syntax:: Literate programming in Org mode.
  346. * Library of Babel:: Use and contribute to a library of useful code blocks.
  347. * Key bindings and Useful Functions:: Work quickly with code blocks.
  348. * Batch Execution:: Call functions from the command line.
  349. Miscellaneous
  350. * Completion:: M-@key{TAB} guesses completions.
  351. * Structure Templates:: Quick insertion of structural elements.
  352. * Speed Keys:: Electric commands at the beginning of a headline.
  353. * Code Evaluation Security:: Org files evaluate in-line code.
  354. * Customization:: Adapting Org to your taste.
  355. * In-buffer Settings:: Overview of keywords.
  356. * The Very Busy @kbd{C-c C-c} Key:: When in doubt, press @kbd{C-c C-c}.
  357. * Clean View:: Getting rid of leading stars in the outline.
  358. * TTY Keys:: Using Org on a tty.
  359. * Interaction:: With other Emacs packages.
  360. * Org Crypt:: Encrypting Org files.
  361. Interaction
  362. * Cooperation:: Packages Org cooperates with.
  363. * Conflicts:: Packages that lead to conflicts.
  364. Hacking
  365. * Hooks: Hooks (2). How to reach into Org's internals.
  366. * Add-on Packages:: Available extensions.
  367. * Adding Hyperlink Types:: New custom link types.
  368. * Adding Export Back-ends:: How to write new export back-ends.
  369. * Tables in Arbitrary Syntax:: Orgtbl for LaTeX and other programs.
  370. * Dynamic Blocks:: Automatically filled blocks.
  371. * Special Agenda Views:: Customized views.
  372. * Speeding Up Your Agendas:: Tips on how to speed up your agendas.
  373. * Extracting Agenda Information:: Post-processing agenda information.
  374. * Using the Property API:: Writing programs that use entry properties.
  375. * Using the Mapping API:: Mapping over all or selected entries.
  376. Tables in Arbitrary Syntax
  377. * Radio tables:: Sending and receiving radio tables.
  378. * A @LaTeX{} example:: Step by step, almost a tutorial.
  379. * Translator functions:: Copy and modify.
  380. MobileOrg
  381. * Setting Up the Staging Area:: For the mobile device.
  382. * Pushing to MobileOrg:: Uploading Org files and agendas.
  383. * Pulling from MobileOrg:: Integrating captured and flagged items.
  384. @end detailmenu
  385. @end menu
  386. @node Introduction
  387. @chapter Introduction
  388. @cindex introduction
  389. @menu
  390. * Summary:: Brief summary of what Org does.
  391. * Installation:: Installing Org.
  392. * Activation:: How to activate Org for certain buffers.
  393. * Feedback:: Bug reports, ideas, patches, etc.
  394. * Conventions:: Typesetting conventions used in this manual.
  395. @end menu
  396. @node Summary
  397. @section Summary
  398. @cindex summary
  399. Org is a mode for keeping notes, maintaining TODO lists, and project
  400. planning with a fast and effective plain-text system. It also is an
  401. authoring system with unique support for literate programming and
  402. reproducible research.
  403. Org is implemented on top of Outline mode, which makes it possible to
  404. keep the content of large files well structured. Visibility cycling
  405. and structure editing help to work with the tree. Tables are easily
  406. created with a built-in table editor. Plain text URL-like links
  407. connect to websites, emails, Usenet messages, BBDB entries, and any
  408. files related to the projects.
  409. Org develops organizational tasks around notes files that contain
  410. lists or information about projects as plain text. Project planning
  411. and task management makes use of metadata which is part of an outline
  412. node. Based on this data, specific entries can be extracted in
  413. queries and create dynamic @emph{agenda views} that also integrate the
  414. Emacs calendar and diary. Org can be used to implement many different
  415. project planning schemes, such as David Allen's GTD system.
  416. Org files can serve as a single source authoring system with export to
  417. many different formats such as HTML, @LaTeX{}, Open Document, and
  418. Markdown. New export backends can be derived from existing ones, or
  419. defined from scratch.
  420. Org files can include source code blocks, which makes Org uniquely
  421. suited for authoring technical documents with code examples. Org
  422. source code blocks are fully functional; they can be evaluated in
  423. place and their results can be captured in the file. This makes it
  424. possible to create a single file reproducible research compendium.
  425. Org keeps simple things simple. When first fired up, it should feel
  426. like a straightforward, easy to use outliner. Complexity is not
  427. imposed, but a large amount of functionality is available when needed.
  428. Org is a toolbox. Many users actually run only a---very
  429. personal---fraction of Org's capabilities, and know that there is more
  430. whenever they need it.
  431. All of this is achieved with strictly plain text files, the most
  432. portable and future-proof file format. Org runs in Emacs. Emacs is
  433. one of the most widely ported programs, so that Org mode is available
  434. on every major platform.
  435. @cindex FAQ
  436. There is a website for Org which provides links to the newest version
  437. of Org, as well as additional information, frequently asked questions
  438. (FAQ), links to tutorials, etc. This page is located at
  439. @uref{https://orgmode.org}.
  440. @cindex print edition
  441. An earlier version (7.3) of this manual is available as a @uref{http://www.network-theory.co.uk/org/manual/, paperback
  442. book from Network Theory Ltd.}.
  443. @node Installation
  444. @section Installation
  445. @cindex installation
  446. Org is part of recent distributions of GNU Emacs, so you normally do
  447. not need to install it. If, for one reason or another, you want to
  448. install Org on top of this pre-packaged version, there are three ways
  449. to do it:
  450. @itemize
  451. @item
  452. By using Emacs package system.
  453. @item
  454. By downloading Org as an archive.
  455. @item
  456. By using Org's git repository.
  457. @end itemize
  458. We @strong{strongly recommend} to stick to a single installation method.
  459. @anchor{Using Emacs packaging system}
  460. @subheading Using Emacs packaging system
  461. Recent Emacs distributions include a packaging system which lets you
  462. install Elisp libraries. You can install Org with @kbd{M-x package-install @key{RET} org}.
  463. @noindent
  464. @strong{Important}: you need to do this in a session where no @samp{.org} file has
  465. been visited, i.e., where no Org built-in function have been loaded.
  466. Otherwise autoload Org functions will mess up the installation.
  467. Then, to make sure your Org configuration is taken into account,
  468. initialize the package system with @code{(package-initialize)} in your
  469. Emacs init file before setting any Org option. If you want to use
  470. Org's package repository, check out the @uref{https://orgmode.org/elpa.html, Org ELPA page}.
  471. @anchor{Downloading Org as an archive}
  472. @subheading Downloading Org as an archive
  473. You can download Org latest release from @uref{https://orgmode.org/, Org's website}. In this case,
  474. make sure you set the load-path correctly in your Emacs init file:
  475. @lisp
  476. (add-to-list 'load-path "~/path/to/orgdir/lisp")
  477. @end lisp
  478. The downloaded archive contains contributed libraries that are not
  479. included in Emacs. If you want to use them, add the @samp{contrib/}
  480. directory to your load-path:
  481. @lisp
  482. (add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t)
  483. @end lisp
  484. Optionally, you can compile the files and/or install them in your
  485. system. Run @samp{make help} to list compilation and installation options.
  486. @anchor{Using Org's git repository}
  487. @subheading Using Org's git repository
  488. You can clone Org's repository and install Org like this:
  489. @example
  490. $ cd ~/src/
  491. $ git clone git@@code.orgmode.org:bzg/org-mode.git
  492. $ make autoloads
  493. @end example
  494. Note that in this case, @code{make autoloads} is mandatory: it defines
  495. Org's version in @samp{org-version.el} and Org's autoloads in
  496. @samp{org-loaddefs.el}.
  497. Remember to add the correct load-path as described in the method
  498. above.
  499. You can also compile with @samp{make}, generate the documentation with
  500. @samp{make doc}, create a local configuration with @samp{make config} and
  501. install Org with @samp{make install}. Please run @samp{make help} to get the
  502. list of compilation/installation options.
  503. For more detailed explanations on Org's build system, please check the
  504. Org Build System page on @uref{https://orgmode.org/worg/dev/org-build-system.html, Worg}.
  505. @node Activation
  506. @section Activation
  507. @cindex activation
  508. @cindex autoload
  509. @cindex ELPA
  510. @cindex global key bindings
  511. @cindex key bindings, global
  512. Org mode buffers need Font Lock to be turned on: this is the default
  513. in Emacs@footnote{If you do not use Font Lock globally turn it on in Org buffer
  514. with @code{(add-hook 'org-mode-hook 'turn-on-font-lock)}.}.
  515. There are compatibility issues between Org mode and some other Elisp
  516. packages (see @ref{Conflicts}). Please take the
  517. time to check the list.
  518. @findex org-agenda
  519. @findex org-capture
  520. @findex org-store-link
  521. For a better experience, the three Org commands @code{org-store-link},
  522. @code{org-capture} and @code{org-agenda} ought to be accessible anywhere in
  523. Emacs, not just in Org buffers. To that effect, you need to bind them
  524. to globally available keys, like the ones reserved for users (see
  525. @ref{Key Binding Conventions,,,elisp,}). Here are suggested
  526. bindings, please modify the keys to your own liking.
  527. @lisp
  528. (global-set-key "\C-cl" 'org-store-link)
  529. (global-set-key "\C-ca" 'org-agenda)
  530. (global-set-key "\C-cc" 'org-capture)
  531. @end lisp
  532. @cindex Org mode, turning on
  533. Files with the @samp{.org} extension use Org mode by default. To turn on
  534. Org mode in a file that does not have the extension @samp{.org}, make the
  535. first line of a file look like this:
  536. @example
  537. MY PROJECTS -*- mode: org; -*-
  538. @end example
  539. @vindex org-insert-mode-line-in-empty-file
  540. @noindent
  541. which selects Org mode for this buffer no matter what the file's name
  542. is. See also the variable @code{org-insert-mode-line-in-empty-file}.
  543. Many commands in Org work on the region if the region is @emph{active}. To
  544. make use of this, you need to have @code{transient-mark-mode} turned on,
  545. which is the default. If you do not like @code{transient-mark-mode}, you
  546. can create an active region by using the mouse to select a region, or
  547. pressing @kbd{C-@key{SPC}} twice before moving the cursor.
  548. @node Feedback
  549. @section Feedback
  550. @cindex feedback
  551. @cindex bug reports
  552. @cindex reporting a bug
  553. @cindex maintainer
  554. @cindex author
  555. If you find problems with Org, or if you have questions, remarks, or
  556. ideas about it, please mail to the Org mailing list
  557. @email{emacs-orgmode@@gnu.org}. You can subscribe to the list @uref{https://lists.gnu.org/mailman/listinfo/emacs-orgmode, on this
  558. web page}. If you are not a member of the mailing list, your mail will
  559. be passed to the list after a moderator has approved it@footnote{Please consider subscribing to the mailing list in order to
  560. minimize the work the mailing list moderators have to do.}.
  561. @findex org-version
  562. @findex org-submit-bug-report
  563. For bug reports, please first try to reproduce the bug with the latest
  564. version of Org available---if you are running an outdated version, it
  565. is quite possible that the bug has been fixed already. If the bug
  566. persists, prepare a report and provide as much information as
  567. possible, including the version information of Emacs (@kbd{M-x emacs-version}) and Org (@kbd{M-x org-version}), as well as
  568. the Org related setup in the Emacs init file. The easiest way to do
  569. this is to use the command
  570. @example
  571. M-x org-submit-bug-report <RET>
  572. @end example
  573. @noindent
  574. which puts all this information into an Emacs mail buffer so that you
  575. only need to add your description. If you are not sending the Email
  576. from within Emacs, please copy and paste the content into your Email
  577. program.
  578. Sometimes you might face a problem due to an error in your Emacs or
  579. Org mode setup. Before reporting a bug, it is very helpful to start
  580. Emacs with minimal customizations and reproduce the problem. Doing so
  581. often helps you determine if the problem is with your customization or
  582. with Org mode itself. You can start a typical minimal session with
  583. a command like the example below.
  584. @example
  585. $ emacs -Q -l /path/to/minimal-org.el
  586. @end example
  587. However if you are using Org mode as distributed with Emacs, a minimal
  588. setup is not necessary. In that case it is sufficient to start Emacs
  589. as @samp{emacs -Q}. The @samp{minimal-org.el} setup file can have contents as
  590. shown below.
  591. @lisp
  592. ;;; Minimal setup to load latest `org-mode'.
  593. ;; Activate debugging.
  594. (setq debug-on-error t
  595. debug-on-signal nil
  596. debug-on-quit nil)
  597. ;; Add latest Org mode to load path.
  598. (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
  599. (add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp" t))
  600. @end lisp
  601. If an error occurs, a ``backtrace'' can be very useful---see below on
  602. how to create one. Often a small example file helps, along with clear
  603. information about:
  604. @enumerate
  605. @item
  606. What exactly did you do?
  607. @item
  608. What did you expect to happen?
  609. @item
  610. What happened instead?
  611. @end enumerate
  612. @noindent
  613. Thank you for helping to improve this program.
  614. @anchor{How to create a useful backtrace}
  615. @subheading How to create a useful backtrace
  616. @cindex backtrace of an error
  617. If working with Org produces an error with a message you do not
  618. understand, you may have hit a bug. The best way to report this is by
  619. providing, in addition to what was mentioned above, a backtrace. This
  620. is information from the built-in debugger about where and how the
  621. error occurred. Here is how to produce a useful backtrace:
  622. @enumerate
  623. @item
  624. Reload uncompiled versions of all Org mode Lisp files. The
  625. backtrace contains much more information if it is produced with
  626. uncompiled code. To do this, use
  627. @example
  628. C-u M-x org-reload <RET>
  629. @end example
  630. @noindent
  631. or, from the menu: Org @arrow{} Refresh/Reload @arrow{} Reload Org uncompiled.
  632. @item
  633. Then, activate the debugger:
  634. @example
  635. M-x toggle-debug-or-error <RET>
  636. @end example
  637. @noindent
  638. or, from the menu: Options @arrow{} Enter Debugger on Error.
  639. @item
  640. Do whatever you have to do to hit the error. Do not forget to
  641. document the steps you take.
  642. @item
  643. When you hit the error, a @samp{*Backtrace*} buffer appears on the
  644. screen. Save this buffer to a file---for example using @kbd{C-x C-w}---and attach it to your bug report.
  645. @end enumerate
  646. @node Conventions
  647. @section Typesetting Conventions Used in this Manual
  648. @anchor{TODO keywords tags properties etc}
  649. @subheading TODO keywords, tags, properties, etc.
  650. Org uses various syntactical elements: TODO keywords, tags, property
  651. names, keywords, blocks, etc. In this manual we use the following
  652. conventions:
  653. @table @asis
  654. @item @samp{TODO}
  655. @itemx @samp{WAITING}
  656. TODO keywords are written with all capitals, even if they are
  657. user-defined.
  658. @item @samp{boss}
  659. @itemx @samp{ARCHIVE}
  660. User-defined tags are written in lowercase; built-in tags with
  661. special meaning are written with all capitals.
  662. @item @samp{Release}
  663. @itemx @samp{PRIORITY}
  664. User-defined properties are capitalized; built-in properties with
  665. special meaning are written with all capitals.
  666. @item @samp{TITLE}
  667. @itemx @samp{BEGIN} @dots{} @samp{END}
  668. Keywords and blocks are written in uppercase to enhance their
  669. readability, but you can use lowercase in your Org files.
  670. @end table
  671. @anchor{Key bindings and commands}
  672. @subheading Key bindings and commands
  673. The manual lists both the keys and the corresponding commands for
  674. accessing a functionality. Org mode often uses the same key for
  675. different functions, depending on context. The command that is bound
  676. to such keys has a generic name, like @code{org-metaright}. In the manual
  677. we will, wherever possible, give the function that is internally
  678. called by the generic command. For example, in the chapter on
  679. document structure, @kbd{M-@key{RIGHT}} will be listed to call
  680. @code{org-do-demote}, while in the chapter on tables, it will be listed to
  681. call @code{org-table-move-column-right}.
  682. @node Document Structure
  683. @chapter Document Structure
  684. @cindex document structure
  685. @cindex structure of document
  686. Org is based on Outline mode and provides flexible commands to
  687. edit the structure of the document.
  688. @menu
  689. * Outlines:: Org is based on Outline mode.
  690. * Headlines:: How to typeset Org tree headlines.
  691. * Visibility Cycling:: Show and hide, much simplified.
  692. * Motion:: Jumping to other headlines.
  693. * Structure Editing:: Changing sequence and level of headlines.
  694. * Sparse Trees:: Matches embedded in context.
  695. * Plain Lists:: Additional structure within an entry.
  696. * Drawers:: Tucking stuff away.
  697. * Blocks:: Folding blocks.
  698. * Creating Footnotes:: How footnotes are defined in Org's syntax.
  699. * Org Syntax:: Formal description of Org's syntax.
  700. @end menu
  701. @node Outlines
  702. @section Outlines
  703. @cindex outlines
  704. @cindex Outline mode
  705. Org is implemented on top of Outline mode. Outlines allow a document
  706. to be organized in a hierarchical structure, which, least for me, is
  707. the best representation of notes and thoughts. An overview of this
  708. structure is achieved by folding, i.e., hiding large parts of the
  709. document to show only the general document structure and the parts
  710. currently being worked on. Org greatly simplifies the use of outlines
  711. by compressing the entire show and hide functionalities into a single
  712. command, @code{org-cycle}, which is bound to the @kbd{@key{TAB}} key.
  713. @node Headlines
  714. @section Headlines
  715. @cindex headlines
  716. @cindex outline tree
  717. @vindex org-special-ctrl-a/e
  718. @vindex org-special-ctrl-k
  719. @vindex org-ctrl-k-protect-subtree
  720. Headlines define the structure of an outline tree. The headlines in
  721. Org start with one or more stars, on the left margin@footnote{See the variables @code{org-special-ctrl-a/e}, @code{org-special-ctrl-k},
  722. and @code{org-ctrl-k-protect-subtree} to configure special behavior of
  723. @kbd{C-a}, @kbd{C-e}, and @kbd{C-k} in headlines. Note
  724. also that clocking only works with headings indented less than 30
  725. stars.}. For
  726. example:
  727. @example
  728. * Top level headline
  729. ** Second level
  730. *** Third level
  731. some text
  732. *** Third level
  733. more text
  734. * Another top level headline
  735. @end example
  736. @vindex org-footnote-section
  737. @noindent
  738. Note that the name defined in @code{org-footnote-section} is reserved. Do
  739. not use it as a title for your own headings.
  740. Some people find the many stars too noisy and would prefer an outline
  741. that has whitespace followed by a single star as headline starters.
  742. See @ref{Clean View}.
  743. @vindex org-cycle-separator-lines
  744. An empty line after the end of a subtree is considered part of it and
  745. is hidden when the subtree is folded. However, if you leave at least
  746. two empty lines, one empty line remains visible after folding the
  747. subtree, in order to structure the collapsed view. See the variable
  748. @code{org-cycle-separator-lines} to modify this behavior.
  749. @node Visibility Cycling
  750. @section Visibility Cycling
  751. @cindex cycling, visibility
  752. @cindex visibility cycling
  753. @cindex trees, visibility
  754. @cindex show hidden text
  755. @cindex hide text
  756. @menu
  757. * Global and local cycling:: Cycling through various visibility states.
  758. * Initial visibility:: Setting the initial visibility state.
  759. * Catching invisible edits:: Preventing mistakes when editing invisible parts.
  760. @end menu
  761. @node Global and local cycling
  762. @subsection Global and local cycling
  763. @cindex subtree visibility states
  764. @cindex subtree cycling
  765. @cindex folded, subtree visibility state
  766. @cindex children, subtree visibility state
  767. @cindex subtree, subtree visibility state
  768. Outlines make it possible to hide parts of the text in the buffer.
  769. Org uses just two commands, bound to @kbd{@key{TAB}} and
  770. @kbd{S-@key{TAB}} to change the visibility in the buffer.
  771. @table @asis
  772. @item @kbd{@key{TAB}} (@code{org-cycle})
  773. @kindex TAB
  774. @findex org-cycle
  775. @emph{Subtree cycling}: Rotate current subtree among the states
  776. @example
  777. ,-> FOLDED -> CHILDREN -> SUBTREE --.
  778. '-----------------------------------'
  779. @end example
  780. @vindex org-cycle-emulate-tab
  781. The cursor must be on a headline for this to work@footnote{See, however, the option @code{org-cycle-emulate-tab}.}.
  782. @item @kbd{S-@key{TAB}} (@code{org-global-cycle})
  783. @itemx @kbd{C-u @key{TAB}}
  784. @cindex global visibility states
  785. @cindex global cycling
  786. @cindex overview, global visibility state
  787. @cindex contents, global visibility state
  788. @cindex show all, global visibility state
  789. @kindex C-u TAB
  790. @kindex S-TAB
  791. @findex org-global-cycle
  792. @emph{Global cycling}: Rotate the entire buffer among the states
  793. @example
  794. ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
  795. '--------------------------------------'
  796. @end example
  797. When @kbd{S-@key{TAB}} is called with a numeric prefix argument N,
  798. the CONTENTS view up to headlines of level N are shown. Note
  799. that inside tables (see @ref{Tables}), @kbd{S-@key{TAB}} jumps to the
  800. previous field instead.
  801. @vindex org-cycle-global-at-bob
  802. You can run global cycling using @kbd{@key{TAB}} only if point is
  803. at the very beginning of the buffer, but not on a headline, and
  804. @code{org-cycle-global-at-bob} is set to a non-@code{nil} value.
  805. @item @kbd{C-u C-u @key{TAB}} (@code{org-set-startup-visibility})
  806. @cindex startup visibility
  807. @kindex C-u C-u TAB
  808. @findex org-set-startup-visibility
  809. Switch back to the startup visibility of the buffer (see @ref{Initial visibility}).
  810. @item @kbd{C-u C-u C-u @key{TAB}} (@code{outline-show-all})
  811. @cindex show all, command
  812. @kindex C-u C-u C-u TAB
  813. @findex outline-show-all
  814. Show all, including drawers.
  815. @item @kbd{C-c C-r} (@code{org-reveal})
  816. @cindex revealing context
  817. @kindex C-c C-r
  818. @findex org-reveal
  819. Reveal context around point, showing the current entry, the
  820. following heading and the hierarchy above. Useful for working
  821. near a location that has been exposed by a sparse tree command
  822. (see @ref{Sparse Trees}) or an agenda command (see @ref{Agenda Commands}). With a prefix argument show, on each level, all
  823. sibling headings. With a double prefix argument, also show the
  824. entire subtree of the parent.
  825. @item @kbd{C-c C-k} (@code{outline-show-branches})
  826. @cindex show branches, command
  827. @kindex C-c C-k
  828. @findex outline-show-branches
  829. Expose all the headings of the subtree, CONTENTS view for just
  830. one subtree.
  831. @item @kbd{C-c @key{TAB}} (@code{outline-show-children})
  832. @cindex show children, command
  833. @kindex C-c TAB
  834. @findex outline-show-children
  835. Expose all direct children of the subtree. With a numeric prefix
  836. argument N, expose all children down to level N.
  837. @item @kbd{C-c C-x b} (@code{org-tree-to-indirect-buffer})
  838. @kindex C-c C-x b
  839. @findex org-tree-to-indirect-buffer
  840. Show the current subtree in an indirect buffer@footnote{The indirect buffer contains the entire buffer, but is narrowed
  841. to the current tree. Editing the indirect buffer also changes the
  842. original buffer, but without affecting visibility in that buffer. For
  843. more information about indirect buffers, see @ref{Indirect Buffers,GNU Emacs Manual,,emacs,}.}. With
  844. a numeric prefix argument, N, go up to level N and then take that
  845. tree. If N is negative then go up that many levels. With
  846. a @kbd{C-u} prefix, do not remove the previously used
  847. indirect buffer.
  848. @item @kbd{C-c C-x v} (@code{org-copy-visible})
  849. @kindex C-c C-x v
  850. @findex org-copy-visible
  851. Copy the @emph{visible} text in the region into the kill ring.
  852. @end table
  853. @node Initial visibility
  854. @subsection Initial visibility
  855. @vindex org-startup-folded
  856. When Emacs first visits an Org file, the global state is set to
  857. OVERVIEW, i.e., only the top level headlines are visible@footnote{When @code{org-agenda-inhibit-startup} is non-@code{nil}, Org does not
  858. honor the default visibility state when first opening a file for the
  859. agenda (see @ref{Speeding Up Your Agendas}).}. This
  860. can be configured through the variable @code{org-startup-folded}, or on
  861. a per-file basis by adding one of the following lines anywhere in the
  862. buffer:
  863. @cindex STARTUP, keyword
  864. @example
  865. #+STARTUP: overview
  866. #+STARTUP: content
  867. #+STARTUP: showall
  868. #+STARTUP: showeverything
  869. @end example
  870. @cindex @samp{VISIBILITY}, property
  871. @noindent
  872. Furthermore, any entries with a @samp{VISIBILITY} property (see @ref{Properties and Columns}) get their visibility adapted accordingly. Allowed values
  873. for this property are @samp{folded}, @samp{children}, @samp{content}, and @code{all}.
  874. @table @asis
  875. @item @kbd{C-u C-u @key{TAB}} (@code{org-set-startup-visibility})
  876. @kindex C-u C-u TAB
  877. @findex org-set-startup-visibility
  878. Switch back to the startup visibility of the buffer, i.e.,
  879. whatever is requested by startup options and @samp{VISIBILITY}
  880. properties in individual entries.
  881. @end table
  882. @node Catching invisible edits
  883. @subsection Catching invisible edits
  884. @cindex edits, catching invisible
  885. @vindex org-catch-invisible-edits
  886. Sometimes you may inadvertently edit an invisible part of the buffer
  887. and be confused on what has been edited and how to undo the mistake.
  888. Setting @code{org-catch-invisible-edits} to non-@code{nil} helps preventing
  889. this. See the docstring of this option on how Org should catch
  890. invisible edits and process them.
  891. @node Motion
  892. @section Motion
  893. @cindex motion, between headlines
  894. @cindex jumping, to headlines
  895. @cindex headline navigation
  896. The following commands jump to other headlines in the buffer.
  897. @table @asis
  898. @item @kbd{C-c C-n} (@code{outline-next-visible-heading})
  899. @kindex C-c C-n
  900. @findex outline-next-visible-heading
  901. Next heading.
  902. @item @kbd{C-c C-p} (@code{outline-previous-visible-heading})
  903. @kindex C-c C-p
  904. @findex outline-previous-visible-heading
  905. Previous heading.
  906. @item @kbd{C-c C-f} (@code{org-forward-same-level})
  907. @kindex C-c C-f
  908. @findex org-forward-same-level
  909. Next heading same level.
  910. @item @kbd{C-c C-b} (@code{org-backward-same-level})
  911. @kindex C-c C-b
  912. @findex org-backward-same-level
  913. Previous heading same level.
  914. @item @kbd{C-c C-u} (@code{outline-up-heading})
  915. @kindex C-c C-u
  916. @findex outline-up-heading
  917. Backward to higher level heading.
  918. @item @kbd{C-c C-j} (@code{org-goto})
  919. @kindex C-c C-j
  920. @findex org-goto
  921. @vindex org-goto-auto-isearch
  922. Jump to a different place without changing the current outline
  923. visibility. Shows the document structure in a temporary buffer,
  924. where you can use the following keys to find your destination:
  925. @multitable @columnfractions 0.3 0.7
  926. @item @kbd{@key{TAB}}
  927. @tab Cycle visibility.
  928. @item @kbd{@key{DOWN}} / @kbd{@key{UP}}
  929. @tab Next/previous visible headline.
  930. @item @kbd{@key{RET}}
  931. @tab Select this location.
  932. @item @kbd{/}
  933. @tab Do a Sparse-tree search
  934. @end multitable
  935. @noindent
  936. The following keys work if you turn off @code{org-goto-auto-isearch}
  937. @multitable @columnfractions 0.3 0.7
  938. @item @kbd{n} / @kbd{p}
  939. @tab Next/previous visible headline.
  940. @item @kbd{f} / @kbd{b}
  941. @tab Next/previous headline same level.
  942. @item @kbd{u}
  943. @tab One level up.
  944. @item @kbd{0} @dots{} @kbd{9}
  945. @tab Digit argument.
  946. @item @kbd{q}
  947. @tab Quit.
  948. @end multitable
  949. @vindex org-goto-interface
  950. @noindent
  951. See also the variable @code{org-goto-interface}.
  952. @end table
  953. @node Structure Editing
  954. @section Structure Editing
  955. @cindex structure editing
  956. @cindex headline, promotion and demotion
  957. @cindex promotion, of subtrees
  958. @cindex demotion, of subtrees
  959. @cindex subtree, cut and paste
  960. @cindex pasting, of subtrees
  961. @cindex cutting, of subtrees
  962. @cindex copying, of subtrees
  963. @cindex sorting, of subtrees
  964. @cindex subtrees, cut and paste
  965. @table @asis
  966. @item @kbd{M-@key{RET}} (@code{org-meta-return})
  967. @kindex M-RET
  968. @findex org-meta-return
  969. @vindex org-M-RET-may-split-line
  970. Insert a new heading, item or row.
  971. If the command is used at the @emph{beginning} of a line, and if there
  972. is a heading or a plain list item (see @ref{Plain Lists}) at point,
  973. the new heading/item is created @emph{before} the current line. When
  974. used at the beginning of a regular line of text, turn that line
  975. into a heading.
  976. When this command is used in the middle of a line, the line is
  977. split and the rest of the line becomes the new item or headline.
  978. If you do not want the line to be split, customize
  979. @code{org-M-RET-may-split-line}.
  980. Calling the command with a @kbd{C-u} prefix unconditionally
  981. inserts a new heading at the end of the current subtree, thus
  982. preserving its contents. With a double @kbd{C-u C-u}
  983. prefix, the new heading is created at the end of the parent
  984. subtree instead.
  985. @item @kbd{C-@key{RET}} (@code{org-insert-heading-respect-content})
  986. @kindex C-RET
  987. @findex org-insert-heading-respect-content
  988. Insert a new heading at the end of the current subtree.
  989. @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading})
  990. @kindex M-S-RET
  991. @findex org-insert-todo-heading
  992. @vindex org-treat-insert-todo-heading-as-state-change
  993. Insert new TODO entry with same level as current heading. See
  994. also the variable
  995. @code{org-treat-insert-todo-heading-as-state-change}.
  996. @item @kbd{C-S-@key{RET}} (@code{org-insert-todo-heading-respect-content})
  997. @kindex C-S-RET
  998. @findex org-insert-todo-heading-respect-content
  999. Insert new TODO entry with same level as current heading. Like
  1000. @kbd{C-@key{RET}}, the new headline is inserted after the current
  1001. subtree.
  1002. @item @kbd{@key{TAB}} (@code{org-cycle})
  1003. @kindex TAB
  1004. @findex org-cycle
  1005. In a new entry with no text yet, the first @kbd{@key{TAB}} demotes
  1006. the entry to become a child of the previous one. The next
  1007. @kbd{@key{TAB}} makes it a parent, and so on, all the way to top
  1008. level. Yet another @kbd{@key{TAB}}, and you are back to the
  1009. initial level.
  1010. @item @kbd{M-@key{LEFT}} (@code{org-do-promote})
  1011. @kindex M-LEFT
  1012. @findex org-do-promote
  1013. Promote current heading by one level.
  1014. @item @kbd{M-@key{RIGHT}} (@code{org-do-demote})
  1015. @kindex M-RIGHT
  1016. @findex org-do-demote
  1017. Demote current heading by one level.
  1018. @item @kbd{M-S-@key{LEFT}} (@code{org-promote-subtree})
  1019. @kindex M-S-LEFT
  1020. @findex org-promote-subtree
  1021. Promote the current subtree by one level.
  1022. @item @kbd{M-S-@key{RIGHT}} (@code{org-demote-subtree})
  1023. @kindex M-S-RIGHT
  1024. @findex org-demote-subtree
  1025. Demote the current subtree by one level.
  1026. @item @kbd{M-@key{UP}} (@code{org-move-subtree-up})
  1027. @kindex M-UP
  1028. @findex org-move-subtree-up
  1029. Move subtree up, i.e., swap with previous subtree of same level.
  1030. @item @kbd{M-@key{DOWN}} (@code{org-move-subtree-down})
  1031. @kindex M-DOWN
  1032. @findex org-move-subtree-down
  1033. Move subtree down, i.e., swap with next subtree of same level.
  1034. @item @kbd{C-c @@} (@code{org-mark-subtree})
  1035. @kindex C-c @@
  1036. @findex org-mark-subtree
  1037. Mark the subtree at point. Hitting repeatedly marks subsequent
  1038. subtrees of the same level as the marked subtree.
  1039. @item @kbd{C-c C-x C-w} (@code{org-cut-subtree})
  1040. @kindex C-c C-x C-w
  1041. @findex org-cut-subtree
  1042. Kill subtree, i.e., remove it from buffer but save in kill ring.
  1043. With a numeric prefix argument N, kill N sequential subtrees.
  1044. @item @kbd{C-c C-x M-w} (@code{org-copy-subtree})
  1045. @kindex C-c C-x M-w
  1046. @findex org-copy-subtree
  1047. Copy subtree to kill ring. With a numeric prefix argument N,
  1048. copy the N sequential subtrees.
  1049. @item @kbd{C-c C-x C-y} (@code{org-paste-subtree})
  1050. @kindex C-c C-x C-y
  1051. @findex org-paste-subtree
  1052. Yank subtree from kill ring. This does modify the level of the
  1053. subtree to make sure the tree fits in nicely at the yank
  1054. position. The yank level can also be specified with a numeric
  1055. prefix argument, or by yanking after a headline marker like
  1056. @samp{****}.
  1057. @item @kbd{C-y} (@code{org-yank})
  1058. @kindex C-y
  1059. @findex org-yank
  1060. @vindex org-yank-adjusted-subtrees
  1061. @vindex org-yank-folded-subtrees
  1062. Depending on the variables @code{org-yank-adjusted-subtrees} and
  1063. @code{org-yank-folded-subtrees}, Org's internal @code{yank} command pastes
  1064. subtrees folded and in a clever way, using the same command as
  1065. @kbd{C-c C-x C-y}. With the default settings, no level
  1066. adjustment takes place, but the yanked tree is folded unless
  1067. doing so would swallow text previously visible. Any prefix
  1068. argument to this command forces a normal @code{yank} to be executed,
  1069. with the prefix passed along. A good way to force a normal yank
  1070. is @kbd{C-u C-y}. If you use @code{yank-pop} after a yank, it
  1071. yanks previous kill items plainly, without adjustment and
  1072. folding.
  1073. @item @kbd{C-c C-x c} (@code{org-clone-subtree-with-time-shift})
  1074. @kindex C-c C-x c
  1075. @findex org-clone-subtree-with-time-shift
  1076. Clone a subtree by making a number of sibling copies of it. You
  1077. are prompted for the number of copies to make, and you can also
  1078. specify if any timestamps in the entry should be shifted. This
  1079. can be useful, for example, to create a number of tasks related
  1080. to a series of lectures to prepare. For more details, see the
  1081. docstring of the command @code{org-clone-subtree-with-time-shift}.
  1082. @item @kbd{C-c C-w} (@code{org-refile})
  1083. @kindex C-c C-w
  1084. @findex org-refile
  1085. Refile entry or region to a different location. See @ref{Refile and Copy}.
  1086. @item @kbd{C-c ^} (@code{org-sort})
  1087. @kindex C-c ^
  1088. @findex org-sort
  1089. Sort same-level entries. When there is an active region, all
  1090. entries in the region are sorted. Otherwise the children of the
  1091. current headline are sorted. The command prompts for the sorting
  1092. method, which can be alphabetically, numerically, by time---first
  1093. timestamp with active preferred, creation time, scheduled time,
  1094. deadline time---by priority, by TODO keyword---in the sequence
  1095. the keywords have been defined in the setup---or by the value of
  1096. a property. Reverse sorting is possible as well. You can also
  1097. supply your own function to extract the sorting key. With
  1098. a @kbd{C-u} prefix, sorting is case-sensitive.
  1099. @item @kbd{C-x n s} (@code{org-narrow-to-subtree})
  1100. @kindex C-x n s
  1101. @findex org-narrow-to-subtree
  1102. Narrow buffer to current subtree.
  1103. @item @kbd{C-x n b} (@code{org-narrow-to-block})
  1104. @kindex C-x n b
  1105. @findex org-narrow-to-block
  1106. Narrow buffer to current block.
  1107. @item @kbd{C-x n w} (@code{widen})
  1108. @kindex C-x n w
  1109. @findex widen
  1110. Widen buffer to remove narrowing.
  1111. @item @kbd{C-c *} (@code{org-toggle-heading})
  1112. @kindex C-c *
  1113. @findex org-toggle-heading
  1114. Turn a normal line or plain list item into a headline---so that
  1115. it becomes a subheading at its location. Also turn a headline
  1116. into a normal line by removing the stars. If there is an active
  1117. region, turn all lines in the region into headlines. If the
  1118. first line in the region was an item, turn only the item lines
  1119. into headlines. Finally, if the first line is a headline, remove
  1120. the stars from all headlines in the region.
  1121. @end table
  1122. @cindex region, active
  1123. @cindex active region
  1124. @cindex transient mark mode
  1125. When there is an active region---i.e., when Transient Mark mode is
  1126. active---promotion and demotion work on all headlines in the region.
  1127. To select a region of headlines, it is best to place both point and
  1128. mark at the beginning of a line, mark at the beginning of the first
  1129. headline, and point at the line just after the last headline to
  1130. change. Note that when the cursor is inside a table (see @ref{Tables}),
  1131. the Meta-Cursor keys have different functionality.
  1132. @node Sparse Trees
  1133. @section Sparse Trees
  1134. @cindex sparse trees
  1135. @cindex trees, sparse
  1136. @cindex folding, sparse trees
  1137. @cindex occur, command
  1138. @vindex org-show-context-detail
  1139. An important feature of Org mode is the ability to construct @emph{sparse
  1140. trees} for selected information in an outline tree, so that the entire
  1141. document is folded as much as possible, but the selected information
  1142. is made visible along with the headline structure above it@footnote{See also the variable @code{org-show-context-detail} to decide how
  1143. much context is shown around each match.}.
  1144. Just try it out and you will see immediately how it works.
  1145. Org mode contains several commands creating such trees, all these
  1146. commands can be accessed through a dispatcher:
  1147. @table @asis
  1148. @item @kbd{C-c /} (@code{org-sparse-tree})
  1149. @kindex C-c /
  1150. @findex org-sparse-tree
  1151. This prompts for an extra key to select a sparse-tree creating
  1152. command.
  1153. @item @kbd{C-c / r} or @kbd{C-c / /} (@code{org-occur})
  1154. @kindex C-c / r
  1155. @kindex C-c / /
  1156. @findex org-occur
  1157. @vindex org-remove-highlights-with-change
  1158. Prompts for a regexp and shows a sparse tree with all matches.
  1159. If the match is in a headline, the headline is made visible. If
  1160. the match is in the body of an entry, headline and body are made
  1161. visible. In order to provide minimal context, also the full
  1162. hierarchy of headlines above the match is shown, as well as the
  1163. headline following the match. Each match is also highlighted;
  1164. the highlights disappear when the buffer is changed by an editing
  1165. command, or by pressing @kbd{C-c C-c}@footnote{This depends on the option @code{org-remove-highlights-with-change}.}. When called
  1166. with a @kbd{C-u} prefix argument, previous highlights are
  1167. kept, so several calls to this command can be stacked.
  1168. @item @kbd{M-g n} or @kbd{M-g M-n} (@code{next-error})
  1169. @kindex M-g n
  1170. @kindex M-g M-n
  1171. @findex next-error
  1172. Jump to the next sparse tree match in this buffer.
  1173. @item @kbd{M-g p} or @kbd{M-g M-p} (@code{previous-error})
  1174. @kindex M-g p
  1175. @kindex M-g M-p
  1176. @findex previous-error
  1177. Jump to the previous sparse tree match in this buffer.
  1178. @end table
  1179. @vindex org-agenda-custom-commands
  1180. @noindent
  1181. For frequently used sparse trees of specific search strings, you can
  1182. use the variable @code{org-agenda-custom-commands} to define fast keyboard
  1183. access to specific sparse trees. These commands will then be
  1184. accessible through the agenda dispatcher (see @ref{Agenda Dispatcher}).
  1185. For example:
  1186. @lisp
  1187. (setq org-agenda-custom-commands
  1188. '(("f" occur-tree "FIXME")))
  1189. @end lisp
  1190. @noindent
  1191. defines the key @kbd{f} as a shortcut for creating a sparse tree
  1192. matching the string @samp{FIXME}.
  1193. The other sparse tree commands select headings based on TODO keywords,
  1194. tags, or properties and are discussed later in this manual.
  1195. @kindex C-c C-e v
  1196. @cindex printing sparse trees
  1197. @cindex visible text, printing
  1198. To print a sparse tree, you can use the Emacs command
  1199. @code{ps-print-buffer-with-faces} which does not print invisible parts of
  1200. the document. Or you can use the command @kbd{C-c C-e v} to
  1201. export only the visible part of the document and print the resulting
  1202. file.
  1203. @node Plain Lists
  1204. @section Plain Lists
  1205. @cindex plain lists
  1206. @cindex lists, plain
  1207. @cindex lists, ordered
  1208. @cindex ordered lists
  1209. Within an entry of the outline tree, hand-formatted lists can provide
  1210. additional structure. They also provide a way to create lists of
  1211. checkboxes (see @ref{Checkboxes}). Org supports editing such lists, and
  1212. every exporter (see @ref{Exporting}) can parse and format them.
  1213. Org knows ordered lists, unordered lists, and description lists.
  1214. @itemize
  1215. @item
  1216. @emph{Unordered} list items start with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a bullet, lines must be indented so that they
  1217. are not interpreted as headlines. Also, when you are hiding leading
  1218. stars to get a clean outline view, plain list items starting with
  1219. a star may be hard to distinguish from true headlines. In short: even
  1220. though @samp{*} is supported, it may be better to not use it for plain list
  1221. items.} as bullets.
  1222. @item
  1223. @vindex org-plain-list-ordered-item-terminator
  1224. @vindex org-alphabetical-lists
  1225. @emph{Ordered} list items start with a numeral followed by either
  1226. a period or a right parenthesis@footnote{You can filter out any of them by configuring
  1227. @code{org-plain-list-ordered-item-terminator}.}, such as @samp{1.} or @samp{1)}@footnote{You can also get @samp{a.}, @samp{A.}, @samp{a)} and @samp{A)} by configuring
  1228. @code{org-list-allow-alphabetical}. To minimize confusion with normal
  1229. text, those are limited to one character only. Beyond that limit,
  1230. bullets automatically become numbers.}
  1231. If you want a list to start with a different value---e.g.,
  1232. 20---start the text of the item with @samp{[@@20]}@footnote{If there's a checkbox in the item, the cookie must be put
  1233. @emph{before} the checkbox. If you have activated alphabetical lists, you
  1234. can also use counters like @samp{[@@b]}.}. Those
  1235. constructs can be used in any item of the list in order to enforce
  1236. a particular numbering.
  1237. @item
  1238. @emph{Description} list items are unordered list items, and contain the
  1239. separator @samp{::} to distinguish the description @emph{term} from the
  1240. description.
  1241. @end itemize
  1242. Items belonging to the same list must have the same indentation on the
  1243. first line. In particular, if an ordered list reaches number @samp{10.},
  1244. then the 2-digit numbers must be written left-aligned with the other
  1245. numbers in the list. An item ends before the next line that is less
  1246. or equally indented than its bullet/number.
  1247. A list ends whenever every item has ended, which means before any line
  1248. less or equally indented than items at top level. It also ends before
  1249. two blank lines. In that case, all items are closed. Here is an
  1250. example:
  1251. @example
  1252. * Lord of the Rings
  1253. My favorite scenes are (in this order)
  1254. 1. The attack of the Rohirrim
  1255. 2. Eowyn's fight with the witch king
  1256. + this was already my favorite scene in the book
  1257. + I really like Miranda Otto.
  1258. 3. Peter Jackson being shot by Legolas
  1259. - on DVD only
  1260. He makes a really funny face when it happens.
  1261. But in the end, no individual scenes matter but the film as a whole.
  1262. Important actors in this film are:
  1263. - Elijah Wood :: He plays Frodo
  1264. - Sean Astin :: He plays Sam, Frodo's friend. I still remember him
  1265. very well from his role as Mikey Walsh in /The Goonies/.
  1266. @end example
  1267. Org supports these lists by tuning filling and wrapping commands to
  1268. deal with them correctly, and by exporting them properly (see
  1269. @ref{Exporting}). Since indentation is what governs the structure of these
  1270. lists, many structural constructs like @samp{#+BEGIN_} blocks can be
  1271. indented to signal that they belong to a particular item.
  1272. @vindex org-list-demote-modify-bullet
  1273. @vindex org-list-indent-offset
  1274. If you find that using a different bullet for a sub-list---than that
  1275. used for the current list-level---improves readability, customize the
  1276. variable @code{org-list-demote-modify-bullet}. To get a greater difference
  1277. of indentation between items and theirs sub-items, customize
  1278. @code{org-list-indent-offset}.
  1279. @vindex org-list-automatic-rules
  1280. The following commands act on items when the cursor is in the first
  1281. line of an item---the line with the bullet or number. Some of them
  1282. imply the application of automatic rules to keep list structure
  1283. intact. If some of these actions get in your way, configure
  1284. @code{org-list-automatic-rules} to disable them individually.
  1285. @table @asis
  1286. @item @kbd{@key{TAB}} (@code{org-cycle})
  1287. @cindex cycling, in plain lists
  1288. @kindex TAB
  1289. @findex org-cycle
  1290. @vindex org-cycle-include-plain-lists
  1291. Items can be folded just like headline levels. Normally this
  1292. works only if the cursor is on a plain list item. For more
  1293. details, see the variable @code{org-cycle-include-plain-lists}. If
  1294. this variable is set to @code{integrate}, plain list items are treated
  1295. like low-level headlines. The level of an item is then given by
  1296. the indentation of the bullet/number. Items are always
  1297. subordinate to real headlines, however; the hierarchies remain
  1298. completely separated. In a new item with no text yet, the first
  1299. @kbd{@key{TAB}} demotes the item to become a child of the previous
  1300. one. Subsequent @kbd{@key{TAB}}s move the item to meaningful
  1301. levels in the list and eventually get it back to its initial
  1302. position.
  1303. @item @kbd{M-@key{RET}} (@code{org-insert-heading})
  1304. @kindex M-RET
  1305. @findex org-insert-heading
  1306. @vindex org-M-RET-may-split-line
  1307. Insert new item at current level. With a prefix argument, force
  1308. a new heading (see @ref{Structure Editing}). If this command is used
  1309. in the middle of an item, that item is @emph{split} in two, and the
  1310. second part becomes the new item@footnote{If you do not want the item to be split, customize the
  1311. variable @code{org-M-RET-may-split-line}.}. If this command is
  1312. executed @emph{before item's body}, the new item is created @emph{before}
  1313. the current one.
  1314. @item @kbd{M-S-@key{RET}}
  1315. @kindex M-S-RET
  1316. Insert a new item with a checkbox (see @ref{Checkboxes}).
  1317. @item @kbd{S-@key{UP}}
  1318. @itemx @kbd{S-@key{DOWN}}
  1319. @kindex S-UP
  1320. @kindex S-DOWN
  1321. @cindex shift-selection-mode
  1322. @vindex org-support-shift-select
  1323. @vindex org-list-use-circular-motion
  1324. Jump to the previous/next item in the current list, but only if
  1325. @code{org-support-shift-select} is off@footnote{If you want to cycle around items that way, you may customize
  1326. @code{org-list-use-circular-motion}.}. If not, you can
  1327. still use paragraph jumping commands like @kbd{C-@key{UP}}
  1328. and @kbd{C-@key{DOWN}} to quite similar effect.
  1329. @item @kbd{M-@key{UP}}
  1330. @itemx @kbd{M-@key{DOWN}}
  1331. @kindex M-UP
  1332. @kindex M-DOWN
  1333. Move the item including subitems up/down@footnote{See @code{org-list-use-circular-motion} for a cyclic behavior.}, i.e., swap with
  1334. previous/next item of same indentation. If the list is ordered,
  1335. renumbering is automatic.
  1336. @item @kbd{M-@key{LEFT}}
  1337. @itemx @kbd{M-@key{RIGHT}}
  1338. @kindex M-LEFT
  1339. @kindex M-RIGHT
  1340. Decrease/increase the indentation of an item, leaving children
  1341. alone.
  1342. @item @kbd{M-S-@key{LEFT}}
  1343. @itemx @kbd{M-S-@key{RIGHT}}
  1344. @kindex M-S-LEFT
  1345. @kindex M-S-RIGHT
  1346. Decrease/increase the indentation of the item, including
  1347. subitems. Initially, the item tree is selected based on current
  1348. indentation. When these commands are executed several times in
  1349. direct succession, the initially selected region is used, even if
  1350. the new indentation would imply a different hierarchy. To use
  1351. the new hierarchy, break the command chain with a cursor motion
  1352. or so.
  1353. As a special case, using this command on the very first item of
  1354. a list moves the whole list. This behavior can be disabled by
  1355. configuring @code{org-list-automatic-rules}. The global indentation
  1356. of a list has no influence on the text @emph{after} the list.
  1357. @item @kbd{C-c C-c}
  1358. @kindex C-c C-c
  1359. If there is a checkbox (see @ref{Checkboxes}) in the item line, toggle
  1360. the state of the checkbox. In any case, verify bullets and
  1361. indentation consistency in the whole list.
  1362. @item @kbd{C-c -}
  1363. @kindex C-c -
  1364. @vindex org-plain-list-ordered-item-terminator
  1365. Cycle the entire list level through the different
  1366. itemize/enumerate bullets (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}) or a subset
  1367. of them, depending on @code{org-plain-list-ordered-item-terminator},
  1368. the type of list, and its indentation. With a numeric prefix
  1369. argument N, select the Nth bullet from this list. If there is an
  1370. active region when calling this, selected text is changed into an
  1371. item. With a prefix argument, all lines are converted to list
  1372. items. If the first line already was a list item, any item
  1373. marker is removed from the list. Finally, even without an active
  1374. region, a normal line is converted into a list item.
  1375. @item @kbd{C-c *}
  1376. @kindex C-c *
  1377. Turn a plain list item into a headline---so that it becomes
  1378. a subheading at its location. See @ref{Structure Editing}, for
  1379. a detailed explanation.
  1380. @item @kbd{C-c C-*}
  1381. @kindex C-c C-*
  1382. Turn the whole plain list into a subtree of the current heading.
  1383. Checkboxes (see @ref{Checkboxes}) become TODO, respectively DONE,
  1384. keywords when unchecked, respectively checked.
  1385. @item @kbd{S-@key{LEFT}}
  1386. @itemx @kbd{S-@key{RIGHT}}
  1387. @vindex org-support-shift-select
  1388. @kindex S-LEFT
  1389. @kindex S-RIGHT
  1390. This command also cycles bullet styles when the cursor in on the
  1391. bullet or anywhere in an item line, details depending on
  1392. @code{org-support-shift-select}.
  1393. @item @kbd{C-c ^}
  1394. @kindex C-c ^
  1395. @cindex sorting, of plain list
  1396. Sort the plain list. Prompt for the sorting method: numerically,
  1397. alphabetically, by time, or by custom function.
  1398. @end table
  1399. @node Drawers
  1400. @section Drawers
  1401. @cindex drawers
  1402. @cindex visibility cycling, drawers
  1403. Sometimes you want to keep information associated with an entry, but
  1404. you normally do not want to see it. For this, Org mode has @emph{drawers}.
  1405. They can contain anything but a headline and another drawer. Drawers
  1406. look like this:
  1407. @example
  1408. ** This is a headline
  1409. Still outside the drawer
  1410. :DRAWERNAME:
  1411. This is inside the drawer.
  1412. :END:
  1413. After the drawer.
  1414. @end example
  1415. @kindex C-c C-x d
  1416. @findex org-insert-drawer
  1417. You can interactively insert a drawer at point by calling
  1418. @code{org-insert-drawer}, which is bound to @kbd{C-c C-x d}. With an
  1419. active region, this command puts the region inside the drawer. With
  1420. a prefix argument, this command calls @code{org-insert-property-drawer},
  1421. which creates a @samp{PROPERTIES} drawer right below the current headline.
  1422. Org mode uses this special drawer for storing properties (see
  1423. @ref{Properties and Columns}). You cannot use it for anything else.
  1424. Completion over drawer keywords is also possible using
  1425. @kbd{M-@key{TAB}}@footnote{Many desktops intercept @kbd{M-@key{TAB}} to switch windows.
  1426. Use @kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} instead.}.
  1427. Visibility cycling (see @ref{Visibility Cycling}) on the headline hides and
  1428. shows the entry, but keep the drawer collapsed to a single line. In
  1429. order to look inside the drawer, you need to move the cursor to the
  1430. drawer line and press @kbd{@key{TAB}} there.
  1431. You can also arrange for state change notes (see @ref{Tracking TODO state changes}) and clock times (see @ref{Clocking Work Time}) to be stored in
  1432. a @samp{LOGBOOK} drawer. If you want to store a quick note there, in
  1433. a similar way to state changes, use
  1434. @table @asis
  1435. @item @kbd{C-c C-z}
  1436. @kindex C-c C-z
  1437. Add a time-stamped note to the @samp{LOGBOOK} drawer.
  1438. @end table
  1439. @node Blocks
  1440. @section Blocks
  1441. @vindex org-hide-block-startup
  1442. @cindex blocks, folding
  1443. Org mode uses @samp{#+BEGIN} @dots{} @samp{#+END} blocks for various purposes from
  1444. including source code examples (see @ref{Literal Examples}) to capturing
  1445. time logging information (see @ref{Clocking Work Time}). These blocks can
  1446. be folded and unfolded by pressing @kbd{@key{TAB}} in the @samp{#+BEGIN}
  1447. line. You can also get all blocks folded at startup by configuring
  1448. the variable @code{org-hide-block-startup} or on a per-file basis by using
  1449. @cindex STARTUP, keyword
  1450. @example
  1451. #+STARTUP: hideblocks
  1452. #+STARTUP: nohideblocks
  1453. @end example
  1454. @node Creating Footnotes
  1455. @section Creating Footnotes
  1456. @cindex footnotes
  1457. Org mode supports the creation of footnotes.
  1458. A footnote is started by a footnote marker in square brackets in
  1459. column 0, no indentation allowed. It ends at the next footnote
  1460. definition, headline, or after two consecutive empty lines. The
  1461. footnote reference is simply the marker in square brackets, inside
  1462. text. Markers always start with @samp{fn:}. For example:
  1463. @example
  1464. The Org homepage[fn:1] now looks a lot better than it used to.
  1465. ...
  1466. [fn:1] The link is: https://orgmode.org
  1467. @end example
  1468. Org mode extends the number-based syntax to @emph{named} footnotes and
  1469. optional inline definition. Here are the valid references:
  1470. @table @asis
  1471. @item @samp{[fn:NAME]}
  1472. A named footnote reference, where @var{NAME} is a unique
  1473. label word, or, for simplicity of automatic creation, a number.
  1474. @item @samp{[fn:: This is the inline definition of this footnote]}
  1475. A @LaTeX{}-like anonymous footnote where the definition is given
  1476. directly at the reference point.
  1477. @item @samp{[fn:NAME: a definition]}
  1478. An inline definition of a footnote, which also specifies a name
  1479. for the note. Since Org allows multiple references to the same
  1480. note, you can then use @samp{[fn:NAME]} to create additional
  1481. references.
  1482. @end table
  1483. @vindex org-footnote-auto-label
  1484. Footnote labels can be created automatically, or you can create names
  1485. yourself. This is handled by the variable @code{org-footnote-auto-label}
  1486. and its corresponding @samp{STARTUP} keywords. See the docstring of that
  1487. variable for details.
  1488. @noindent
  1489. The following command handles footnotes:
  1490. @table @asis
  1491. @item @kbd{C-c C-x f}
  1492. The footnote action command.
  1493. @kindex C-c C-x f
  1494. When the cursor is on a footnote reference, jump to the
  1495. definition. When it is at a definition, jump to
  1496. the---first---reference.
  1497. @vindex org-footnote-define-inline
  1498. @vindex org-footnote-section
  1499. Otherwise, create a new footnote. Depending on the variable
  1500. @code{org-footnote-define-inline}@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP: fninline}
  1501. or @samp{#+STARTUP: nofninline}.}, the definition is placed
  1502. right into the text as part of the reference, or separately into
  1503. the location determined by the variable @code{org-footnote-section}.
  1504. When this command is called with a prefix argument, a menu of
  1505. additional options is offered:
  1506. @multitable @columnfractions 0.1 0.9
  1507. @item @kbd{s}
  1508. @tab Sort the footnote definitions by reference sequence.
  1509. @item @kbd{r}
  1510. @tab Renumber the simple @samp{fn:N} footnotes.
  1511. @item @kbd{S}
  1512. @tab Short for first @kbd{r}, then @kbd{s} action.
  1513. @item @kbd{n}
  1514. @tab Rename all footnotes into a @samp{fn:1} @dots{} @samp{fn:n} sequence.
  1515. @item @kbd{d}
  1516. @tab Delete the footnote at point, including definition and references.
  1517. @end multitable
  1518. @vindex org-footnote-auto-adjust
  1519. Depending on the variable @code{org-footnote-auto-adjust}@footnote{The corresponding in-buffer options are @samp{#+STARTUP: fnadjust}
  1520. and @samp{#+STARTUP: nofnadjust}.},
  1521. renumbering and sorting footnotes can be automatic after each
  1522. insertion or deletion.
  1523. @item @kbd{C-c C-c}
  1524. @kindex C-c C-c
  1525. If the cursor is on a footnote reference, jump to the definition.
  1526. If it is at the definition, jump back to the reference. When
  1527. called at a footnote location with a prefix argument, offer the
  1528. same menu as @kbd{C-c C-x f}.
  1529. @item @kbd{C-c C-o} or @kbd{mouse-1/2}
  1530. @kindex C-c C-o
  1531. @kindex mouse-1
  1532. @kindex mouse-2
  1533. Footnote labels are also links to the corresponding definition or
  1534. reference, and you can use the usual commands to follow these
  1535. links.
  1536. @end table
  1537. @node Org Syntax
  1538. @section Org Syntax
  1539. A reference document providing a formal description of Org's syntax is
  1540. available as @uref{https://orgmode.org/worg/dev/org-syntax.html, a draft on Worg}, written and maintained by Nicolas
  1541. Goaziou. It defines Org's core internal concepts such as @samp{headlines},
  1542. @samp{sections}, @samp{affiliated keywords}, @samp{(greater) elements} and @samp{objects}.
  1543. Each part of an Org file falls into one of the categories above.
  1544. To explore the abstract structure of an Org buffer, run this in
  1545. a buffer:
  1546. @example
  1547. M-: (org-element-parse-buffer) <RET>
  1548. @end example
  1549. @noindent
  1550. It outputs a list containing the buffer's content represented as an
  1551. abstract structure. The export engine relies on the information
  1552. stored in this list. Most interactive commands---e.g., for structure
  1553. editing---also rely on the syntactic meaning of the surrounding
  1554. context.
  1555. @cindex syntax checker
  1556. @cindex linter
  1557. @findex org-lint
  1558. You can check syntax in your documents using @code{org-lint} command.
  1559. @node Tables
  1560. @chapter Tables
  1561. @cindex tables
  1562. @cindex editing tables
  1563. Org comes with a fast and intuitive table editor. Spreadsheet-like
  1564. calculations are supported using the Emacs Calc package (see @ref{Top,GNU Emacs
  1565. Calculator Manual,,calc,}).
  1566. @menu
  1567. * Built-in Table Editor:: Simple tables.
  1568. * Column Width and Alignment:: Overrule the automatic settings.
  1569. * Column Groups:: Grouping to trigger vertical lines.
  1570. * Orgtbl Mode:: The table editor as minor mode.
  1571. * The spreadsheet:: The table editor has spreadsheet capabilities.
  1572. * Org Plot:: Plotting from Org tables.
  1573. @end menu
  1574. @node Built-in Table Editor
  1575. @section Built-in Table Editor
  1576. @cindex table editor, built-in
  1577. Org makes it easy to format tables in plain ASCII. Any line with @samp{|}
  1578. as the first non-whitespace character is considered part of a table.
  1579. @samp{|} is also the column separator@footnote{To insert a vertical bar into a table field, use @samp{\vert} or,
  1580. inside a word @samp{abc\vert@{@}def}.}. A table might look like
  1581. this:
  1582. @example
  1583. | Name | Phone | Age |
  1584. |-------+-------+-----|
  1585. | Peter | 1234 | 17 |
  1586. | Anna | 4321 | 25 |
  1587. @end example
  1588. A table is re-aligned automatically each time you press
  1589. @kbd{@key{TAB}}, @kbd{@key{RET}} or @kbd{C-c C-c} inside the table.
  1590. @kbd{@key{TAB}} also moves to the next field---@kbd{@key{RET}} to the
  1591. next row---and creates new table rows at the end of the table or
  1592. before horizontal lines. The indentation of the table is set by the
  1593. first line. Any line starting with @samp{|-} is considered as a horizontal
  1594. separator line and will be expanded on the next re-align to span the
  1595. whole table width. So, to create the above table, you would only type
  1596. @example
  1597. |Name|Phone|Age|
  1598. |-
  1599. @end example
  1600. @noindent
  1601. and then press @kbd{@key{TAB}} to align the table and start filling in
  1602. fields. Even faster would be to type @samp{|Name|Phone|Age} followed by
  1603. @kbd{C-c @key{RET}}.
  1604. When typing text into a field, Org treats @kbd{DEL},
  1605. @kbd{Backspace}, and all character keys in a special way, so that
  1606. inserting and deleting avoids shifting other fields. Also, when
  1607. typing @emph{immediately} after the cursor was moved into a new field with
  1608. @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}, the field is
  1609. automatically made blank. If this behavior is too unpredictable for
  1610. you, configure the option @code{org-table-auto-blank-field}.
  1611. @anchor{Creation and conversion}
  1612. @subheading Creation and conversion
  1613. @table @asis
  1614. @item @kbd{C-c |} (@code{org-table-create-or-convert-from-region})
  1615. @kindex C-c |
  1616. @findex org-table-create-or-convert-from-region
  1617. Convert the active region to table. If every line contains at
  1618. least one @kbd{@key{TAB}} character, the function assumes that the
  1619. material is tab separated. If every line contains a comma,
  1620. comma-separated values (CSV) are assumed. If not, lines are
  1621. split at whitespace into fields. You can use a prefix argument
  1622. to force a specific separator: @kbd{C-u} forces CSV,
  1623. @kbd{C-u C-u} forces @kbd{@key{TAB}}, @kbd{C-u C-u C-u}
  1624. prompts for a regular expression to match the separator, and
  1625. a numeric argument N indicates that at least N consecutive
  1626. spaces, or alternatively a @kbd{@key{TAB}} will be the separator.
  1627. If there is no active region, this command creates an empty Org
  1628. table. But it is easier just to start typing, like @kbd{| N a m e | P h o n e | A g e @key{RET} | - @key{TAB}}.
  1629. @end table
  1630. @anchor{Re-aligning and field motion}
  1631. @subheading Re-aligning and field motion
  1632. @table @asis
  1633. @item @kbd{C-c C-c} (@code{org-table-align})
  1634. @kindex C-c C-c
  1635. @findex org-table-align
  1636. Re-align the table without moving the cursor.
  1637. @item @kbd{@key{TAB}} (@code{org-table-next-field})
  1638. @kindex TAB
  1639. @findex org-table-next-field
  1640. Re-align the table, move to the next field. Creates a new row if
  1641. necessary.
  1642. @item @kbd{C-c @key{SPC}} (@code{org-table-blank-field})
  1643. @kindex C-c SPC
  1644. @findex org-table-blank-field
  1645. Blank the field at point.
  1646. @item @kbd{S-@key{TAB}} (@code{org-table-previous-field})
  1647. @kindex S-TAB
  1648. @findex org-table-previous-field
  1649. Re-align, move to previous field.
  1650. @item @kbd{@key{RET}} (@code{org-table-next-row})
  1651. @kindex RET
  1652. @findex org-table-next-row
  1653. Re-align the table and move down to next row. Creates a new row
  1654. if necessary. At the beginning or end of a line, @kbd{@key{RET}}
  1655. still inserts a new line, so it can be used to split a table.
  1656. @item @kbd{M-a} (@code{org-table-beginning-of-field})
  1657. @kindex M-a
  1658. @findex org-table-beginning-of-field
  1659. Move to beginning of the current table field, or on to the
  1660. previous field.
  1661. @item @kbd{M-e} (@code{org-table-end-of-field})
  1662. @kindex M-e
  1663. @findex org-table-end-of-field
  1664. Move to end of the current table field, or on to the next field.
  1665. @end table
  1666. @anchor{Column and row editing}
  1667. @subheading Column and row editing
  1668. @table @asis
  1669. @item @kbd{M-@key{LEFT}} (@code{org-table-move-column-left})
  1670. @kindex M-LEFT
  1671. @findex org-table-move-column-left
  1672. Move the current column left.
  1673. @item @kbd{M-@key{RIGHT}} (@code{org-table-move-column-right})
  1674. @kindex M-RIGHT
  1675. @findex org-table-move-column-right
  1676. Move the current column right.
  1677. @item @kbd{M-S-@key{LEFT}} (@code{org-table-delete-column})
  1678. @kindex M-S-LEFT
  1679. @findex org-table-delete-column
  1680. Kill the current column.
  1681. @item @kbd{M-S-@key{RIGHT}} (@code{org-table-insert-column})
  1682. @kindex M-S-RIGHT
  1683. @findex org-table-insert-column
  1684. Insert a new column to the left of the cursor position.
  1685. @item @kbd{M-@key{UP}} (@code{org-table-move-row-up})
  1686. @kindex M-UP
  1687. @findex org-table-move-row-up
  1688. Move the current row up.
  1689. @item @kbd{M-@key{DOWN}} (@code{org-table-move-row-down})
  1690. @kindex M-DOWN
  1691. @findex org-table-move-row-down
  1692. Move the current row down.
  1693. @item @kbd{M-S-@key{UP}} (@code{org-table-kill-row})
  1694. @kindex M-S-UP
  1695. @findex org-table-kill-row
  1696. Kill the current row or horizontal line.
  1697. @item @kbd{M-S-@key{DOWN}} (@code{org-table-insert-row})
  1698. @kindex M-S-DOWN
  1699. @findex org-table-insert-row
  1700. Insert a new row above the current row. With a prefix argument,
  1701. the line is created below the current one.
  1702. @item @kbd{C-c -} (@code{org-table-insert-hline})
  1703. @kindex C-c -
  1704. @findex org-table-insert-hline
  1705. Insert a horizontal line below current row. With a prefix
  1706. argument, the line is created above the current line.
  1707. @item @kbd{C-c @key{RET}} (@code{org-table-hline-and-move})
  1708. @kindex C-c RET
  1709. @findex org-table-hline-and-move
  1710. Insert a horizontal line below current row, and move the cursor
  1711. into the row below that line.
  1712. @item @kbd{C-c ^} (@code{org-table-sort-lines})
  1713. @kindex C-c ^
  1714. @findex org-table-sort-lines
  1715. Sort the table lines in the region. The position of point
  1716. indicates the column to be used for sorting, and the range of
  1717. lines is the range between the nearest horizontal separator
  1718. lines, or the entire table. If point is before the first column,
  1719. you are prompted for the sorting column. If there is an active
  1720. region, the mark specifies the first line and the sorting column,
  1721. while point should be in the last line to be included into the
  1722. sorting. The command prompts for the sorting type,
  1723. alphabetically, numerically, or by time. You can sort in normal
  1724. or reverse order. You can also supply your own key extraction
  1725. and comparison functions. When called with a prefix argument,
  1726. alphabetic sorting is case-sensitive.
  1727. @end table
  1728. @anchor{Regions}
  1729. @subheading Regions
  1730. @table @asis
  1731. @item @kbd{C-c C-x M-w} (@code{org-table-copy-region})
  1732. @kindex C-c C-x M-w
  1733. @findex org-table-copy-region
  1734. Copy a rectangular region from a table to a special clipboard.
  1735. Point and mark determine edge fields of the rectangle. If there
  1736. is no active region, copy just the current field. The process
  1737. ignores horizontal separator lines.
  1738. @item @kbd{C-c C-x C-w} (@code{org-table-cut-region})
  1739. @kindex C-c C-x C-w
  1740. @findex org-table-cut-region
  1741. Copy a rectangular region from a table to a special clipboard,
  1742. and blank all fields in the rectangle. So this is the ``cut''
  1743. operation.
  1744. @item @kbd{C-c C-x C-y} (@code{org-table-paste-rectangle})
  1745. @kindex C-c C-x C-y
  1746. @findex org-table-paste-rectangle
  1747. Paste a rectangular region into a table. The upper left corner
  1748. ends up in the current field. All involved fields are
  1749. overwritten. If the rectangle does not fit into the present
  1750. table, the table is enlarged as needed. The process ignores
  1751. horizontal separator lines.
  1752. @item @kbd{M-@key{RET}} (@code{org-table-wrap-region})
  1753. @kindex M-RET
  1754. @findex org-table-wrap-region
  1755. Split the current field at the cursor position and move the rest
  1756. to the line below. If there is an active region, and both point
  1757. and mark are in the same column, the text in the column is
  1758. wrapped to minimum width for the given number of lines.
  1759. A numeric prefix argument may be used to change the number of
  1760. desired lines. If there is no region, but you specify a prefix
  1761. argument, the current field is made blank, and the content is
  1762. appended to the field above.
  1763. @end table
  1764. @anchor{Calculations}
  1765. @subheading Calculations
  1766. @cindex formula, in tables
  1767. @cindex calculations, in tables
  1768. @table @asis
  1769. @item @kbd{C-c +} (@code{org-table-sum})
  1770. @kindex C-c +
  1771. @findex org-table-sum
  1772. Sum the numbers in the current column, or in the rectangle
  1773. defined by the active region. The result is shown in the echo
  1774. area and can be inserted with @kbd{C-y}.
  1775. @item @kbd{S-@key{RET}} (@code{org-table-copy-down})
  1776. @kindex S-RET
  1777. @findex org-table-copy-down
  1778. @vindex org-table-copy-increment
  1779. When current field is empty, copy from first non-empty field
  1780. above. When not empty, copy current field down to next row and
  1781. move cursor along with it. Depending on the variable
  1782. @code{org-table-copy-increment}, integer field values can be
  1783. incremented during copy. Integers that are too large are not
  1784. incremented, however. Also, a @code{0} prefix argument temporarily
  1785. disables the increment. This key is also used by shift-selection
  1786. and related modes (see @ref{Conflicts}).
  1787. @end table
  1788. @anchor{Miscellaneous (1)}
  1789. @subheading Miscellaneous
  1790. @table @asis
  1791. @item @kbd{C-c `} (@code{org-table-edit-field})
  1792. @kindex C-c `
  1793. @findex org-table-edit-field
  1794. Edit the current field in a separate window. This is useful for
  1795. fields that are not fully visible (see @ref{Column Width and Alignment}). When called with a @kbd{C-u} prefix, just make
  1796. the full field visible, so that it can be edited in place. When
  1797. called with two @kbd{C-u} prefixes, make the editor window
  1798. follow the cursor through the table and always show the current
  1799. field. The follow mode exits automatically when the cursor
  1800. leaves the table, or when you repeat this command with @kbd{C-u C-u C-c `}.
  1801. @item @kbd{M-x org-table-import}
  1802. @findex org-table-import
  1803. Import a file as a table. The table should be TAB or whitespace
  1804. separated. Use, for example, to import a spreadsheet table or
  1805. data from a database, because these programs generally can write
  1806. TAB-separated text files. This command works by inserting the
  1807. file into the buffer and then converting the region to a table.
  1808. Any prefix argument is passed on to the converter, which uses it
  1809. to determine the separator.
  1810. @item @kbd{C-c |} (@code{org-table-create-or-convert-from-region})
  1811. @kindex C-c |
  1812. @findex org-table-create-or-convert-from-region
  1813. Tables can also be imported by pasting tabular text into the Org
  1814. buffer, selecting the pasted text with @kbd{C-x C-x} and
  1815. then using the @kbd{C-c |} command (see @ref{Creation and conversion}).
  1816. @item @kbd{M-x org-table-export}
  1817. @findex org-table-export
  1818. @vindex org-table-export-default-format
  1819. Export the table, by default as a TAB-separated file. Use for
  1820. data exchange with, for example, spreadsheet or database
  1821. programs. The format used to export the file can be configured
  1822. in the variable @code{org-table-export-default-format}. You may also
  1823. use properties @samp{TABLE_EXPORT_FILE} and @samp{TABLE_EXPORT_FORMAT} to
  1824. specify the file name and the format for table export in
  1825. a subtree. Org supports quite general formats for exported
  1826. tables. The exporter format is the same as the format used by
  1827. Orgtbl radio tables, see @ref{Translator functions}, for a detailed
  1828. description.
  1829. @end table
  1830. @node Column Width and Alignment
  1831. @section Column Width and Alignment
  1832. @cindex narrow columns in tables
  1833. @cindex alignment in tables
  1834. The width of columns is automatically determined by the table editor.
  1835. The alignment of a column is determined automatically from the
  1836. fraction of number-like versus non-number fields in the column.
  1837. @vindex org-table-automatic-realign
  1838. Editing a field may modify alignment of the table. Moving
  1839. a contiguous row or column---i.e., using @kbd{@key{TAB}} or
  1840. @kbd{@key{RET}}---automatically re-aligns it. If you want to disable
  1841. this behavior, set @code{org-table-automatic-realign} to @code{nil}. In any
  1842. case, you can always align manually a table:
  1843. @table @asis
  1844. @item @kbd{C-c C-c} (@code{org-table-align})
  1845. @kindex C-c C-c
  1846. @findex org-table-align
  1847. Align the current table.
  1848. @end table
  1849. @noindent
  1850. @vindex org-startup-align-all-tables
  1851. Setting the option @code{org-startup-align-all-tables} re-aligns all tables
  1852. in a file upon visiting it. You can also set this option on
  1853. a per-file basis with:
  1854. @example
  1855. #+STARTUP: align
  1856. #+STARTUP: noalign
  1857. @end example
  1858. Sometimes a single field or a few fields need to carry more text,
  1859. leading to inconveniently wide columns. Maybe you want to hide away
  1860. several columns or display them with a fixed width, regardless of
  1861. content, as shown in the following example.
  1862. @example
  1863. |---+---------------------+--------| |---+-------…|…|
  1864. | | <6> | | | | <6> …|…|
  1865. | 1 | one | some | ----\ | 1 | one …|…|
  1866. | 2 | two | boring | ----/ | 2 | two …|…|
  1867. | 3 | This is a long text | column | | 3 | This i…|…|
  1868. |---+---------------------+--------| |---+-------…|…|
  1869. @end example
  1870. To set the width of a column, one field anywhere in the column may
  1871. contain just the string @samp{<N>} where @var{N} specifies the width
  1872. as a number of characters. You control displayed width of columns
  1873. with the following tools:
  1874. @table @asis
  1875. @item @kbd{C-c @key{TAB}} (@code{org-table-toggle-column-width})
  1876. @kindex C-c TAB
  1877. @findex org-table-toggle-column-width
  1878. Shrink or expand current column.
  1879. If a width cookie specifies a width W for the column, shrinking
  1880. it displays the first W visible characters only. Otherwise, the
  1881. column is shrunk to a single character.
  1882. When called before the first column or after the last one, ask
  1883. for a list of column ranges to operate on.
  1884. @item @kbd{C-u C-c @key{TAB}} (@code{org-table-shrink})
  1885. @kindex C-u C-c TAB
  1886. @findex org-table-shrink
  1887. Shrink all columns with a column width. Expand the others.
  1888. @item @kbd{C-u C-u C-c @key{TAB}} (@code{org-table-expand})
  1889. @kindex C-u C-u C-c TAB
  1890. @findex org-table-expand
  1891. Expand all columns.
  1892. @end table
  1893. To see the full text of a shrunk field, hold the mouse over it---a
  1894. tool-tip window then shows the full content. Alternatively @kbd{C-h .} (@code{display-local-help}) reveals the full content. For
  1895. convenience, any change to a shrunk column expands it.
  1896. @vindex org-startup-shrink-all-tables
  1897. Setting the option @code{org-startup-shrink-all-tables} shrinks all columns
  1898. containing a width cookie in a file the moment it is visited. You can
  1899. also set this option on a per-file basis with:
  1900. @example
  1901. #+STARTUP: shrink
  1902. @end example
  1903. If you would like to overrule the automatic alignment of number-rich
  1904. columns to the right and of string-rich columns to the left, you can
  1905. use @samp{<r>}, @samp{<c>} or @samp{<l>} in a similar fashion. You may also combine
  1906. alignment and field width like this: @samp{<r10>}.
  1907. Lines which only contain these formatting cookies are removed
  1908. automatically upon exporting the document.
  1909. @node Column Groups
  1910. @section Column Groups
  1911. @cindex grouping columns in tables
  1912. When Org exports tables, it does so by default without vertical lines
  1913. because that is visually more satisfying in general. Occasionally
  1914. however, vertical lines can be useful to structure a table into groups
  1915. of columns, much like horizontal lines can do for groups of rows. In
  1916. order to specify column groups, you can use a special row where the
  1917. first field contains only @samp{/}. The further fields can either contain
  1918. @samp{<} to indicate that this column should start a group, @samp{>} to indicate
  1919. the end of a column, or @samp{<>} (no space between @samp{<} and @samp{>}) to make
  1920. a column a group of its own. Upon export, boundaries between column
  1921. groups are marked with vertical lines. Here is an example:
  1922. @example
  1923. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1924. |---+-----+-----+-----+---------+------------|
  1925. | / | < | | > | < | > |
  1926. | 1 | 1 | 1 | 1 | 1 | 1 |
  1927. | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
  1928. | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
  1929. |---+-----+-----+-----+---------+------------|
  1930. #+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
  1931. @end example
  1932. It is also sufficient to just insert the column group starters after
  1933. every vertical line you would like to have:
  1934. @example
  1935. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1936. |---+-----+-----+-----+---------+------------|
  1937. | / | < | | | < | |
  1938. @end example
  1939. @node Orgtbl Mode
  1940. @section The Orgtbl Minor Mode
  1941. @cindex Orgtbl mode
  1942. @cindex minor mode for tables
  1943. @findex orgtbl-mode
  1944. If you like the intuitive way the Org table editor works, you might
  1945. also want to use it in other modes like Text mode or Mail mode. The
  1946. minor mode Orgtbl mode makes this possible. You can always toggle the
  1947. mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
  1948. example in Message mode, use
  1949. @lisp
  1950. (add-hook 'message-mode-hook 'turn-on-orgtbl)
  1951. @end lisp
  1952. Furthermore, with some special setup, it is possible to maintain
  1953. tables in arbitrary syntax with Orgtbl mode. For example, it is
  1954. possible to construct @LaTeX{} tables with the underlying ease and power
  1955. of Orgtbl mode, including spreadsheet capabilities. For details, see
  1956. @ref{Tables in Arbitrary Syntax}.
  1957. @node The spreadsheet
  1958. @section The spreadsheet
  1959. @cindex calculations, in tables
  1960. @cindex spreadsheet capabilities
  1961. @cindex Calc package
  1962. The table editor makes use of the Emacs Calc package to implement
  1963. spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms
  1964. to derive fields from other fields. While fully featured, Org's
  1965. implementation is not identical to other spreadsheets. For example,
  1966. Org knows the concept of a @emph{column formula} that will be applied to
  1967. all non-header fields in a column without having to copy the formula
  1968. to each relevant field. There is also a formula debugger, and
  1969. a formula editor with features for highlighting fields in the table
  1970. corresponding to the references at the point in the formula, moving
  1971. these references by arrow keys.
  1972. @menu
  1973. * References:: How to refer to another field or range.
  1974. * Formula syntax for Calc:: Using Calc to compute stuff.
  1975. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp.
  1976. * Durations and time values:: How to compute durations and time values.
  1977. * Field and range formulas:: Formula for specific (ranges of) fields.
  1978. * Column formulas:: Formulas valid for an entire column.
  1979. * Lookup functions:: Lookup functions for searching tables.
  1980. * Editing and debugging formulas:: Fixing formulas.
  1981. * Updating the table:: Recomputing all dependent fields.
  1982. * Advanced features:: Field and column names, automatic recalculation...
  1983. @end menu
  1984. @node References
  1985. @subsection References
  1986. @cindex references
  1987. To compute fields in the table from other fields, formulas must
  1988. reference other fields or ranges. In Org, fields can be referenced by
  1989. name, by absolute coordinates, and by relative coordinates. To find
  1990. out what the coordinates of a field are, press @kbd{C-c ?} in
  1991. that field, or press @kbd{C-c @}} to toggle the display of a grid.
  1992. @anchor{Field references}
  1993. @subsubheading Field references
  1994. @cindex field references
  1995. @cindex references, to fields
  1996. Formulas can reference the value of another field in two ways. Like
  1997. in any other spreadsheet, you may reference fields with
  1998. a letter/number combination like @samp{B3}, meaning the second field in the
  1999. third row. However, Org prefers to use another, more general
  2000. representation that looks like this:@footnote{Org understands references typed by the user as @samp{B4}, but it
  2001. does not use this syntax when offering a formula for editing. You can
  2002. customize this behavior using the variable
  2003. @code{org-table-use-standard-references}.}
  2004. @example
  2005. @@ROW$COLUMN
  2006. @end example
  2007. Column specifications can be absolute like @samp{$1}, @samp{$2}, @dots{}, @samp{$N}, or
  2008. relative to the current column, i.e., the column of the field which is
  2009. being computed, like @samp{$+1} or @samp{$-2}. @samp{$<} and @samp{$>} are immutable
  2010. references to the first and last column, respectively, and you can use
  2011. @samp{$>>>} to indicate the third column from the right.
  2012. The row specification only counts data lines and ignores horizontal
  2013. separator lines, or ``hlines''. Like with columns, you can use absolute
  2014. row numbers @samp{@@1}, @samp{@@2}, @dots{}, @samp{@@N}, and row numbers relative to the
  2015. current row like @samp{@@+3} or @samp{@@-1}. @samp{@@<} and @samp{@@>} are immutable
  2016. references the first and last row in the table, respectively. You may
  2017. also specify the row relative to one of the hlines: @samp{@@I} refers to the
  2018. first hline, @samp{@@II} to the second, etc. @samp{@@-I} refers to the first such
  2019. line above the current line, @samp{@@+I} to the first such line below the
  2020. current line. You can also write @samp{@@III+2} which is the second data
  2021. line after the third hline in the table.
  2022. @samp{@@0} and @samp{$0} refer to the current row and column, respectively, i.e.,
  2023. to the row/column for the field being computed. Also, if you omit
  2024. either the column or the row part of the reference, the current
  2025. row/column is implied.
  2026. Org's references with @emph{unsigned} numbers are fixed references in the
  2027. sense that if you use the same reference in the formula for two
  2028. different fields, the same field is referenced each time. Org's
  2029. references with @emph{signed} numbers are floating references because the
  2030. same reference operator can reference different fields depending on
  2031. the field being calculated by the formula.
  2032. Here are a few examples:
  2033. @multitable @columnfractions 0.2 0.8
  2034. @item @samp{@@2$3}
  2035. @tab 2nd row, 3rd column (same as @samp{C2})
  2036. @item @samp{$5}
  2037. @tab column 5 in the current row (same as @samp{E&})
  2038. @item @samp{@@2}
  2039. @tab current column, row 2
  2040. @item @samp{@@-1$-3}
  2041. @tab field one row up, three columns to the left
  2042. @item @samp{@@-I$2}
  2043. @tab field just under hline above current row, column 2
  2044. @item @samp{@@>$5}
  2045. @tab field in the last row, in column 5
  2046. @end multitable
  2047. @anchor{Range references}
  2048. @subsubheading Range references
  2049. @cindex range references
  2050. @cindex references, to ranges
  2051. You may reference a rectangular range of fields by specifying two
  2052. field references connected by two dots @samp{..}. If both fields are in
  2053. the current row, you may simply use @samp{$2..$7}, but if at least one
  2054. field is in a different row, you need to use the general @samp{@@ROW$COLUMN}
  2055. format at least for the first field, i.e., the reference must start
  2056. with @samp{@@} in order to be interpreted correctly. Examples:
  2057. @multitable @columnfractions 0.2 0.8
  2058. @item @samp{$1..$3}
  2059. @tab first three fields in the current row
  2060. @item @samp{$P..$Q}
  2061. @tab range, using column names (see @ref{Advanced features})
  2062. @item @samp{$<<<..$>>}
  2063. @tab start in third column, continue to the last but one
  2064. @item @samp{@@2$1..@@4$3}
  2065. @tab six fields between these two fields (same as @samp{A2..C4})
  2066. @item @samp{@@-1$-2..@@-1}
  2067. @tab 3 fields in the row above, starting from 2 columns on the left
  2068. @item @samp{@@I..II}
  2069. @tab between first and second hline, short for @samp{@@I..@@II}
  2070. @end multitable
  2071. @noindent
  2072. Range references return a vector of values that can be fed into Calc
  2073. vector functions. Empty fields in ranges are normally suppressed, so
  2074. that the vector contains only the non-empty fields. For other options
  2075. with the mode switches @samp{E}, @samp{N} and examples, see @ref{Formula syntax for Calc}.
  2076. @anchor{Field coordinates in formulas}
  2077. @subsubheading Field coordinates in formulas
  2078. @cindex field coordinates
  2079. @cindex coordinates, of field
  2080. @cindex row, of field coordinates
  2081. @cindex column, of field coordinates
  2082. @vindex org-table-current-column
  2083. @vindex org-table-current-dline
  2084. One of the very first actions during evaluation of Calc formulas and
  2085. Lisp formulas is to substitute @samp{@@#} and @samp{$#} in the formula with the
  2086. row or column number of the field where the current result will go to.
  2087. The traditional Lisp formula equivalents are @code{org-table-current-dline}
  2088. and @code{org-table-current-column}. Examples:
  2089. @table @asis
  2090. @item @samp{if(@@# % 2, $#, string(""))}
  2091. Insert column number on odd rows, set field to empty on even
  2092. rows.
  2093. @item @samp{$2 = '(identity remote(FOO, @@@@#$1))}
  2094. Copy text or values of each row of column 1 of the table named
  2095. @var{FOO} into column 2 of the current table.
  2096. @item @samp{@@3 = 2 * remote(FOO, @@@@1$$#)}
  2097. Insert the doubled value of each column of row 1 of the table
  2098. named @var{FOO} into row 3 of the current table.
  2099. @end table
  2100. @noindent
  2101. For the second and third examples, table @var{FOO} must have at
  2102. least as many rows or columns as the current table. Note that this is
  2103. inefficient@footnote{The computation time scales as O(N^2) because table
  2104. @var{FOO} is parsed for each field to be copied.} for large number of rows.
  2105. @anchor{Named references}
  2106. @subsubheading Named references
  2107. @cindex named references
  2108. @cindex references, named
  2109. @cindex name, of column or field
  2110. @cindex constants, in calculations
  2111. @cindex @samp{CONSTANTS}, keyword
  2112. @vindex org-table-formula-constants
  2113. @samp{$name} is interpreted as the name of a column, parameter or constant.
  2114. Constants are defined globally through the variable
  2115. @code{org-table-formula-constants}, and locally---for the file---through
  2116. a line like this example:
  2117. @example
  2118. #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
  2119. @end example
  2120. @noindent
  2121. @vindex constants-unit-system
  2122. @pindex constants.el
  2123. Also, properties (see @ref{Properties and Columns}) can be used as
  2124. constants in table formulas: for a property @samp{Xyz} use the name
  2125. @samp{$PROP_Xyz}, and the property will be searched in the current outline
  2126. entry and in the hierarchy above it. If you have the @samp{constants.el}
  2127. package, it will also be used to resolve constants, including natural
  2128. constants like @samp{$h} for Planck's constant, and units like @samp{$km} for
  2129. kilometers@footnote{The file @samp{constants.el} can supply the values of constants in
  2130. two different unit systems, @samp{SI} and @samp{cgs}. Which one is used depends
  2131. on the value of the variable @code{constants-unit-system}. You can use the
  2132. @samp{STARTUP} options @samp{constSI} and @samp{constcgs} to set this value for the
  2133. current buffer.}. Column names and parameters can be specified in
  2134. special table lines. These are described below, see @ref{Advanced features}. All names must start with a letter, and further consist
  2135. of letters and numbers.
  2136. @anchor{Remote references}
  2137. @subsubheading Remote references
  2138. @cindex remote references
  2139. @cindex references, remote
  2140. @cindex references, to a different table
  2141. @cindex name, of column or field
  2142. @cindex @samp{NAME}, keyword
  2143. You may also reference constants, fields and ranges from a different
  2144. table, either in the current file or even in a different file. The
  2145. syntax is
  2146. @example
  2147. remote(NAME,REF)
  2148. @end example
  2149. @noindent
  2150. where @var{NAME} can be the name of a table in the current file
  2151. as set by a @samp{#+NAME:} line before the table. It can also be the ID of
  2152. an entry, even in a different file, and the reference then refers to
  2153. the first table in that entry. @var{REF} is an absolute field or
  2154. range reference as described above for example @samp{@@3$3} or @samp{$somename},
  2155. valid in the referenced table.
  2156. @cindex table indirection
  2157. When @var{NAME} has the format @samp{@@ROW$COLUMN}, it is substituted
  2158. with the name or ID found in this field of the current table. For
  2159. example @samp{remote($1, @@@@>$2)} @result{} @samp{remote(year_2013, @@@@>$1)}. The format
  2160. @samp{B3} is not supported because it can not be distinguished from a plain
  2161. table name or ID.
  2162. @node Formula syntax for Calc
  2163. @subsection Formula syntax for Calc
  2164. @cindex formula syntax, Calc
  2165. @cindex syntax, of formulas
  2166. A formula can be any algebraic expression understood by the Emacs Calc
  2167. package. Note that Calc has the non-standard convention that @samp{/} has
  2168. lower precedence than @samp{*}, so that @samp{a/b*c} is interpreted as
  2169. @samp{(a/(b*c))}. Before evaluation by @code{calc-eval} (see @ref{Calling Calc from Your Programs,Calling Calc from
  2170. Your Lisp Programs,,calc,}), variable substitution takes place according to
  2171. the rules described above.
  2172. @cindex vectors, in table calculations
  2173. The range vectors can be directly fed into the Calc vector functions
  2174. like @code{vmean} and @code{vsum}.
  2175. @cindex format specifier, in spreadsheet
  2176. @cindex mode, for Calc
  2177. @vindex org-calc-default-modes
  2178. A formula can contain an optional mode string after a semicolon. This
  2179. string consists of flags to influence Calc and other modes during
  2180. execution. By default, Org uses the standard Calc modes (precision
  2181. 12, angular units degrees, fraction and symbolic modes off). The
  2182. display format, however, has been changed to @code{(float 8)} to keep
  2183. tables compact. The default settings can be configured using the
  2184. variable @code{org-calc-default-modes}.
  2185. @table @asis
  2186. @item @samp{p20}
  2187. Set the internal Calc calculation precision to 20 digits.
  2188. @item @samp{n3}, @samp{s3}, @samp{e2}, @samp{f4}
  2189. Normal, scientific, engineering or fixed format of the result of
  2190. Calc passed back to Org. Calc formatting is unlimited in
  2191. precision as long as the Calc calculation precision is greater.
  2192. @item @samp{D}, @samp{R}
  2193. Degree and radian angle modes of Calc.
  2194. @item @samp{F}, @samp{S}
  2195. Fraction and symbolic modes of Calc.
  2196. @item @samp{T}, @samp{t}, @samp{U}
  2197. Duration computations in Calc or Lisp, @ref{Durations and time values}.
  2198. @item @samp{E}
  2199. If and how to consider empty fields. Without @samp{E} empty fields in
  2200. range references are suppressed so that the Calc vector or Lisp
  2201. list contains only the non-empty fields. With @samp{E} the empty
  2202. fields are kept. For empty fields in ranges or empty field
  2203. references the value @samp{nan} (not a number) is used in Calc
  2204. formulas and the empty string is used for Lisp formulas. Add @samp{N}
  2205. to use 0 instead for both formula types. For the value of
  2206. a field the mode @samp{N} has higher precedence than @samp{E}.
  2207. @item @samp{N}
  2208. Interpret all fields as numbers, use 0 for non-numbers. See the
  2209. next section to see how this is essential for computations with
  2210. Lisp formulas. In Calc formulas it is used only occasionally
  2211. because there number strings are already interpreted as numbers
  2212. without @samp{N}.
  2213. @item @samp{L}
  2214. Literal, for Lisp formulas only. See the next section.
  2215. @end table
  2216. @noindent
  2217. Unless you use large integer numbers or high-precision calculation and
  2218. display for floating point numbers you may alternatively provide
  2219. a @code{printf} format specifier to reformat the Calc result after it has
  2220. been passed back to Org instead of letting Calc already do the
  2221. formatting@footnote{The printf reformatting is limited in precision because the
  2222. value passed to it is converted into an ``integer'' or ``double''. The
  2223. ``integer'' is limited in size by truncating the signed value to 32
  2224. bits. The ``double'' is limited in precision to 64 bits overall which
  2225. leaves approximately 16 significant decimal digits.}. A few examples:
  2226. @multitable {aaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  2227. @item @samp{$1+$2}
  2228. @tab Sum of first and second field
  2229. @item @samp{$1+$2;%.2f}
  2230. @tab Same, format result to two decimals
  2231. @item @samp{exp($2)+exp($1)}
  2232. @tab Math functions can be used
  2233. @item @samp{$0;%.1f}
  2234. @tab Reformat current cell to 1 decimal
  2235. @item @samp{($3-32)*5/9}
  2236. @tab Degrees F @arrow{} C conversion
  2237. @item @samp{$c/$1/$cm}
  2238. @tab Hz @arrow{} cm conversion, using @samp{constants.el}
  2239. @item @samp{tan($1);Dp3s1}
  2240. @tab Compute in degrees, precision 3, display SCI 1
  2241. @item @samp{sin($1);Dp3%.1e}
  2242. @tab Same, but use @code{printf} specifier for display
  2243. @item @samp{vmean($2..$7)}
  2244. @tab Compute column range mean, using vector function
  2245. @item @samp{vmean($2..$7);EN}
  2246. @tab Same, but treat empty fields as 0
  2247. @item @samp{taylor($3,x=7,2)}
  2248. @tab Taylor series of $3, at x=7, second degree
  2249. @end multitable
  2250. Calc also contains a complete set of logical operations (see @ref{Logical Operations,Logical
  2251. Operations,,calc,}). For example
  2252. @table @asis
  2253. @item @samp{if($1 < 20, teen, string(""))}
  2254. @samp{"teen"} if age @samp{$1} is less than 20, else the Org table result
  2255. field is set to empty with the empty string.
  2256. @item @samp{if("$1" =} ``nan'' || ``$2'' @samp{= "nan", string(""), $1 + $2); E f-1}
  2257. Sum of the first two columns. When at least one of the input
  2258. fields is empty the Org table result field is set to empty. @samp{E}
  2259. is required to not convert empty fields to 0. @samp{f-1} is an
  2260. optional Calc format string similar to @samp{%.1f} but leaves empty
  2261. results empty.
  2262. @item @samp{if(typeof(vmean($1..$7)) =} 12, string(``''), vmean($1..$7); E=
  2263. Mean value of a range unless there is any empty field. Every
  2264. field in the range that is empty is replaced by @samp{nan} which lets
  2265. @samp{vmean} result in @samp{nan}. Then @samp{typeof =} 12= detects the @samp{nan}
  2266. from @code{vmean} and the Org table result field is set to empty. Use
  2267. this when the sample set is expected to never have missing
  2268. values.
  2269. @item @samp{if("$1..$7" =} ``[]'', string(``''), vmean($1..$7))=
  2270. Mean value of a range with empty fields skipped. Every field in
  2271. the range that is empty is skipped. When all fields in the range
  2272. are empty the mean value is not defined and the Org table result
  2273. field is set to empty. Use this when the sample set can have
  2274. a variable size.
  2275. @item @samp{vmean($1..$7); EN}
  2276. To complete the example before: Mean value of a range with empty
  2277. fields counting as samples with value 0. Use this only when
  2278. incomplete sample sets should be padded with 0 to the full size.
  2279. @end table
  2280. You can add your own Calc functions defined in Emacs Lisp with
  2281. @code{defmath} and use them in formula syntax for Calc.
  2282. @node Formula syntax for Lisp
  2283. @subsection Emacs Lisp forms as formulas
  2284. @cindex Lisp forms, as table formulas
  2285. It is also possible to write a formula in Emacs Lisp. This can be
  2286. useful for string manipulation and control structures, if Calc's
  2287. functionality is not enough.
  2288. If a formula starts with a single-quote followed by an opening
  2289. parenthesis, then it is evaluated as a Lisp form. The evaluation
  2290. should return either a string or a number. Just as with Calc
  2291. formulas, you can specify modes and a @code{printf} format after
  2292. a semicolon.
  2293. With Emacs Lisp forms, you need to be conscious about the way field
  2294. references are interpolated into the form. By default, a reference is
  2295. interpolated as a Lisp string (in double-quotes) containing the field.
  2296. If you provide the @samp{N} mode switch, all referenced elements are
  2297. numbers---non-number fields will be zero---and interpolated as Lisp
  2298. numbers, without quotes. If you provide the @samp{L} flag, all fields are
  2299. interpolated literally, without quotes. I.e., if you want a reference
  2300. to be interpreted as a string by the Lisp form, enclose the reference
  2301. operator itself in double-quotes, like @samp{"$3"}. Ranges are inserted as
  2302. space-separated fields, so you can embed them in list or vector
  2303. syntax.
  2304. Here are a few examples---note how the @samp{N} mode is used when we do
  2305. computations in Lisp:
  2306. @table @asis
  2307. @item @samp{'(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))}
  2308. Swap the first two characters of the content of column 1.
  2309. @item @samp{'(+ $1 $2);N}
  2310. Add columns 1 and 2, equivalent to Calc's @samp{$1+$2}.
  2311. @item @samp{'(apply '+ '($1..$4));N}
  2312. Compute the sum of columns 1 to 4, like Calc's @samp{vsum($1..$4)}.
  2313. @end table
  2314. @node Durations and time values
  2315. @subsection Durations and time values
  2316. @cindex Duration, computing
  2317. @cindex Time, computing
  2318. @vindex org-table-duration-custom-format
  2319. If you want to compute time values use the @samp{T}, @samp{t}, or @samp{U} flag,
  2320. either in Calc formulas or Elisp formulas:
  2321. @example
  2322. | Task 1 | Task 2 | Total |
  2323. |---------+----------+----------|
  2324. | 2:12 | 1:47 | 03:59:00 |
  2325. | 2:12 | 1:47 | 03:59 |
  2326. | 3:02:20 | -2:07:00 | 0.92 |
  2327. #+TBLFM: @@2$3=$1+$2;T::@@3$3=$1+$2;U::@@4$3=$1+$2;t
  2328. @end example
  2329. Input duration values must be of the form @samp{HH:MM[:SS]}, where seconds
  2330. are optional. With the @samp{T} flag, computed durations are displayed as
  2331. @samp{HH:MM:SS} (see the first formula above). With the @samp{U} flag, seconds
  2332. are omitted so that the result is only @samp{HH:MM} (see second formula
  2333. above). Zero-padding of the hours field depends upon the value of the
  2334. variable @code{org-table-duration-hour-zero-padding}.
  2335. With the @samp{t} flag, computed durations are displayed according to the
  2336. value of the option @code{org-table-duration-custom-format}, which defaults
  2337. to @code{hours} and displays the result as a fraction of hours (see the
  2338. third formula in the example above).
  2339. Negative duration values can be manipulated as well, and integers are
  2340. considered as seconds in addition and subtraction.
  2341. @node Field and range formulas
  2342. @subsection Field and range formulas
  2343. @cindex field formula
  2344. @cindex range formula
  2345. @cindex formula, for individual table field
  2346. @cindex formula, for range of fields
  2347. To assign a formula to a particular field, type it directly into the
  2348. field, preceded by @samp{:=}, for example @samp{vsum(@@II..III)}. When you press
  2349. @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{C-c C-c} with the cursor
  2350. still in the field, the formula is stored as the formula for this
  2351. field, evaluated, and the current field is replaced with the result.
  2352. @cindex @samp{TBLFM}, keyword
  2353. Formulas are stored in a special @samp{TBLFM} keyword located directly
  2354. below the table. If you type the equation in the fourth field of the
  2355. third data line in the table, the formula looks like @samp{@@3$4=$1+$2}.
  2356. When inserting/deleting/swapping column and rows with the appropriate
  2357. commands, @emph{absolute references} (but not relative ones) in stored
  2358. formulas are modified in order to still reference the same field. To
  2359. avoid this from happening, in particular in range references, anchor
  2360. ranges at the table borders (using @samp{@@<}, @samp{@@>}, @samp{$<}, @samp{$>}), or at
  2361. hlines using the @samp{@@I} notation. Automatic adaptation of field
  2362. references does of course not happen if you edit the table structure
  2363. with normal editing commands---then you must fix the equations
  2364. yourself.
  2365. Instead of typing an equation into the field, you may also use the
  2366. following command
  2367. @table @asis
  2368. @item @kbd{C-u C-c =} (@code{org-table-eval-formula})
  2369. @kindex C-u C-c =
  2370. @findex org-table-eval-formula
  2371. Install a new formula for the current field. The command prompts
  2372. for a formula with default taken from the @samp{TBLFM} keyword,
  2373. applies it to the current field, and stores it.
  2374. @end table
  2375. The left-hand side of a formula can also be a special expression in
  2376. order to assign the formula to a number of different fields. There is
  2377. no keyboard shortcut to enter such range formulas. To add them, use
  2378. the formula editor (see @ref{Editing and debugging formulas}) or edit the
  2379. @samp{TBLFM} keyword directly.
  2380. @table @asis
  2381. @item @samp{$2=}
  2382. Column formula, valid for the entire column. This is so common
  2383. that Org treats these formulas in a special way, see @ref{Column formulas}.
  2384. @item @code{@@3=}
  2385. Row formula, applies to all fields in the specified row. @samp{@@>=}
  2386. means the last row.
  2387. @item @samp{@@1$2..@@4$3=}
  2388. Range formula, applies to all fields in the given rectangular
  2389. range. This can also be used to assign a formula to some but not
  2390. all fields in a row.
  2391. @item @samp{$NAME=}
  2392. Named field, see @ref{Advanced features}.
  2393. @end table
  2394. @node Column formulas
  2395. @subsection Column formulas
  2396. @cindex column formula
  2397. @cindex formula, for table column
  2398. When you assign a formula to a simple column reference like @samp{$3=}, the
  2399. same formula is used in all fields of that column, with the following
  2400. very convenient exceptions: (i) If the table contains horizontal
  2401. separator hlines with rows above and below, everything before the
  2402. first such hline is considered part of the table @emph{header} and is not
  2403. modified by column formulas. Therefore a header is mandatory when you
  2404. use column formulas and want to add hlines to group rows, like for
  2405. example to separate a total row at the bottom from the summand rows
  2406. above. (ii) Fields that already get a value from a field/range
  2407. formula are left alone by column formulas. These conditions make
  2408. column formulas very easy to use.
  2409. To assign a formula to a column, type it directly into any field in
  2410. the column, preceded by an equal sign, like @samp{=$1+$2}. When you press
  2411. @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{C-c C-c} with the cursor
  2412. still in the field, the formula is stored as the formula for the
  2413. current column, evaluated and the current field replaced with the
  2414. result. If the field contains only @samp{=}, the previously stored formula
  2415. for this column is used. For each column, Org only remembers the most
  2416. recently used formula. In the @samp{TBLFM} keyword, column formulas look
  2417. like @samp{$4=$1+$2}. The left-hand side of a column formula can not be
  2418. the name of column, it must be the numeric column reference or @samp{$>}.
  2419. Instead of typing an equation into the field, you may also use the
  2420. following command:
  2421. @table @asis
  2422. @item @kbd{C-c =} (@code{org-table-eval-formula})
  2423. @kindex C-c =
  2424. @findex org-table-eval-formula
  2425. Install a new formula for the current column and replace current
  2426. field with the result of the formula. The command prompts for
  2427. a formula, with default taken from the @samp{TBLFM} keyword, applies
  2428. it to the current field and stores it. With a numeric prefix
  2429. argument, e.g., @kbd{C-5 C-c =}, the command applies it to
  2430. that many consecutive fields in the current column.
  2431. @end table
  2432. @node Lookup functions
  2433. @subsection Lookup functions
  2434. @cindex lookup functions in tables
  2435. @cindex table lookup functions
  2436. Org has three predefined Emacs Lisp functions for lookups in tables.
  2437. @table @asis
  2438. @item @code{(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)}
  2439. @findex org-lookup-first
  2440. Searches for the first element @var{S} in list
  2441. @var{S-LIST} for which
  2442. @lisp
  2443. (PREDICATE VAL S)
  2444. @end lisp
  2445. is non-@code{nil}; returns the value from the corresponding position
  2446. in list @var{R-LIST}. The default @var{PREDICATE} is
  2447. @code{equal}. Note that the parameters @var{VAL} and
  2448. @var{S} are passed to @var{PREDICATE} in the same order
  2449. as the corresponding parameters are in the call to
  2450. @code{org-lookup-first}, where @var{VAL} precedes
  2451. @var{S-LIST}. If @var{R-LIST} is @code{nil}, the matching
  2452. element @var{S} of @var{S-LIST} is returned.
  2453. @item @code{(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)}
  2454. @findex org-lookup-last
  2455. Similar to @code{org-lookup-first} above, but searches for the @emph{last}
  2456. element for which @var{PREDICATE} is non-@code{nil}.
  2457. @item @code{(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)}
  2458. @findex org-lookup-all
  2459. Similar to @code{org-lookup-first}, but searches for @emph{all} elements
  2460. for which @var{PREDICATE} is non-@code{nil}, and returns @emph{all}
  2461. corresponding values. This function can not be used by itself in
  2462. a formula, because it returns a list of values. However,
  2463. powerful lookups can be built when this function is combined with
  2464. other Emacs Lisp functions.
  2465. @end table
  2466. If the ranges used in these functions contain empty fields, the @samp{E}
  2467. mode for the formula should usually be specified: otherwise empty
  2468. fields are not included in @var{S-LIST} and/or @var{R-LIST}
  2469. which can, for example, result in an incorrect mapping from an element
  2470. of @var{S-LIST} to the corresponding element of
  2471. @var{R-LIST}.
  2472. These three functions can be used to implement associative arrays,
  2473. count matching cells, rank results, group data, etc. For practical
  2474. examples see @uref{https://orgmode.org/worg/org-tutorials/org-lookups.html, this tutorial on Worg}.
  2475. @node Editing and debugging formulas
  2476. @subsection Editing and debugging formulas
  2477. @cindex formula editing
  2478. @cindex editing, of table formulas
  2479. @vindex org-table-use-standard-references
  2480. You can edit individual formulas in the minibuffer or directly in the
  2481. field. Org can also prepare a special buffer with all active formulas
  2482. of a table. When offering a formula for editing, Org converts
  2483. references to the standard format (like @samp{B3} or @samp{D&}) if possible. If
  2484. you prefer to only work with the internal format (like @samp{@@3$2} or
  2485. @samp{$4}), configure the variable @code{org-table-use-standard-references}.
  2486. @table @asis
  2487. @item @kbd{C-c =} or @kbd{C-u C-c =} (@code{org-table-eval-formula})
  2488. @kindex C-c =
  2489. @kindex C-u C-c =
  2490. @findex org-table-eval-formula
  2491. Edit the formula associated with the current column/field in the
  2492. minibuffer. See @ref{Column formulas}, and @ref{Field and range formulas}.
  2493. @item @kbd{C-u C-u C-c =} (@code{org-table-eval-formula})
  2494. @kindex C-u C-u C-c =
  2495. @findex org-table-eval-formula
  2496. Re-insert the active formula (either a field formula, or a column
  2497. formula) into the current field, so that you can edit it directly
  2498. in the field. The advantage over editing in the minibuffer is
  2499. that you can use the command @kbd{C-c ?}.
  2500. @item @kbd{C-c ?} (@code{org-table-field-info})
  2501. @kindex C-c ?
  2502. @findex org-table-field-info
  2503. While editing a formula in a table field, highlight the field(s)
  2504. referenced by the reference at the cursor position in the
  2505. formula.
  2506. @item @kbd{C-c @}} (@code{org-table-toggle-coordinate-overlays})
  2507. @kindex C-c @}
  2508. @findex org-table-toggle-coordinate-overlays
  2509. Toggle the display of row and column numbers for a table, using
  2510. overlays. These are updated each time the table is aligned; you
  2511. can force it with @kbd{C-c C-c}.
  2512. @item @kbd{C-c @{} (@code{org-table-toggle-formula-debugger})
  2513. @kindex C-c @{
  2514. @findex org-table-toggle-formula-debugger
  2515. Toggle the formula debugger on and off. See below.
  2516. @item @kbd{C-c '} (@code{org-table-edit-formulas})
  2517. @kindex C-c '
  2518. @findex org-table-edit-formulas
  2519. Edit all formulas for the current table in a special buffer,
  2520. where the formulas are displayed one per line. If the current
  2521. field has an active formula, the cursor in the formula editor
  2522. marks it. While inside the special buffer, Org automatically
  2523. highlights any field or range reference at the cursor position.
  2524. You may edit, remove and add formulas, and use the following
  2525. commands:
  2526. @table @asis
  2527. @item @kbd{C-c C-c} or @kbd{C-x C-s} (@code{org-table-fedit-finish})
  2528. @kindex C-x C-s
  2529. @kindex C-c C-c
  2530. @findex org-table-fedit-finish
  2531. Exit the formula editor and store the modified formulas. With
  2532. @kbd{C-u} prefix, also apply the new formulas to the
  2533. entire table.
  2534. @item @kbd{C-c C-q} (@code{org-table-fedit-abort})
  2535. @kindex C-c C-q
  2536. @findex org-table-fedit-abort
  2537. Exit the formula editor without installing changes.
  2538. @item @kbd{C-c C-r} (@code{org-table-fedit-toggle-ref-type})
  2539. @kindex C-c C-r
  2540. @findex org-table-fedit-toggle-ref-type
  2541. Toggle all references in the formula editor between standard
  2542. (like @samp{B3}) and internal (like @samp{@@3$2}).
  2543. @item @kbd{@key{TAB}} (@code{org-table-fedit-lisp-indent})
  2544. @kindex TAB
  2545. @findex org-table-fedit-lisp-indent
  2546. Pretty-print or indent Lisp formula at point. When in a line
  2547. containing a Lisp formula, format the formula according to
  2548. Emacs Lisp rules. Another @kbd{@key{TAB}} collapses the formula
  2549. back again. In the open formula, @kbd{@key{TAB}} re-indents
  2550. just like in Emacs Lisp mode.
  2551. @item @kbd{M-@key{TAB}} (@code{lisp-complete-symbol})
  2552. @kindex M-TAB
  2553. @findex lisp-complete-symbol
  2554. Complete Lisp symbols, just like in Emacs Lisp mode.
  2555. @item @kbd{S-@key{UP}}, @kbd{S-@key{DOWN}}, @kbd{S-@key{LEFT}}, @kbd{S-@key{RIGHT}}
  2556. @kindex S-UP
  2557. @kindex S-DOWN
  2558. @kindex S-LEFT
  2559. @kindex S-RIGHT
  2560. @findex org-table-fedit-ref-up
  2561. @findex org-table-fedit-ref-down
  2562. @findex org-table-fedit-ref-left
  2563. @findex org-table-fedit-ref-right
  2564. Shift the reference at point. For example, if the reference
  2565. is @samp{B3} and you press @kbd{S-@key{RIGHT}}, it becomes @samp{C3}.
  2566. This also works for relative references and for hline
  2567. references.
  2568. @item @kbd{M-S-@key{UP}} (@code{org-table-fedit-line-up})
  2569. @kindex M-S-UP
  2570. @findex org-table-fedit-line-up
  2571. Move the test line for column formulas up in the Org buffer.
  2572. @item @kbd{M-S-@key{DOWN}} (@code{org-table-fedit-line-down})
  2573. @kindex M-S-DOWN
  2574. @findex org-table-fedit-line-down
  2575. Move the test line for column formulas down in the Org buffer.
  2576. @item @kbd{M-@key{UP}} (@code{org-table-fedit-scroll-up})
  2577. @kindex M-UP
  2578. @findex org-table-fedit-scroll-up
  2579. Scroll up the window displaying the table.
  2580. @item @kbd{M-@key{DOWN}} (@code{org-table-fedit-scroll-down})
  2581. @kindex M-DOWN
  2582. @findex org-table-fedit-scroll-down
  2583. Scroll down the window displaying the table.
  2584. @item @kbd{C-c @}}
  2585. @kindex C-c @}
  2586. @findex org-table-toggle-coordinate-overlays
  2587. Turn the coordinate grid in the table on and off.
  2588. @end table
  2589. @end table
  2590. Making a table field blank does not remove the formula associated with
  2591. the field, because that is stored in a different line---the @samp{TBLFM}
  2592. keyword line. During the next recalculation, the field will be filled
  2593. again. To remove a formula from a field, you have to give an empty
  2594. reply when prompted for the formula, or to edit the @samp{TBLFM} keyword.
  2595. @kindex C-c C-c
  2596. You may edit the @samp{TBLFM} keyword directly and re-apply the changed
  2597. equations with @kbd{C-c C-c} in that line or with the normal
  2598. recalculation commands in the table.
  2599. @anchor{Using multiple @samp{TBLFM} lines}
  2600. @subsubheading Using multiple @samp{TBLFM} lines
  2601. @cindex multiple formula lines
  2602. @cindex @samp{TBLFM} keywords, multiple
  2603. @cindex @samp{TBLFM}, switching
  2604. @kindex C-c C-c
  2605. You may apply the formula temporarily. This is useful when you switch
  2606. the formula. Place multiple @samp{TBLFM} keywords right after the table,
  2607. and then press @kbd{C-c C-c} on the formula to apply. Here is an
  2608. example:
  2609. @example
  2610. | x | y |
  2611. |---+---|
  2612. | 1 | |
  2613. | 2 | |
  2614. #+TBLFM: $2=$1*1
  2615. #+TBLFM: $2=$1*2
  2616. @end example
  2617. @noindent
  2618. Pressing @kbd{C-c C-c} in the line of @samp{#+TBLFM: $2=$1*2} yields:
  2619. @example
  2620. | x | y |
  2621. |---+---|
  2622. | 1 | 2 |
  2623. | 2 | 4 |
  2624. #+TBLFM: $2=$1*1
  2625. #+TBLFM: $2=$1*2
  2626. @end example
  2627. @noindent
  2628. Note: If you recalculate this table, with @kbd{C-u C-c *}, for
  2629. example, you get the following result of applying only the first
  2630. @samp{TBLFM} keyword.
  2631. @example
  2632. | x | y |
  2633. |---+---|
  2634. | 1 | 1 |
  2635. | 2 | 2 |
  2636. #+TBLFM: $2=$1*1
  2637. #+TBLFM: $2=$1*2
  2638. @end example
  2639. @anchor{Debugging formulas}
  2640. @subsubheading Debugging formulas
  2641. @cindex formula debugging
  2642. @cindex debugging, of table formulas
  2643. When the evaluation of a formula leads to an error, the field content
  2644. becomes the string @samp{#ERROR}. If you would like to see what is going
  2645. on during variable substitution and calculation in order to find
  2646. a bug, turn on formula debugging in the Tbl menu and repeat the
  2647. calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in
  2648. a field. Detailed information are displayed.
  2649. @node Updating the table
  2650. @subsection Updating the table
  2651. @cindex recomputing table fields
  2652. @cindex updating, table
  2653. Recalculation of a table is normally not automatic, but needs to be
  2654. triggered by a command. To make recalculation at least
  2655. semi-automatic, see @ref{Advanced features}.
  2656. In order to recalculate a line of a table or the entire table, use the
  2657. following commands:
  2658. @table @asis
  2659. @item @kbd{C-c *} (@code{org-table-recalculate})
  2660. @kindex C-c *
  2661. @findex org-table-recalculate
  2662. Recalculate the current row by first applying the stored column
  2663. formulas from left to right, and all field/range formulas in the
  2664. current row.
  2665. @item @kbd{C-u C-c *} or @kbd{C-u C-c C-c}
  2666. @kindex C-u C-c *
  2667. @kindex C-u C-c C-c
  2668. Recompute the entire table, line by line. Any lines before the
  2669. first hline are left alone, assuming that these are part of the
  2670. table header.
  2671. @item @kbd{C-u C-u C-c *} or @kbd{C-u C-u C-c C-c} (@code{org-table-iterate})
  2672. @kindex C-u C-u C-c *
  2673. @kindex C-u C-u C-c C-c
  2674. @findex org-table-iterate
  2675. Iterate the table by recomputing it until no further changes
  2676. occur. This may be necessary if some computed fields use the
  2677. value of other fields that are computed @emph{later} in the
  2678. calculation sequence.
  2679. @item @kbd{M-x org-table-recalculate-buffer-tables}
  2680. @findex org-table-recalculate-buffer-tables
  2681. Recompute all tables in the current buffer.
  2682. @item @kbd{M-x org-table-iterate-buffer-tables}
  2683. @findex org-table-iterate-buffer-tables
  2684. Iterate all tables in the current buffer, in order to converge
  2685. table-to-table dependencies.
  2686. @end table
  2687. @node Advanced features
  2688. @subsection Advanced features
  2689. If you want the recalculation of fields to happen automatically, or if
  2690. you want to be able to assign @emph{names}@footnote{Such names must start with an alphabetic character and use
  2691. only alphanumeric/underscore characters.} to fields and columns,
  2692. you need to reserve the first column of the table for special marking
  2693. characters.
  2694. @table @asis
  2695. @item @kbd{C-#} (@code{org-table-rotate-recalc-marks})
  2696. @kindex C-#
  2697. @findex org-table-rotate-recalc-marks
  2698. Rotate the calculation mark in first column through the states
  2699. @samp{#}, @samp{*}, @samp{!}, @samp{$}. When there is an active region, change all
  2700. marks in the region.
  2701. @end table
  2702. Here is an example of a table that collects exam results of students
  2703. and makes use of these features:
  2704. @example
  2705. |---+---------+--------+--------+--------+-------+------|
  2706. | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
  2707. |---+---------+--------+--------+--------+-------+------|
  2708. | ! | | P1 | P2 | P3 | Tot | |
  2709. | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
  2710. | ^ | | m1 | m2 | m3 | mt | |
  2711. |---+---------+--------+--------+--------+-------+------|
  2712. | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
  2713. | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
  2714. |---+---------+--------+--------+--------+-------+------|
  2715. | | Average | | | | 25.0 | |
  2716. | ^ | | | | | at | |
  2717. | $ | max=50 | | | | | |
  2718. |---+---------+--------+--------+--------+-------+------|
  2719. #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
  2720. @end example
  2721. @noindent
  2722. @strong{Important}: please note that for these special tables, recalculating
  2723. the table with @kbd{C-u C-c *} only affects rows that are marked
  2724. @samp{#} or @samp{*}, and fields that have a formula assigned to the field
  2725. itself. The column formulas are not applied in rows with empty first
  2726. field.
  2727. @cindex marking characters, tables
  2728. The marking characters have the following meaning:
  2729. @table @asis
  2730. @item @samp{!}
  2731. The fields in this line define names for the columns, so that you
  2732. may refer to a column as @samp{$Tot} instead of @samp{$6}.
  2733. @item @samp{^}
  2734. This row defines names for the fields @emph{above} the row. With such
  2735. a definition, any formula in the table may use @samp{$m1} to refer to
  2736. the value @samp{10}. Also, if you assign a formula to a names field,
  2737. it is stored as @samp{$name = ...}.
  2738. @item @samp{_}
  2739. Similar to @samp{^}, but defines names for the fields in the row
  2740. @emph{below}.
  2741. @item @samp{$}
  2742. Fields in this row can define @emph{parameters} for formulas. For
  2743. example, if a field in a @samp{$} row contains @samp{max=50}, then formulas
  2744. in this table can refer to the value 50 using @samp{$max}. Parameters
  2745. work exactly like constants, only that they can be defined on
  2746. a per-table basis.
  2747. @item @samp{#}
  2748. Fields in this row are automatically recalculated when pressing
  2749. @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{S-@key{TAB}} in this row.
  2750. Also, this row is selected for a global recalculation with
  2751. @kbd{C-u C-c *}. Unmarked lines are left alone by this
  2752. command.
  2753. @item @samp{*}
  2754. Selects this line for global recalculation with @kbd{C-u C-c *}, but not for automatic recalculation. Use this when
  2755. automatic recalculation slows down editing too much.
  2756. @item @samp{/}
  2757. Do not export this line. Useful for lines that contain the
  2758. narrowing @samp{<N>} markers or column group markers.
  2759. @end table
  2760. Finally, just to whet your appetite for what can be done with the
  2761. fantastic Calc package, here is a table that computes the Taylor
  2762. series of degree n at location x for a couple of functions.
  2763. @example
  2764. |---+-------------+---+-----+--------------------------------------|
  2765. | | Func | n | x | Result |
  2766. |---+-------------+---+-----+--------------------------------------|
  2767. | # | exp(x) | 1 | x | 1 + x |
  2768. | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
  2769. | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
  2770. | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
  2771. | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
  2772. | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
  2773. |---+-------------+---+-----+--------------------------------------|
  2774. #+TBLFM: $5=taylor($2,$4,$3);n3
  2775. @end example
  2776. @node Org Plot
  2777. @section Org Plot
  2778. @cindex graph, in tables
  2779. @cindex plot tables using Gnuplot
  2780. Org Plot can produce graphs of information stored in Org tables,
  2781. either graphically or in ASCII art.
  2782. @anchor{Graphical plots using Gnuplot}
  2783. @subheading Graphical plots using Gnuplot
  2784. @cindex @samp{PLOT}, keyword
  2785. Org Plot can produce 2D and 3D graphs of information stored in Org
  2786. tables using @uref{http://www.gnuplot.info/, Gnuplot} and @uref{http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html, Gnuplot mode}. To see this in action, ensure
  2787. that you have both Gnuplot and Gnuplot mode installed on your system,
  2788. then call @kbd{C-c " g} or @kbd{M-x org-plot/gnuplot} on the
  2789. following table.
  2790. @example
  2791. #+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
  2792. | Sede | Max cites | H-index |
  2793. |-----------+-----------+---------|
  2794. | Chile | 257.72 | 21.39 |
  2795. | Leeds | 165.77 | 19.68 |
  2796. | Sao Paolo | 71.00 | 11.50 |
  2797. | Stockholm | 134.19 | 14.33 |
  2798. | Morelia | 257.56 | 17.67 |
  2799. @end example
  2800. Notice that Org Plot is smart enough to apply the table's headers as
  2801. labels. Further control over the labels, type, content, and
  2802. appearance of plots can be exercised through the @samp{PLOT} keyword
  2803. preceding a table. See below for a complete list of Org Plot options.
  2804. For more information and examples see the @uref{https://orgmode.org/worg/org-tutorials/org-plot.html, Org Plot tutorial}.
  2805. @anchor{Plot options}
  2806. @subsubheading Plot options
  2807. @table @asis
  2808. @item @samp{set}
  2809. Specify any Gnuplot option to be set when graphing.
  2810. @item @samp{title}
  2811. Specify the title of the plot.
  2812. @item @samp{ind}
  2813. Specify which column of the table to use as the @samp{x} axis.
  2814. @item @samp{deps}
  2815. Specify the columns to graph as a Lisp style list, surrounded by
  2816. parentheses and separated by spaces for example @samp{dep:(3 4)} to
  2817. graph the third and fourth columns. Defaults to graphing all
  2818. other columns aside from the @samp{ind} column.
  2819. @item @samp{type}
  2820. Specify whether the plot is @samp{2d}, @samp{3d}, or @samp{grid}.
  2821. @item @samp{with}
  2822. Specify a @samp{with} option to be inserted for every column being
  2823. plotted, e.g., @samp{lines}, @samp{points}, @samp{boxes}, @samp{impulses}. Defaults
  2824. to @samp{lines}.
  2825. @item @samp{file}
  2826. If you want to plot to a file, specify
  2827. @samp{"path/to/desired/output-file"}.
  2828. @item @samp{labels}
  2829. List of labels to be used for the @samp{deps}. Defaults to the column
  2830. headers if they exist.
  2831. @item @samp{line}
  2832. Specify an entire line to be inserted in the Gnuplot script.
  2833. @item @samp{map}
  2834. When plotting @samp{3d} or @samp{grid} types, set this to @samp{t} to graph
  2835. a flat mapping rather than a @samp{3d} slope.
  2836. @item @samp{timefmt}
  2837. Specify format of Org mode timestamps as they will be parsed by
  2838. Gnuplot. Defaults to @samp{%Y-%m-%d-%H:%M:%S}.
  2839. @item @samp{script}
  2840. If you want total control, you can specify a script file---place
  2841. the file name between double-quotes---which will be used to plot.
  2842. Before plotting, every instance of @samp{$datafile} in the specified
  2843. script will be replaced with the path to the generated data file.
  2844. Note: even if you set this option, you may still want to specify
  2845. the plot type, as that can impact the content of the data file.
  2846. @end table
  2847. @anchor{ASCII bar plots}
  2848. @subheading ASCII bar plots
  2849. While the cursor is on a column, typing @kbd{C-c `` a} or
  2850. @kbd{M-x orgtbl-ascii-plot} create a new column containing an
  2851. ASCII-art bars plot. The plot is implemented through a regular column
  2852. formula. When the source column changes, the bar plot may be updated
  2853. by refreshing the table, for example typing @kbd{C-u C-c *}.
  2854. @example
  2855. | Sede | Max cites | |
  2856. |---------------+-----------+--------------|
  2857. | Chile | 257.72 | WWWWWWWWWWWW |
  2858. | Leeds | 165.77 | WWWWWWWh |
  2859. | Sao Paolo | 71.00 | WWW; |
  2860. | Stockholm | 134.19 | WWWWWW: |
  2861. | Morelia | 257.56 | WWWWWWWWWWWH |
  2862. | Rochefourchat | 0.00 | |
  2863. #+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)
  2864. @end example
  2865. The formula is an Elisp call.
  2866. @defun orgtbl-ascii-draw value min max &optional width
  2867. Draw an ASCII bar in a table.
  2868. @var{VALUE} is the value to plot.
  2869. @var{MIN} is the value displayed as an empty bar. @var{MAX}
  2870. is the value filling all the @var{WIDTH}. Sources values outside
  2871. this range are displayed as @samp{too small} or @samp{too large}.
  2872. @var{WIDTH} is the number of characters of the bar plot. It
  2873. defaults to @samp{12}.
  2874. @end defun
  2875. @node Hyperlinks
  2876. @chapter Hyperlinks
  2877. @cindex hyperlinks
  2878. Like HTML, Org provides links inside a file, external links to
  2879. other files, Usenet articles, emails, and much more.
  2880. @menu
  2881. * Link Format:: How links in Org are formatted.
  2882. * Internal Links:: Links to other places in the current file.
  2883. * Radio Targets:: Make targets trigger links in plain text.
  2884. * External Links:: URL-like links to the world.
  2885. * Handling Links:: Creating, inserting and following.
  2886. * Using Links Outside Org:: Linking from my C source code?
  2887. * Link Abbreviations:: Shortcuts for writing complex links.
  2888. * Search Options:: Linking to a specific location.
  2889. * Custom Searches:: When the default search is not enough.
  2890. @end menu
  2891. @node Link Format
  2892. @section Link Format
  2893. @cindex link format
  2894. @cindex format, of links
  2895. Org recognizes plain URL-like links and activate them as clickable
  2896. links. The general link format, however, looks like this:
  2897. @example
  2898. [[LINK][DESCRIPTION]]
  2899. @end example
  2900. @noindent
  2901. or alternatively
  2902. @example
  2903. [[LINK]]
  2904. @end example
  2905. @noindent
  2906. Once a link in the buffer is complete (all brackets present), Org
  2907. changes the display so that @samp{DESCRIPTION} is displayed instead of
  2908. @samp{[[LINK][DESCRIPTION]]} and @samp{LINK} is displayed instead of @samp{[[LINK]]}. Links are be
  2909. highlighted in the face @code{org-link}, which by default is an underlined
  2910. face. You can directly edit the visible part of a link. Note that
  2911. this can be either the LINK part, if there is no description, or the
  2912. @var{DESCRIPTION} part. To edit also the invisible
  2913. @var{LINK} part, use @kbd{C-c C-l} with the cursor on the
  2914. link.
  2915. If you place the cursor at the beginning or just behind the end of the
  2916. displayed text and press @kbd{@key{BS}}, you remove
  2917. the---invisible---bracket at that location. This makes the link
  2918. incomplete and the internals are again displayed as plain text.
  2919. Inserting the missing bracket hides the link internals again. To show
  2920. the internal structure of all links, use the menu: Org @arrow{} Hyperlinks @arrow{}
  2921. Literal links.
  2922. @node Internal Links
  2923. @section Internal Links
  2924. @cindex internal links
  2925. @cindex links, internal
  2926. @cindex targets, for links
  2927. @cindex @samp{CUSTOM_ID}, property
  2928. If the link does not look like a URL, it is considered to be internal
  2929. in the current file. The most important case is a link like
  2930. @samp{[[#my-custom-id]]} which links to the entry with the @samp{CUSTOM_ID} property
  2931. @samp{my-custom-id}. You are responsible yourself to make sure these
  2932. custom IDs are unique in a file.
  2933. Links such as @samp{[[My Target]]} or @samp{[[My Target][Find my target]]} lead to a text search in
  2934. the current file.
  2935. The link can be followed with @kbd{C-c C-o} when the cursor is on
  2936. the link, or with a mouse click (see @ref{Handling Links}). Links to
  2937. custom IDs point to the corresponding headline. The preferred match
  2938. for a text link is a @emph{dedicated target}: the same string in double
  2939. angular brackets, like @samp{<<My Target>>}.
  2940. @cindex @samp{NAME}, keyword
  2941. If no dedicated target exists, the link tries to match the exact name
  2942. of an element within the buffer. Naming is done with the @samp{NAME}
  2943. keyword, which has to be put in the line before the element it refers
  2944. to, as in the following example
  2945. @example
  2946. #+NAME: My Target
  2947. | a | table |
  2948. |----+------------|
  2949. | of | four cells |
  2950. @end example
  2951. If none of the above succeeds, Org searches for a headline that is
  2952. exactly the link text but may also include a TODO keyword and
  2953. tags@footnote{To insert a link targeting a headline, in-buffer completion
  2954. can be used. Just type a star followed by a few optional letters into
  2955. the buffer and press @kbd{M-@key{TAB}}. All headlines in the current
  2956. buffer are offered as completions.}.
  2957. During export, internal links are used to mark objects and assign them
  2958. a number. Marked objects are then referenced by links pointing to
  2959. them. In particular, links without a description appear as the number
  2960. assigned to the marked object@footnote{When targeting a @samp{NAME} keyword, @samp{CAPTION} keyword is
  2961. mandatory in order to get proper numbering (see @ref{Images and Tables}).}. In the following excerpt from
  2962. an Org buffer
  2963. @example
  2964. 1. one item
  2965. 2. <<target>>another item
  2966. Here we refer to item [[target]].
  2967. @end example
  2968. @noindent
  2969. The last sentence will appear as @samp{Here we refer to item 2} when
  2970. exported.
  2971. In non-Org files, the search looks for the words in the link text. In
  2972. the above example the search would be for @samp{target}.
  2973. Following a link pushes a mark onto Org's own mark ring. You can
  2974. return to the previous position with @kbd{C-c &}. Using this
  2975. command several times in direct succession goes back to positions
  2976. recorded earlier.
  2977. @node Radio Targets
  2978. @section Radio Targets
  2979. @cindex radio targets
  2980. @cindex targets, radio
  2981. @cindex links, radio targets
  2982. Org can automatically turn any occurrences of certain target names in
  2983. normal text into a link. So without explicitly creating a link, the
  2984. text connects to the target radioing its position. Radio targets are
  2985. enclosed by triple angular brackets. For example, a target @samp{<<<My
  2986. Target>>>} causes each occurrence of @samp{my target} in normal text to
  2987. become activated as a link. The Org file is scanned automatically for
  2988. radio targets only when the file is first loaded into Emacs. To
  2989. update the target list during editing, press @kbd{C-c C-c} with
  2990. the cursor on or at a target.
  2991. @node External Links
  2992. @section External Links
  2993. @cindex links, external
  2994. @cindex external links
  2995. @cindex Gnus links
  2996. @cindex BBDB links
  2997. @cindex irc links
  2998. @cindex URL links
  2999. @cindex file links
  3000. @cindex Rmail links
  3001. @cindex MH-E links
  3002. @cindex Usenet links
  3003. @cindex shell links
  3004. @cindex Info links
  3005. @cindex Elisp links
  3006. Org supports links to files, websites, Usenet and email messages, BBDB
  3007. database entries and links to both IRC conversations and their logs.
  3008. External links are URL-like locators. They start with a short
  3009. identifying string followed by a colon. There can be no space after
  3010. the colon. The following list shows examples for each link type.
  3011. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  3012. @item @samp{http://www.astro.uva.nl/=dominik}
  3013. @tab on the web
  3014. @item @samp{doi:10.1000/182}
  3015. @tab DOI for an electronic resource
  3016. @item @samp{file:/home/dominik/images/jupiter.jpg}
  3017. @tab file, absolute path
  3018. @item @samp{/home/dominik/images/jupiter.jpg}
  3019. @tab same as above
  3020. @item @samp{file:papers/last.pdf}
  3021. @tab file, relative path
  3022. @item @samp{./papers/last.pdf}
  3023. @tab same as above
  3024. @item @samp{file:/ssh:me@@some.where:papers/last.pdf}
  3025. @tab file, path on remote machine
  3026. @item @samp{/ssh:me@@some.where:papers/last.pdf}
  3027. @tab same as above
  3028. @item @samp{file:sometextfile::NNN}
  3029. @tab file, jump to line number
  3030. @item @samp{file:projects.org}
  3031. @tab another Org file
  3032. @item @samp{file:projects.org::some words}
  3033. @tab text search in Org file@footnote{The actual behavior of the search depends on the value of the
  3034. variable @code{org-link-search-must-match-exact-headline}. If its value is
  3035. @code{nil}, then a fuzzy text search is done. If it is @code{t}, then only the
  3036. exact headline is matched, ignoring spaces and statistic cookies. If
  3037. the value is @code{query-to-create}, then an exact headline is searched; if
  3038. it is not found, then the user is queried to create it.}
  3039. @item @samp{file:projects.org::*task title}
  3040. @tab heading search in Org file
  3041. @item @samp{file+sys:/path/to/file}
  3042. @tab open via OS, like double-click
  3043. @item @samp{file+emacs:/path/to/file}
  3044. @tab force opening by Emacs
  3045. @item @samp{docview:papers/last.pdf::NNN}
  3046. @tab open in doc-view mode at page
  3047. @item @samp{id:B7423F4D-2E8A-471B-8810-C40F074717E9}
  3048. @tab Link to heading by ID
  3049. @item @samp{news:comp.emacs}
  3050. @tab Usenet link
  3051. @item @samp{mailto:adent@@galaxy.net}
  3052. @tab Mail link
  3053. @item @samp{mhe:folder}
  3054. @tab MH-E folder link
  3055. @item @samp{mhe:folder#id}
  3056. @tab MH-E message link
  3057. @item @samp{rmail:folder}
  3058. @tab Rmail folder link
  3059. @item @samp{rmail:folder#id}
  3060. @tab Rmail message link
  3061. @item @samp{gnus:group}
  3062. @tab Gnus group link
  3063. @item @samp{gnus:group#id}
  3064. @tab Gnus article link
  3065. @item @samp{bbdb:R.*Stallman}
  3066. @tab BBDB link (with regexp)
  3067. @item @samp{irc:/irc.com/#emacs/bob}
  3068. @tab IRC link
  3069. @item @samp{info:org#External links}
  3070. @tab Info node link
  3071. @item @samp{shell:ls *.org}
  3072. @tab A shell command
  3073. @item @samp{elisp:org-agenda}
  3074. @tab Interactive Elisp command
  3075. @item @samp{elisp:(find-file-other-frame "Elisp.org")}
  3076. @tab Elisp form to evaluate
  3077. @end multitable
  3078. @cindex VM links
  3079. @cindex Wanderlust links
  3080. On top of these built-in link types, some are available through the
  3081. @samp{contrib/} directory (see @ref{Installation}). For example, these links to
  3082. VM or Wanderlust messages are available when you load the
  3083. corresponding libraries from the @samp{contrib/} directory:
  3084. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaa}
  3085. @item @samp{vm:folder}
  3086. @tab VM folder link
  3087. @item @samp{vm:folder#id}
  3088. @tab VM message link
  3089. @item @samp{vm://myself@@some.where.org/folder#id}
  3090. @tab VM on remote machine
  3091. @item @samp{vm-imap:account:folder}
  3092. @tab VM IMAP folder link
  3093. @item @samp{vm-imap:account:folder#id}
  3094. @tab VM IMAP message link
  3095. @item @samp{wl:folder}
  3096. @tab Wanderlust folder link
  3097. @item @samp{wl:folder#id}
  3098. @tab Wanderlust message link
  3099. @end multitable
  3100. For customizing Org to add new link types, see @ref{Adding Hyperlink Types}.
  3101. A link should be enclosed in double brackets and may contain
  3102. a descriptive text to be displayed instead of the URL (see @ref{Link Format}), for example:
  3103. @example
  3104. [[http://www.gnu.org/software/emacs/][GNU Emacs]]
  3105. @end example
  3106. @noindent
  3107. If the description is a file name or URL that points to an image, HTML
  3108. export (see @ref{HTML Export}) inlines the image as a clickable button. If
  3109. there is no description at all and the link points to an image, that
  3110. image is inlined into the exported HTML file.
  3111. @cindex square brackets, around links
  3112. @cindex angular brackets, around links
  3113. @cindex plain text external links
  3114. Org also finds external links in the normal text and activates them as
  3115. links. If spaces must be part of the link (for example in
  3116. @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities about
  3117. the end of the link, enclose them in square or angular brackets.
  3118. @node Handling Links
  3119. @section Handling Links
  3120. @cindex links, handling
  3121. Org provides methods to create a link in the correct syntax, to insert
  3122. it into an Org file, and to follow the link.
  3123. @findex org-store-link
  3124. @cindex storing links
  3125. The main function is @code{org-store-link}, called with @kbd{M-x org-store-link}. Because of its importance, we suggest to bind it
  3126. to a widely available key (see @ref{Activation}). It stores a link to the
  3127. current location. The link is stored for later insertion into an Org
  3128. buffer---see below. What kind of link is created depends on the
  3129. current buffer:
  3130. @table @asis
  3131. @item @emph{Org mode buffers}
  3132. For Org files, if there is a @samp{<<target>>} at the cursor, the link
  3133. points to the target. Otherwise it points to the current
  3134. headline, which is also the description@footnote{If the headline contains a timestamp, it is removed from the
  3135. link, which results in a wrong link---you should avoid putting
  3136. a timestamp in the headline.}.
  3137. @vindex org-link-to-org-use-id
  3138. @cindex @samp{CUSTOM_ID}, property
  3139. @cindex @samp{ID}, property
  3140. If the headline has a @samp{CUSTOM_ID} property, store a link to this
  3141. custom ID. In addition or alternatively, depending on the value
  3142. of @code{org-link-to-org-use-id}, create and/or use a globally unique
  3143. ID property for the link@footnote{The Org Id library must first be loaded, either through
  3144. @code{org-customize}, by enabling @code{id} in @code{org-modules}, or by adding
  3145. @code{(require 'org-id)} in your Emacs init file.}. So using this command in Org
  3146. buffers potentially creates two links: a human-readable link from
  3147. the custom ID, and one that is globally unique and works even if
  3148. the entry is moved from file to file. Later, when inserting the
  3149. link, you need to decide which one to use.
  3150. @item @emph{Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus}
  3151. Pretty much all Emacs mail clients are supported. The link
  3152. points to the current article, or, in some Gnus buffers, to the
  3153. group. The description is constructed from the author and the
  3154. subject.
  3155. @item @emph{Web browsers: W3, W3M and EWW}
  3156. Here the link is the current URL, with the page title as
  3157. description.
  3158. @item @emph{Contacts: BBDB}
  3159. Links created in a BBDB buffer point to the current entry.
  3160. @item @emph{Chat: IRC}
  3161. @vindex org-irc-links-to-logs
  3162. For IRC links, if the variable @code{org-irc-link-to-logs} is
  3163. non-@code{nil}, create a @samp{file} style link to the relevant point in
  3164. the logs for the current conversation. Otherwise store an @samp{irc}
  3165. style link to the user/channel/server under the point.
  3166. @item @emph{Other files}
  3167. For any other file, the link points to the file, with a search
  3168. string (see @ref{Search Options}) pointing to the
  3169. contents of the current line. If there is an active region, the
  3170. selected words form the basis of the search string. If the
  3171. automatically created link is not working correctly or accurately
  3172. enough, you can write custom functions to select the search
  3173. string and to do the search for particular file types (see
  3174. @ref{Custom Searches}).
  3175. You can also define dedicated links to other files. See @ref{Adding Hyperlink Types}.
  3176. @item @emph{Agenda view}
  3177. When the cursor is in an agenda view, the created link points to
  3178. the entry referenced by the current line.
  3179. @end table
  3180. From an Org buffer, the following commands create, navigate or, more
  3181. generally, act on links.
  3182. @table @asis
  3183. @item @kbd{C-c C-l} (@code{org-insert-link})
  3184. @kindex C-c C-l
  3185. @findex org-insert-link
  3186. @cindex link completion
  3187. @cindex completion, of links
  3188. @cindex inserting links
  3189. @vindex org-keep-stored-link-after-insertion
  3190. Insert a link@footnote{Note that you do not have to use this command to insert
  3191. a link. Links in Org are plain text, and you can type or paste them
  3192. straight into the buffer. By using this command, the links are
  3193. automatically enclosed in double brackets, and you will be asked for
  3194. the optional descriptive text.}. This prompts for a link to be inserted
  3195. into the buffer. You can just type a link, using text for an
  3196. internal link, or one of the link type prefixes mentioned in the
  3197. examples above. The link is inserted into the buffer, along with
  3198. a descriptive text@footnote{After insertion of a stored link, the link will be removed
  3199. from the list of stored links. To keep it in the list later use, use
  3200. a triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or
  3201. configure the option @code{org-keep-stored-link-after-insertion}.}. If some text was selected at this
  3202. time, it becomes the default description.
  3203. @table @asis
  3204. @item @emph{Inserting stored links}
  3205. All links stored during the current session are part of the
  3206. history for this prompt, so you can access them with
  3207. @kbd{@key{UP}} and @kbd{@key{DOWN}} (or @kbd{M-p},
  3208. @kbd{M-n}).
  3209. @item @emph{Completion support}
  3210. Completion with @kbd{@key{TAB}} helps you to insert valid link
  3211. prefixes like @samp{http} or @samp{ftp}, including the prefixes defined
  3212. through link abbreviations (see @ref{Link Abbreviations}). If you
  3213. press @kbd{@key{RET}} after inserting only the prefix, Org
  3214. offers specific completion support for some link types@footnote{This works if a function has been defined in the @code{:complete}
  3215. property of a link in @code{org-link-parameters}.}.
  3216. For example, if you type @kbd{f i l e @key{RET}}---alternative
  3217. access: @kbd{C-u C-c C-l}, see below---Org offers file
  3218. name completion, and after @kbd{b b d b @key{RET}} you can
  3219. complete contact names.
  3220. @end table
  3221. @item @kbd{C-u C-c C-l}
  3222. @cindex file name completion
  3223. @cindex completion, of file names
  3224. @kindex C-u C-c C-l
  3225. When @kbd{C-c C-l} is called with a @kbd{C-u} prefix
  3226. argument, insert a link to a file. You may use file name
  3227. completion to select the name of the file. The path to the file
  3228. is inserted relative to the directory of the current Org file, if
  3229. the linked file is in the current directory or in a sub-directory
  3230. of it, or if the path is written relative to the current
  3231. directory using @samp{../}. Otherwise an absolute path is used, if
  3232. possible with @samp{~/} for your home directory. You can force an
  3233. absolute path with two @kbd{C-u} prefixes.
  3234. @item @kbd{C-c C-l} (with cursor on existing link)
  3235. @cindex following links
  3236. When the cursor is on an existing link, @kbd{C-c C-l} allows
  3237. you to edit the link and description parts of the link.
  3238. @item @kbd{C-c C-o} (@code{org-open-at-point})
  3239. @kindex C-c C-o
  3240. @findex org-open-at-point
  3241. @vindex org-file-apps
  3242. Open link at point. This launches a web browser for URL (using
  3243. @code{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
  3244. for the corresponding links, and execute the command in a shell
  3245. link. When the cursor is on an internal link, this command runs
  3246. the corresponding search. When the cursor is on a TAG list in
  3247. a headline, it creates the corresponding TAGS view. If the
  3248. cursor is on a timestamp, it compiles the agenda for that date.
  3249. Furthermore, it visits text and remote files in @samp{file} links with
  3250. Emacs and select a suitable application for local non-text files.
  3251. Classification of files is based on file extension only. See
  3252. option @code{org-file-apps}. If you want to override the default
  3253. application and visit the file with Emacs, use a @kbd{C-u}
  3254. prefix. If you want to avoid opening in Emacs, use a @kbd{C-u C-u} prefix.
  3255. @vindex org-link-frame-setup
  3256. If the cursor is on a headline, but not on a link, offer all
  3257. links in the headline and entry text. If you want to setup the
  3258. frame configuration for following links, customize
  3259. @code{org-link-frame-setup}.
  3260. @item @kbd{@key{RET}}
  3261. @vindex org-return-follows-link
  3262. @kindex RET
  3263. When @code{org-return-follows-link} is set, @kbd{@key{RET}} also
  3264. follows the link at point.
  3265. @item @kbd{mouse-2} or @kbd{mouse-1}
  3266. @kindex mouse-2
  3267. @kindex mouse-1
  3268. On links, @kbd{mouse-1} and @kbd{mouse-2} opens the
  3269. link just as @kbd{C-c C-o} does.
  3270. @item @kbd{mouse-3}
  3271. @vindex org-display-internal-link-with-indirect-buffer
  3272. @kindex mouse-3
  3273. Like @kbd{mouse-2}, but force file links to be opened with
  3274. Emacs, and internal links to be displayed in another
  3275. window@footnote{See the variable @code{org-display-internal-link-with-indirect-buffer}.}.
  3276. @item @kbd{C-c C-x C-v} (@code{org-toggle-inline-images})
  3277. @cindex inlining images
  3278. @cindex images, inlining
  3279. @vindex org-startup-with-inline-images
  3280. @kindex C-c C-x C-v
  3281. @findex org-toggle-inline-images
  3282. Toggle the inline display of linked images. Normally this only
  3283. inlines images that have no description part in the link, i.e.,
  3284. images that are inlined during export. When called with a prefix
  3285. argument, also display images that do have a link description.
  3286. You can ask for inline images to be displayed at startup by
  3287. configuring the variable @code{org-startup-with-inline-images}@footnote{The variable @code{org-startup-with-inline-images} can be set
  3288. within a buffer with the @samp{STARTUP} options @samp{inlineimages} and
  3289. @samp{noinlineimages}.}.
  3290. @item @kbd{C-c %} (@code{org-mark-ring-push})
  3291. @kindex C-c %
  3292. @findex org-mark-ring-push
  3293. @cindex mark ring
  3294. Push the current position onto the mark ring, to be able to
  3295. return easily. Commands following an internal link do this
  3296. automatically.
  3297. @item @kbd{C-c &} (@code{org-mark-ring-goto})
  3298. @kindex C-c &
  3299. @findex org-mark-ring-goto
  3300. @cindex links, returning to
  3301. Jump back to a recorded position. A position is recorded by the
  3302. commands following internal links, and by @kbd{C-c %}.
  3303. Using this command several times in direct succession moves
  3304. through a ring of previously recorded positions.
  3305. @item @kbd{C-c C-x C-n} (@code{org-next-link})
  3306. @itemx @kbd{C-c C-x C-p} (@code{org-previous-link})
  3307. @kindex C-c C-x C-p
  3308. @findex org-previous-link
  3309. @kindex C-c C-x C-n
  3310. @findex org-next-link
  3311. @cindex links, finding next/previous
  3312. Move forward/backward to the next link in the buffer. At the
  3313. limit of the buffer, the search fails once, and then wraps
  3314. around. The key bindings for this are really too long; you might
  3315. want to bind this also to @kbd{M-n} and @kbd{M-p}.
  3316. @lisp
  3317. (add-hook 'org-load-hook
  3318. (lambda ()
  3319. (define-key org-mode-map "\M-n" 'org-next-link)
  3320. (define-key org-mode-map "\M-p" 'org-previous-link)))
  3321. @end lisp
  3322. @end table
  3323. @node Using Links Outside Org
  3324. @section Using Links Outside Org
  3325. @findex org-insert-link-global
  3326. @findex org-open-at-point-global
  3327. You can insert and follow links that have Org syntax not only in Org,
  3328. but in any Emacs buffer. For this, Org provides two functions:
  3329. @code{org-insert-link-global} and @code{org-open-at-point-global}.
  3330. You might want to bind them to globally available keys. See
  3331. @ref{Activation} for some advice.
  3332. @node Link Abbreviations
  3333. @section Link Abbreviations
  3334. @cindex link abbreviations
  3335. @cindex abbreviation, links
  3336. Long URL can be cumbersome to type, and often many similar links are
  3337. needed in a document. For this you can use link abbreviations. An
  3338. abbreviated link looks like this
  3339. @example
  3340. [[linkword:tag][description]]
  3341. @end example
  3342. @noindent
  3343. @vindex org-link-abbrev-alist
  3344. where the tag is optional. The @emph{linkword} must be a word, starting
  3345. with a letter, followed by letters, numbers, @samp{-}, and @samp{_}.
  3346. Abbreviations are resolved according to the information in the
  3347. variable @code{org-link-abbrev-alist} that relates the linkwords to
  3348. replacement text. Here is an example:
  3349. @lisp
  3350. (setq org-link-abbrev-alist
  3351. '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
  3352. ("url-to-ja" . "http://translate.google.fr/translate?sl=en&tl=ja&u=%h")
  3353. ("google" . "http://www.google.com/search?q=")
  3354. ("gmap" . "http://maps.google.com/maps?q=%s")
  3355. ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
  3356. ("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")))
  3357. @end lisp
  3358. If the replacement text contains the string @samp{%s}, it is replaced with
  3359. the tag. Using @samp{%h} instead of @samp{%s} percent-encodes the tag (see the
  3360. example above, where we need to encode the URL parameter). Using
  3361. @samp{%(my-function)} passes the tag to a custom function, and replace it
  3362. by the resulting string.
  3363. If the replacement text do not contain any specifier, it is simply
  3364. appended to the string in order to create the link.
  3365. Instead of a string, you may also specify a function that will be
  3366. called with the tag as the only argument to create the link.
  3367. With the above setting, you could link to a specific bug with
  3368. @samp{[[bugzilla:129]]}, search the web for @samp{OrgMode} with @samp{[[google:OrgMode]]},
  3369. show the map location of the Free Software Foundation @samp{[[gmap:51
  3370. Franklin Street, Boston]]} or of Carsten office @samp{[[omap:Science Park 904,
  3371. Amsterdam, The Netherlands]]} and find out what the Org author is doing
  3372. besides Emacs hacking with @samp{[[ads:Dominik,C]]}.
  3373. If you need special abbreviations just for a single Org buffer, you
  3374. can define them in the file with
  3375. @cindex @samp{LINK}, keyword
  3376. @example
  3377. #+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
  3378. #+LINK: google http://www.google.com/search?q=%s
  3379. @end example
  3380. @noindent
  3381. In-buffer completion (see @ref{Completion}) can be used after @samp{[} to
  3382. complete link abbreviations. You may also define a function that
  3383. implements special (e.g., completion) support for inserting such
  3384. a link with @kbd{C-c C-l}. Such a function should not accept any
  3385. arguments, and return the full link with prefix. You can set the link
  3386. completion function like this:
  3387. @lisp
  3388. (org-link-set-parameter "type" :complete #'some-completion-function)
  3389. @end lisp
  3390. @node Search Options
  3391. @section Search Options in File Links
  3392. @cindex search option in file links
  3393. @cindex file links, searching
  3394. File links can contain additional information to make Emacs jump to
  3395. a particular location in the file when following a link. This can be
  3396. a line number or a search option after a double colon@footnote{For backward compatibility, line numbers can also follow a
  3397. single colon.}. For
  3398. example, when the command @code{org-store-link} creates a link (see
  3399. @ref{Handling Links}) to a file, it encodes the words in the current line
  3400. as a search string that can be used to find this line back later when
  3401. following the link with @kbd{C-c C-o}.
  3402. Here is the syntax of the different ways to attach a search to a file
  3403. link, together with an explanation:
  3404. @example
  3405. [[file:~/code/main.c::255]]
  3406. [[file:~/xx.org::My Target]]
  3407. [[file:~/xx.org::*My Target]]
  3408. [[file:~/xx.org::#my-custom-id]]
  3409. [[file:~/xx.org::/regexp/]]
  3410. @end example
  3411. @table @asis
  3412. @item @samp{255}
  3413. Jump to line 255.
  3414. @item @samp{My Target}
  3415. Search for a link target @samp{<<My Target>>}, or do a text search for
  3416. @samp{my target}, similar to the search in internal links, see
  3417. @ref{Internal Links}. In HTML export (see @ref{HTML Export}), such a file
  3418. link becomes a HTML reference to the corresponding named anchor
  3419. in the linked file.
  3420. @item @samp{*My Target}
  3421. In an Org file, restrict search to headlines.
  3422. @item @samp{#my-custom-id}
  3423. Link to a heading with a @samp{CUSTOM_ID} property
  3424. @item @samp{/REGEXP/}
  3425. Do a regular expression search for @var{REGEXP}. This uses
  3426. the Emacs command @code{occur} to list all matches in a separate
  3427. window. If the target file is in Org mode, @code{org-occur} is used
  3428. to create a sparse tree with the matches.
  3429. @end table
  3430. As a degenerate case, a file link with an empty file name can be used
  3431. to search the current file. For example, @samp{[[file:::find me]]} does
  3432. a search for @samp{find me} in the current file, just as @samp{[[find me]]} would.
  3433. @node Custom Searches
  3434. @section Custom Searches
  3435. @cindex custom search strings
  3436. @cindex search strings, custom
  3437. The default mechanism for creating search strings and for doing the
  3438. actual search related to a file link may not work correctly in all
  3439. cases. For example, Bib@TeX{} database files have many entries like
  3440. @code{year="1993"} which would not result in good search strings, because
  3441. the only unique identification for a Bib@TeX{} entry is the citation key.
  3442. @vindex org-create-file-search-functions
  3443. @vindex org-execute-file-search-functions
  3444. If you come across such a problem, you can write custom functions to
  3445. set the right search string for a particular file type, and to do the
  3446. search for the string in the file. Using @code{add-hook}, these functions
  3447. need to be added to the hook variables
  3448. @code{org-create-file-search-functions} and
  3449. @code{org-execute-file-search-functions}. See the docstring for these
  3450. variables for more information. Org actually uses this mechanism for
  3451. Bib@TeX{} database files, and you can use the corresponding code as an
  3452. implementation example. See the file @samp{org-bibtex.el}.
  3453. @node TODO Items
  3454. @chapter TODO Items
  3455. @cindex TODO items
  3456. Org mode does not maintain TODO lists as separate documents@footnote{Of course, you can make a document that contains only long
  3457. lists of TODO items, but this is not required.}.
  3458. Instead, TODO items are an integral part of the notes file, because
  3459. TODO items usually come up while taking notes! With Org mode, simply
  3460. mark any entry in a tree as being a TODO item. In this way,
  3461. information is not duplicated, and the entire context from which the
  3462. TODO item emerged is always present.
  3463. Of course, this technique for managing TODO items scatters them
  3464. throughout your notes file. Org mode compensates for this by
  3465. providing methods to give you an overview of all the things that you
  3466. have to do.
  3467. @menu
  3468. * TODO Basics:: Marking and displaying TODO entries.
  3469. * TODO Extensions:: Workflow and assignments.
  3470. * Progress Logging:: Dates and notes for progress.
  3471. * Priorities:: Some things are more important than others.
  3472. * Breaking Down Tasks:: Splitting a task into manageable pieces.
  3473. * Checkboxes:: Tick-off lists.
  3474. @end menu
  3475. @node TODO Basics
  3476. @section Basic TODO Functionality
  3477. Any headline becomes a TODO item when it starts with the word @samp{TODO},
  3478. for example:
  3479. @example
  3480. *** TODO Write letter to Sam Fortune
  3481. @end example
  3482. @noindent
  3483. The most important commands to work with TODO entries are:
  3484. @table @asis
  3485. @item @kbd{C-c C-t} (@code{org-todo})
  3486. @kindex C-c C-t
  3487. @cindex cycling, of TODO states
  3488. Rotate the TODO state of the current item among
  3489. @example
  3490. ,-> (unmarked) -> TODO -> DONE --.
  3491. '--------------------------------'
  3492. @end example
  3493. If TODO keywords have fast access keys (see @ref{Fast access to TODO states}), prompt for a TODO keyword through the fast
  3494. selection interface; this is the default behavior when
  3495. @code{org-use-fast-todo-selection} is non-@code{nil}.
  3496. The same rotation can also be done ``remotely'' from the timeline
  3497. and agenda buffers with the @kbd{t} command key (see
  3498. @ref{Agenda Commands}).
  3499. @item @kbd{C-u C-c C-t}
  3500. @kindex C-u C-c C-t
  3501. When TODO keywords have no selection keys, select a specific
  3502. keyword using completion; otherwise force cycling through TODO
  3503. states with no prompt. When @code{org-use-fast-todo-selection} is set
  3504. to @code{prefix}, use the fast selection interface.
  3505. @item @kbd{S-@key{RIGHT}} @kbd{S-@key{LEFT}}
  3506. @kindex S-RIGHT
  3507. @kindex S-LEFT
  3508. @vindex org-treat-S-cursor-todo-selection-as-state-change
  3509. Select the following/preceding TODO state, similar to cycling.
  3510. Useful mostly if more than two TODO states are possible (see
  3511. @ref{TODO Extensions}). See also @ref{Conflicts}, for a discussion of the interaction with
  3512. @code{shift-selection-mode}. See also the variable
  3513. @code{org-treat-S-cursor-todo-selection-as-state-change}.
  3514. @item @kbd{C-c / t} (@code{org-show-todo-tree})
  3515. @kindex C-c / t
  3516. @cindex sparse tree, for TODO
  3517. @vindex org-todo-keywords
  3518. @findex org-show-todo-tree
  3519. View TODO items in a @emph{sparse tree} (see @ref{Sparse Trees}). Folds
  3520. the entire buffer, but shows all TODO items---with not-DONE
  3521. state---and the headings hierarchy above them. With a prefix
  3522. argument, or by using @kbd{C-c / T}, search for a specific
  3523. TODO. You are prompted for the keyword, and you can also give
  3524. a list of keywords like @samp{KWD1|KWD2|...} to list entries that
  3525. match any one of these keywords. With a numeric prefix argument
  3526. N, show the tree for the Nth keyword in the variable
  3527. @code{org-todo-keywords}. With two prefix arguments, find all TODO
  3528. states, both un-done and done.
  3529. @item @kbd{C-c a t} (@code{org-todo-list})
  3530. @kindex C-c a t
  3531. Show the global TODO list. Collects the TODO items (with
  3532. not-DONE states) from all agenda files (see @ref{Agenda Views}) into
  3533. a single buffer. The new buffer is in Org Agenda mode, which
  3534. provides commands to examine and manipulate the TODO entries from
  3535. the new buffer (see @ref{Agenda Commands}). See @ref{Global TODO list}, for more information.
  3536. @item @kbd{S-M-@key{RET}} (@code{org-insert-todo-heading})
  3537. @kindex S-M-RET
  3538. @findex org-insert-todo-heading
  3539. Insert a new TODO entry below the current one.
  3540. @end table
  3541. @vindex org-todo-state-tags-triggers
  3542. @noindent
  3543. Changing a TODO state can also trigger tag changes. See the docstring
  3544. of the option @code{org-todo-state-tags-triggers} for details.
  3545. @node TODO Extensions
  3546. @section Extended Use of TODO Keywords
  3547. @cindex extended TODO keywords
  3548. @vindex org-todo-keywords
  3549. By default, marked TODO entries have one of only two states: TODO and
  3550. DONE. Org mode allows you to classify TODO items in more complex ways
  3551. with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With special
  3552. setup, the TODO keyword system can work differently in different
  3553. files.
  3554. Note that @emph{tags} are another way to classify headlines in general and
  3555. TODO items in particular (see @ref{Tags}).
  3556. @menu
  3557. * Workflow states:: From TODO to DONE in steps.
  3558. * TODO types:: I do this, Fred does the rest.
  3559. * Multiple sets in one file:: Mixing it all, still finding your way.
  3560. * Fast access to TODO states:: Single letter selection of state.
  3561. * Per-file keywords:: Different files, different requirements.
  3562. * Faces for TODO keywords:: Highlighting states.
  3563. * TODO dependencies:: When one task needs to wait for others.
  3564. @end menu
  3565. @node Workflow states
  3566. @subsection TODO keywords as workflow states
  3567. @cindex TODO workflow
  3568. @cindex workflow states as TODO keywords
  3569. You can use TODO keywords to indicate different @emph{sequential} states in
  3570. the process of working on an item, for example@footnote{Changing the variable @code{org-todo-keywords} only becomes
  3571. effective after restarting Org mode in a buffer.}:
  3572. @lisp
  3573. (setq org-todo-keywords
  3574. '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
  3575. @end lisp
  3576. The vertical bar separates the TODO keywords (states that @emph{need
  3577. action}) from the DONE states (which need @emph{no further action}). If
  3578. you do not provide the separator bar, the last state is used as the
  3579. DONE state.
  3580. @cindex completion, of TODO keywords
  3581. With this setup, the command @kbd{C-c C-t} cycles an entry from
  3582. @samp{TODO} to @samp{FEEDBACK}, then to @samp{VERIFY}, and finally to @samp{DONE} and
  3583. @samp{DELEGATED}. You may also use a numeric prefix argument to quickly
  3584. select a specific state. For example @kbd{C-3 C-c C-t} changes
  3585. the state immediately to @samp{VERIFY}. Or you can use @kbd{S-@key{LEFT}}
  3586. to go backward through the sequence. If you define many keywords, you
  3587. can use in-buffer completion (see @ref{Completion}) or even a special
  3588. one-key selection scheme (see @ref{Fast access to TODO states}) to insert
  3589. these words into the buffer. Changing a TODO state can be logged with
  3590. a timestamp, see @ref{Tracking TODO state changes}, for more information.
  3591. @node TODO types
  3592. @subsection TODO keywords as types
  3593. @cindex TODO types
  3594. @cindex names as TODO keywords
  3595. @cindex types as TODO keywords
  3596. The second possibility is to use TODO keywords to indicate different
  3597. @emph{types} of action items. For example, you might want to indicate that
  3598. items are for ``work'' or ``home''. Or, when you work with several people
  3599. on a single project, you might want to assign action items directly to
  3600. persons, by using their names as TODO keywords. This would be set up
  3601. like this:
  3602. @lisp
  3603. (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
  3604. @end lisp
  3605. In this case, different keywords do not indicate a sequence, but
  3606. rather different types. So the normal work flow would be to assign
  3607. a task to a person, and later to mark it DONE. Org mode supports this
  3608. style by adapting the workings of the command @kbd{C-c C-t}@footnote{This is also true for the @kbd{t} command in the timeline
  3609. and agenda buffers.}. When used several times in succession, it still
  3610. cycles through all names, in order to first select the right type for
  3611. a task. But when you return to the item after some time and execute
  3612. @kbd{C-c C-t} again, it will switch from any name directly to
  3613. @samp{DONE}. Use prefix arguments or completion to quickly select
  3614. a specific name. You can also review the items of a specific TODO
  3615. type in a sparse tree by using a numeric prefix to @kbd{C-c / t}.
  3616. For example, to see all things Lucy has to do, you would use
  3617. @kbd{C-3 C-c / t}. To collect Lucy's items from all agenda files
  3618. into a single buffer, you would use the numeric prefix argument as
  3619. well when creating the global TODO list: @kbd{C-3 C-c a t}.
  3620. @node Multiple sets in one file
  3621. @subsection Multiple keyword sets in one file
  3622. @cindex TODO keyword sets
  3623. Sometimes you may want to use different sets of TODO keywords in
  3624. parallel. For example, you may want to have the basic TODO/DONE, but
  3625. also a workflow for bug fixing, and a separate state indicating that
  3626. an item has been canceled---so it is not DONE, but also does not
  3627. require action. Your setup would then look like this:
  3628. @lisp
  3629. (setq org-todo-keywords
  3630. '((sequence "TODO" "|" "DONE")
  3631. (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
  3632. (sequence "|" "CANCELED")))
  3633. @end lisp
  3634. The keywords should all be different, this helps Org mode to keep
  3635. track of which subsequence should be used for a given entry. In this
  3636. setup, @kbd{C-c C-t} only operates within a subsequence, so it
  3637. switches from @samp{DONE} to (nothing) to @samp{TODO}, and from @samp{FIXED} to
  3638. (nothing) to @samp{REPORT}. Therefore you need a mechanism to initially
  3639. select the correct sequence. Besides the obvious ways like typing
  3640. a keyword or using completion, you may also apply the following
  3641. commands:
  3642. @table @asis
  3643. @item @kbd{C-u C-u C-c C-t}
  3644. @itemx @kbd{C-S-@key{RIGHT}}
  3645. @itemx @kbd{C-S-@key{LEFT}}
  3646. @kindex C-S-RIGHT
  3647. @kindex C-S-LEFT
  3648. @kindex C-u C-u C-c C-t
  3649. These keys jump from one TODO subset to the next. In the above
  3650. example, @kbd{C-u C-u C-c C-t} or @kbd{C-S-@key{RIGHT}} would
  3651. jump from @samp{TODO} or @samp{DONE} to @samp{REPORT}, and any of the words in
  3652. the second row to @samp{CANCELED}. Note that the @kbd{C-S-} key
  3653. binding conflict with @code{shift-selection-mode} (see @ref{Conflicts}).
  3654. @item @kbd{S-@key{RIGHT}}
  3655. @itemx @kbd{S-@key{LEFT}}
  3656. @kindex S-RIGHT
  3657. @kindex S-LEFT
  3658. @kbd{S-@key{LEFT}} and @kbd{S-@key{RIGHT}} walk through @emph{all}
  3659. keywords from all sets, so for example @kbd{S-@key{RIGHT}} would
  3660. switch from @samp{DONE} to @samp{REPORT} in the example above. For
  3661. a discussion of the interaction with @code{shift-selection-mode}, see
  3662. @ref{Conflicts}.
  3663. @end table
  3664. @node Fast access to TODO states
  3665. @subsection Fast access to TODO states
  3666. If you would like to quickly change an entry to an arbitrary TODO
  3667. state instead of cycling through the states, you can set up keys for
  3668. single-letter access to the states. This is done by adding the
  3669. selection character after each keyword, in parentheses@footnote{All characters are allowed except @samp{@@}, @samp{^} and @samp{!}, which have
  3670. a special meaning here.}. For
  3671. example:
  3672. @lisp
  3673. (setq org-todo-keywords
  3674. '((sequence "TODO(t)" "|" "DONE(d)")
  3675. (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
  3676. (sequence "|" "CANCELED(c)")))
  3677. @end lisp
  3678. @vindex org-fast-tag-selection-include-todo
  3679. If you then press @kbd{C-c C-t} followed by the selection key,
  3680. the entry is switched to this state. @kbd{@key{SPC}} can be used to
  3681. remove any TODO keyword from an entry@footnote{Check also the variable @code{org-fast-tag-selection-include-todo},
  3682. it allows you to change the TODO state through the tags interface
  3683. (@ref{Setting Tags}), in case you like to mingle the two concepts. Note
  3684. that this means you need to come up with unique keys across both sets
  3685. of keywords.}.
  3686. @node Per-file keywords
  3687. @subsection Setting up keywords for individual files
  3688. @cindex keyword options
  3689. @cindex per-file keywords
  3690. @cindex @samp{TODO}, keyword
  3691. @cindex @samp{TYP_TODO}, keyword
  3692. @cindex @samp{SEQ_TODO}, keyword
  3693. It can be very useful to use different aspects of the TODO mechanism
  3694. in different files. For file-local settings, you need to add special
  3695. lines to the file which set the keywords and interpretation for that
  3696. file only. For example, to set one of the two examples discussed
  3697. above, you need one of the following lines, starting in column zero
  3698. anywhere in the file:
  3699. @example
  3700. #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
  3701. @end example
  3702. @noindent
  3703. you may also write @samp{#+SEQ_TODO} to be explicit about the
  3704. interpretation, but it means the same as @samp{#+TODO}, or
  3705. @example
  3706. #+TYP_TODO: Fred Sara Lucy Mike | DONE
  3707. @end example
  3708. A setup for using several sets in parallel would be:
  3709. @example
  3710. #+TODO: TODO | DONE
  3711. #+TODO: REPORT BUG KNOWNCAUSE | FIXED
  3712. #+TODO: | CANCELED
  3713. @end example
  3714. @cindex completion, of option keywords
  3715. @kindex M-TAB
  3716. @noindent
  3717. To make sure you are using the correct keyword, type @samp{#+} into the
  3718. buffer and then use @kbd{M-@key{TAB}} completion.
  3719. @cindex DONE, final TODO keyword
  3720. Remember that the keywords after the vertical bar---or the last
  3721. keyword if no bar is there---must always mean that the item is DONE,
  3722. although you may use a different word. After changing one of these
  3723. lines, use @kbd{C-c C-c} with the cursor still in the line to
  3724. make the changes known to Org mode@footnote{Org mode parses these lines only when Org mode is activated
  3725. after visiting a file. @kbd{C-c C-c} with the cursor in a line
  3726. starting with @samp{#+} is simply restarting Org mode for the current
  3727. buffer.}.
  3728. @node Faces for TODO keywords
  3729. @subsection Faces for TODO keywords
  3730. @cindex faces, for TODO keywords
  3731. @vindex org-todo, face
  3732. @vindex org-done, face
  3733. @vindex org-todo-keyword-faces
  3734. Org mode highlights TODO keywords with special faces: @code{org-todo} for
  3735. keywords indicating that an item still has to be acted upon, and
  3736. @code{org-done} for keywords indicating that an item is finished. If you
  3737. are using more than two different states, you might want to use
  3738. special faces for some of them. This can be done using the variable
  3739. @code{org-todo-keyword-faces}. For example:
  3740. @lisp
  3741. (setq org-todo-keyword-faces
  3742. '(("TODO" . org-warning) ("STARTED" . "yellow")
  3743. ("CANCELED" . (:foreground "blue" :weight bold))))
  3744. @end lisp
  3745. @vindex org-faces-easy-properties
  3746. While using a list with face properties as shown for @samp{CANCELED}
  3747. @emph{should} work, this does not always seem to be the case. If
  3748. necessary, define a special face and use that. A string is
  3749. interpreted as a color. The variable @code{org-faces-easy-properties}
  3750. determines if that color is interpreted as a foreground or
  3751. a background color.
  3752. @node TODO dependencies
  3753. @subsection TODO dependencies
  3754. @cindex TODO dependencies
  3755. @cindex dependencies, of TODO states
  3756. @vindex org-enforce-todo-dependencies
  3757. @cindex @samp{ORDERED}, property
  3758. The structure of Org files---hierarchy and lists---makes it easy to
  3759. define TODO dependencies. Usually, a parent TODO task should not be
  3760. marked DONE until all subtasks, defined as children tasks, are marked
  3761. as DONE. And sometimes there is a logical sequence to a number of
  3762. (sub)tasks, so that one task cannot be acted upon before all siblings
  3763. above it are done. If you customize the variable
  3764. @code{org-enforce-todo-dependencies}, Org blocks entries from changing
  3765. state to DONE while they have children that are not DONE.
  3766. Furthermore, if an entry has a property @samp{ORDERED}, each of its
  3767. children is blocked until all earlier siblings are marked DONE. Here
  3768. is an example:
  3769. @example
  3770. * TODO Blocked until (two) is done
  3771. ** DONE one
  3772. ** TODO two
  3773. * Parent
  3774. :PROPERTIES:
  3775. :ORDERED: t
  3776. :END:
  3777. ** TODO a
  3778. ** TODO b, needs to wait for (a)
  3779. ** TODO c, needs to wait for (a) and (b)
  3780. @end example
  3781. @cindex TODO dependencies, NOBLOCKING
  3782. @cindex NOBLOCKING, property
  3783. You can ensure an entry is never blocked by using the @samp{NOBLOCKING}
  3784. property:
  3785. @example
  3786. * This entry is never blocked
  3787. :PROPERTIES:
  3788. :NOBLOCKING: t
  3789. :END:
  3790. @end example
  3791. @table @asis
  3792. @item @kbd{C-c C-x o} (@code{org-toggle-ordered-property})
  3793. @kindex C-c C-x o
  3794. @findex org-toggle-ordered-property
  3795. @vindex org-track-ordered-property-with-tag
  3796. Toggle the @samp{ORDERED} property of the current entry. A property
  3797. is used for this behavior because this should be local to the
  3798. current entry, not inherited like a tag. However, if you would
  3799. like to @emph{track} the value of this property with a tag for better
  3800. visibility, customize the variable
  3801. @code{org-track-ordered-property-with-tag}.
  3802. @item @kbd{C-u C-u C-u C-c C-t}
  3803. @kindex C-u C-u C-u C-c C-t
  3804. Change TODO state, circumventing any state blocking.
  3805. @end table
  3806. @vindex org-agenda-dim-blocked-tasks
  3807. If you set the variable @code{org-agenda-dim-blocked-tasks}, TODO entries
  3808. that cannot be closed because of such dependencies are shown in
  3809. a dimmed font or even made invisible in agenda views (see @ref{Agenda Views}).
  3810. @cindex checkboxes and TODO dependencies
  3811. @vindex org-enforce-todo-dependencies
  3812. You can also block changes of TODO states by looking at checkboxes
  3813. (see @ref{Checkboxes}). If you set the variable
  3814. @code{org-enforce-todo-checkbox-dependencies}, an entry that has unchecked
  3815. checkboxes is blocked from switching to DONE.
  3816. If you need more complex dependency structures, for example
  3817. dependencies between entries in different trees or files, check out
  3818. the contributed module @samp{org-depend.el}.
  3819. @node Progress Logging
  3820. @section Progress Logging
  3821. @cindex progress logging
  3822. @cindex logging, of progress
  3823. Org mode can automatically record a timestamp and possibly a note when
  3824. you mark a TODO item as DONE, or even each time you change the state
  3825. of a TODO item. This system is highly configurable, settings can be
  3826. on a per-keyword basis and can be localized to a file or even
  3827. a subtree. For information on how to clock working time for a task,
  3828. see @ref{Clocking Work Time}.
  3829. @menu
  3830. * Closing items:: When was this entry marked DONE?
  3831. * Tracking TODO state changes:: When did the status change?
  3832. * Tracking your habits:: How consistent have you been?
  3833. @end menu
  3834. @node Closing items
  3835. @subsection Closing items
  3836. The most basic logging is to keep track of @emph{when} a certain TODO item
  3837. was finished. This is achieved with@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP: logdone}.}
  3838. @lisp
  3839. (setq org-log-done 'time)
  3840. @end lisp
  3841. @vindex org-closed-keep-when-no-todo
  3842. @noindent
  3843. Then each time you turn an entry from a TODO (not-done) state into any
  3844. of the DONE states, a line @samp{CLOSED: [timestamp]} is inserted just
  3845. after the headline. If you turn the entry back into a TODO item
  3846. through further state cycling, that line is removed again. If you
  3847. turn the entry back to a non-TODO state (by pressing @kbd{C-c C-t @key{SPC}} for example), that line is also removed, unless you set
  3848. @code{org-closed-keep-when-no-todo} to non-@code{nil}. If you want to record
  3849. a note along with the timestamp, use@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP:
  3850. lognotedone}.}
  3851. @lisp
  3852. (setq org-log-done 'note)
  3853. @end lisp
  3854. @noindent
  3855. You are then be prompted for a note, and that note is stored below the
  3856. entry with a @samp{Closing Note} heading.
  3857. @node Tracking TODO state changes
  3858. @subsection Tracking TODO state changes
  3859. @cindex drawer, for state change recording
  3860. @vindex org-log-states-order-reversed
  3861. @vindex org-log-into-drawer
  3862. @cindex @samp{LOG_INTO_DRAWER}, property
  3863. When TODO keywords are used as workflow states (see @ref{Workflow states, , *Workflow states}),
  3864. you might want to keep track of when a state change occurred and maybe
  3865. take a note about this change. You can either record just
  3866. a timestamp, or a time-stamped note for a change. These records are
  3867. inserted after the headline as an itemized list, newest first@footnote{See the variable @code{org-log-states-order-reversed}.}.
  3868. When taking a lot of notes, you might want to get the notes out of the
  3869. way into a drawer (see @ref{Drawers}). Customize the variable
  3870. @code{org-log-into-drawer} to get this behavior---the recommended drawer
  3871. for this is called @samp{LOGBOOK}@footnote{Note that the @samp{LOGBOOK} drawer is unfolded when pressing
  3872. @kbd{@key{SPC}} in the agenda to show an entry---use @kbd{C-u @key{SPC}} to keep it folded here.}. You can also overrule the
  3873. setting of this variable for a subtree by setting a @samp{LOG_INTO_DRAWER}
  3874. property.
  3875. Since it is normally too much to record a note for every state, Org
  3876. mode expects configuration on a per-keyword basis for this. This is
  3877. achieved by adding special markers @samp{!} (for a timestamp) or @samp{@@} (for
  3878. a note with timestamp) in parentheses after each keyword. For
  3879. example, with the setting
  3880. @lisp
  3881. (setq org-todo-keywords
  3882. '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
  3883. @end lisp
  3884. @noindent
  3885. to record a timestamp without a note for TODO keywords configured with
  3886. @samp{@@}, just type @kbd{C-c C-c} to enter a blank note when prompted.
  3887. @vindex org-log-done
  3888. @noindent
  3889. You not only define global TODO keywords and fast access keys, but
  3890. also request that a time is recorded when the entry is set to @samp{DONE},
  3891. and that a note is recorded when switching to @samp{WAIT} or
  3892. @samp{CANCELED}@footnote{It is possible that Org mode records two timestamps when you
  3893. are using both @code{org-log-done} and state change logging. However, it
  3894. never prompts for two notes: if you have configured both, the state
  3895. change recording note takes precedence and cancel the closing note.}. The setting for @samp{WAIT} is even more special: the
  3896. @samp{!} after the slash means that in addition to the note taken when
  3897. entering the state, a timestamp should be recorded when @emph{leaving} the
  3898. @samp{WAIT} state, if and only if the @emph{target} state does not configure
  3899. logging for entering it. So it has no effect when switching from
  3900. @samp{WAIT} to @samp{DONE}, because @samp{DONE} is configured to record a timestamp
  3901. only. But when switching from @samp{WAIT} back to @samp{TODO}, the @samp{/!} in the
  3902. @samp{WAIT} setting now triggers a timestamp even though @samp{TODO} has no
  3903. logging configured.
  3904. You can use the exact same syntax for setting logging preferences local
  3905. to a buffer:
  3906. @example
  3907. #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
  3908. @end example
  3909. @cindex @samp{LOGGING}, property
  3910. In order to define logging settings that are local to a subtree or
  3911. a single item, define a @samp{LOGGING} property in this entry. Any
  3912. non-empty @samp{LOGGING} property resets all logging settings to @code{nil}.
  3913. You may then turn on logging for this specific tree using @samp{STARTUP}
  3914. keywords like @samp{lognotedone} or @samp{logrepeat}, as well as adding state
  3915. specific settings like @samp{TODO(!)}. For example:
  3916. @example
  3917. * TODO Log each state with only a time
  3918. :PROPERTIES:
  3919. :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
  3920. :END:
  3921. * TODO Only log when switching to WAIT, and when repeating
  3922. :PROPERTIES:
  3923. :LOGGING: WAIT(@@) logrepeat
  3924. :END:
  3925. * TODO No logging at all
  3926. :PROPERTIES:
  3927. :LOGGING: nil
  3928. :END:
  3929. @end example
  3930. @node Tracking your habits
  3931. @subsection Tracking your habits
  3932. @cindex habits
  3933. @cindex STYLE, property
  3934. Org has the ability to track the consistency of a special category of
  3935. TODO, called ``habits.'' A habit has the following properties:
  3936. @enumerate
  3937. @item
  3938. You have enabled the @code{habits} module by customizing the variable
  3939. @code{org-modules}.
  3940. @item
  3941. The habit is a TODO item, with a TODO keyword representing an open
  3942. state.
  3943. @item
  3944. The property @samp{STYLE} is set to the value @samp{habit}.
  3945. @item
  3946. The TODO has a scheduled date, usually with a @samp{.+} style repeat
  3947. interval. A @samp{++} style may be appropriate for habits with time
  3948. constraints, e.g., must be done on weekends, or a @samp{+} style for an
  3949. unusual habit that can have a backlog, e.g., weekly reports.
  3950. @item
  3951. The TODO may also have minimum and maximum ranges specified by
  3952. using the syntax @samp{.+2d/3d}, which says that you want to do the task
  3953. at least every three days, but at most every two days.
  3954. @item
  3955. You must also have state logging for the DONE state enabled (see
  3956. @ref{Tracking TODO state changes}), in order for historical data to be
  3957. represented in the consistency graph. If it is not enabled it is
  3958. not an error, but the consistency graphs are largely meaningless.
  3959. @end enumerate
  3960. To give you an idea of what the above rules look like in action, here's an
  3961. actual habit with some history:
  3962. @example
  3963. ** TODO Shave
  3964. SCHEDULED: <2009-10-17 Sat .+2d/4d>
  3965. :PROPERTIES:
  3966. :STYLE: habit
  3967. :LAST_REPEAT: [2009-10-19 Mon 00:36]
  3968. :END:
  3969. - State "DONE" from "TODO" [2009-10-15 Thu]
  3970. - State "DONE" from "TODO" [2009-10-12 Mon]
  3971. - State "DONE" from "TODO" [2009-10-10 Sat]
  3972. - State "DONE" from "TODO" [2009-10-04 Sun]
  3973. - State "DONE" from "TODO" [2009-10-02 Fri]
  3974. - State "DONE" from "TODO" [2009-09-29 Tue]
  3975. - State "DONE" from "TODO" [2009-09-25 Fri]
  3976. - State "DONE" from "TODO" [2009-09-19 Sat]
  3977. - State "DONE" from "TODO" [2009-09-16 Wed]
  3978. - State "DONE" from "TODO" [2009-09-12 Sat]
  3979. @end example
  3980. What this habit says is: I want to shave at most every 2 days---given
  3981. by the @samp{SCHEDULED} date and repeat interval---and at least every
  3982. 4 days. If today is the 15th, then the habit first appears in the
  3983. agenda on Oct 17, after the minimum of 2 days has elapsed, and will
  3984. appear overdue on Oct 19, after four days have elapsed.
  3985. What's really useful about habits is that they are displayed along
  3986. with a consistency graph, to show how consistent you've been at
  3987. getting that task done in the past. This graph shows every day that
  3988. the task was done over the past three weeks, with colors for each day.
  3989. The colors used are:
  3990. @table @asis
  3991. @item Blue
  3992. If the task was not to be done yet on that day.
  3993. @item Green
  3994. If the task could have been done on that day.
  3995. @item Yellow
  3996. If the task was going to be overdue the next day.
  3997. @item Red
  3998. If the task was overdue on that day.
  3999. @end table
  4000. In addition to coloring each day, the day is also marked with an
  4001. asterisk if the task was actually done that day, and an exclamation
  4002. mark to show where the current day falls in the graph.
  4003. There are several configuration variables that can be used to change
  4004. the way habits are displayed in the agenda.
  4005. @table @asis
  4006. @item @code{org-habit-graph-column}
  4007. @vindex org-habit-graph-column
  4008. The buffer column at which the consistency graph should be drawn.
  4009. This overwrites any text in that column, so it is a good idea to
  4010. keep your habits' titles brief and to the point.
  4011. @item @code{org-habit-preceding-days}
  4012. @vindex org-habit-preceding-days
  4013. The amount of history, in days before today, to appear in
  4014. consistency graphs.
  4015. @item @code{org-habit-following-days}
  4016. @vindex org-habit-following-days
  4017. The number of days after today that appear in consistency graphs.
  4018. @item @code{org-habit-show-habits-only-for-today}
  4019. @vindex org-habit-show-habits-only-for-today
  4020. If non-@code{nil}, only show habits in today's agenda view. This is
  4021. set to true by default.
  4022. @end table
  4023. Lastly, pressing @kbd{K} in the agenda buffer causes habits to
  4024. temporarily be disabled and do not appear at all. Press @kbd{K}
  4025. again to bring them back. They are also subject to tag filtering, if
  4026. you have habits which should only be done in certain contexts, for
  4027. example.
  4028. @node Priorities
  4029. @section Priorities
  4030. @cindex priorities
  4031. @cindex priority cookie
  4032. If you use Org mode extensively, you may end up with enough TODO items
  4033. that it starts to make sense to prioritize them. Prioritizing can be
  4034. done by placing a @emph{priority cookie} into the headline of a TODO item,
  4035. like this
  4036. @example
  4037. *** TODO [#A] Write letter to Sam Fortune
  4038. @end example
  4039. @vindex org-priority-faces
  4040. @noindent
  4041. By default, Org mode supports three priorities: @samp{A}, @samp{B}, and @samp{C}.
  4042. @samp{A} is the highest priority. An entry without a cookie is treated
  4043. just like priority @samp{B}. Priorities make a difference only for sorting
  4044. in the agenda (see @ref{Weekly/daily agenda}); outside the agenda, they
  4045. have no inherent meaning to Org mode. The cookies can be highlighted
  4046. with special faces by customizing the variable @code{org-priority-faces}.
  4047. Priorities can be attached to any outline node; they do not need to be
  4048. TODO items.
  4049. @table @asis
  4050. @item @kbd{C-c ,} (@code{org-priority})
  4051. @kindex C-c ,
  4052. @findex org-priority
  4053. Set the priority of the current headline. The command prompts
  4054. for a priority character @samp{A}, @samp{B} or @samp{C}. When you press
  4055. @kbd{@key{SPC}} instead, the priority cookie is removed from the
  4056. headline. The priorities can also be changed ``remotely'' from the
  4057. timeline and agenda buffer with the @kbd{,} command (see
  4058. @ref{Agenda Commands}).
  4059. @item @kbd{S-@key{UP}} (@code{org-priority-up})
  4060. @itemx @kbd{S-@key{DOWN}} (@code{org-priority-down})
  4061. @kindex S-UP
  4062. @kindex S-DOWN
  4063. @findex org-priority-up
  4064. @findex org-priority-down
  4065. @vindex org-priority-start-cycle-with-default
  4066. Increase/decrease priority of current headline@footnote{See also the option @code{org-priority-start-cycle-with-default}.}. Note that
  4067. these keys are also used to modify timestamps (see @ref{Creating Timestamps}). See also @ref{Conflicts}, for
  4068. a discussion of the interaction with @code{shift-selection-mode}.
  4069. @end table
  4070. @vindex org-highest-priority
  4071. @vindex org-lowest-priority
  4072. @vindex org-default-priority
  4073. You can change the range of allowed priorities by setting the
  4074. variables @code{org-highest-priority}, @code{org-lowest-priority}, and
  4075. @code{org-default-priority}. For an individual buffer, you may set these
  4076. values (highest, lowest, default) like this (please make sure that the
  4077. highest priority is earlier in the alphabet than the lowest priority):
  4078. @cindex @samp{PRIORITIES}, keyword
  4079. @example
  4080. #+PRIORITIES: A C B
  4081. @end example
  4082. @node Breaking Down Tasks
  4083. @section Breaking Down Tasks into Subtasks
  4084. @cindex tasks, breaking down
  4085. @cindex statistics, for TODO items
  4086. @vindex org-agenda-todo-list-sublevels
  4087. It is often advisable to break down large tasks into smaller,
  4088. manageable subtasks. You can do this by creating an outline tree
  4089. below a TODO item, with detailed subtasks on the tree@footnote{To keep subtasks out of the global TODO list, see the
  4090. @code{org-agenda-todo-list-sublevels}.}. To keep
  4091. the overview over the fraction of subtasks that are already completed,
  4092. insert either @samp{[/]} or @samp{[%]} anywhere in the headline. These cookies
  4093. are updated each time the TODO status of a child changes, or when
  4094. pressing @kbd{C-c C-c} on the cookie. For example:
  4095. @example
  4096. * Organize Party [33%]
  4097. ** TODO Call people [1/2]
  4098. *** TODO Peter
  4099. *** DONE Sarah
  4100. ** TODO Buy food
  4101. ** DONE Talk to neighbor
  4102. @end example
  4103. @cindex @samp{COOKIE_DATA}, property
  4104. If a heading has both checkboxes and TODO children below it, the
  4105. meaning of the statistics cookie become ambiguous. Set the property
  4106. @samp{COOKIE_DATA} to either @samp{checkbox} or @samp{todo} to resolve this issue.
  4107. @vindex org-hierarchical-todo-statistics
  4108. If you would like to have the statistics cookie count any TODO entries
  4109. in the subtree (not just direct children), configure the variable
  4110. @code{org-hierarchical-todo-statistics}. To do this for a single subtree,
  4111. include the word @samp{recursive} into the value of the @samp{COOKIE_DATA}
  4112. property.
  4113. @example
  4114. * Parent capturing statistics [2/20]
  4115. :PROPERTIES:
  4116. :COOKIE_DATA: todo recursive
  4117. :END:
  4118. @end example
  4119. If you would like a TODO entry to automatically change to DONE when
  4120. all children are done, you can use the following setup:
  4121. @lisp
  4122. (defun org-summary-todo (n-done n-not-done)
  4123. "Switch entry to DONE when all subentries are done, to TODO otherwise."
  4124. (let (org-log-done org-log-states) ; turn off logging
  4125. (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
  4126. (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
  4127. @end lisp
  4128. Another possibility is the use of checkboxes to identify (a hierarchy
  4129. of) a large number of subtasks (see @ref{Checkboxes}).
  4130. @node Checkboxes
  4131. @section Checkboxes
  4132. @cindex checkboxes
  4133. @vindex org-list-automatic-rules
  4134. Every item in a plain list@footnote{With the exception of description lists. But you can allow it
  4135. by modifying @code{org-list-automatic-rules} accordingly.} (see @ref{Plain Lists}) can be made into
  4136. a checkbox by starting it with the string @samp{[ ]}. This feature is
  4137. similar to TODO items (see @ref{TODO Items}), but is more lightweight.
  4138. Checkboxes are not included into the global TODO list, so they are
  4139. often great to split a task into a number of simple steps. Or you can
  4140. use them in a shopping list. To toggle a checkbox, use @kbd{C-c C-c}, or use the mouse (thanks to Piotr Zielinski's
  4141. @samp{org-mouse.el}).
  4142. Here is an example of a checkbox list.
  4143. @example
  4144. * TODO Organize party [2/4]
  4145. - [-] call people [1/3]
  4146. - [ ] Peter
  4147. - [X] Sarah
  4148. - [ ] Sam
  4149. - [X] order food
  4150. - [ ] think about what music to play
  4151. - [X] talk to the neighbors
  4152. @end example
  4153. Checkboxes work hierarchically, so if a checkbox item has children
  4154. that are checkboxes, toggling one of the children checkboxes makes the
  4155. parent checkbox reflect if none, some, or all of the children are
  4156. checked.
  4157. @cindex statistics, for checkboxes
  4158. @cindex checkbox statistics
  4159. @cindex @samp{COOKIE_DATA}, property
  4160. @vindex org-hierarchical-checkbox-statistics
  4161. The @samp{[2/4]} and @samp{[1/3]} in the first and second line are cookies
  4162. indicating how many checkboxes present in this entry have been checked
  4163. off, and the total number of checkboxes present. This can give you an
  4164. idea on how many checkboxes remain, even without opening a folded
  4165. entry. The cookies can be placed into a headline or into (the first
  4166. line of) a plain list item. Each cookie covers checkboxes of direct
  4167. children structurally below the headline/item on which the cookie
  4168. appears@footnote{Set the variable @code{org-hierarchical-checkbox-statistics} if you
  4169. want such cookies to count all checkboxes below the cookie, not just
  4170. those belonging to direct children.}. You have to insert the cookie yourself by typing
  4171. either @samp{[/]} or @samp{[%]}. With @samp{[/]} you get an @samp{n out of m} result, as
  4172. in the examples above. With @samp{[%]} you get information about the
  4173. percentage of checkboxes checked (in the above example, this would be
  4174. @samp{[50%]} and @samp{[33%]}, respectively). In a headline, a cookie can count
  4175. either checkboxes below the heading or TODO states of children, and it
  4176. displays whatever was changed last. Set the property @samp{COOKIE_DATA} to
  4177. either @samp{checkbox} or @samp{todo} to resolve this issue.
  4178. @cindex blocking, of checkboxes
  4179. @cindex checkbox blocking
  4180. @cindex @samp{ORDERED}, property
  4181. If the current outline node has an @samp{ORDERED} property, checkboxes must
  4182. be checked off in sequence, and an error is thrown if you try to check
  4183. off a box while there are unchecked boxes above it.
  4184. @noindent
  4185. The following commands work with checkboxes:
  4186. @table @asis
  4187. @item @kbd{C-c C-c} (@code{org-toggle-checkbox})
  4188. @kindex C-c C-c
  4189. @findex org-toggle-checkbox
  4190. Toggle checkbox status or---with prefix argument---checkbox
  4191. presence at point. With a single prefix argument, add an empty
  4192. checkbox or remove the current one@footnote{@kbd{C-u C-c C-c} on the @emph{first} item of a list with no
  4193. checkbox adds checkboxes to the rest of the list.}. With a double prefix
  4194. argument, set it to @samp{[-]}, which is considered to be an
  4195. intermediate state.
  4196. @item @kbd{C-c C-x C-b} (@code{org-toggle-checkbox})
  4197. @kindex C-c C-x C-b
  4198. Toggle checkbox status or---with prefix argument---checkbox
  4199. presence at point. With double prefix argument, set it to @samp{[-]},
  4200. which is considered to be an intermediate state.
  4201. @itemize
  4202. @item
  4203. If there is an active region, toggle the first checkbox in the
  4204. region and set all remaining boxes to the same status as the
  4205. first. With a prefix argument, add or remove the checkbox for
  4206. all items in the region.
  4207. @item
  4208. If the cursor is in a headline, toggle checkboxes in the region
  4209. between this headline and the next---so @emph{not} the entire
  4210. subtree.
  4211. @item
  4212. If there is no active region, just toggle the checkbox at
  4213. point.
  4214. @end itemize
  4215. @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading})
  4216. @kindex M-S-RET
  4217. @findex org-insert-todo-heading
  4218. Insert a new item with a checkbox. This works only if the cursor
  4219. is already in a plain list item (see @ref{Plain Lists}).
  4220. @item @kbd{C-c C-x o} (@code{org-toggle-ordered-property})
  4221. @kindex C-c C-x o
  4222. @findex org-toggle-ordered-property
  4223. @vindex org-track-ordered-property-with-tag
  4224. Toggle the @samp{ORDERED} property of the entry, to toggle if
  4225. checkboxes must be checked off in sequence. A property is used
  4226. for this behavior because this should be local to the current
  4227. entry, not inherited like a tag. However, if you would like to
  4228. @emph{track} the value of this property with a tag for better
  4229. visibility, customize @code{org-track-ordered-property-with-tag}.
  4230. @item @kbd{C-c #} (@code{org-update-statistics-cookies})
  4231. @kindex C-c #
  4232. @findex org-update-statistics-cookies
  4233. Update the statistics cookie in the current outline entry. When
  4234. called with a @kbd{C-u} prefix, update the entire file.
  4235. Checkbox statistic cookies are updated automatically if you
  4236. toggle checkboxes with @kbd{C-c C-c} and make new ones with
  4237. @kbd{M-S-@key{RET}}. TODO statistics cookies update when changing
  4238. TODO states. If you delete boxes/entries or add/change them by
  4239. hand, use this command to get things back into sync.
  4240. @end table
  4241. @node Tags
  4242. @chapter Tags
  4243. @cindex tags
  4244. @cindex headline tagging
  4245. @cindex matching, tags
  4246. @cindex sparse tree, tag based
  4247. An excellent way to implement labels and contexts for
  4248. cross-correlating information is to assign @emph{tags} to headlines. Org
  4249. mode has extensive support for tags.
  4250. @vindex org-tag-faces
  4251. Every headline can contain a list of tags; they occur at the end of
  4252. the headline. Tags are normal words containing letters, numbers, @samp{_},
  4253. and @samp{@@}. Tags must be preceded and followed by a single colon, e.g.,
  4254. @samp{:work:}. Several tags can be specified, as in @samp{:work:urgent:}. Tags
  4255. by default are in bold face with the same color as the headline. You
  4256. may specify special faces for specific tags using the variable
  4257. @code{org-tag-faces}, in much the same way as you can for TODO keywords
  4258. (see @ref{Faces for TODO keywords}).
  4259. @menu
  4260. * Tag Inheritance:: Tags use the tree structure of an outline.
  4261. * Setting Tags:: How to assign tags to a headline.
  4262. * Tag Hierarchy:: Create a hierarchy of tags.
  4263. * Tag Searches:: Searching for combinations of tags.
  4264. @end menu
  4265. @node Tag Inheritance
  4266. @section Tag Inheritance
  4267. @cindex tag inheritance
  4268. @cindex inheritance, of tags
  4269. @cindex sublevels, inclusion into tags match
  4270. @emph{Tags} make use of the hierarchical structure of outline trees. If
  4271. a heading has a certain tag, all subheadings inherit the tag as well.
  4272. For example, in the list
  4273. @example
  4274. * Meeting with the French group :work:
  4275. ** Summary by Frank :boss:notes:
  4276. *** TODO Prepare slides for him :action:
  4277. @end example
  4278. @noindent
  4279. the final heading has the tags @samp{work}, @samp{boss}, @samp{notes}, and @samp{action}
  4280. even though the final heading is not explicitly marked with those
  4281. tags. You can also set tags that all entries in a file should inherit
  4282. just as if these tags were defined in a hypothetical level zero that
  4283. surrounds the entire file. Use a line like this@footnote{As with all these in-buffer settings, pressing @kbd{C-c C-c} activates any changes in the line.}
  4284. @cindex @samp{FILETAGS}, keyword
  4285. @example
  4286. #+FILETAGS: :Peter:Boss:Secret:
  4287. @end example
  4288. @vindex org-use-tag-inheritance
  4289. @vindex org-tags-exclude-from-inheritance
  4290. @noindent
  4291. To limit tag inheritance to specific tags, or to turn it off entirely,
  4292. use the variables @code{org-use-tag-inheritance} and
  4293. @code{org-tags-exclude-from-inheritance}.
  4294. @vindex org-tags-match-list-sublevels
  4295. When a headline matches during a tags search while tag inheritance is
  4296. turned on, all the sublevels in the same tree---for a simple match
  4297. form---match as well@footnote{This is only true if the search does not involve more complex
  4298. tests including properties (see @ref{Property Searches}).}. The list of matches may then become
  4299. very long. If you only want to see the first tags match in a subtree,
  4300. configure the variable @code{org-tags-match-list-sublevels} (not
  4301. recommended).
  4302. @vindex org-agenda-use-tag-inheritance
  4303. Tag inheritance is relevant when the agenda search tries to match
  4304. a tag, either in the @code{tags} or @code{tags-todo} agenda types. In other
  4305. agenda types, @code{org-use-tag-inheritance} has no effect. Still, you may
  4306. want to have your tags correctly set in the agenda, so that tag
  4307. filtering works fine, with inherited tags. Set
  4308. @code{org-agenda-use-tag-inheritance} to control this: the default value
  4309. includes all agenda types, but setting this to @code{nil} can really speed
  4310. up agenda generation.
  4311. @node Setting Tags
  4312. @section Setting Tags
  4313. @cindex setting tags
  4314. @cindex tags, setting
  4315. @kindex M-TAB
  4316. Tags can simply be typed into the buffer at the end of a headline.
  4317. After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
  4318. also a special command for inserting tags:
  4319. @table @asis
  4320. @item @kbd{C-c C-q} (@code{org-set-tags-command})
  4321. @kindex C-c C-q
  4322. @findex org-set-tags-command
  4323. @cindex completion, of tags
  4324. @vindex org-tags-column
  4325. Enter new tags for the current headline. Org mode either offers
  4326. completion or a special single-key interface for setting tags,
  4327. see below. After pressing @kbd{@key{RET}}, the tags are inserted
  4328. and aligned to @code{org-tags-column}. When called with
  4329. a @kbd{C-u} prefix, all tags in the current buffer are
  4330. aligned to that column, just to make things look nice. Tags are
  4331. automatically realigned after promotion, demotion, and TODO state
  4332. changes (see @ref{TODO Basics}).
  4333. @item @kbd{C-c C-c} (@code{org-set-tags-command})
  4334. @kindex C-c C-c
  4335. When the cursor is in a headline, this does the same as
  4336. @kbd{C-c C-q}.
  4337. @end table
  4338. @vindex org-tag-alist
  4339. Org supports tag insertion based on a @emph{list of tags}. By default this
  4340. list is constructed dynamically, containing all tags currently used in
  4341. the buffer. You may also globally specify a hard list of tags with
  4342. the variable @code{org-tag-alist}. Finally you can set the default tags
  4343. for a given file with lines like
  4344. @cindex @samp{TAGS}, keyword
  4345. @example
  4346. #+TAGS: @@work @@home @@tennisclub
  4347. #+TAGS: laptop car pc sailboat
  4348. @end example
  4349. If you have globally defined your preferred set of tags using the
  4350. variable @code{org-tag-alist}, but would like to use a dynamic tag list in
  4351. a specific file, add an empty @samp{TAGS} keyword to that file:
  4352. @example
  4353. #+TAGS:
  4354. @end example
  4355. @vindex org-tag-persistent-alist
  4356. If you have a preferred set of tags that you would like to use in
  4357. every file, in addition to those defined on a per-file basis by @samp{TAGS}
  4358. keyword, then you may specify a list of tags with the variable
  4359. @code{org-tag-persistent-alist}. You may turn this off on a per-file basis
  4360. by adding a @samp{STARTUP} keyword to that file:
  4361. @example
  4362. #+STARTUP: noptag
  4363. @end example
  4364. By default Org mode uses the standard minibuffer completion facilities
  4365. for entering tags. However, it also implements another, quicker, tag
  4366. selection method called @emph{fast tag selection}. This allows you to
  4367. select and deselect tags with just a single key press. For this to
  4368. work well you should assign unique letters to most of your commonly
  4369. used tags. You can do this globally by configuring the variable
  4370. @code{org-tag-alist} in your Emacs init file. For example, you may find
  4371. the need to tag many items in different files with @samp{@@home}. In this
  4372. case you can set something like:
  4373. @lisp
  4374. (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
  4375. @end lisp
  4376. @noindent
  4377. If the tag is only relevant to the file you are working on, then you
  4378. can instead set the @samp{TAGS} keyword as:
  4379. @example
  4380. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
  4381. @end example
  4382. @noindent
  4383. The tags interface shows the available tags in a splash window. If
  4384. you want to start a new line after a specific tag, insert @samp{\n} into
  4385. the tag list
  4386. @example
  4387. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) \n laptop(l) pc(p)
  4388. @end example
  4389. @noindent
  4390. or write them in two lines:
  4391. @example
  4392. #+TAGS: @@work(w) @@home(h) @@tennisclub(t)
  4393. #+TAGS: laptop(l) pc(p)
  4394. @end example
  4395. @noindent
  4396. You can also group together tags that are mutually exclusive by using
  4397. braces, as in:
  4398. @example
  4399. #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
  4400. @end example
  4401. @noindent
  4402. you indicate that at most one of @samp{@@work}, @samp{@@home}, and @samp{@@tennisclub}
  4403. should be selected. Multiple such groups are allowed.
  4404. @noindent
  4405. Do not forget to press @kbd{C-c C-c} with the cursor in one of
  4406. these lines to activate any changes.
  4407. @noindent
  4408. To set these mutually exclusive groups in the variable
  4409. @code{org-tags-alist}, you must use the dummy tags @code{:startgroup} and
  4410. @code{:endgroup} instead of the braces. Similarly, you can use @code{:newline}
  4411. to indicate a line break. The previous example would be set globally
  4412. by the following configuration:
  4413. @lisp
  4414. (setq org-tag-alist '((:startgroup . nil)
  4415. ("@@work" . ?w) ("@@home" . ?h)
  4416. ("@@tennisclub" . ?t)
  4417. (:endgroup . nil)
  4418. ("laptop" . ?l) ("pc" . ?p)))
  4419. @end lisp
  4420. If at least one tag has a selection key then pressing @kbd{C-c C-c} automatically presents you with a special interface, listing
  4421. inherited tags, the tags of the current headline, and a list of all
  4422. valid tags with corresponding keys@footnote{Keys are automatically assigned to tags that have no
  4423. configured keys.}.
  4424. Pressing keys assigned to tags adds or removes them from the list of
  4425. tags in the current line. Selecting a tag in a group of mutually
  4426. exclusive tags turns off any other tag from that group.
  4427. In this interface, you can also use the following special keys:
  4428. @table @asis
  4429. @item @kbd{@key{TAB}}
  4430. @kindex TAB
  4431. Enter a tag in the minibuffer, even if the tag is not in the
  4432. predefined list. You can complete on all tags present in the
  4433. buffer. You can also add several tags: just separate them with
  4434. a comma.
  4435. @item @kbd{@key{SPC}}
  4436. @kindex SPC
  4437. Clear all tags for this line.
  4438. @item @kbd{@key{RET}}
  4439. @kindex RET
  4440. Accept the modified set.
  4441. @item @kbd{C-g}
  4442. @kindex C-g
  4443. Abort without installing changes.
  4444. @item @kbd{q}
  4445. @kindex q
  4446. If @kbd{q} is not assigned to a tag, it aborts like
  4447. @kbd{C-g}.
  4448. @item @kbd{!}
  4449. @kindex !
  4450. Turn off groups of mutually exclusive tags. Use this to (as an
  4451. exception) assign several tags from such a group.
  4452. @item @kbd{C-c}
  4453. @kindex C-c C-c
  4454. Toggle auto-exit after the next change (see below). If you are
  4455. using expert mode, the first @kbd{C-c} displays the
  4456. selection window.
  4457. @end table
  4458. @noindent
  4459. This method lets you assign tags to a headline with very few keys.
  4460. With the above setup, you could clear the current tags and set
  4461. @samp{@@home}, @samp{laptop} and @samp{pc} tags with just the following keys:
  4462. @kbd{C-c C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to @samp{@@work}
  4463. would be done with @kbd{C-c C-c w @key{RET}} or alternatively with
  4464. @kbd{C-c C-c C-c w}. Adding the non-predefined tag @samp{Sarah} could
  4465. be done with @kbd{C-c C-c @key{TAB} S a r a h @key{RET}}.
  4466. @vindex org-fast-tag-selection-single-key
  4467. If you find that most of the time you need only a single key press to
  4468. modify your list of tags, set the variable
  4469. @code{org-fast-tag-selection-single-key}. Then you no longer have to press
  4470. @kbd{@key{RET}} to exit fast tag selection---it exits after the first
  4471. change. If you then occasionally need more keys, press @kbd{C-c}
  4472. to turn off auto-exit for the current tag selection process (in
  4473. effect: start selection with @kbd{C-c C-c C-c} instead of
  4474. @kbd{C-c C-c}). If you set the variable to the value @code{expert},
  4475. the special window is not even shown for single-key tag selection, it
  4476. comes up only when you press an extra @kbd{C-c}.
  4477. @node Tag Hierarchy
  4478. @section Tag Hierarchy
  4479. @cindex group tags
  4480. @cindex tags, groups
  4481. @cindex tags hierarchy
  4482. Tags can be defined in hierarchies. A tag can be defined as a @emph{group
  4483. tag} for a set of other tags. The group tag can be seen as the
  4484. ``broader term'' for its set of tags. Defining multiple group tags and
  4485. nesting them creates a tag hierarchy.
  4486. One use-case is to create a taxonomy of terms (tags) that can be used
  4487. to classify nodes in a document or set of documents.
  4488. When you search for a group tag, it return matches for all members in
  4489. the group and its subgroups. In an agenda view, filtering by a group
  4490. tag displays or hide headlines tagged with at least one of the members
  4491. of the group or any of its subgroups. This makes tag searches and
  4492. filters even more flexible.
  4493. You can set group tags by using brackets and inserting a colon between
  4494. the group tag and its related tags---beware that all whitespaces are
  4495. mandatory so that Org can parse this line correctly:
  4496. @example
  4497. #+TAGS: [ GTD : Control Persp ]
  4498. @end example
  4499. In this example, @samp{GTD} is the group tag and it is related to two other
  4500. tags: @samp{Control}, @samp{Persp}. Defining @samp{Control} and @samp{Persp} as group
  4501. tags creates an hierarchy of tags:
  4502. @example
  4503. #+TAGS: [ Control : Context Task ]
  4504. #+TAGS: [ Persp : Vision Goal AOF Project ]
  4505. @end example
  4506. That can conceptually be seen as a hierarchy of tags:
  4507. @itemize
  4508. @item
  4509. @samp{GTD}
  4510. @itemize
  4511. @item
  4512. @samp{Persp}
  4513. @itemize
  4514. @item
  4515. @samp{Vision}
  4516. @item
  4517. @samp{Goal}
  4518. @item
  4519. @samp{AOF}
  4520. @item
  4521. @samp{Project}
  4522. @end itemize
  4523. @item
  4524. @samp{Control}
  4525. @itemize
  4526. @item
  4527. @samp{Context}
  4528. @item
  4529. @samp{Task}
  4530. @end itemize
  4531. @end itemize
  4532. @end itemize
  4533. You can use the @code{:startgrouptag}, @code{:grouptags} and @code{:endgrouptag}
  4534. keyword directly when setting @code{org-tag-alist} directly:
  4535. @lisp
  4536. (setq org-tag-alist '((:startgrouptag)
  4537. ("GTD")
  4538. (:grouptags)
  4539. ("Control")
  4540. ("Persp")
  4541. (:endgrouptag)
  4542. (:startgrouptag)
  4543. ("Control")
  4544. (:grouptags)
  4545. ("Context")
  4546. ("Task")
  4547. (:endgrouptag)))
  4548. @end lisp
  4549. The tags in a group can be mutually exclusive if using the same group
  4550. syntax as is used for grouping mutually exclusive tags together; using
  4551. curly brackets.
  4552. @example
  4553. #+TAGS: @{ Context : @@Home @@Work @@Call @}
  4554. @end example
  4555. When setting @code{org-tag-alist} you can use @code{:startgroup} and @code{:endgroup}
  4556. instead of @code{:startgrouptag} and @code{:endgrouptag} to make the tags
  4557. mutually exclusive.
  4558. Furthermore, the members of a group tag can also be regular
  4559. expressions, creating the possibility of a more dynamic and rule-based
  4560. tag structure. The regular expressions in the group must be specified
  4561. within curly brackets. Here is an expanded example:
  4562. @example
  4563. #+TAGS: [ Vision : @{V@@.+@} ]
  4564. #+TAGS: [ Goal : @{G@@.+@} ]
  4565. #+TAGS: [ AOF : @{AOF@@.+@} ]
  4566. #+TAGS: [ Project : @{P@@.+@} ]
  4567. @end example
  4568. Searching for the tag @samp{Project} now lists all tags also including
  4569. regular expression matches for @samp{P@@.+}, and similarly for tag searches
  4570. on @samp{Vision}, @samp{Goal} and @samp{AOF}. For example, this would work well for
  4571. a project tagged with a common project-identifier,
  4572. e.g. @samp{P@@2014_OrgTags}.
  4573. @kindex C-c C-x q
  4574. @findex org-toggle-tags-groups
  4575. @vindex org-group-tags
  4576. If you want to ignore group tags temporarily, toggle group tags
  4577. support with @code{org-toggle-tags-groups}, bound to @kbd{C-c C-x q}.
  4578. If you want to disable tag groups completely, set @code{org-group-tags} to
  4579. @code{nil}.
  4580. @node Tag Searches
  4581. @section Tag Searches
  4582. @cindex tag searches
  4583. @cindex searching for tags
  4584. Once a system of tags has been set up, it can be used to collect
  4585. related information into special lists.
  4586. @table @asis
  4587. @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree})
  4588. @kindex C-c / m
  4589. @kindex C-c \
  4590. @findex org-match-sparse-tree
  4591. Create a sparse tree with all headlines matching a tags search.
  4592. With a @kbd{C-u} prefix argument, ignore headlines that are
  4593. not a TODO line.
  4594. @item @kbd{C-c a m} (@code{org-tags-view})
  4595. @kindex C-c a m
  4596. @findex org-tags-view
  4597. Create a global list of tag matches from all agenda files. See
  4598. @ref{Matching tags and properties}.
  4599. @item @kbd{C-c a M} (@code{org-tags-view})
  4600. @kindex C-c a M
  4601. @vindex org-tags-match-list-sublevels
  4602. Create a global list of tag matches from all agenda files, but
  4603. check only TODO items and force checking subitems (see the option
  4604. @code{org-tags-match-list-sublevels}).
  4605. @end table
  4606. These commands all prompt for a match string which allows basic
  4607. Boolean logic like @samp{+boss+urgent-project1}, to find entries with tags
  4608. @samp{boss} and @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find
  4609. entries which are tagged, like @samp{Kathy} or @samp{Sally}. The full syntax of
  4610. the search string is rich and allows also matching against TODO
  4611. keywords, entry levels and properties. For a complete description
  4612. with many examples, see @ref{Matching tags and properties}.
  4613. @node Properties and Columns
  4614. @chapter Properties and Columns
  4615. @cindex properties
  4616. A property is a key-value pair associated with an entry. Properties
  4617. can be set so they are associated with a single entry, with every
  4618. entry in a tree, or with every entry in an Org file.
  4619. There are two main applications for properties in Org mode. First,
  4620. properties are like tags, but with a value. Imagine maintaining
  4621. a file where you document bugs and plan releases for a piece of
  4622. software. Instead of using tags like @samp{release_1}, @samp{release_2}, you
  4623. can use a property, say @samp{Release}, that in different subtrees has
  4624. different values, such as @samp{1.0} or @samp{2.0}. Second, you can use
  4625. properties to implement (very basic) database capabilities in an Org
  4626. buffer. Imagine keeping track of your music CDs, where properties
  4627. could be things such as the album, artist, date of release, number of
  4628. tracks, and so on.
  4629. Properties can be conveniently edited and viewed in column view (see
  4630. @ref{Column View}).
  4631. @menu
  4632. * Property Syntax:: How properties are spelled out.
  4633. * Special Properties:: Access to other Org mode features.
  4634. * Property Searches:: Matching property values.
  4635. * Property Inheritance:: Passing values down a tree.
  4636. * Column View:: Tabular viewing and editing.
  4637. @end menu
  4638. @node Property Syntax
  4639. @section Property Syntax
  4640. @cindex property syntax
  4641. @cindex drawer, for properties
  4642. Properties are key--value pairs. When they are associated with
  4643. a single entry or with a tree they need to be inserted into a special
  4644. drawer (see @ref{Drawers}) with the name @samp{PROPERTIES}, which has to be
  4645. located right below a headline, and its planning line (see @ref{Deadlines and Scheduling}) when applicable. Each property is specified on
  4646. a single line, with the key---surrounded by colons---first, and the
  4647. value after it. Keys are case-insensitive. Here is an example:
  4648. @example
  4649. * CD collection
  4650. ** Classic
  4651. *** Goldberg Variations
  4652. :PROPERTIES:
  4653. :Title: Goldberg Variations
  4654. :Composer: J.S. Bach
  4655. :Artist: Glen Gould
  4656. :Publisher: Deutsche Grammophon
  4657. :NDisks: 1
  4658. :END:
  4659. @end example
  4660. Depending on the value of @code{org-use-property-inheritance}, a property
  4661. set this way is associated either with a single entry, or with the
  4662. sub-tree defined by the entry, see @ref{Property Inheritance}.
  4663. You may define the allowed values for a particular property @samp{Xyz} by
  4664. setting a property @samp{Xyz_ALL}. This special property is @emph{inherited},
  4665. so if you set it in a level 1 entry, it applies to the entire tree.
  4666. When allowed values are defined, setting the corresponding property
  4667. becomes easier and is less prone to typing errors. For the example
  4668. with the CD collection, we can pre-define publishers and the number of
  4669. disks in a box like this:
  4670. @example
  4671. * CD collection
  4672. :PROPERTIES:
  4673. :NDisks_ALL: 1 2 3 4
  4674. :Publisher_ALL: "Deutsche Grammophon" Philips EMI
  4675. :END:
  4676. @end example
  4677. If you want to set properties that can be inherited by any entry in
  4678. a file, use a line like:
  4679. @cindex @samp{_ALL} suffix, in properties
  4680. @cindex @samp{PROPERTY}, keyword
  4681. @example
  4682. #+PROPERTY: NDisks_ALL 1 2 3 4
  4683. @end example
  4684. @cindex @samp{+} suffix, in properties
  4685. If you want to add to the value of an existing property, append a @samp{+}
  4686. to the property name. The following results in the property @samp{var}
  4687. having the value @samp{foo=1 bar=2}.
  4688. @example
  4689. #+PROPERTY: var foo=1
  4690. #+PROPERTY: var+ bar=2
  4691. @end example
  4692. It is also possible to add to the values of inherited properties. The
  4693. following results in the @samp{Genres} property having the value @samp{Classic
  4694. Baroque} under the @samp{Goldberg Variations} subtree.
  4695. @example
  4696. * CD collection
  4697. ** Classic
  4698. :PROPERTIES:
  4699. :Genres: Classic
  4700. :END:
  4701. *** Goldberg Variations
  4702. :PROPERTIES:
  4703. :Title: Goldberg Variations
  4704. :Composer: J.S. Bach
  4705. :Artist: Glen Gould
  4706. :Publisher: Deutsche Grammophon
  4707. :NDisks: 1
  4708. :Genres+: Baroque
  4709. :END:
  4710. @end example
  4711. Note that a property can only have one entry per drawer.
  4712. @vindex org-global-properties
  4713. Property values set with the global variable @code{org-global-properties}
  4714. can be inherited by all entries in all Org files.
  4715. @noindent
  4716. The following commands help to work with properties:
  4717. @table @asis
  4718. @item @kbd{M-@key{TAB}} (@code{pcomplete})
  4719. @kindex M-TAB
  4720. @findex pcomplete
  4721. After an initial colon in a line, complete property keys. All
  4722. keys used in the current file are offered as possible
  4723. completions.
  4724. @item @kbd{C-c C-x p} (@code{org-set-property})
  4725. @kindex C-c C-x p
  4726. @findex org-set-property
  4727. Set a property. This prompts for a property name and a value.
  4728. If necessary, the property drawer is created as well.
  4729. @item @kbd{C-u M-x org-insert-drawer}
  4730. @findex org-insert-drawer
  4731. Insert a property drawer into the current entry. The drawer is
  4732. inserted early in the entry, but after the lines with planning
  4733. information like deadlines.
  4734. @item @kbd{C-c C-c} (@code{org-property-action})
  4735. @kindex C-c C-c
  4736. @findex org-property-action
  4737. With the cursor in a property drawer, this executes property
  4738. commands.
  4739. @item @kbd{C-c C-c s} (@code{org-set-property})
  4740. @kindex C-c C-c s
  4741. @findex org-set-property
  4742. Set a property in the current entry. Both the property and the value
  4743. can be inserted using completion.
  4744. @item @kbd{S-@key{RIGHT}} (@code{org-property-next-allowed-values})
  4745. @itemx @kbd{S-@key{LEFT}} (@code{org-property-previous-allowed-value})
  4746. @kindex S-RIGHT
  4747. @kindex S-LEFT
  4748. Switch property at point to the next/previous allowed value.
  4749. @item @kbd{C-c C-c d} (@code{org-delete-property})
  4750. @kindex C-c C-c d
  4751. @findex org-delete-property
  4752. Remove a property from the current entry.
  4753. @item @kbd{C-c C-c D} (@code{org-delete-property-globally})
  4754. @kindex C-c C-c D
  4755. @findex org-delete-property-globally
  4756. Globally remove a property, from all entries in the current file.
  4757. @item @kbd{C-c C-c c} (@code{org-compute-property-at-point})
  4758. @kindex C-c C-c c
  4759. @findex org-compute-property-at-point
  4760. Compute the property at point, using the operator and scope from
  4761. the nearest column format definition.
  4762. @end table
  4763. @node Special Properties
  4764. @section Special Properties
  4765. @cindex properties, special
  4766. Special properties provide an alternative access method to Org mode
  4767. features, like the TODO state or the priority of an entry, discussed
  4768. in the previous chapters. This interface exists so that you can
  4769. include these states in a column view (see @ref{Column View}), or to use
  4770. them in queries. The following property names are special and should
  4771. not be used as keys in the properties drawer:
  4772. @cindex @samp{ALLTAGS}, special property
  4773. @cindex @samp{BLOCKED}, special property
  4774. @cindex @samp{CLOCKSUM}, special property
  4775. @cindex @samp{CLOCKSUM_T}, special property
  4776. @cindex @samp{CLOSED}, special property
  4777. @cindex @samp{DEADLINE}, special property
  4778. @cindex @samp{FILE}, special property
  4779. @cindex @samp{ITEM}, special property
  4780. @cindex @samp{PRIORITY}, special property
  4781. @cindex @samp{SCHEDULED}, special property
  4782. @cindex @samp{TAGS}, special property
  4783. @cindex @samp{TIMESTAMP}, special property
  4784. @cindex @samp{TIMESTAMP_IA}, special property
  4785. @cindex @samp{TODO}, special property
  4786. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  4787. @item @samp{ALLTAGS}
  4788. @tab All tags, including inherited ones.
  4789. @item @samp{BLOCKED}
  4790. @tab @code{t} if task is currently blocked by children or siblings.
  4791. @item @samp{CATEGORY}
  4792. @tab The category of an entry.
  4793. @item @samp{CLOCKSUM}
  4794. @tab The sum of CLOCK intervals in the subtree. @code{org-clock-sum}
  4795. @item
  4796. @tab must be run first to compute the values in the current buffer.
  4797. @item @samp{CLOCKSUM_T}
  4798. @tab The sum of CLOCK intervals in the subtree for today.
  4799. @item
  4800. @tab @code{org-clock-sum-today} must be run first to compute the
  4801. @item
  4802. @tab values in the current buffer.
  4803. @item @samp{CLOSED}
  4804. @tab When was this entry closed?
  4805. @item @samp{DEADLINE}
  4806. @tab The deadline time string, without the angular brackets.
  4807. @item @samp{FILE}
  4808. @tab The filename the entry is located in.
  4809. @item @samp{ITEM}
  4810. @tab The headline of the entry.
  4811. @item @samp{PRIORITY}
  4812. @tab The priority of the entry, a string with a single letter.
  4813. @item @samp{SCHEDULED}
  4814. @tab The scheduling timestamp, without the angular brackets.
  4815. @item @samp{TAGS}
  4816. @tab The tags defined directly in the headline.
  4817. @item @samp{TIMESTAMP}
  4818. @tab The first keyword-less timestamp in the entry.
  4819. @item @samp{TIMESTAMP_IA}
  4820. @tab The first inactive timestamp in the entry.
  4821. @item @samp{TODO}
  4822. @tab The TODO keyword of the entry.
  4823. @end multitable
  4824. @node Property Searches
  4825. @section Property Searches
  4826. @cindex properties, searching
  4827. @cindex searching, of properties
  4828. To create sparse trees and special lists with selection based on
  4829. properties, the same commands are used as for tag searches (see @ref{Tag Searches}).
  4830. @table @asis
  4831. @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree})
  4832. @kindex C-c / m
  4833. @kindex C-c \
  4834. @findex org-match-sparse-tree
  4835. Create a sparse tree with all matching entries. With
  4836. a @kbd{C-u} prefix argument, ignore headlines that are not
  4837. a TODO line.
  4838. @item @kbd{C-c a m}, @code{org-tags-view}
  4839. @kindex C-c a m
  4840. Create a global list of tag/property matches from all agenda
  4841. files.
  4842. @item @kbd{C-c a M} (@code{org-tags-view})
  4843. @kindex C-c a M
  4844. @findex org-tags-view
  4845. @vindex org-tags-match-list-sublevels
  4846. Create a global list of tag matches from all agenda files, but
  4847. check only TODO items and force checking of subitems (see the
  4848. option @code{org-tags-match-list-sublevels}).
  4849. @end table
  4850. The syntax for the search string is described in @ref{Matching tags and properties}.
  4851. There is also a special command for creating sparse trees based on a
  4852. single property:
  4853. @table @asis
  4854. @item @kbd{C-c / p}
  4855. @kindex C-c / p
  4856. Create a sparse tree based on the value of a property. This
  4857. first prompts for the name of a property, and then for a value.
  4858. A sparse tree is created with all entries that define this
  4859. property with the given value. If you enclose the value in curly
  4860. braces, it is interpreted as a regular expression and matched
  4861. against the property values.
  4862. @end table
  4863. @node Property Inheritance
  4864. @section Property Inheritance
  4865. @cindex properties, inheritance
  4866. @cindex inheritance, of properties
  4867. @vindex org-use-property-inheritance
  4868. The outline structure of Org documents lends itself to an inheritance
  4869. model of properties: if the parent in a tree has a certain property,
  4870. the children can inherit this property. Org mode does not turn this
  4871. on by default, because it can slow down property searches
  4872. significantly and is often not needed. However, if you find
  4873. inheritance useful, you can turn it on by setting the variable
  4874. @code{org-use-property-inheritance}. It may be set to @code{t} to make all
  4875. properties inherited from the parent, to a list of properties that
  4876. should be inherited, or to a regular expression that matches inherited
  4877. properties. If a property has the value @code{nil}, this is interpreted as
  4878. an explicit un-define of the property, so that inheritance search
  4879. stops at this value and returns @code{nil}.
  4880. Org mode has a few properties for which inheritance is hard-coded, at
  4881. least for the special applications for which they are used:
  4882. @table @asis
  4883. @item @code{COLUMNS}
  4884. @cindex @samp{COLUMNS}, property
  4885. The @samp{COLUMNS} property defines the format of column view (see
  4886. @ref{Column View}). It is inherited in the sense that the level where
  4887. a @samp{COLUMNS} property is defined is used as the starting point for
  4888. a column view table, independently of the location in the subtree
  4889. from where columns view is turned on.
  4890. @item @code{CATEGORY}
  4891. @cindex @samp{CATEGORY}, property
  4892. For agenda view, a category set through a @samp{CATEGORY} property
  4893. applies to the entire subtree.
  4894. @item @code{ARCHIVE}
  4895. @cindex @samp{ARCHIVE}, property
  4896. For archiving, the @samp{ARCHIVE} property may define the archive
  4897. location for the entire subtree (see @ref{Moving subtrees}).
  4898. @item @code{LOGGING}
  4899. @cindex @samp{LOGGING}, property
  4900. The @samp{LOGGING} property may define logging settings for an entry
  4901. or a subtree (see @ref{Tracking TODO state changes}).
  4902. @end table
  4903. @node Column View
  4904. @section Column View
  4905. A great way to view and edit properties in an outline tree is @emph{column
  4906. view}. In column view, each outline node is turned into a table row.
  4907. Columns in this table provide access to properties of the entries.
  4908. Org mode implements columns by overlaying a tabular structure over the
  4909. headline of each item. While the headlines have been turned into
  4910. a table row, you can still change the visibility of the outline tree.
  4911. For example, you get a compact table by switching to ``contents''
  4912. view---@kbd{S-@key{TAB}} @kbd{S-@key{TAB}}, or simply @kbd{c}
  4913. while column view is active---but you can still open, read, and edit
  4914. the entry below each headline. Or, you can switch to column view
  4915. after executing a sparse tree command and in this way get a table only
  4916. for the selected items. Column view also works in agenda buffers (see
  4917. @ref{Agenda Views}) where queries have collected selected items, possibly
  4918. from a number of files.
  4919. @menu
  4920. * Defining columns:: The COLUMNS format property.
  4921. * Using column view:: How to create and use column view.
  4922. * Capturing column view:: A dynamic block for column view.
  4923. @end menu
  4924. @node Defining columns
  4925. @subsection Defining columns
  4926. @cindex column view, for properties
  4927. @cindex properties, column view
  4928. Setting up a column view first requires defining the columns. This is
  4929. done by defining a column format line.
  4930. @menu
  4931. * Scope of column definitions:: Where defined, where valid?
  4932. * Column attributes:: Appearance and content of a column.
  4933. @end menu
  4934. @node Scope of column definitions
  4935. @subsubsection Scope of column definitions
  4936. To define a column format for an entire file, use a line like:
  4937. @cindex @samp{COLUMNS}, keyword
  4938. @example
  4939. #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  4940. @end example
  4941. To specify a format that only applies to a specific tree, add
  4942. a @samp{COLUMNS} property to the top node of that tree, for example:
  4943. @example
  4944. ** Top node for columns view
  4945. :PROPERTIES:
  4946. :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  4947. :END:
  4948. @end example
  4949. If a @samp{COLUMNS} property is present in an entry, it defines columns for
  4950. the entry itself, and for the entire subtree below it. Since the
  4951. column definition is part of the hierarchical structure of the
  4952. document, you can define columns on level 1 that are general enough
  4953. for all sublevels, and more specific columns further down, when you
  4954. edit a deeper part of the tree.
  4955. @node Column attributes
  4956. @subsubsection Column attributes
  4957. A column definition sets the attributes of a column. The general
  4958. definition looks like this:
  4959. @example
  4960. %[WIDTH]PROPERTY[(TITLE)][@{SUMMARY-TYPE@}]
  4961. @end example
  4962. @noindent
  4963. Except for the percent sign and the property name, all items are
  4964. optional. The individual parts have the following meaning:
  4965. @table @asis
  4966. @item @var{WIDTH}
  4967. An integer specifying the width of the column in characters. If
  4968. omitted, the width is determined automatically.
  4969. @item @var{PROPERTY}
  4970. The property that should be edited in this column. Special
  4971. properties representing meta data are allowed here as well (see
  4972. @ref{Special Properties}).
  4973. @item @var{TITLE}
  4974. The header text for the column. If omitted, the property name is
  4975. used.
  4976. @item @var{SUMMARY-TYPE}
  4977. The summary type. If specified, the column values for parent
  4978. nodes are computed from the children@footnote{If more than one summary type applies to the same property,
  4979. the parent values are computed according to the first of them.}.
  4980. Supported summary types are:
  4981. @multitable {aaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  4982. @item @samp{+}
  4983. @tab Sum numbers in this column.
  4984. @item @samp{+;%.1f}
  4985. @tab Like @samp{+}, but format result with @samp{%.1f}.
  4986. @item @samp{$}
  4987. @tab Currency, short for @samp{+;%.2f}.
  4988. @item @samp{min}
  4989. @tab Smallest number in column.
  4990. @item @samp{max}
  4991. @tab Largest number.
  4992. @item @samp{mean}
  4993. @tab Arithmetic mean of numbers.
  4994. @item @samp{X}
  4995. @tab Checkbox status, @samp{[X]} if all children are @samp{[X]}.
  4996. @item @samp{X/}
  4997. @tab Checkbox status, @samp{[n/m]}.
  4998. @item @samp{X%}
  4999. @tab Checkbox status, @samp{[n%]}.
  5000. @item @samp{:}
  5001. @tab Sum times, HH:MM, plain numbers are hours.
  5002. @item @samp{:min}
  5003. @tab Smallest time value in column.
  5004. @item @samp{:max}
  5005. @tab Largest time value.
  5006. @item @samp{:mean}
  5007. @tab Arithmetic mean of time values.
  5008. @item @samp{@@min}
  5009. @tab Minimum age@footnote{An age is defined as a duration, using effort modifiers
  5010. defined in @code{org-effort-durations}, e.g., @samp{3d 1h}. If any value in the
  5011. column is as such, the summary is also an effort duration.} (in days/hours/mins/seconds).
  5012. @item @samp{@@max}
  5013. @tab Maximum age (in days/hours/mins/seconds).
  5014. @item @samp{@@mean}
  5015. @tab Arithmetic mean of ages (in days/hours/mins/seconds).
  5016. @item @samp{est+}
  5017. @tab Add low-high estimates.
  5018. @end multitable
  5019. @noindent
  5020. @vindex org-columns-summary-types
  5021. You can also define custom summary types by setting
  5022. @code{org-columns-summary-types}.
  5023. @end table
  5024. The @samp{est+} summary type requires further explanation. It is used for
  5025. combining estimates, expressed as low-high ranges. For example,
  5026. instead of estimating a particular task will take 5 days, you might
  5027. estimate it as 5--6 days if you're fairly confident you know how much
  5028. work is required, or 1--10 days if you do not really know what needs
  5029. to be done. Both ranges average at 5.5 days, but the first represents
  5030. a more predictable delivery.
  5031. When combining a set of such estimates, simply adding the lows and
  5032. highs produces an unrealistically wide result. Instead, @samp{est+} adds
  5033. the statistical mean and variance of the sub-tasks, generating a final
  5034. estimate from the sum. For example, suppose you had ten tasks, each
  5035. of which was estimated at 0.5 to 2 days of work. Straight addition
  5036. produces an estimate of 5 to 20 days, representing what to expect if
  5037. everything goes either extremely well or extremely poorly. In
  5038. contrast, @samp{est+} estimates the full job more realistically, at 10--15
  5039. days.
  5040. Here is an example for a complete columns definition, along with
  5041. allowed values@footnote{Please note that the @samp{COLUMNS} definition must be on a single
  5042. line; it is wrapped here only because of formatting constraints.}.
  5043. @example
  5044. :COLUMNS: %25ITEM %9Approved(Approved?)@{X@} %Owner %11Status \
  5045. %10Time_Estimate@{:@} %CLOCKSUM %CLOCKSUM_T
  5046. :Owner_ALL: Tammy Mark Karl Lisa Don
  5047. :Status_ALL: "In progress" "Not started yet" "Finished" ""
  5048. :Approved_ALL: "[ ]" "[X]"
  5049. @end example
  5050. @noindent
  5051. The first column, @samp{%25ITEM}, means the first 25 characters of the item
  5052. itself, i.e., of the headline. You probably always should start the
  5053. column definition with the @samp{ITEM} specifier. The other specifiers
  5054. create columns @samp{Owner} with a list of names as allowed values, for
  5055. @samp{Status} with four different possible values, and for a checkbox field
  5056. @samp{Approved}. When no width is given after the @samp{%} character, the
  5057. column is exactly as wide as it needs to be in order to fully display
  5058. all values. The @samp{Approved} column does have a modified title
  5059. (@samp{Approved?}, with a question mark). Summaries are created for the
  5060. @samp{Time_Estimate} column by adding time duration expressions like HH:MM,
  5061. and for the @samp{Approved} column, by providing an @samp{[X]} status if all
  5062. children have been checked. The @samp{CLOCKSUM} and @samp{CLOCKSUM_T} columns
  5063. are special, they lists the sums of CLOCK intervals in the subtree,
  5064. either for all clocks or just for today.
  5065. @node Using column view
  5066. @subsection Using column view
  5067. @anchor{Turning column view on or off}
  5068. @subsubheading Turning column view on or off
  5069. @table @asis
  5070. @item @kbd{C-c C-x C-c} (@code{org-columns})
  5071. @kindex C-c C-x C-c
  5072. @vindex org-columns
  5073. @vindex org-columns-default-format
  5074. Turn on column view. If the cursor is before the first headline
  5075. in the file, column view is turned on for the entire file, using
  5076. the @samp{#+COLUMNS} definition. If the cursor is somewhere inside
  5077. the outline, this command searches the hierarchy, up from point,
  5078. for a @samp{COLUMNS} property that defines a format. When one is
  5079. found, the column view table is established for the tree starting
  5080. at the entry that contains the @samp{COLUMNS} property. If no such
  5081. property is found, the format is taken from the @samp{#+COLUMNS} line
  5082. or from the variable @code{org-columns-default-format}, and column
  5083. view is established for the current entry and its subtree.
  5084. @item @kbd{r} or @kbd{g} (@code{org-columns-redo})
  5085. @kindex r
  5086. @kindex g
  5087. @findex org-columns-redo
  5088. Recreate the column view, to include recent changes made in the
  5089. buffer.
  5090. @item @kbd{q} (@code{org-columns-quit})
  5091. @kindex q
  5092. @findex org-columns-quit
  5093. Exit column view.
  5094. @end table
  5095. @anchor{Editing values}
  5096. @subsubheading Editing values
  5097. @table @asis
  5098. @item @kbd{@key{LEFT}}, @kbd{@key{RIGHT}}, @kbd{@key{UP}}, @kbd{@key{DOWN}}
  5099. Move through the column view from field to field.
  5100. @item @kbd{1..9,0}
  5101. @kindex 1..9,0
  5102. Directly select the Nth allowed value, @kbd{0} selects the
  5103. 10th value.
  5104. @item @kbd{n} or @kbd{S-@key{RIGHT}} (@code{org-columns-next-allowed-value})
  5105. @itemx @kbd{p} or @kbd{S-@key{LEFT}} (@code{org-columns-previous-allowed-value})
  5106. @kindex n
  5107. @kindex S-RIGHT
  5108. @kindex p
  5109. @kindex S-LEFT
  5110. @findex org-columns-next-allowed-value
  5111. @findex org-columns-previous-allowed-value
  5112. Switch to the next/previous allowed value of the field. For
  5113. this, you have to have specified allowed values for a property.
  5114. @item @kbd{e} (@code{org-columns-edit-value})
  5115. @kindex e
  5116. @findex org-columns-edit-value
  5117. Edit the property at point. For the special properties, this
  5118. invokes the same interface that you normally use to change that
  5119. property. For example, the tag completion or fast selection
  5120. interface pops up when editing a @samp{TAGS} property.
  5121. @item @kbd{C-c C-c} (@code{org-columns-set-tags-or-toggle})
  5122. @kindex C-c C-c
  5123. @findex org-columns-set-tags-or-toggle
  5124. When there is a checkbox at point, toggle it.
  5125. @item @kbd{v} (@code{org-columns-show-value})
  5126. @kindex v
  5127. @findex org-columns-show-value
  5128. View the full value of this property. This is useful if the
  5129. width of the column is smaller than that of the value.
  5130. @item @kbd{a} (@code{org-columns-edit-allowed})
  5131. @kindex a
  5132. @findex org-columns-edit-allowed
  5133. Edit the list of allowed values for this property. If the list
  5134. is found in the hierarchy, the modified values is stored there.
  5135. If no list is found, the new value is stored in the first entry
  5136. that is part of the current column view.
  5137. @end table
  5138. @anchor{Modifying column view on-the-fly}
  5139. @subsubheading Modifying column view on-the-fly:
  5140. @table @asis
  5141. @item @kbd{<} (@code{org-columns-narrow})
  5142. @itemx @kbd{>} (@code{org-columns-widen})
  5143. @kindex <
  5144. @kindex >
  5145. @findex org-columns-narrow
  5146. @findex org-columns-widen
  5147. Make the column narrower/wider by one character.
  5148. @item @kbd{S-M-@key{RIGHT}} (@code{org-columns-new})
  5149. @kindex S-M-RIGHT
  5150. @findex org-columns-new
  5151. Insert a new column, to the left of the current column.
  5152. @item @kbd{S-M-@key{LEFT}} (@code{org-columns-delete})
  5153. @kindex S-M-LEFT
  5154. @findex org-columns-delete
  5155. Delete the current column.
  5156. @end table
  5157. @node Capturing column view
  5158. @subsection Capturing column view
  5159. Since column view is just an overlay over a buffer, it cannot be
  5160. exported or printed directly. If you want to capture a column view,
  5161. use a @samp{columnview} dynamic block (see @ref{Dynamic Blocks}). The frame of
  5162. this block looks like this:
  5163. @cindex @samp{BEGIN columnview}
  5164. @example
  5165. * The column view
  5166. #+BEGIN: columnview :hlines 1 :id "label"
  5167. #+END:
  5168. @end example
  5169. @noindent
  5170. This dynamic block has the following parameters:
  5171. @table @asis
  5172. @item @samp{:id}
  5173. This is the most important parameter. Column view is a feature
  5174. that is often localized to a certain (sub)tree, and the capture
  5175. block might be at a different location in the file. To identify
  5176. the tree whose view to capture, you can use four values:
  5177. @table @asis
  5178. @item @samp{local}
  5179. Use the tree in which the capture block is located.
  5180. @item @samp{global}
  5181. Make a global view, including all headings in the file.
  5182. @item @samp{file:FILENAME}
  5183. Run column view at the top of the @var{FILENAME} file
  5184. @item @samp{LABEL}
  5185. @cindex @samp{ID}, property
  5186. Call column view in the tree that has an @samp{ID} property with
  5187. the value @var{LABEL}. You can use @kbd{M-x org-id-copy} to create a globally unique ID for the
  5188. current entry and copy it to the kill-ring.
  5189. @end table
  5190. @item @samp{:hlines}
  5191. When @code{t}, insert an hline after every line. When a number N,
  5192. insert an hline before each headline with level @code{<= N}.
  5193. @item @samp{:vlines}
  5194. When non-@code{nil}, force column groups to get vertical lines.
  5195. @item @samp{:maxlevel}
  5196. When set to a number, do not capture entries below this level.
  5197. @item @samp{:skip-empty-rows}
  5198. When non-@code{nil}, skip rows where the only non-empty specifier of
  5199. the column view is @samp{ITEM}.
  5200. @item @samp{:indent}
  5201. When non-@code{nil}, indent each @samp{ITEM} field according to its level.
  5202. @end table
  5203. @noindent
  5204. The following commands insert or update the dynamic block:
  5205. @table @asis
  5206. @item @kbd{C-c C-x i} (@code{org-insert-columns-dblock})
  5207. @kindex C-c C-x i
  5208. @findex org-insert-columns-dblock
  5209. Insert a dynamic block capturing a column view. Prompt for the
  5210. scope or ID of the view.
  5211. @item @kbd{C-c C-c} @kbd{C-c C-x C-u} (@code{org-dblock-update})
  5212. @kindex C-c C-c
  5213. @kindex C-c C-x C-u
  5214. @findex org-dblock-update
  5215. Update dynamic block at point. The cursor needs to be in the
  5216. @samp{#+BEGIN} line of the dynamic block.
  5217. @item @kbd{C-u C-c C-x C-u} (@code{org-update-all-dblocks})
  5218. @kindex C-u C-c C-x C-u
  5219. Update all dynamic blocks (see @ref{Dynamic Blocks}). This is useful
  5220. if you have several clock table blocks, column-capturing blocks
  5221. or other dynamic blocks in a buffer.
  5222. @end table
  5223. You can add formulas to the column view table and you may add plotting
  5224. instructions in front of the table---these survive an update of the
  5225. block. If there is a @samp{TBLFM} keyword after the table, the table is
  5226. recalculated automatically after an update.
  5227. An alternative way to capture and process property values into a table
  5228. is provided by Eric Schulte's @samp{org-collector.el} which is
  5229. a contributed package@footnote{Contributed packages are not part of Emacs, but are
  5230. distributed with the main distribution of Org---visit
  5231. @uref{https://orgmode.org}.}. It provides a general API to collect
  5232. properties from entries in a certain scope, and arbitrary Lisp
  5233. expressions to process these values before inserting them into a table
  5234. or a dynamic block.
  5235. @node Dates and Times
  5236. @chapter Dates and Times
  5237. @cindex dates
  5238. @cindex times
  5239. @cindex timestamp
  5240. @cindex date stamp
  5241. To assist project planning, TODO items can be labeled with a date
  5242. and/or a time. The specially formatted string carrying the date and
  5243. time information is called a @emph{timestamp} in Org mode. This may be
  5244. a little confusing because timestamp is often used as indicating when
  5245. something was created or last changed. However, in Org mode this term
  5246. is used in a much wider sense.
  5247. @menu
  5248. * Timestamps:: Assigning a time to a tree entry.
  5249. * Creating Timestamps:: Commands to insert timestamps.
  5250. * Deadlines and Scheduling:: Planning your work.
  5251. * Clocking Work Time:: Tracking how long you spend on a task.
  5252. * Effort Estimates:: Planning work effort in advance.
  5253. * Timers:: Notes with a running timer.
  5254. @end menu
  5255. @node Timestamps
  5256. @section Timestamps, Deadlines and Scheduling
  5257. @cindex timestamps
  5258. @cindex ranges, time
  5259. @cindex date stamps
  5260. @cindex deadlines
  5261. @cindex scheduling
  5262. A timestamp is a specification of a date (possibly with a time or
  5263. a range of times) in a special format, either @samp{<2003-09-16 Tue>} or
  5264. @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue 12:00-12:30>}@footnote{The Org date format is inspired by the standard ISO 8601
  5265. date/time format. To use an alternative format, see @ref{Custom time format}. The day name is optional when you type the date yourself.
  5266. However, any date inserted or modified by Org adds that day name, for
  5267. reading convenience.}.
  5268. A timestamp can appear anywhere in the headline or body of an Org tree
  5269. entry. Its presence causes entries to be shown on specific dates in
  5270. the agenda (see @ref{Weekly/daily agenda}). We distinguish:
  5271. @table @asis
  5272. @item Plain timestamp; Event; Appointment
  5273. @cindex timestamp
  5274. @cindex appointment
  5275. A simple timestamp just assigns a date/time to an item. This is
  5276. just like writing down an appointment or event in a paper agenda.
  5277. In the timeline and agenda displays, the headline of an entry
  5278. associated with a plain timestamp is shown exactly on that date.
  5279. @example
  5280. * Meet Peter at the movies
  5281. <2006-11-01 Wed 19:15>
  5282. * Discussion on climate change
  5283. <2006-11-02 Thu 20:00-22:00>
  5284. @end example
  5285. @item Timestamp with repeater interval
  5286. @cindex timestamp, with repeater interval
  5287. A timestamp may contain a @emph{repeater interval}, indicating that it
  5288. applies not only on the given date, but again and again after
  5289. a certain interval of N days (d), weeks (w), months (m), or years
  5290. (y). The following shows up in the agenda every Wednesday:
  5291. @example
  5292. * Pick up Sam at school
  5293. <2007-05-16 Wed 12:30 +1w>
  5294. @end example
  5295. @item Diary-style sexp entries
  5296. @cindex diary style timestamps
  5297. @cindex sexp timestamps
  5298. For more complex date specifications, Org mode supports using the
  5299. special sexp diary entries implemented in the Emacs
  5300. calendar/diary package@footnote{When working with the standard diary sexp functions, you need
  5301. to be very careful with the order of the arguments. That order
  5302. depends evilly on the variable @code{calendar-date-style}. For example, to
  5303. specify a date December 12, 2005, the call might look like
  5304. @samp{(diary-date 12 1 2005)} or @samp{(diary-date 1 12 2005)} or @samp{(diary-date
  5305. 2005 12 1)}, depending on the settings. This has been the source of
  5306. much confusion. Org mode users can resort to special versions of
  5307. these functions like @code{org-date} or @code{org-anniversary}. These work just
  5308. like the corresponding @code{diary-} functions, but with stable ISO order
  5309. of arguments (year, month, day) wherever applicable, independent of
  5310. the value of @code{calendar-date-style}.}. For example, with optional time:
  5311. @example
  5312. * 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
  5313. <%%(org-float t 4 2)>
  5314. @end example
  5315. @item Time/Date range
  5316. @cindex timerange
  5317. @cindex date range
  5318. Two timestamps connected by @samp{--} denote a range. The headline is
  5319. shown on the first and last day of the range, and on any dates
  5320. that are displayed and fall in the range. Here is an example:
  5321. @example
  5322. ** Meeting in Amsterdam
  5323. <2004-08-23 Mon>--<2004-08-26 Thu>
  5324. @end example
  5325. @item Inactive timestamp
  5326. @cindex timestamp, inactive
  5327. @cindex inactive timestamp
  5328. Just like a plain timestamp, but with square brackets instead of
  5329. angular ones. These timestamps are inactive in the sense that
  5330. they do @emph{not} trigger an entry to show up in the agenda.
  5331. @example
  5332. * Gillian comes late for the fifth time
  5333. [2006-11-01 Wed]
  5334. @end example
  5335. @end table
  5336. @node Creating Timestamps
  5337. @section Creating Timestamps
  5338. For Org mode to recognize timestamps, they need to be in the specific
  5339. format. All commands listed below produce timestamps in the correct
  5340. format.
  5341. @table @asis
  5342. @item @kbd{C-c .} (@code{org-time-stamp})
  5343. @kindex C-c .
  5344. @findex org-time-stamp
  5345. Prompt for a date and insert a corresponding timestamp. When the
  5346. cursor is at an existing timestamp in the buffer, the command is
  5347. used to modify this timestamp instead of inserting a new one.
  5348. When this command is used twice in succession, a time range is
  5349. inserted.
  5350. @kindex C-u C-c .
  5351. @vindex org-time-stamp-rounding-minutes
  5352. When called with a prefix argument, use the alternative format
  5353. which contains date and time. The default time can be rounded to
  5354. multiples of 5 minutes. See the option
  5355. @code{org-time-stamp-rounding-minutes}.
  5356. @kindex C-u C-u C-c .
  5357. With two prefix arguments, insert an active timestamp with the
  5358. current time without prompting.
  5359. @item @kbd{C-c !} (@code{org-time-stamp-inactive})
  5360. @kindex C-c !
  5361. @kindex C-u C-c !
  5362. @kindex C-u C-u C-c !
  5363. @findex org-time-stamp-inactive
  5364. Like @kbd{C-c .}, but insert an inactive timestamp that does
  5365. not cause an agenda entry.
  5366. @item @kbd{C-c C-c}
  5367. @kindex C-c C-c
  5368. Normalize timestamp, insert or fix day name if missing or wrong.
  5369. @item @kbd{C-c <} (@code{org-date-from-calendar})
  5370. @kindex C-c <
  5371. @findex org-date-from-calendar
  5372. Insert a timestamp corresponding to the cursor date in the
  5373. calendar.
  5374. @item @kbd{C-c >} (@code{org-goto-calendar})
  5375. @kindex C-c >
  5376. @findex org-goto-calendar
  5377. Access the Emacs calendar for the current date. If there is
  5378. a timestamp in the current line, go to the corresponding date
  5379. instead.
  5380. @item @kbd{C-c C-o} (@code{org-open-at-point})
  5381. @kindex C-c C-o
  5382. @findex org-open-at-point
  5383. Access the agenda for the date given by the timestamp or -range
  5384. at point (see @ref{Weekly/daily agenda}).
  5385. @item @kbd{S-@key{LEFT}} (@code{org-timestamp-down-day})
  5386. @itemx @kbd{S-@key{RIGHT}} (@code{org-timestamp-up-day})
  5387. @kindex S-LEFT
  5388. @kindex S-RIGHT
  5389. @findex org-timestamp-down-day
  5390. @findex org-timestamp-up-day
  5391. Change date at cursor by one day. These key bindings conflict
  5392. with shift-selection and related modes (see @ref{Conflicts}).
  5393. @item @kbd{S-@key{UP}} (@code{org-timestamp-up})
  5394. @itemx @kbd{S-@key{DOWN}} (@code{org-timestamp-down})
  5395. @kindex S-UP
  5396. @kindex S-DOWN
  5397. Change the item under the cursor in a timestamp. The cursor can
  5398. be on a year, month, day, hour or minute. When the timestamp
  5399. contains a time range like @samp{15:30-16:30}, modifying the first
  5400. time also shifts the second, shifting the time block with
  5401. constant length. To change the length, modify the second time.
  5402. Note that if the cursor is in a headline and not at a timestamp,
  5403. these same keys modify the priority of an item. (see
  5404. @ref{Priorities}). The key bindings also conflict with
  5405. shift-selection and related modes (see @ref{Conflicts}).
  5406. @item @kbd{C-c C-y} (@code{org-evaluate-time-range})
  5407. @kindex C-c C-y
  5408. @findex org-evaluate-time-range
  5409. @cindex evaluate time range
  5410. Evaluate a time range by computing the difference between start
  5411. and end. With a prefix argument, insert result after the time
  5412. range (in a table: into the following column).
  5413. @end table
  5414. @menu
  5415. * The date/time prompt:: How Org mode helps you enter dates and times.
  5416. * Custom time format:: Making dates look different.
  5417. @end menu
  5418. @node The date/time prompt
  5419. @subsection The date/time prompt
  5420. @cindex date, reading in minibuffer
  5421. @cindex time, reading in minibuffer
  5422. @vindex org-read-date-prefer-future
  5423. When Org mode prompts for a date/time, the default is shown in default
  5424. date/time format, and the prompt therefore seems to ask for a specific
  5425. format. But it in fact accepts date/time information in a variety of
  5426. formats. Generally, the information should start at the beginning of
  5427. the string. Org mode finds whatever information is in there and
  5428. derives anything you have not specified from the @emph{default date and
  5429. time}. The default is usually the current date and time, but when
  5430. modifying an existing timestamp, or when entering the second stamp of
  5431. a range, it is taken from the stamp in the buffer. When filling in
  5432. information, Org mode assumes that most of the time you want to enter
  5433. a date in the future: if you omit the month/year and the given
  5434. day/month is @emph{before} today, it assumes that you mean a future
  5435. date@footnote{See the variable @code{org-read-date-prefer-future}. You may set
  5436. that variable to the symbol @code{time} to even make a time before now
  5437. shift the date to tomorrow.}. If the date has been automatically shifted into the
  5438. future, the time prompt shows this with @samp{(=>F)}.
  5439. For example, let's assume that today is @strong{June 13, 2006}. Here is how
  5440. various inputs are interpreted, the items filled in by Org mode are in
  5441. @strong{bold}.
  5442. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  5443. @item @samp{3-2-5}
  5444. @tab @result{} 2003-02-05
  5445. @item @samp{2/5/3}
  5446. @tab @result{} 2003-02-05
  5447. @item @samp{14}
  5448. @tab @result{} @strong{2006}-@strong{06}-14
  5449. @item @samp{12}
  5450. @tab @result{} @strong{2006}-@strong{07}-12
  5451. @item @samp{2/5}
  5452. @tab @result{} @strong{2007}-02-05
  5453. @item @samp{Fri}
  5454. @tab @result{} nearest Friday (default date or later)
  5455. @item @samp{sep 15}
  5456. @tab @result{} @strong{2006}-09-15
  5457. @item @samp{feb 15}
  5458. @tab @result{} @strong{2007}-02-15
  5459. @item @samp{sep 12 9}
  5460. @tab @result{} 2009-09-12
  5461. @item @samp{12:45}
  5462. @tab @result{} @strong{2006}-@strong{06}-@strong{13} 12:45
  5463. @item @samp{22 sept 0:34}
  5464. @tab @result{} @strong{2006}-09-22 0:34
  5465. @item @samp{w4}
  5466. @tab @result{} ISO week for of the current year @strong{2006}
  5467. @item @samp{2012 w4 fri}
  5468. @tab @result{} Friday of ISO week 4 in 2012
  5469. @item @samp{2012-w04-5}
  5470. @tab @result{} Same as above
  5471. @end multitable
  5472. Furthermore you can specify a relative date by giving, as the @emph{first}
  5473. thing in the input: a plus/minus sign, a number and a letter---@samp{d},
  5474. @samp{w}, @samp{m} or @samp{y}---to indicate change in days, weeks, months, or
  5475. years. With a single plus or minus, the date is always relative to
  5476. today. With a double plus or minus, it is relative to the default
  5477. date. If instead of a single letter, you use the abbreviation of day
  5478. name, the date is the Nth such day, e.g.:
  5479. @multitable {aaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  5480. @item @samp{+0}
  5481. @tab @result{} today
  5482. @item @samp{.}
  5483. @tab @result{} today
  5484. @item @samp{+4d}
  5485. @tab @result{} four days from today
  5486. @item @samp{+4}
  5487. @tab @result{} same as +4d
  5488. @item @samp{+2w}
  5489. @tab @result{} two weeks from today
  5490. @item @samp{++5}
  5491. @tab @result{} five days from default date
  5492. @item @samp{+2tue}
  5493. @tab @result{} second Tuesday from now
  5494. @end multitable
  5495. @vindex parse-time-months
  5496. @vindex parse-time-weekdays
  5497. The function understands English month and weekday abbreviations. If
  5498. you want to use un-abbreviated names and/or other languages, configure
  5499. the variables @code{parse-time-months} and @code{parse-time-weekdays}.
  5500. @vindex org-read-date-force-compatible-dates
  5501. Not all dates can be represented in a given Emacs implementation. By
  5502. default Org mode forces dates into the compatibility range 1970--2037
  5503. which works on all Emacs implementations. If you want to use dates
  5504. outside of this range, read the docstring of the variable
  5505. @code{org-read-date-force-compatible-dates}.
  5506. You can specify a time range by giving start and end times or by
  5507. giving a start time and a duration (in HH:MM format). Use one or two
  5508. dash(es) as the separator in the former case and use @samp{+} as the
  5509. separator in the latter case, e.g.:
  5510. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaa}
  5511. @item @samp{11am-1:15pm}
  5512. @tab @result{} 11:00-13:15
  5513. @item @samp{11am--1:15pm}
  5514. @tab @result{} same as above
  5515. @item @samp{11am+2:15}
  5516. @tab @result{} same as above
  5517. @end multitable
  5518. @cindex calendar, for selecting date
  5519. @vindex org-popup-calendar-for-date-prompt
  5520. Parallel to the minibuffer prompt, a calendar is popped up@footnote{If you do not need/want the calendar, configure the variable
  5521. @code{org-popup-calendar-for-date-prompt}.}.
  5522. When you exit the date prompt, either by clicking on a date in the
  5523. calendar, or by pressing @kbd{@key{RET}}, the date selected in the
  5524. calendar is combined with the information entered at the prompt. You
  5525. can control the calendar fully from the minibuffer:
  5526. @kindex <
  5527. @kindex >
  5528. @kindex M-v
  5529. @kindex C-v
  5530. @kindex mouse-1
  5531. @kindex S-RIGHT
  5532. @kindex S-LEFT
  5533. @kindex S-DOWN
  5534. @kindex S-UP
  5535. @kindex M-S-RIGHT
  5536. @kindex M-S-LEFT
  5537. @kindex RET
  5538. @multitable @columnfractions 0.25 0.55
  5539. @item @kbd{@key{RET}}
  5540. @tab Choose date at cursor in calendar.
  5541. @item @kbd{mouse-1}
  5542. @tab Select date by clicking on it.
  5543. @item @kbd{S-@key{RIGHT}}
  5544. @tab One day forward.
  5545. @item @kbd{S-@key{LEFT}}
  5546. @tab One day backward.
  5547. @item @kbd{S-@key{DOWN}}
  5548. @tab One week forward.
  5549. @item @kbd{S-@key{UP}}
  5550. @tab One week backward.
  5551. @item @kbd{M-S-@key{RIGHT}}
  5552. @tab One month forward.
  5553. @item @kbd{M-S-@key{LEFT}}
  5554. @tab One month backward.
  5555. @item @kbd{>}
  5556. @tab Scroll calendar forward by one month.
  5557. @item @kbd{<}
  5558. @tab Scroll calendar backward by one month.
  5559. @item @kbd{M-v}
  5560. @tab Scroll calendar forward by 3 months.
  5561. @item @kbd{C-v}
  5562. @tab Scroll calendar backward by 3 months.
  5563. @end multitable
  5564. @vindex org-read-date-display-live
  5565. The actions of the date/time prompt may seem complex, but I assure you
  5566. they will grow on you, and you will start getting annoyed by pretty
  5567. much any other way of entering a date/time out there. To help you
  5568. understand what is going on, the current interpretation of your input
  5569. is displayed live in the minibuffer@footnote{If you find this distracting, turn off the display with
  5570. @code{org-read-date-display-live}.}.
  5571. @node Custom time format
  5572. @subsection Custom time format
  5573. @cindex custom date/time format
  5574. @cindex time format, custom
  5575. @cindex date format, custom
  5576. @vindex org-display-custom-times
  5577. @vindex org-time-stamp-custom-formats
  5578. Org mode uses the standard ISO notation for dates and times as it is
  5579. defined in ISO 8601. If you cannot get used to this and require
  5580. another representation of date and time to keep you happy, you can get
  5581. it by customizing the variables @code{org-display-custom-times} and
  5582. @code{org-time-stamp-custom-formats}.
  5583. @table @asis
  5584. @item @kbd{C-c C-x C-t} (@code{org-toggle-time-stamp-overlays})
  5585. @kindex C-c C-x C-t
  5586. @findex org-toggle-time-stamp-overlays
  5587. Toggle the display of custom formats for dates and times.
  5588. @end table
  5589. @noindent
  5590. Org mode needs the default format for scanning, so the custom
  5591. date/time format does not @emph{replace} the default format. Instead, it
  5592. is put @emph{over} the default format using text properties. This has the
  5593. following consequences:
  5594. @itemize
  5595. @item
  5596. You cannot place the cursor onto a timestamp anymore, only before or
  5597. after.
  5598. @item
  5599. The @kbd{S-@key{UP}} and @kbd{S-@key{DOWN}} keys can no longer be used
  5600. to adjust each component of a timestamp. If the cursor is at the
  5601. beginning of the stamp, @kbd{S-@key{UP}} and @kbd{S-@key{DOWN}} change
  5602. the stamp by one day, just like @kbd{S-@key{LEFT}}
  5603. @kbd{S-@key{RIGHT}}. At the end of the stamp, change the time by one
  5604. minute.
  5605. @item
  5606. If the timestamp contains a range of clock times or a repeater,
  5607. these are not overlaid, but remain in the buffer as they were.
  5608. @item
  5609. When you delete a timestamp character-by-character, it only
  5610. disappears from the buffer after @emph{all} (invisible) characters
  5611. belonging to the ISO timestamp have been removed.
  5612. @item
  5613. If the custom timestamp format is longer than the default and you
  5614. are using dates in tables, table alignment will be messed up. If
  5615. the custom format is shorter, things do work as expected.
  5616. @end itemize
  5617. @node Deadlines and Scheduling
  5618. @section Deadlines and Scheduling
  5619. A timestamp may be preceded by special keywords to facilitate
  5620. planning. Both the timestamp and the keyword have to be positioned
  5621. immediately after the task they refer to.
  5622. @table @asis
  5623. @item @samp{DEADLINE}
  5624. @cindex @samp{DEADLINE}
  5625. Meaning: the task (most likely a TODO item, though not
  5626. necessarily) is supposed to be finished on that date.
  5627. @vindex org-deadline-warning-days
  5628. On the deadline date, the task is listed in the agenda. In
  5629. addition, the agenda for @emph{today} carries a warning about the
  5630. approaching or missed deadline, starting
  5631. @code{org-deadline-warning-days} before the due date, and continuing
  5632. until the entry is marked DONE. An example:
  5633. @example
  5634. *** TODO write article about the Earth for the Guide
  5635. DEADLINE: <2004-02-29 Sun>
  5636. The editor in charge is [[bbdb:Ford Prefect]]
  5637. @end example
  5638. @vindex org-agenda-skip-deadline-prewarning-if-scheduled
  5639. You can specify a different lead time for warnings for a specific
  5640. deadlines using the following syntax. Here is an example with
  5641. a warning period of 5 days @samp{DEADLINE: <2004-02-29 Sun -5d>}.
  5642. This warning is deactivated if the task gets scheduled and you
  5643. set @code{org-agenda-skip-deadline-prewarning-if-scheduled} to @code{t}.
  5644. @item @samp{SCHEDULED}
  5645. @cindex @samp{SCHEDULED}
  5646. Meaning: you are planning to start working on that task on the
  5647. given date.
  5648. @vindex org-agenda-skip-scheduled-if-done
  5649. The headline is listed under the given date@footnote{It will still be listed on that date after it has been marked
  5650. DONE. If you do not like this, set the variable
  5651. @code{org-agenda-skip-scheduled-if-done}.}. In addition,
  5652. a reminder that the scheduled date has passed is present in the
  5653. compilation for @emph{today}, until the entry is marked DONE, i.e.,
  5654. the task is automatically forwarded until completed.
  5655. @example
  5656. *** TODO Call Trillian for a date on New Years Eve.
  5657. SCHEDULED: <2004-12-25 Sat>
  5658. @end example
  5659. @vindex org-scheduled-delay-days
  5660. @vindex org-agenda-skip-scheduled-delay-if-deadline
  5661. If you want to @emph{delay} the display of this task in the agenda,
  5662. use @samp{SCHEDULED: <2004-12-25 Sat -2d>}: the task is still
  5663. scheduled on the 25th but will appear two days later. In case
  5664. the task contains a repeater, the delay is considered to affect
  5665. all occurrences; if you want the delay to only affect the first
  5666. scheduled occurrence of the task, use @samp{--2d} instead. See
  5667. @code{org-scheduled-delay-days} and
  5668. @code{org-agenda-skip-scheduled-delay-if-deadline} for details on how
  5669. to control this globally or per agenda.
  5670. @noindent
  5671. @strong{Important:} Scheduling an item in Org mode should @emph{not} be
  5672. understood in the same way that we understand @emph{scheduling
  5673. a meeting}. Setting a date for a meeting is just a simple
  5674. appointment, you should mark this entry with a simple plain
  5675. timestamp, to get this item shown on the date where it applies.
  5676. This is a frequent misunderstanding by Org users. In Org mode,
  5677. @emph{scheduling} means setting a date when you want to start working
  5678. on an action item.
  5679. @end table
  5680. You may use timestamps with repeaters in scheduling and deadline
  5681. entries. Org mode issues early and late warnings based on the
  5682. assumption that the timestamp represents the @emph{nearest instance} of the
  5683. repeater. However, the use of diary S-exp entries like
  5684. @example
  5685. <%%(org-float t 42)>
  5686. @end example
  5687. @noindent
  5688. in scheduling and deadline timestamps is limited. Org mode does not
  5689. know enough about the internals of each S-exp function to issue early
  5690. and late warnings. However, it shows the item on each day where the
  5691. S-exp entry matches.
  5692. @menu
  5693. * Inserting deadline/schedule:: Planning items.
  5694. * Repeated tasks:: Items that show up again and again.
  5695. @end menu
  5696. @node Inserting deadline/schedule
  5697. @subsection Inserting deadlines or schedules
  5698. The following commands allow you to quickly insert a deadline or to
  5699. schedule an item:@footnote{The @samp{SCHEDULED} and @samp{DEADLINE} dates are inserted on the line
  5700. right below the headline. Do not put any text between this line and
  5701. the headline.}
  5702. @table @asis
  5703. @item @kbd{C-c C-d} (@code{org-deadline})
  5704. @kindex C-c C-d
  5705. @findex org-deadline
  5706. @vindex org-log-redeadline
  5707. Insert @samp{DEADLINE} keyword along with a stamp. The insertion
  5708. happens in the line directly following the headline. Remove any
  5709. @samp{CLOSED} timestamp . When called with a prefix argument, also
  5710. remove any existing deadline from the entry. Depending on the
  5711. variable @code{org-log-redeadline}, take a note when changing an
  5712. existing deadline@footnote{Note the corresponding @samp{STARTUP} options @samp{logredeadline},
  5713. @samp{lognoteredeadline}, and @samp{nologredeadline}.}.
  5714. @item @kbd{C-c C-s} (@code{org-schedule})
  5715. @kindex C-c C-s
  5716. @findex org-schedule
  5717. @vindex org-log-reschedule
  5718. Insert @samp{SCHEDULED} keyword along with a stamp. The insertion
  5719. happens in the line directly following the headline. Remove any
  5720. @samp{CLOSED} timestamp. When called with a prefix argument, also
  5721. remove the scheduling date from the entry. Depending on the
  5722. variable @code{org-log-reschedule}, take a note when changing an
  5723. existing scheduling time@footnote{Note the corresponding @samp{STARTUP} options @samp{logreschedule},
  5724. @samp{lognotereschedule}, and @samp{nologreschedule}.}.
  5725. @item @kbd{C-c C-x C-k} (@code{org-mark-entry-for-agenda-action})
  5726. @kindex C-c C-x C-k
  5727. @kindex k a
  5728. @kindex k s
  5729. @findex org-mark-entry-for-agenda-action
  5730. Mark the current entry for agenda action. After you have marked
  5731. the entry like this, you can open the agenda or the calendar to
  5732. find an appropriate date. With the cursor on the selected date,
  5733. press @kbd{k s} or @kbd{k d} to schedule the marked
  5734. item.
  5735. @item @kbd{C-c / d} (@code{org-check-deadlines})
  5736. @kindex C-c / d
  5737. @findex org-check-deadlines
  5738. @cindex sparse tree, for deadlines
  5739. @vindex org-deadline-warning-days
  5740. Create a sparse tree with all deadlines that are either past-due,
  5741. or which will become due within @code{org-deadline-warning-days}.
  5742. With @kbd{C-u} prefix, show all deadlines in the file. With
  5743. a numeric prefix, check that many days. For example, @kbd{C-1 C-c / d} shows all deadlines due tomorrow.
  5744. @item @kbd{C-c / b}, @code{org-check-before-date}
  5745. @kindex C-c / b
  5746. @findex org-check-before-date
  5747. Sparse tree for deadlines and scheduled items before a given
  5748. date.
  5749. @item @kbd{C-c / a}, @code{org-check-after-date}
  5750. @kindex C-c / a
  5751. @findex org-check-after-date
  5752. Sparse tree for deadlines and scheduled items after a given date.
  5753. @end table
  5754. Note that @code{org-schedule} and @code{org-deadline} supports setting the date
  5755. by indicating a relative time e.g., @samp{+1d} sets the date to the next
  5756. day after today, and @samp{--1w} sets the date to the previous week before
  5757. any current timestamp.
  5758. @node Repeated tasks
  5759. @subsection Repeated tasks
  5760. @cindex tasks, repeated
  5761. @cindex repeated tasks
  5762. Some tasks need to be repeated again and again. Org mode helps to
  5763. organize such tasks using a so-called repeater in a @samp{DEADLINE},
  5764. @samp{SCHEDULED}, or plain timestamp. In the following example:
  5765. @example
  5766. ** TODO Pay the rent
  5767. DEADLINE: <2005-10-01 Sat +1m>
  5768. @end example
  5769. noindent
  5770. the @samp{+1m} is a repeater; the intended interpretation is that the task
  5771. has a deadline on @samp{<2005-10-01>} and repeats itself every (one) month
  5772. starting from that time. You can use yearly, monthly, weekly, daily
  5773. and hourly repeat cookies by using the @code{y/w/m/d/h} letters. If you
  5774. need both a repeater and a special warning period in a deadline entry,
  5775. the repeater should come first and the warning period last: @samp{DEADLINE:
  5776. <2005-10-01 Sat +1m -3d>}.
  5777. @vindex org-todo-repeat-to-state
  5778. Deadlines and scheduled items produce entries in the agenda when they
  5779. are over-due, so it is important to be able to mark such an entry as
  5780. completed once you have done so. When you mark a @samp{DEADLINE} or
  5781. a @samp{SCHEDULED} with the TODO keyword @samp{DONE}, it no longer produces
  5782. entries in the agenda. The problem with this is, however, is that
  5783. then also the @emph{next} instance of the repeated entry will not be
  5784. active. Org mode deals with this in the following way: when you try
  5785. to mark such an entry DONE, using @kbd{C-c C-t}, it shifts the
  5786. base date of the repeating timestamp by the repeater interval, and
  5787. immediately sets the entry state back to TODO@footnote{In fact, the target state is taken from, in this sequence, the
  5788. @samp{REPEAT_TO_STATE} property, the variable @code{org-todo-repeat-to-state} if
  5789. it is a string, the previous TODO state if @code{org-todo-repeat-to-state}
  5790. is @code{t}, or the first state of the TODO state sequence.}. In the example
  5791. above, setting the state to DONE would actually switch the date like
  5792. this:
  5793. @example
  5794. ** TODO Pay the rent
  5795. DEADLINE: <2005-11-01 Tue +1m>
  5796. @end example
  5797. To mark a task with a repeater as DONE, use @kbd{C-- 1 C-c C-t},
  5798. i.e., @code{org-todo} with a numeric prefix argument of @samp{-1}.
  5799. @vindex org-log-repeat
  5800. A timestamp@footnote{You can change this using the option @code{org-log-repeat}, or the
  5801. @samp{STARTUP} options @samp{logrepeat}, @samp{lognoterepeat}, and @samp{nologrepeat}.
  5802. With @samp{lognoterepeat}, you will also be prompted for a note.} is added under the deadline, to keep a record that
  5803. you actually acted on the previous instance of this deadline.
  5804. As a consequence of shifting the base date, this entry is no longer
  5805. visible in the agenda when checking past dates, but all future
  5806. instances will be visible.
  5807. With the @samp{+1m} cookie, the date shift is always exactly one month. So
  5808. if you have not paid the rent for three months, marking this entry
  5809. DONE still keeps it as an overdue deadline. Depending on the task,
  5810. this may not be the best way to handle it. For example, if you forgot
  5811. to call your father for 3 weeks, it does not make sense to call him
  5812. 3 times in a single day to make up for it. Finally, there are tasks
  5813. like changing batteries which should always repeat a certain time
  5814. @emph{after} the last time you did it. For these tasks, Org mode has
  5815. special repeaters @samp{++} and @samp{.+}. For example:
  5816. @example
  5817. ** TODO Call Father
  5818. DEADLINE: <2008-02-10 Sun ++1w>
  5819. Marking this DONE shifts the date by at least one week, but also
  5820. by as many weeks as it takes to get this date into the future.
  5821. However, it stays on a Sunday, even if you called and marked it
  5822. done on Saturday.
  5823. ** TODO Empty kitchen trash
  5824. DEADLINE: <2008-02-08 Fri 20:00 ++1d>
  5825. Marking this DONE shifts the date by at least one day, and also
  5826. by as many days as it takes to get the timestamp into the future.
  5827. Since there is a time in the timestamp, the next deadline in the
  5828. future will be on today's date if you complete the task before
  5829. 20:00.
  5830. ** TODO Check the batteries in the smoke detectors
  5831. DEADLINE: <2005-11-01 Tue .+1m>
  5832. Marking this DONE will shift the date to one month after today.
  5833. @end example
  5834. @vindex org-agenda-skip-scheduled-if-deadline-is-shown
  5835. You may have both scheduling and deadline information for a specific
  5836. task. If the repeater is set for the scheduling information only, you
  5837. probably want the repeater to be ignored after the deadline. If so,
  5838. set the variable @code{org-agenda-skip-scheduled-if-deadline-is-shown} to
  5839. @code{repeated-after-deadline}. However, any scheduling information
  5840. without a repeater is no longer relevant once the task is done, and
  5841. thus, removed upon repeating the task. If you want both scheduling
  5842. and deadline information to repeat after the same interval, set the
  5843. same repeater for both timestamps.
  5844. An alternative to using a repeater is to create a number of copies of
  5845. a task subtree, with dates shifted in each copy. The command
  5846. @kbd{C-c C-x c} was created for this purpose; it is described in
  5847. @ref{Structure Editing}.
  5848. @node Clocking Work Time
  5849. @section Clocking Work Time
  5850. @cindex clocking time
  5851. @cindex time clocking
  5852. Org mode allows you to clock the time you spend on specific tasks in
  5853. a project. When you start working on an item, you can start the
  5854. clock. When you stop working on that task, or when you mark the task
  5855. done, the clock is stopped and the corresponding time interval is
  5856. recorded. It also computes the total time spent on each
  5857. subtree@footnote{Clocking only works if all headings are indented with less
  5858. than 30 stars. This is a hard-coded limitation of @code{lmax} in
  5859. @code{org-clock-sum}.} of a project. And it remembers a history or tasks
  5860. recently clocked, to that you can jump quickly between a number of
  5861. tasks absorbing your time.
  5862. To save the clock history across Emacs sessions, use:
  5863. @lisp
  5864. (setq org-clock-persist 'history)
  5865. (org-clock-persistence-insinuate)
  5866. @end lisp
  5867. @vindex org-clock-persist
  5868. When you clock into a new task after resuming Emacs, the incomplete
  5869. clock@footnote{To resume the clock under the assumption that you have worked
  5870. on this task while outside Emacs, use @code{(setq org-clock-persist t)}.} is retrieved (see @ref{Resolving idle time (1)}) and you are
  5871. prompted about what to do with it.
  5872. @menu
  5873. * Clocking commands:: Starting and stopping a clock.
  5874. * The clock table:: Detailed reports.
  5875. * Resolving idle time:: Resolving time when you've been idle.
  5876. @end menu
  5877. @node Clocking commands
  5878. @subsection Clocking commands
  5879. @table @asis
  5880. @item @kbd{C-c C-x C-i} (@code{org-clock-in})
  5881. @kindex C-c C-x C-i
  5882. @findex org-clock-in
  5883. @vindex org-clock-into-drawer
  5884. @vindex org-clock-continuously
  5885. @cindex @samp{LOG_INTO_DRAWER}, property
  5886. Start the clock on the current item (clock-in). This inserts the
  5887. CLOCK keyword together with a timestamp. If this is not the
  5888. first clocking of this item, the multiple CLOCK lines are wrapped
  5889. into a @samp{LOGBOOK} drawer (see also the variable
  5890. @code{org-clock-into-drawer}). You can also overrule the setting of
  5891. this variable for a subtree by setting a @samp{CLOCK_INTO_DRAWER} or
  5892. @samp{LOG_INTO_DRAWER} property. When called with a @kbd{C-u}
  5893. prefix argument, select the task from a list of recently clocked
  5894. tasks. With two @kbd{C-u C-u} prefixes, clock into the task
  5895. at point and mark it as the default task; the default task is
  5896. always be available with letter @kbd{d} when selecting
  5897. a clocking task. With three @kbd{C-u C-u C-u} prefixes,
  5898. force continuous clocking by starting the clock when the last
  5899. clock stopped.
  5900. @cindex @samp{CLOCK_MODELINE_TOTAL}, property
  5901. @cindex @samp{LAST_REPEAT}, property
  5902. @vindex org-clock-mode-line-total
  5903. @vindex org-clock-in-prepare-hook
  5904. While the clock is running, Org shows the current clocking time
  5905. in the mode line, along with the title of the task. The clock
  5906. time shown is all time ever clocked for this task and its
  5907. children. If the task has an effort estimate (see @ref{Effort Estimates}), the mode line displays the current clocking time
  5908. against it@footnote{To add an effort estimate ``on the fly'', hook a function doing
  5909. this to @code{org-clock-in-prepare-hook}.}. If the task is a repeating one (see @ref{Repeated tasks}), show only the time since the last reset of the
  5910. task@footnote{The last reset of the task is recorded by the @samp{LAST_REPEAT}
  5911. property.}. You can exercise more control over show time with
  5912. the @samp{CLOCK_MODELINE_TOTAL} property. It may have the values
  5913. @samp{current} to show only the current clocking instance, @samp{today} to
  5914. show all time clocked on this tasks today---see also the
  5915. variable @code{org-extend-today-until}, @code{all} to include all time, or
  5916. @code{auto} which is the default@footnote{See also the variable @code{org-clock-mode-line-total}.}. Clicking with
  5917. @kbd{mouse-1} onto the mode line entry pops up a menu with
  5918. clocking options.
  5919. @item @kbd{C-c C-x C-o} (@code{org-clock-out})
  5920. @kindex C-c C-x C-o
  5921. @findex org-clock-out
  5922. @vindex org-log-note-clock-out
  5923. Stop the clock (clock-out). This inserts another timestamp at
  5924. the same location where the clock was last started. It also
  5925. directly computes the resulting time in inserts it after the time
  5926. range as @samp{=>HH:MM}. See the variable @code{org-log-note-clock-out}
  5927. for the possibility to record an additional note together with
  5928. the clock-out timestamp@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP:
  5929. lognoteclock-out}.}.
  5930. @item @kbd{C-c C-x C-x} (@code{org-clock-in-last})
  5931. @kindex C-c C-x C-x
  5932. @findex org-clock-in-last
  5933. @vindex org-clock-continuously
  5934. Re-clock the last clocked task. With one @kbd{C-u} prefix
  5935. argument, select the task from the clock history. With two
  5936. @kbd{C-u} prefixes, force continuous clocking by starting
  5937. the clock when the last clock stopped.
  5938. @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate})
  5939. @kindex C-c C-x C-e
  5940. @findex org-clock-modify-effort-estimate
  5941. Update the effort estimate for the current clock task.
  5942. @item @kbd{C-c C-c} or @kbd{C-c C-y} (@code{org-evaluate-time-range})
  5943. @kindex C-c C-c
  5944. @kindex C-c C-y
  5945. @findex org-evaluate-time-range
  5946. Recompute the time interval after changing one of the timestamps.
  5947. This is only necessary if you edit the timestamps directly. If
  5948. you change them with @kbd{S-<cursor>} keys, the update is
  5949. automatic.
  5950. @item @kbd{C-S-@key{UP}} (@code{org-clock-timestamps-up})
  5951. @itemx @kbd{C-S-@key{DOWN}} (@code{org-clock-timestamps-down})
  5952. @kindex C-S-UP
  5953. @findex org-clock-timestamps-up
  5954. @kindex C-S-DOWN
  5955. @findex org-clock-timestamps-down
  5956. On CLOCK log lines, increase/decrease both timestamps so that the
  5957. clock duration keeps the same value.
  5958. @item @kbd{S-M-@key{UP}} (@code{org-timestamp-up})
  5959. @itemx @kbd{S-M-@key{DOWN}} (@code{org-timestamp-down})
  5960. @kindex S-M-UP
  5961. @findex org-clock-timestamp-up
  5962. @kindex S-M-DOWN
  5963. @findex org-clock-timestamp-down
  5964. On @samp{CLOCK} log lines, increase/decrease the timestamp at point
  5965. and the one of the previous, or the next, clock timestamp by the
  5966. same duration. For example, if you hit @kbd{S-M-@key{UP}} to
  5967. increase a clocked-out timestamp by five minutes, then the
  5968. clocked-in timestamp of the next clock is increased by five
  5969. minutes.
  5970. @item @kbd{C-c C-t} (@code{org-todo})
  5971. @kindex C-c C-t
  5972. @findex org-todo
  5973. Changing the TODO state of an item to DONE automatically stops
  5974. the clock if it is running in this same item.
  5975. @item @kbd{C-c C-x C-q} (@code{org-clock-cancel})
  5976. @kindex C-c C-x C-q
  5977. @findex org-clock-cancel
  5978. Cancel the current clock. This is useful if a clock was started
  5979. by mistake, or if you ended up working on something else.
  5980. @item @kbd{C-c C-x C-j} (@code{org-clock-goto})
  5981. @kindex C-c C-x C-j
  5982. @findex or-clock-goto
  5983. Jump to the headline of the currently clocked in task. With
  5984. a @kbd{C-u} prefix argument, select the target task from
  5985. a list of recently clocked tasks.
  5986. @item @kbd{C-c C-x C-d} (@code{org-clock-display})
  5987. @kindex C-c C-x C-d
  5988. @findex org-clock-display
  5989. @vindex org-remove-highlights-with-change
  5990. Display time summaries for each subtree in the current buffer.
  5991. This puts overlays at the end of each headline, showing the total
  5992. time recorded under that heading, including the time of any
  5993. subheadings. You can use visibility cycling to study the tree,
  5994. but the overlays disappear when you change the buffer (see
  5995. variable @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
  5996. @end table
  5997. The @kbd{l} key may be used in the agenda (see @ref{Weekly/daily agenda}) to show which tasks have been worked on or closed during
  5998. a day.
  5999. @strong{Important:} note that both @code{org-clock-out} and @code{org-clock-in-last}
  6000. can have a global keybinding and do not modify the window disposition.
  6001. @node The clock table
  6002. @subsection The clock table
  6003. @cindex clocktable, dynamic block
  6004. @cindex report, of clocked time
  6005. Org mode can produce quite complex reports based on the time clocking
  6006. information. Such a report is called a @emph{clock table}, because it is
  6007. formatted as one or several Org tables.
  6008. @table @asis
  6009. @item @kbd{C-c C-x C-r} (@code{org-clock-report})
  6010. @kindex C-c C-x C-r
  6011. @findex org-clock-report
  6012. Insert a dynamic block (see @ref{Dynamic Blocks}) containing a clock
  6013. report as an Org mode table into the current file. When the
  6014. cursor is at an existing clock table, just update it. When
  6015. called with a prefix argument, jump to the first clock report in
  6016. the current document and update it. The clock table includes
  6017. archived trees.
  6018. @item @kbd{C-c C-c} or @kbd{C-c C-x C-u} (@code{org-dblock-update})
  6019. @kindex C-c C-c
  6020. @kindex C-c C-x C-u
  6021. @findex org-dblock-update
  6022. Update dynamic block at point. The cursor needs to be in the
  6023. @samp{BEGIN} line of the dynamic block.
  6024. @item @kbd{C-u C-c C-x C-u}
  6025. @kindex C-u C-c C-x C-u
  6026. Update all dynamic blocks (see @ref{Dynamic Blocks}). This is useful
  6027. if you have several clock table blocks in a buffer.
  6028. @item @kbd{S-@key{LEFT}}
  6029. @itemx @kbd{S-@key{RIGHT}} (@code{org-clocktable-try-shift})
  6030. @kindex S-LEFT
  6031. @kindex S-RIGHT
  6032. @findex org-clocktable-try-shift
  6033. Shift the current @samp{:block} interval and update the table. The
  6034. cursor needs to be in the @samp{#+BEGIN: clocktable} line for this
  6035. command. If @samp{:block} is @samp{today}, it is shifted to @samp{today-1},
  6036. etc.
  6037. @end table
  6038. Here is an example of the frame for a clock table as it is inserted
  6039. into the buffer with the @kbd{C-c C-x C-r} command:
  6040. @cindex @samp{BEGIN clocktable}
  6041. @example
  6042. #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
  6043. #+END: clocktable
  6044. @end example
  6045. @noindent
  6046. @vindex org-clocktable-defaults
  6047. The @samp{#+BEGIN} line and specify a number of options to define the
  6048. scope, structure, and formatting of the report. Defaults for all
  6049. these options can be configured in the variable
  6050. @code{org-clocktable-defaults}.
  6051. @noindent
  6052. First there are options that determine which clock entries are to
  6053. be selected:
  6054. @table @asis
  6055. @item :maxlevel
  6056. Maximum level depth to which times are listed in the table.
  6057. Clocks at deeper levels are summed into the upper level.
  6058. @item :scope
  6059. The scope to consider. This can be any of the following:
  6060. @multitable {aaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  6061. @item @code{nil}
  6062. @tab the current buffer or narrowed region
  6063. @item @code{file}
  6064. @tab the full current buffer
  6065. @item @code{subtree}
  6066. @tab the subtree where the clocktable is located
  6067. @item @code{treeN}
  6068. @tab the surrounding level N tree, for example @samp{tree3}
  6069. @item @code{tree}
  6070. @tab the surrounding level 1 tree
  6071. @item @code{agenda}
  6072. @tab all agenda files
  6073. @item @samp{("file" ...)}
  6074. @tab scan these files
  6075. @item @samp{FUNCTION}
  6076. @tab scan files returned by calling FUNCTION with no argument
  6077. @item @code{file-with-archives}
  6078. @tab current file and its archives
  6079. @item @code{agenda-with-archives}
  6080. @tab all agenda files, including archives
  6081. @end multitable
  6082. @item :block
  6083. The time block to consider. This block is specified either
  6084. absolutely, or relative to the current time and may be any of
  6085. these formats:
  6086. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaa}
  6087. @item @samp{2007-12-31}
  6088. @tab New year eve 2007
  6089. @item @samp{2007-12}
  6090. @tab December 2007
  6091. @item @samp{2007-W50}
  6092. @tab ISO-week 50 in 2007
  6093. @item @samp{2007-Q2}
  6094. @tab 2nd quarter in 2007
  6095. @item @samp{2007}
  6096. @tab the year 2007
  6097. @item @code{today}, @code{yesterday}, @code{today-N}
  6098. @tab a relative day
  6099. @item @code{thisweek}, @code{lastweek}, @code{thisweek-N}
  6100. @tab a relative week
  6101. @item @code{thismonth}, @code{lastmonth}, @code{thismonth-N}
  6102. @tab a relative month
  6103. @item @code{thisyear}, @code{lastyear}, @code{thisyear-N}
  6104. @tab a relative year
  6105. @item @code{untilnow}
  6106. @tab all clocked time ever
  6107. @end multitable
  6108. @vindex org-clock-display-default-range
  6109. When this option is not set, Org falls back to the value in
  6110. @code{org-clock-display-default-range}, which defaults to the current
  6111. year.
  6112. Use @kbd{S-@key{LEFT}} or @kbd{S-@key{RIGHT}} to shift the time
  6113. interval.
  6114. @item :tstart
  6115. A time string specifying when to start considering times.
  6116. Relative times like @samp{"<-2w>"} can also be used. See @ref{Matching tags and properties} for relative time syntax.
  6117. @item :tend
  6118. A time string specifying when to stop considering times.
  6119. Relative times like @samp{"<now>"} can also be used. See @ref{Matching tags and properties} for relative time syntax.
  6120. @item wstart
  6121. The starting day of the week. The default is 1 for Monday.
  6122. @item mstart
  6123. The starting day of the month. The default is 1 for the first.
  6124. @item :step
  6125. Set to @code{week} or @code{day} to split the table into chunks. To use
  6126. this, @code{:block} or @code{:tstart}, @code{:tend} are needed.
  6127. @item :stepskip0
  6128. Do not show steps that have zero time.
  6129. @item :fileskip0
  6130. Do not show table sections from files which did not contribute.
  6131. @item :tags
  6132. A tags match to select entries that should contribute. See
  6133. @ref{Matching tags and properties} for the match syntax.
  6134. @end table
  6135. @findex org-clocktable-write-default
  6136. Then there are options that determine the formatting of the table.
  6137. There options are interpreted by the function
  6138. @code{org-clocktable-write-default}, but you can specify your own function
  6139. using the @samp{:formatter} parameter.
  6140. @table @asis
  6141. @item :emphasize
  6142. When @code{t}, emphasize level one and level two items.
  6143. @item :lang
  6144. Language@footnote{Language terms can be set through the variable
  6145. @code{org-clock-clocktable-language-setup}.} to use for descriptive cells like ``Task''.
  6146. @item :link
  6147. Link the item headlines in the table to their origins.
  6148. @item :narrow
  6149. An integer to limit the width of the headline column in the Org
  6150. table. If you write it like @samp{50!}, then the headline is also
  6151. shortened in export.
  6152. @item :indent
  6153. Indent each headline field according to its level.
  6154. @item :tcolumns
  6155. Number of columns to be used for times. If this is smaller than
  6156. @samp{:maxlevel}, lower levels are lumped into one column.
  6157. @item :level
  6158. Should a level number column be included?
  6159. @item :sort
  6160. A cons cell containing the column to sort and a sorting type.
  6161. E.g., @samp{:sort (1 . ?a)} sorts the first column alphabetically.
  6162. @item :compact
  6163. Abbreviation for @samp{:level nil :indent t :narrow 40! :tcolumns 1}.
  6164. All are overwritten except if there is an explicit @samp{:narrow}.
  6165. @item :timestamp
  6166. A timestamp for the entry, when available. Look for SCHEDULED,
  6167. DEADLINE, TIMESTAMP and TIMESTAMP_IA special properties (see
  6168. @ref{Special Properties}), in this order.
  6169. @item :properties
  6170. List of properties shown in the table. Each property gets its
  6171. own column.
  6172. @item :inherit-props
  6173. When this flag is non-@code{nil}, the values for @samp{:properties} are
  6174. inherited.
  6175. @item :formula
  6176. Content of a @samp{TBLFM} keyword to be added and evaluated. As
  6177. a special case, @samp{:formula %} adds a column with % time. If you
  6178. do not specify a formula here, any existing formula below the
  6179. clock table survives updates and is evaluated.
  6180. @item :formatter
  6181. A function to format clock data and insert it into the buffer.
  6182. @end table
  6183. To get a clock summary of the current level 1 tree, for the current
  6184. day, you could write:
  6185. @example
  6186. #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
  6187. #+END: clocktable
  6188. @end example
  6189. @noindent
  6190. To use a specific time range you could write@footnote{Note that all parameters must be specified in a single
  6191. line---the line is broken here only to fit it into the manual.}
  6192. @example
  6193. #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
  6194. :tend "<2006-08-10 Thu 12:00>"
  6195. #+END: clocktable
  6196. @end example
  6197. A range starting a week ago and ending right now could be written as
  6198. @example
  6199. #+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
  6200. #+END: clocktable
  6201. @end example
  6202. A summary of the current subtree with % times would be:
  6203. @example
  6204. #+BEGIN: clocktable :scope subtree :link t :formula %
  6205. #+END: clocktable
  6206. @end example
  6207. A horizontally compact representation of everything clocked during
  6208. last week would be:
  6209. @example
  6210. #+BEGIN: clocktable :scope agenda :block lastweek :compact t
  6211. #+END: clocktable
  6212. @end example
  6213. @node Resolving idle time
  6214. @subsection Resolving idle time and continuous clocking
  6215. @anchor{Resolving idle time (1)}
  6216. @subsubheading Resolving idle time
  6217. @cindex resolve idle time
  6218. @cindex idle, resolve, dangling
  6219. If you clock in on a work item, and then walk away from your
  6220. computer---perhaps to take a phone call---you often need to
  6221. ``resolve'' the time you were away by either subtracting it from the
  6222. current clock, or applying it to another one.
  6223. @vindex org-clock-idle-time
  6224. @vindex org-clock-x11idle-program-name
  6225. By customizing the variable @code{org-clock-idle-time} to some integer,
  6226. such as 10 or 15, Emacs can alert you when you get back to your
  6227. computer after being idle for that many minutes@footnote{On computers using macOS, idleness is based on actual user
  6228. idleness, not just Emacs' idle time. For X11, you can install
  6229. a utility program @samp{x11idle.c}, available in the @samp{contrib/scripts/}
  6230. directory of the Org Git distribution, or install the xprintidle
  6231. package and set it to the variable @code{org-clock-x11idle-program-name} if
  6232. you are running Debian, to get the same general treatment of idleness.
  6233. On other systems, idle time refers to Emacs idle time only.}, and ask what
  6234. you want to do with the idle time. There will be a question waiting
  6235. for you when you get back, indicating how much idle time has passed
  6236. constantly updated with the current amount, as well as a set of
  6237. choices to correct the discrepancy:
  6238. @table @asis
  6239. @item @kbd{k}
  6240. @kindex k
  6241. To keep some or all of the minutes and stay clocked in, press
  6242. @kbd{k}. Org asks how many of the minutes to keep. Press
  6243. @kbd{@key{RET}} to keep them all, effectively changing nothing, or
  6244. enter a number to keep that many minutes.
  6245. @item @kbd{K}
  6246. @kindex K
  6247. If you use the shift key and press @kbd{K}, it keeps however
  6248. many minutes you request and then immediately clock out of that
  6249. task. If you keep all of the minutes, this is the same as just
  6250. clocking out of the current task.
  6251. @item @kbd{s}
  6252. @kindex s
  6253. To keep none of the minutes, use @kbd{s} to subtract all the
  6254. away time from the clock, and then check back in from the moment
  6255. you returned.
  6256. @item @kbd{S}
  6257. @kindex S
  6258. To keep none of the minutes and just clock out at the start of
  6259. the away time, use the shift key and press @kbd{S}.
  6260. Remember that using shift always leave you clocked out, no matter
  6261. which option you choose.
  6262. @item @kbd{C}
  6263. @kindex C
  6264. To cancel the clock altogether, use @kbd{C}. Note that if
  6265. instead of canceling you subtract the away time, and the
  6266. resulting clock amount is less than a minute, the clock is still
  6267. canceled rather than cluttering up the log with an empty entry.
  6268. @end table
  6269. What if you subtracted those away minutes from the current clock, and
  6270. now want to apply them to a new clock? Simply clock in to any task
  6271. immediately after the subtraction. Org will notice that you have
  6272. subtracted time ``on the books'', so to speak, and will ask if you want
  6273. to apply those minutes to the next task you clock in on.
  6274. There is one other instance when this clock resolution magic occurs.
  6275. Say you were clocked in and hacking away, and suddenly your cat chased
  6276. a mouse who scared a hamster that crashed into your UPS's power
  6277. button! You suddenly lose all your buffers, but thanks to auto-save
  6278. you still have your recent Org mode changes, including your last clock
  6279. in.
  6280. If you restart Emacs and clock into any task, Org will notice that you
  6281. have a dangling clock which was never clocked out from your last
  6282. session. Using that clock's starting time as the beginning of the
  6283. unaccounted-for period, Org will ask how you want to resolve that
  6284. time. The logic and behavior is identical to dealing with away time
  6285. due to idleness; it is just happening due to a recovery event rather
  6286. than a set amount of idle time.
  6287. You can also check all the files visited by your Org agenda for
  6288. dangling clocks at any time using @kbd{M-x org-resolve-clocks @key{RET}} (or @kbd{C-c C-x C-z}).
  6289. @anchor{Continuous clocking}
  6290. @subsubheading Continuous clocking
  6291. @cindex continuous clocking
  6292. @vindex org-clock-continuously
  6293. You may want to start clocking from the time when you clocked out the
  6294. previous task. To enable this systematically, set
  6295. @code{org-clock-continuously} to non-@code{nil}. Each time you clock in, Org
  6296. retrieves the clock-out time of the last clocked entry for this
  6297. session, and start the new clock from there.
  6298. If you only want this from time to time, use three universal prefix
  6299. arguments with @code{org-clock-in} and two @kbd{C-u C-u} with
  6300. @code{org-clock-in-last}.
  6301. @node Effort Estimates
  6302. @section Effort Estimates
  6303. @cindex effort estimates
  6304. @cindex @samp{EFFORT}, property
  6305. @vindex org-effort-property
  6306. If you want to plan your work in a very detailed way, or if you need
  6307. to produce offers with quotations of the estimated work effort, you
  6308. may want to assign effort estimates to entries. If you are also
  6309. clocking your work, you may later want to compare the planned effort
  6310. with the actual working time, a great way to improve planning
  6311. estimates. Effort estimates are stored in a special property
  6312. @samp{EFFORT}. You can set the effort for an entry with the following
  6313. commands:
  6314. @table @asis
  6315. @item @kbd{C-c C-x e} (@code{org-set-effort})
  6316. @kindex C-c C-x e
  6317. @findex org-set-effort
  6318. Set the effort estimate for the current entry. With a prefix
  6319. argument, set it to the next allowed value---see below. This
  6320. command is also accessible from the agenda with the @kbd{e}
  6321. key.
  6322. @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate})
  6323. @kindex C-c C-x C-e
  6324. @findex org-clock-modify-effort-estimate
  6325. Modify the effort estimate of the item currently being clocked.
  6326. @end table
  6327. Clearly the best way to work with effort estimates is through column
  6328. view (see @ref{Column View}). You should start by setting up discrete
  6329. values for effort estimates, and a @samp{COLUMNS} format that displays
  6330. these values together with clock sums---if you want to clock your
  6331. time. For a specific buffer you can use:
  6332. @example
  6333. #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
  6334. #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
  6335. @end example
  6336. noindent
  6337. @vindex org-global-properties
  6338. @vindex org-columns-default-format
  6339. or, even better, you can set up these values globally by customizing
  6340. the variables @code{org-global-properties} and
  6341. @code{org-columns-default-format}. In particular if you want to use this
  6342. setup also in the agenda, a global setup may be advised.
  6343. The way to assign estimates to individual items is then to switch to
  6344. column mode, and to use @kbd{S-@key{RIGHT}} and @kbd{S-@key{LEFT}} to
  6345. change the value. The values you enter are immediately summed up in
  6346. the hierarchy. In the column next to it, any clocked time is
  6347. displayed.
  6348. @vindex org-agenda-columns-add-appointments-to-effort-sum
  6349. If you switch to column view in the daily/weekly agenda, the effort
  6350. column summarizes the estimated work effort for each day@footnote{Please note the pitfalls of summing hierarchical data in
  6351. a flat list (@ref{Agenda Column View}).}, and
  6352. you can use this to find space in your schedule. To get an overview
  6353. of the entire part of the day that is committed, you can set the
  6354. option @code{org-agenda-columns-add-appointments-to-effort-sum}. The
  6355. appointments on a day that take place over a specified time interval
  6356. are then also added to the load estimate of the day.
  6357. Effort estimates can be used in secondary agenda filtering that is
  6358. triggered with the @kbd{/} key in the agenda (see @ref{Agenda Commands}). If you have these estimates defined consistently,
  6359. two or three key presses narrow down the list to stuff that fits into
  6360. an available time slot.
  6361. @node Timers
  6362. @section Taking Notes with a Relative Timer
  6363. @cindex relative timer
  6364. @cindex countdown timer
  6365. Org provides two types of timers. There is a relative timer that
  6366. counts up, which can be useful when taking notes during, for example,
  6367. a meeting or a video viewing. There is also a countdown timer.
  6368. The relative and countdown are started with separate commands.
  6369. @table @asis
  6370. @item @kbd{C-c C-x 0} (@code{org-timer-start})
  6371. @kindex C-c C-x 0
  6372. @findex org-timer-start
  6373. Start or reset the relative timer. By default, the timer is set
  6374. to 0. When called with a @kbd{C-u} prefix, prompt the user
  6375. for a starting offset. If there is a timer string at point, this
  6376. is taken as the default, providing a convenient way to restart
  6377. taking notes after a break in the process. When called with
  6378. a double prefix argument @kbd{C-u C-u}, change all timer
  6379. strings in the active region by a certain amount. This can be
  6380. used to fix timer strings if the timer was not started at exactly
  6381. the right moment.
  6382. @item @kbd{C-c C-x ;} (@code{org-timer-set-timer})
  6383. @kindex C-c C-x ;
  6384. @findex org-timer-set-timer
  6385. @vindex org-timer-default-timer
  6386. Start a countdown timer. The user is prompted for a duration.
  6387. @code{org-timer-default-timer} sets the default countdown value.
  6388. Giving a numeric prefix argument overrides this default value.
  6389. This command is available as @kbd{;} in agenda buffers.
  6390. @end table
  6391. Once started, relative and countdown timers are controlled with the
  6392. same commands.
  6393. @table @asis
  6394. @item @kbd{C-c C-x .} (@code{org-timer})
  6395. @kindex C-c C-x .
  6396. @findex org-timer
  6397. Insert a relative time into the buffer. The first time you use
  6398. this, the timer starts. Using a prefix argument restarts it.
  6399. @item @kbd{C-c C-x -} (@code{org-timer-item})
  6400. @kindex C-c C-x -
  6401. @findex org-timer-item
  6402. Insert a description list item with the current relative time.
  6403. With a prefix argument, first reset the timer to 0.
  6404. @item @kbd{M-@key{RET}} (@code{org-insert-heading})
  6405. @kindex M-RET
  6406. @findex org-insert-heading
  6407. Once the timer list is started, you can also use
  6408. @kbd{M-@key{RET}} to insert new timer items.
  6409. @item @kbd{C-c C-x ,} (@code{org-timer-pause-or-continue})
  6410. @kindex C-c C-x ,
  6411. @findex org-timer-pause-or-continue
  6412. Pause the timer, or continue it if it is already paused.
  6413. @item @kbd{C-c C-x _} (@code{org-timer-stop})
  6414. @kindex C-c C-x _
  6415. @findex org-timer-stop
  6416. Stop the timer. After this, you can only start a new timer, not
  6417. continue the old one. This command also removes the timer from
  6418. the mode line.
  6419. @end table
  6420. @node Capture Refile Archive
  6421. @chapter Capture, Refile, Archive
  6422. @cindex capture
  6423. An important part of any organization system is the ability to quickly
  6424. capture new ideas and tasks, and to associate reference material with
  6425. them. Org does this using a process called @emph{capture}. It also can
  6426. store files related to a task (@emph{attachments}) in a special directory.
  6427. Once in the system, tasks and projects need to be moved around.
  6428. Moving completed project trees to an archive file keeps the system
  6429. compact and fast.
  6430. @menu
  6431. * Capture:: Capturing new stuff.
  6432. * Attachments:: Add files to tasks.
  6433. * RSS Feeds:: Getting input from RSS feeds.
  6434. * Protocols:: External access to Emacs and Org.
  6435. * Refile and Copy:: Moving/copying a tree from one place to another.
  6436. * Archiving:: What to do with finished products.
  6437. @end menu
  6438. @node Capture
  6439. @section Capture
  6440. @cindex capture
  6441. Capture lets you quickly store notes with little interruption of your
  6442. work flow. Org's method for capturing new items is heavily inspired
  6443. by John Wiegley's excellent Remember package.
  6444. @menu
  6445. * Setting up capture:: Where notes will be stored.
  6446. * Using capture:: Commands to invoke and terminate capture.
  6447. * Capture templates:: Define the outline of different note types.
  6448. @end menu
  6449. @node Setting up capture
  6450. @subsection Setting up capture
  6451. The following customization sets a default target file for notes.
  6452. @vindex org-default-notes-file
  6453. @lisp
  6454. (setq org-default-notes-file (concat org-directory "/notes.org"))
  6455. @end lisp
  6456. You may also define a global key for capturing new material (see
  6457. @ref{Activation}).
  6458. @node Using capture
  6459. @subsection Using capture
  6460. @table @asis
  6461. @item @kbd{M-x org-capture} (@code{org-capture})
  6462. @findex org-capture
  6463. @cindex date tree
  6464. Display the capture templates menu. If you have templates
  6465. defined (see @ref{Capture templates}), it offers these templates for
  6466. selection or use a new Org outline node as the default template.
  6467. It inserts the template into the target file and switch to an
  6468. indirect buffer narrowed to this new node. You may then insert
  6469. the information you want.
  6470. @item @kbd{C-c C-c} (@code{org-capture-finalize})
  6471. @kindex C-c C-c @r{(Capture buffer)}
  6472. @findex org-capture-finalize
  6473. Once you have finished entering information into the capture
  6474. buffer, @kbd{C-c C-c} returns you to the window
  6475. configuration before the capture process, so that you can resume
  6476. your work without further distraction. When called with a prefix
  6477. argument, finalize and then jump to the captured item.
  6478. @item @kbd{C-c C-w} (@code{org-capture-refile})
  6479. @kindex C-c C-w @r{(Capture buffer)}
  6480. @findex org-capture-refile
  6481. Finalize the capture process by refiling the note to a different
  6482. place (see @ref{Refile and Copy}). Please realize that this is
  6483. a normal refiling command that will be executed---so the cursor
  6484. position at the moment you run this command is important. If you
  6485. have inserted a tree with a parent and children, first move the
  6486. cursor back to the parent. Any prefix argument given to this
  6487. command is passed on to the @code{org-refile} command.
  6488. @item @kbd{C-c C-k} (@code{org-capture-kill})
  6489. @kindex C-c C-k @r{(Capture buffer)}
  6490. @findex org-capture-kill
  6491. Abort the capture process and return to the previous state.
  6492. @end table
  6493. @kindex k c @r{(Agenda)}
  6494. You can also call @code{org-capture} in a special way from the agenda,
  6495. using the @kbd{k c} key combination. With this access, any
  6496. timestamps inserted by the selected capture template defaults to the
  6497. cursor date in the agenda, rather than to the current date.
  6498. To find the locations of the last stored capture, use @code{org-capture}
  6499. with prefix commands:
  6500. @table @asis
  6501. @item @kbd{C-u M-x org-capture}
  6502. Visit the target location of a capture template. You get to
  6503. select the template in the usual way.
  6504. @item @kbd{C-u C-u M-x org-capture}
  6505. Visit the last stored capture item in its buffer.
  6506. @end table
  6507. @vindex org-capture-bookmark
  6508. @vindex org-capture-last-stored
  6509. You can also jump to the bookmark @code{org-capture-last-stored}, which is
  6510. automatically created unless you set @code{org-capture-bookmark} to @code{nil}.
  6511. To insert the capture at point in an Org buffer, call @code{org-capture}
  6512. with a @code{C-0} prefix argument.
  6513. @node Capture templates
  6514. @subsection Capture templates
  6515. @cindex templates, for Capture
  6516. You can use templates for different types of capture items, and for
  6517. different target locations. The easiest way to create such templates
  6518. is through the customize interface.
  6519. @table @asis
  6520. @item @kbd{C}
  6521. @kindex C @r{(Capture menu}
  6522. @vindex org-capture-templates
  6523. Customize the variable @code{org-capture-templates}.
  6524. @end table
  6525. Before we give the formal description of template definitions, let's
  6526. look at an example. Say you would like to use one template to create
  6527. general TODO entries, and you want to put these entries under the
  6528. heading @samp{Tasks} in your file @samp{~/org/gtd.org}. Also, a date tree in
  6529. the file @samp{journal.org} should capture journal entries. A possible
  6530. configuration would look like:
  6531. @lisp
  6532. (setq org-capture-templates
  6533. '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
  6534. "* TODO %?\n %i\n %a")
  6535. ("j" "Journal" entry (file+datetree "~/org/journal.org")
  6536. "* %?\nEntered on %U\n %i\n %a")))
  6537. @end lisp
  6538. @noindent
  6539. If you then press @kbd{t} from the capture menu, Org will prepare
  6540. the template for you like this:
  6541. @example
  6542. * TODO
  6543. [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
  6544. @end example
  6545. @noindent
  6546. During expansion of the template, @code{%a} has been replaced by a link to
  6547. the location from where you called the capture command. This can be
  6548. extremely useful for deriving tasks from emails, for example. You
  6549. fill in the task definition, press @kbd{C-c C-c} and Org returns
  6550. you to the same place where you started the capture process.
  6551. To define special keys to capture to a particular template without
  6552. going through the interactive template selection, you can create your
  6553. key binding like this:
  6554. @lisp
  6555. (define-key global-map "\C-cx"
  6556. (lambda () (interactive) (org-capture nil "x")))
  6557. @end lisp
  6558. @menu
  6559. * Template elements:: What is needed for a complete template entry.
  6560. * Template expansion:: Filling in information about time and context.
  6561. * Templates in contexts:: Only show a template in a specific context.
  6562. @end menu
  6563. @node Template elements
  6564. @subsubsection Template elements
  6565. Now lets look at the elements of a template definition. Each entry in
  6566. @code{org-capture-templates} is a list with the following items:
  6567. @table @asis
  6568. @item keys
  6569. The keys that selects the template, as a string, characters only,
  6570. for example @samp{"a"}, for a template to be selected with a single
  6571. key, or @samp{"bt"} for selection with two keys. When using several
  6572. keys, keys using the same prefix key must be sequential in the
  6573. list and preceded by a 2-element entry explaining the prefix key,
  6574. for example:
  6575. @lisp
  6576. ("b" "Templates for marking stuff to buy")
  6577. @end lisp
  6578. @noindent
  6579. If you do not define a template for the @kbd{C} key, this
  6580. key opens the Customize buffer for this complex variable.
  6581. @item description
  6582. A short string describing the template, shown during selection.
  6583. @item type
  6584. The type of entry, a symbol. Valid values are:
  6585. @table @asis
  6586. @item @code{entry}
  6587. An Org mode node, with a headline. Will be filed as the child
  6588. of the target entry or as a top-level entry. The target file
  6589. should be an Org file.
  6590. @item @code{item}
  6591. A plain list item, placed in the first plain list at the
  6592. target location. Again the target file should be an Org
  6593. file.
  6594. @item @code{checkitem}
  6595. A checkbox item. This only differs from the plain list item
  6596. by the default template.
  6597. @item @code{table-line}
  6598. A new line in the first table at the target location. Where
  6599. exactly the line will be inserted depends on the properties
  6600. @code{:prepend} and @code{:table-line-pos} (see below).
  6601. @item @code{plain}
  6602. Text to be inserted as it is.
  6603. @end table
  6604. @item target
  6605. @vindex org-default-notes-file
  6606. @vindex org-directory
  6607. Specification of where the captured item should be placed. In
  6608. Org files, targets usually define a node. Entries will become
  6609. children of this node. Other types will be added to the table or
  6610. list in the body of this node. Most target specifications
  6611. contain a file name. If that file name is the empty string, it
  6612. defaults to @code{org-default-notes-file}. A file can also be given
  6613. as a variable or as a function called with no argument. When an
  6614. absolute path is not specified for a target, it is taken as
  6615. relative to @code{org-directory}.
  6616. Valid values are:
  6617. @table @asis
  6618. @item @samp{(file "path/to/file")}
  6619. Text will be placed at the beginning or end of that file.
  6620. @item @samp{(id "id of existing org entry")}
  6621. Filing as child of this entry, or in the body of the entry.
  6622. @item @samp{(file+headline "filename" "node headline")}
  6623. Fast configuration if the target heading is unique in the file.
  6624. @item @samp{(file+olp "filename" "Level 1 heading" "Level 2" ...)}
  6625. For non-unique headings, the full path is safer.
  6626. @item @samp{(file+regexp "filename" "regexp to find location")}
  6627. Use a regular expression to position the cursor.
  6628. @item @samp{(file+olp+datetree "filename" [ "Level 1 heading" ...])}
  6629. This target@footnote{Org used to offer four different targets for date/week tree
  6630. capture. Now, Org automatically translates these to use
  6631. @code{file+olp+datetree}, applying the @code{:time-prompt} and @code{:tree-type}
  6632. properties. Please rewrite your date/week-tree targets using
  6633. @code{file+olp+datetree} since the older targets are now deprecated.} creates a heading in a date tree@footnote{A date tree is an outline structure with years on the highest
  6634. level, months or ISO weeks as sublevels and then dates on the lowest
  6635. level. Tags are allowed in the tree structure.} for
  6636. today's date. If the optional outline path is given, the tree
  6637. will be built under the node it is pointing to, instead of at
  6638. top level. Check out the @code{:time-prompt} and @code{:tree-type}
  6639. properties below for additional options.
  6640. @item @code{(file+function "filename" function-finding-location)}
  6641. A function to find the right location in the file.
  6642. @item @code{(clock)}
  6643. File to the entry that is currently being clocked.
  6644. @item @code{(function function-finding-location)}
  6645. Most general way: write your own function which both visits the
  6646. file and moves point to the right location.
  6647. @end table
  6648. @item template
  6649. The template for creating the capture item. If you leave this
  6650. empty, an appropriate default template will be used. Otherwise
  6651. this is a string with escape codes, which will be replaced
  6652. depending on time and context of the capture call. The string
  6653. with escapes may be loaded from a template file, using the
  6654. special syntax @samp{(file "template filename")}. See below for more
  6655. details.
  6656. @item properties
  6657. The rest of the entry is a property list of additional options.
  6658. Recognized properties are:
  6659. @table @asis
  6660. @item @code{:prepend}
  6661. Normally new captured information will be appended at the
  6662. target location (last child, last table line, last list item,
  6663. @dots{}). Setting this property changes that.
  6664. @item @code{:immediate-finish}
  6665. When set, do not offer to edit the information, just file it
  6666. away immediately. This makes sense if the template only needs
  6667. information that can be added automatically.
  6668. @item @code{:empty-lines}
  6669. Set this to the number of lines to insert before and after the
  6670. new item. Default 0, and the only other common value is 1.
  6671. @item @code{:clock-in}
  6672. Start the clock in this item.
  6673. @item @code{:clock-keep}
  6674. Keep the clock running when filing the captured entry.
  6675. @item @code{:clock-resume}
  6676. If starting the capture interrupted a clock, restart that clock
  6677. when finished with the capture. Note that @code{:clock-keep} has
  6678. precedence over @code{:clock-resume}. When setting both to
  6679. non-@code{nil}, the current clock will run and the previous one will
  6680. not be resumed.
  6681. @item @code{:time-prompt}
  6682. Prompt for a date/time to be used for date/week trees and when
  6683. filling the template. Without this property, capture uses the
  6684. current date and time. Even if this property has not been set,
  6685. you can force the same behavior by calling @code{org-capture} with
  6686. a @kbd{C-1} prefix argument.
  6687. @item @code{:tree-type}
  6688. When @code{week}, make a week tree instead of the month tree, i.e.,
  6689. place the headings for each day under a heading with the
  6690. current ISO week.
  6691. @item @code{:unnarrowed}
  6692. Do not narrow the target buffer, simply show the full buffer. Default
  6693. is to narrow it so that you only see the new material.
  6694. @item @code{:table-line-pos}
  6695. Specification of the location in the table where the new line
  6696. should be inserted. It should be a string like @samp{II-3} meaning
  6697. that the new line should become the third line before the
  6698. second horizontal separator line.
  6699. @item @code{:kill-buffer}
  6700. If the target file was not yet visited when capture was invoked, kill
  6701. the buffer again after capture is completed.
  6702. @end table
  6703. @end table
  6704. @node Template expansion
  6705. @subsubsection Template expansion
  6706. In the template itself, special ``%-escapes''@footnote{If you need one of these sequences literally, escape the @samp{%}
  6707. with a backslash.} allow dynamic
  6708. insertion of content. The templates are expanded in the order given
  6709. here:
  6710. @table @asis
  6711. @item @code{%[FILE]}
  6712. Insert the contents of the file given by @var{FILE}.
  6713. @item @code{%(SEXP)}
  6714. Evaluate Elisp SEXP and replace with the result. The
  6715. @var{SEXP} must return a string.
  6716. @item @code{%<FORMAT>}
  6717. The result of format-time-string on the @var{FORMAT}
  6718. specification.
  6719. @item @code{%t}
  6720. Timestamp, date only.
  6721. @item @code{%T}
  6722. Timestamp, with date and time.
  6723. @item @code{%u}, @code{%U}
  6724. Like @code{%t}, @code{%T} above, but inactive timestamps.
  6725. @item @code{%i}
  6726. Initial content, the region when capture is called while the
  6727. region is active. The entire text will be indented like @code{%i}
  6728. itself.
  6729. @item @code{%a}
  6730. Annotation, normally the link created with @code{org-store-link}.
  6731. @item @code{%A}
  6732. Like @code{%a}, but prompt for the description part.
  6733. @item @code{%l}
  6734. Like @code{%a}, but only insert the literal link.
  6735. @item @code{%c}
  6736. Current kill ring head.
  6737. @item @code{%x}
  6738. Content of the X clipboard.
  6739. @item @code{%k}
  6740. Title of the currently clocked task.
  6741. @item @code{%K}
  6742. Link to the currently clocked task.
  6743. @item @code{%n}
  6744. User name (taken from @code{user-full-name}).
  6745. @item @code{%f}
  6746. File visited by current buffer when org-capture was called.
  6747. @item @code{%F}
  6748. Full path of the file or directory visited by current buffer.
  6749. @item @code{%:keyword}
  6750. Specific information for certain link types, see below.
  6751. @item @code{%^g}
  6752. Prompt for tags, with completion on tags in target file.
  6753. @item @code{%^G}
  6754. Prompt for tags, with completion all tags in all agenda files.
  6755. @item @code{%^t}
  6756. Like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}. You may
  6757. define a prompt like @code{%^@{Birthday@}t}.
  6758. @item @code{%^C}
  6759. Interactive selection of which kill or clip to use.
  6760. @item @code{%^L}
  6761. Like @code{%^C}, but insert as link.
  6762. @item @code{%^@{PROP@}p}
  6763. Prompt the user for a value for property PROP.
  6764. @item @code{%^@{PROMPT@}}
  6765. Prompt the user for a string and replace this sequence with it.
  6766. You may specify a default value and a completion table with
  6767. @code{%^@{prompt|default|completion2|completion3...@}}. The arrow keys
  6768. access a prompt-specific history.
  6769. @item @code{%\n}
  6770. Insert the text entered at the Nth @code{%^@{PROMPT@}}, where N is
  6771. a number, starting from 1.
  6772. @item @code{%?}
  6773. After completing the template, position cursor here.
  6774. @end table
  6775. @noindent
  6776. @vindex org-store-link-props
  6777. For specific link types, the following keywords are defined@footnote{If you define your own link types (see @ref{Adding Hyperlink Types}), any property you store with @code{org-store-link-props} can be
  6778. accessed in capture templates in a similar way.}:
  6779. @vindex org-from-is-user-regexp
  6780. @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  6781. @headitem Link type
  6782. @tab Available keywords
  6783. @item bbdb
  6784. @tab @code{%:name}, @code{%:company}
  6785. @item irc
  6786. @tab @code{%:server}, @code{%:port}, @code{%:nick}
  6787. @item mh, rmail
  6788. @tab @code{%:type}, @code{%:subject}, @code{%:message-id}
  6789. @item
  6790. @tab @code{%:from}, @code{%:fromname}, @code{%:fromaddress}
  6791. @item
  6792. @tab @code{%:to}, @code{%:toname}, @code{%:toaddress}
  6793. @item
  6794. @tab @code{%:date} (message date header field)
  6795. @item
  6796. @tab @code{%:date-timestamp} (date as active timestamp)
  6797. @item
  6798. @tab @code{%:date-timestamp-inactive} (date as inactive timestamp)
  6799. @item
  6800. @tab @code{%:fromto} (either ``to NAME'' or ``from NAME'')@footnote{This is always the other, not the user. See the variable
  6801. @code{org-from-is-user-regexp}.}
  6802. @item gnus
  6803. @tab @code{%:group}, for messages also all email fields
  6804. @item w3, w3m
  6805. @tab @code{%:url}
  6806. @item info
  6807. @tab @code{%:file}, @code{%:node}
  6808. @item calendar
  6809. @tab @code{%:date}
  6810. @item org-protocol
  6811. @tab @code{%:link}, @code{%:description}, @code{%:annotation}
  6812. @end multitable
  6813. @node Templates in contexts
  6814. @subsubsection Templates in contexts
  6815. @vindex org-capture-templates-contexts
  6816. To control whether a capture template should be accessible from
  6817. a specific context, you can customize
  6818. @code{org-capture-templates-contexts}. Let's say, for example, that you
  6819. have a capture template ``p'' for storing Gnus emails containing
  6820. patches. Then you would configure this option like this:
  6821. @lisp
  6822. (setq org-capture-templates-contexts
  6823. '(("p" (in-mode . "message-mode"))))
  6824. @end lisp
  6825. You can also tell that the command key @kbd{p} should refer to
  6826. another template. In that case, add this command key like this:
  6827. @lisp
  6828. (setq org-capture-templates-contexts
  6829. '(("p" "q" (in-mode . "message-mode"))))
  6830. @end lisp
  6831. See the docstring of the variable for more information.
  6832. @node Attachments
  6833. @section Attachments
  6834. @cindex attachments
  6835. @vindex org-attach-directory
  6836. It is often useful to associate reference material with an outline
  6837. node/task. Small chunks of plain text can simply be stored in the
  6838. subtree of a project. Hyperlinks (see @ref{Hyperlinks}) can establish
  6839. associations with files that live elsewhere on your computer or in the
  6840. cloud, like emails or source code files belonging to a project.
  6841. Another method is @emph{attachments}, which are files located in
  6842. a directory belonging to an outline node. Org uses directories named
  6843. by the unique ID of each entry. These directories are located in the
  6844. @code{data} directory which lives in the same directory where your Org file
  6845. lives@footnote{If you move entries or Org files from one directory to
  6846. another, you may want to configure @code{org-attach-directory} to contain
  6847. an absolute path.}. If you initialize this directory with @samp{git init}, Org
  6848. automatically commits changes when it sees them. The attachment
  6849. system has been contributed to Org by John Wiegley.
  6850. In cases where it seems better to do so, you can attach a directory of
  6851. your choice to an entry. You can also make children inherit the
  6852. attachment directory from a parent, so that an entire subtree uses the
  6853. same attached directory.
  6854. @noindent
  6855. The following commands deal with attachments:
  6856. @table @asis
  6857. @item @kbd{C-c C-a} (@code{org-attach})
  6858. @kindex C-c C-a
  6859. @findex org-attach
  6860. The dispatcher for commands related to the attachment system.
  6861. After these keys, a list of commands is displayed and you must
  6862. press an additional key to select a command:
  6863. @table @asis
  6864. @item @kbd{a} (@code{org-attach-attach})
  6865. @kindex C-c C-a a
  6866. @findex org-attach-attach
  6867. @vindex org-attach-method
  6868. Select a file and move it into the task's attachment
  6869. directory. The file is copied, moved, or linked, depending
  6870. on @code{org-attach-method}. Note that hard links are not
  6871. supported on all systems.
  6872. @item @kbd{c}/@kbd{m}/@kbd{l}
  6873. @kindex C-c C-a c
  6874. @kindex C-c C-a m
  6875. @kindex C-c C-a l
  6876. Attach a file using the copy/move/link method. Note that
  6877. hard links are not supported on all systems.
  6878. @item @kbd{n} (@code{org-attach-new})
  6879. @kindex C-c C-a n
  6880. @findex org-attach-new
  6881. Create a new attachment as an Emacs buffer.
  6882. @item @kbd{z} (@code{org-attach-sync})
  6883. @kindex C-c C-a z
  6884. @findex org-attach-sync
  6885. Synchronize the current task with its attachment directory, in case
  6886. you added attachments yourself.
  6887. @item @kbd{o} (@code{org-attach-open})
  6888. @kindex C-c C-a o
  6889. @findex org-attach-open
  6890. @vindex org-file-apps
  6891. Open current task's attachment. If there is more than one,
  6892. prompt for a file name first. Opening follows the rules set
  6893. by @code{org-file-apps}. For more details, see the information
  6894. on following hyperlinks (see @ref{Handling Links}).
  6895. @item @kbd{O} (@code{org-attach-open-in-emacs})
  6896. @kindex C-c C-a O
  6897. @findex org-attach-open-in-emacs
  6898. Also open the attachment, but force opening the file in
  6899. Emacs.
  6900. @item @kbd{f} (@code{org-attach-reveal})
  6901. @kindex C-c C-a f
  6902. @findex org-attach-reveal
  6903. Open the current task's attachment directory.
  6904. @item @kbd{F} (@code{org-attach-reveal-in-emacs})
  6905. @kindex C-c C-a F
  6906. @findex org-attach-reveal-in-emacs
  6907. Also open the directory, but force using Dired in Emacs.
  6908. @item @kbd{d} (@code{org-attach-delete-one})
  6909. @kindex C-c C-a d
  6910. Select and delete a single attachment.
  6911. @item @kbd{D} (@code{org-attach-delete-all})
  6912. @kindex C-c C-a D
  6913. Delete all of a task's attachments. A safer way is to open
  6914. the directory in Dired and delete from there.
  6915. @item @kbd{s} (@code{org-attach-set-directory})
  6916. @kindex C-c C-a s
  6917. @cindex @samp{ATTACH_DIR}, property
  6918. Set a specific directory as the entry's attachment
  6919. directory. This works by putting the directory path into
  6920. the @samp{ATTACH_DIR} property.
  6921. @item @kbd{i} (@code{org-attach-set-inherit})
  6922. @kindex C-c C-a i
  6923. @cindex @samp{ATTACH_DIR_INHERIT}, property
  6924. Set the @samp{ATTACH_DIR_INHERIT} property, so that children use
  6925. the same directory for attachments as the parent does.
  6926. @end table
  6927. @end table
  6928. @cindex attach from Dired
  6929. @findex org-attach-dired-to-subtree
  6930. It is possible to attach files to a subtree from a Dired buffer. To
  6931. use this feature, have one window in Dired mode containing the file(s)
  6932. to be attached and another window with point in the subtree that shall
  6933. get the attachments. In the Dired window, with point on a file,
  6934. @kbd{M-x org-attach-dired-to-subtree} attaches the file to the
  6935. subtree using the attachment method set by variable
  6936. @code{org-attach-method}. When files are marked in the Dired window then
  6937. all marked files get attached.
  6938. Add the following lines to the Emacs init file to have @kbd{C-c C-x a} attach files in Dired buffers.
  6939. @lisp
  6940. (add-hook 'dired-mode-hook
  6941. (lambda ()
  6942. (define-key dired-mode-map
  6943. (kbd "C-c C-x a")
  6944. #'org-attach-dired-to-subtree))))
  6945. @end lisp
  6946. The following code shows how to bind the previous command with
  6947. a specific attachment method.
  6948. @lisp
  6949. (add-hook 'dired-mode-hook
  6950. (lambda ()
  6951. (define-key dired-mode-map (kbd "C-c C-x c")
  6952. (lambda ()
  6953. (interactive)
  6954. (let ((org-attach-method 'cp))
  6955. (call-interactively #'org-attach-dired-to-subtree))))))
  6956. @end lisp
  6957. @node RSS Feeds
  6958. @section RSS Feeds
  6959. @cindex RSS feeds
  6960. @cindex Atom feeds
  6961. Org can add and change entries based on information found in RSS feeds
  6962. and Atom feeds. You could use this to make a task out of each new
  6963. podcast in a podcast feed. Or you could use a phone-based
  6964. note-creating service on the web to import tasks into Org. To access
  6965. feeds, configure the variable @code{org-feed-alist}. The docstring of this
  6966. variable has detailed information. With the following
  6967. @lisp
  6968. (setq org-feed-alist
  6969. '(("Slashdot"
  6970. "http://rss.slashdot.org/Slashdot/slashdot"
  6971. "~/txt/org/feeds.org" "Slashdot Entries")))
  6972. @end lisp
  6973. @noindent
  6974. new items from the feed provided by @samp{rss.slashdot.org} result in new
  6975. entries in the file @samp{~/org/feeds.org} under the heading @samp{Slashdot
  6976. Entries}, whenever the following command is used:
  6977. @table @asis
  6978. @item @kbd{C-c C-x g} (@code{org-feed-update-all})
  6979. @kindex C-c C-x g
  6980. Collect items from the feeds configured in @code{org-feed-alist} and
  6981. act upon them.
  6982. @item @kbd{C-c C-x G} (@code{org-feed-goto-inbox})
  6983. @kindex C-c C-x G
  6984. Prompt for a feed name and go to the inbox configured for this feed.
  6985. @end table
  6986. Under the same headline, Org creates a drawer @samp{FEEDSTATUS} in which it
  6987. stores information about the status of items in the feed, to avoid
  6988. adding the same item several times.
  6989. For more information, including how to read atom feeds, see
  6990. @samp{org-feed.el} and the docstring of @code{org-feed-alist}.
  6991. @node Protocols
  6992. @section Protocols for External Access
  6993. @cindex protocols, for external access
  6994. Org protocol is a means to trigger custom actions in Emacs from
  6995. external applications. Any application that supports calling external
  6996. programs with an URL as argument may be used with this functionality.
  6997. For example, you can configure bookmarks in your web browser to send
  6998. a link to the current page to Org and create a note from it using
  6999. capture (see @ref{Capture}). You can also create a bookmark that tells
  7000. Emacs to open the local source file of a remote website you are
  7001. browsing.
  7002. @cindex Org protocol, set-up
  7003. @cindex Installing Org protocol
  7004. In order to use Org protocol from an application, you need to register
  7005. @samp{org-protocol://} as a valid scheme-handler. External calls are
  7006. passed to Emacs through the @samp{emacsclient} command, so you also need to
  7007. ensure an Emacs server is running. More precisely, when the
  7008. application calls
  7009. @example
  7010. emacsclient org-protocol://PROTOCOL?key1=val1&key2=val2
  7011. @end example
  7012. @noindent
  7013. Emacs calls the handler associated to @var{PROTOCOL} with
  7014. argument @samp{(:key1 val1 :key2 val2)}.
  7015. @cindex protocol, new protocol
  7016. @cindex defining new protocols
  7017. Org protocol comes with three predefined protocols, detailed in the
  7018. following sections. Configure @code{org-protocol-protocol-alist} to define
  7019. your own.
  7020. @menu
  7021. * @code{store-link} protocol:: Store a link, push URL to kill-ring.
  7022. * @code{capture} protocol:: Fill a buffer with external information.
  7023. * @code{open-source} protocol:: Edit published contents.
  7024. @end menu
  7025. @node @code{store-link} protocol
  7026. @subsection @code{store-link} protocol
  7027. @cindex store-link protocol
  7028. @cindex protocol, store-link
  7029. Using @code{store-link} handler, you can copy links, insertable through
  7030. @kbd{M-x org-insert-link} or yanking thereafter. More precisely,
  7031. the command
  7032. @example
  7033. emacsclient org-protocol://store-link?url=URL&title=TITLE
  7034. @end example
  7035. @noindent
  7036. stores the following link:
  7037. @example
  7038. [[URL][TITLE]]
  7039. @end example
  7040. In addition, @var{URL} is pushed on the kill-ring for yanking.
  7041. You need to encode @var{URL} and @var{TITLE} if they contain
  7042. slashes, and probably quote those for the shell.
  7043. To use this feature from a browser, add a bookmark with an arbitrary
  7044. name, e.g., @samp{Org: store-link} and enter this as @emph{Location}:
  7045. @example
  7046. javascript:location.href='org-protocol://store-link?url='+
  7047. encodeURIComponent(location.href);
  7048. @end example
  7049. @node @code{capture} protocol
  7050. @subsection @code{capture} protocol
  7051. @cindex capture protocol
  7052. @cindex protocol, capture
  7053. Activating ``capture'' handler pops up a @samp{Capture} buffer and fills the
  7054. capture template associated to the @samp{X} key with them.
  7055. @example
  7056. emacsclient org-protocol://capture?template=X?url=URL?title=TITLE?body=BODY
  7057. @end example
  7058. To use this feature, add a bookmark with an arbitrary name, e.g.
  7059. @samp{Org: capture} and enter this as @samp{Location}:
  7060. @example
  7061. javascript:location.href='org-protocol://capture?template=x'+
  7062. '&url='+encodeURIComponent(window.location.href)+
  7063. '&title='+encodeURIComponent(document.title)+
  7064. '&body='+encodeURIComponent(window.getSelection());
  7065. @end example
  7066. @vindex org-protocol-default-template-key
  7067. The result depends on the capture template used, which is set in the
  7068. bookmark itself, as in the example above, or in
  7069. @code{org-protocol-default-template-key}.
  7070. The following template placeholders are available:
  7071. @example
  7072. %:link The URL
  7073. %:description The webpage title
  7074. %:annotation Equivalent to [[%:link][%:description]]
  7075. %i The selected text
  7076. @end example
  7077. @node @code{open-source} protocol
  7078. @subsection @code{open-source} protocol
  7079. @cindex open-source protocol
  7080. @cindex protocol, open-source
  7081. The @code{open-source} handler is designed to help with editing local
  7082. sources when reading a document. To that effect, you can use
  7083. a bookmark with the following location:
  7084. @example
  7085. javascript:location.href='org-protocol://open-source?&url='+
  7086. encodeURIComponent(location.href)
  7087. @end example
  7088. @vindex org-protocol-project-alist
  7089. The variable @code{org-protocol-project-alist} maps URLs to local file
  7090. names, by stripping URL parameters from the end and replacing the
  7091. @code{:base-url} with @code{:working-directory} and @code{:online-suffix} with
  7092. @code{:working-suffix}. For example, assuming you own a local copy of
  7093. @samp{https://orgmode.org/worg/} contents at @samp{/home/user/worg}, you can set
  7094. @code{org-protocol-project-alist} to the following
  7095. @lisp
  7096. (setq org-protocol-project-alist
  7097. '(("Worg"
  7098. :base-url "https://orgmode.org/worg/"
  7099. :working-directory "/home/user/worg/"
  7100. :online-suffix ".html"
  7101. :working-suffix ".org")))
  7102. @end lisp
  7103. @noindent
  7104. If you are now browsing
  7105. @samp{https://orgmode.org/worg/org-contrib/org-protocol.html} and find
  7106. a typo or have an idea about how to enhance the documentation, simply
  7107. click the bookmark and start editing.
  7108. @cindex rewritten URL in open-source protocol
  7109. @cindex protocol, open-source rewritten URL
  7110. However, such mapping may not yield the desired results. Suppose you
  7111. maintain an online store located at @samp{http://example.com/}. The local
  7112. sources reside in @samp{/home/user/example/}. It is common practice to
  7113. serve all products in such a store through one file and rewrite URLs
  7114. that do not match an existing file on the server. That way, a request
  7115. to @samp{http://example.com/print/posters.html} might be rewritten on the
  7116. server to something like
  7117. @samp{http://example.com/shop/products.php/posters.html.php}. The
  7118. @code{open-source} handler probably cannot find a file named
  7119. @samp{/home/user/example/print/posters.html.php} and fails.
  7120. Such an entry in @code{org-protocol-project-alist} may hold an additional
  7121. property @code{:rewrites}. This property is a list of cons cells, each of
  7122. which maps a regular expression to a path relative to the
  7123. @code{:working-directory}.
  7124. Now map the URL to the path @samp{/home/user/example/products.php} by
  7125. adding @code{:rewrites} rules like this:
  7126. @lisp
  7127. (setq org-protocol-project-alist
  7128. '(("example.com"
  7129. :base-url "http://example.com/"
  7130. :working-directory "/home/user/example/"
  7131. :online-suffix ".php"
  7132. :working-suffix ".php"
  7133. :rewrites (("example.com/print/" . "products.php")
  7134. ("example.com/$" . "index.php")))))
  7135. @end lisp
  7136. @noindent
  7137. Since @samp{example.com/$} is used as a regular expression, it maps
  7138. @samp{http://example.com/}, @samp{https://example.com},
  7139. @samp{http://www.example.com/} and similar to
  7140. @samp{/home/user/example/index.php}.
  7141. The @code{:rewrites} rules are searched as a last resort if and only if no
  7142. existing file name is matched.
  7143. @cindex protocol, open-source, set-up mapping
  7144. @cindex mappings in open-source protocol
  7145. @findex org-protocol-create
  7146. @findex org-protocol-create-for-org
  7147. Two functions can help you filling @code{org-protocol-project-alist} with
  7148. valid contents: @code{org-protocol-create} and
  7149. @code{org-protocol-create-for-org}. The latter is of use if you're editing
  7150. an Org file that is part of a publishing project.
  7151. @node Refile and Copy
  7152. @section Refile and Copy
  7153. @cindex refiling notes
  7154. @cindex copying notes
  7155. When reviewing the captured data, you may want to refile or to copy
  7156. some of the entries into a different list, for example into a project.
  7157. Cutting, finding the right location, and then pasting the note is
  7158. cumbersome. To simplify this process, you can use the following
  7159. special command:
  7160. @table @asis
  7161. @item @kbd{C-c M-w} (@code{org-copy})
  7162. @kindex C-c M-w
  7163. @findex org-copy
  7164. Copying works like refiling, except that the original note is not
  7165. deleted.
  7166. @item @kbd{C-c C-w} (@code{org-refile})
  7167. @kindex C-c C-w
  7168. @findex org-refile
  7169. @vindex org-reverse-note-order
  7170. @vindex org-refile-targets
  7171. @vindex org-refile-use-outline-path
  7172. @vindex org-outline-path-complete-in-steps
  7173. @vindex org-refile-allow-creating-parent-nodes
  7174. @vindex org-log-refile
  7175. Refile the entry or region at point. This command offers
  7176. possible locations for refiling the entry and lets you select one
  7177. with completion. The item (or all items in the region) is filed
  7178. below the target heading as a subitem. Depending on
  7179. @code{org-reverse-note-order}, it is either the first or last subitem.
  7180. By default, all level 1 headlines in the current buffer are
  7181. considered to be targets, but you can have more complex
  7182. definitions across a number of files. See the variable
  7183. @code{org-refile-targets} for details. If you would like to select
  7184. a location via a file-path-like completion along the outline
  7185. path, see the variables @code{org-refile-use-outline-path} and
  7186. @code{org-outline-path-complete-in-steps}. If you would like to be
  7187. able to create new nodes as new parents for refiling on the fly,
  7188. check the variable @code{org-refile-allow-creating-parent-nodes}.
  7189. When the variable @code{org-log-refile}@footnote{Note the corresponding @samp{STARTUP} options @samp{logrefile},
  7190. @samp{lognoterefile}, and @samp{nologrefile}.} is set, a timestamp or
  7191. a note is recorded whenever an entry is refiled.
  7192. @item @kbd{C-u C-c C-w}
  7193. @kindex C-u C-c C-w
  7194. Use the refile interface to jump to a heading.
  7195. @item @kbd{C-u C-u C-c C-w} (@code{org-refile-goto-last-stored})
  7196. @kindex C-u C-u C-c C-w
  7197. @findex org-refile-goto-last-stored
  7198. Jump to the location where @code{org-refile} last moved a tree to.
  7199. @item @kbd{C-2 C-c C-w}
  7200. @kindex C-2 C-c C-w
  7201. Refile as the child of the item currently being clocked.
  7202. @item @kbd{C-3 C-c C-w}
  7203. @kindex C-3 C-c C-w
  7204. @vindex org-refile-keep
  7205. Refile and keep the entry in place. Also see @code{org-refile-keep}
  7206. to make this the default behavior, and beware that this may
  7207. result in duplicated @code{ID} properties.
  7208. @item @kbd{C-0 C-c C-w} or @kbd{C-u C-u C-u C-c C-w} (@code{org-refile-cache-clear})
  7209. @kindex C-u C-u C-u C-c C-w
  7210. @kindex C-0 C-c C-w
  7211. @findex org-refile-cache-clear
  7212. @vindex org-refile-use-cache
  7213. Clear the target cache. Caching of refile targets can be turned
  7214. on by setting @code{org-refile-use-cache}. To make the command see
  7215. new possible targets, you have to clear the cache with this
  7216. command.
  7217. @end table
  7218. @node Archiving
  7219. @section Archiving
  7220. @cindex archiving
  7221. When a project represented by a (sub)tree is finished, you may want to
  7222. move the tree out of the way and to stop it from contributing to the
  7223. agenda. Archiving is important to keep your working files compact and
  7224. global searches like the construction of agenda views fast.
  7225. @table @asis
  7226. @item @kbd{C-c C-x C-a} (@code{org-archive-subtree-default})
  7227. @kindex C-c C-x C-a
  7228. @findex org-archive-subtree-default
  7229. @vindex org-archive-default-command
  7230. Archive the current entry using the command specified in the
  7231. variable @code{org-archive-default-command}.
  7232. @end table
  7233. @menu
  7234. * Moving subtrees:: Moving a tree to an archive file.
  7235. * Internal archiving:: Switch off a tree but keep it in the file.
  7236. @end menu
  7237. @node Moving subtrees
  7238. @subsection Moving a tree to an archive file
  7239. @cindex external archiving
  7240. The most common archiving action is to move a project tree to another
  7241. file, the archive file.
  7242. @table @asis
  7243. @item @kbd{C-c C-x C-s} or short @kbd{C-c $} (@code{org-archive-subtree})
  7244. @kindex C-c C-x C-s
  7245. @kindex C-c $
  7246. @findex org-archive-subtree
  7247. @vindex org-archive-location
  7248. Archive the subtree starting at the cursor position to the
  7249. location given by @code{org-archive-location}.
  7250. @item @kbd{C-u C-c C-x C-s}
  7251. @kindex C-u C-c C-x C-s
  7252. Check if any direct children of the current headline could be
  7253. moved to the archive. To do this, check each subtree for open
  7254. TODO entries. If none is found, the command offers to move it to
  7255. the archive location. If the cursor is @emph{not} on a headline when
  7256. this command is invoked, check level 1 trees.
  7257. @item @kbd{C-u C-u C-c C-x C-s}
  7258. @kindex C-u C-u C-c C-x C-s
  7259. As above, but check subtree for timestamps instead of TODO
  7260. entries. The command offers to archive the subtree if it @emph{does}
  7261. contain a timestamp, and that timestamp is in the past.
  7262. @end table
  7263. @cindex archive locations
  7264. The default archive location is a file in the same directory as the
  7265. current file, with the name derived by appending @samp{_archive} to the
  7266. current file name. You can also choose what heading to file archived
  7267. items under, with the possibility to add them to a datetree in a file.
  7268. For information and examples on how to specify the file and the
  7269. heading, see the documentation string of the variable
  7270. @code{org-archive-location}.
  7271. There is also an in-buffer option for setting this variable, for
  7272. example:
  7273. @cindex @samp{ARCHIVE}, keyword
  7274. @example
  7275. #+ARCHIVE: %s_done::
  7276. @end example
  7277. @noindent
  7278. @cindex ARCHIVE, property
  7279. If you would like to have a special archive location for a single
  7280. entry or a (sub)tree, give the entry an @samp{ARCHIVE} property with the
  7281. location as the value (see @ref{Properties and Columns}).
  7282. @vindex org-archive-save-context-info
  7283. When a subtree is moved, it receives a number of special properties
  7284. that record context information like the file from where the entry
  7285. came, its outline path the archiving time etc. Configure the variable
  7286. @code{org-archive-save-context-info} to adjust the amount of information
  7287. added.
  7288. @node Internal archiving
  7289. @subsection Internal archiving
  7290. @cindex @samp{ARCHIVE}, tag
  7291. If you want to just switch off---for agenda views---certain subtrees
  7292. without moving them to a different file, you can use the @samp{ARCHIVE}
  7293. tag.
  7294. A headline that is marked with the @samp{ARCHIVE} tag (see @ref{Tags}) stays at
  7295. its location in the outline tree, but behaves in the following way:
  7296. @itemize
  7297. @item
  7298. @vindex org-cycle-open-archived-trees
  7299. It does not open when you attempt to do so with a visibility cycling
  7300. command (see @ref{Visibility Cycling}). You can force cycling archived
  7301. subtrees with @kbd{C-@key{TAB}}, or by setting the option
  7302. @code{org-cycle-open-archived-trees}. Also normal outline commands, like
  7303. @code{outline-show-all}, open archived subtrees.
  7304. @item
  7305. @vindex org-sparse-tree-open-archived-trees
  7306. During sparse tree construction (see @ref{Sparse Trees}), matches in
  7307. archived subtrees are not exposed, unless you configure the option
  7308. @code{org-sparse-tree-open-archived-trees}.
  7309. @item
  7310. @vindex org-agenda-skip-archived-trees
  7311. During agenda view construction (see @ref{Agenda Views}), the content of
  7312. archived trees is ignored unless you configure the option
  7313. @code{org-agenda-skip-archived-trees}, in which case these trees are
  7314. always included. In the agenda you can press @kbd{v a} to get
  7315. archives temporarily included.
  7316. @item
  7317. @vindex org-export-with-archived-trees
  7318. Archived trees are not exported (see @ref{Exporting}), only the headline
  7319. is. Configure the details using the variable
  7320. @code{org-export-with-archived-trees}.
  7321. @item
  7322. @vindex org-columns-skip-archived-trees
  7323. Archived trees are excluded from column view unless the variable
  7324. @code{org-columns-skip-archived-trees} is configured to @code{nil}.
  7325. @end itemize
  7326. The following commands help manage the @samp{ARCHIVE} tag:
  7327. @table @asis
  7328. @item @kbd{C-c C-x a} (@code{org-toggle-archive-tag})
  7329. @kindex C-c C-x a
  7330. @findex org-toggle-archive-tag
  7331. Toggle the archive tag for the current headline. When the tag is
  7332. set, the headline changes to a shadowed face, and the subtree
  7333. below it is hidden.
  7334. @item @kbd{C-u C-c C-x a}
  7335. @kindex C-u C-c C-x a
  7336. Check if any direct children of the current headline should be
  7337. archived. To do this, check each subtree for open TODO entries.
  7338. If none is found, the command offers to set the @samp{ARCHIVE} tag for
  7339. the child. If the cursor is @emph{not} on a headline when this
  7340. command is invoked, check the level 1 trees.
  7341. @item @kbd{C-@key{TAB}}, @code{org-force-cycle-archived}
  7342. @kindex C-TAB
  7343. Cycle a tree even if it is tagged with @samp{ARCHIVE}.
  7344. @item @kbd{C-c C-x A} (@code{org-archive-to-archive-sibling})
  7345. @kindex C-c C-x A
  7346. @findex org-archive-to-archive-sibling
  7347. Move the current entry to the @emph{Archive Sibling}. This is
  7348. a sibling of the entry with the heading @samp{Archive} and the archive
  7349. tag. The entry becomes a child of that sibling and in this way
  7350. retains a lot of its original context, including inherited tags
  7351. and approximate position in the outline.
  7352. @end table
  7353. @node Agenda Views
  7354. @chapter Agenda Views
  7355. @cindex agenda views
  7356. Due to the way Org works, TODO items, time-stamped items, and tagged
  7357. headlines can be scattered throughout a file or even a number of
  7358. files. To get an overview of open action items, or of events that are
  7359. important for a particular date, this information must be collected,
  7360. sorted and displayed in an organized way.
  7361. Org can select items based on various criteria and display them in
  7362. a separate buffer. Seven different view types are provided:
  7363. @itemize
  7364. @item
  7365. an @emph{agenda} that is like a calendar and shows information for
  7366. specific dates,
  7367. @item
  7368. a @emph{TODO list} that covers all unfinished action items,
  7369. @item
  7370. a @emph{match view}, showings headlines based on the tags, properties,
  7371. and TODO state associated with them,
  7372. @item
  7373. a @emph{timeline view} that shows all events in a single Org file, in
  7374. time-sorted view,
  7375. @item
  7376. a @emph{text search view} that shows all entries from multiple files that
  7377. contain specified keywords,
  7378. @item
  7379. a @emph{stuck projects view} showing projects that currently do not move
  7380. along, and
  7381. @item
  7382. @emph{custom views} that are special searches and combinations of
  7383. different views.
  7384. @end itemize
  7385. @noindent
  7386. The extracted information is displayed in a special @emph{agenda buffer}.
  7387. This buffer is read-only, but provides commands to visit the
  7388. corresponding locations in the original Org files, and even to edit
  7389. these files remotely.
  7390. @vindex org-agenda-skip-comment-trees
  7391. @vindex org-agenda-skip-archived-trees
  7392. @cindex commented entries, in agenda views
  7393. @cindex archived entries, in agenda views
  7394. By default, the report ignores commented (see @ref{Comment Lines}) and
  7395. archived (see @ref{Internal archiving}) entries. You can override this by
  7396. setting @code{org-agenda-skip-comment-trees} and
  7397. @code{org-agenda-skip-archived-trees} to @code{nil}.
  7398. @vindex org-agenda-window-setup
  7399. @vindex org-agenda-restore-windows-after-quit
  7400. Two variables control how the agenda buffer is displayed and whether
  7401. the window configuration is restored when the agenda exits:
  7402. @code{org-agenda-window-setup} and @code{org-agenda-restore-windows-after-quit}.
  7403. @menu
  7404. * Agenda Files:: Files being searched for agenda information.
  7405. * Agenda Dispatcher:: Keyboard access to agenda views.
  7406. * Built-in Agenda Views:: What is available out of the box?
  7407. * Presentation and Sorting:: How agenda items are prepared for display.
  7408. * Agenda Commands:: Remote editing of Org trees.
  7409. * Custom Agenda Views:: Defining special searches and views.
  7410. * Exporting Agenda Views:: Writing a view to a file.
  7411. * Agenda Column View:: Using column view for collected entries.
  7412. @end menu
  7413. @node Agenda Files
  7414. @section Agenda Files
  7415. @cindex agenda files
  7416. @cindex files for agenda
  7417. @vindex org-agenda-files
  7418. The information to be shown is normally collected from all @emph{agenda
  7419. files}, the files listed in the variable @code{org-agenda-files}@footnote{If the value of that variable is not a list, but a single file
  7420. name, then the list of agenda files in maintained in that external
  7421. file.}.
  7422. If a directory is part of this list, all files with the extension
  7423. @samp{.org} in this directory are part of the list.
  7424. Thus, even if you only work with a single Org file, that file should
  7425. be put into the list@footnote{When using the dispatcher, pressing @kbd{<} before
  7426. selecting a command actually limits the command to the current file,
  7427. and ignores @code{org-agenda-files} until the next dispatcher command.}. You can customize @code{org-agenda-files},
  7428. but the easiest way to maintain it is through the following commands
  7429. @table @asis
  7430. @item @kbd{C-c [} (@code{org-agenda-file-to-front})
  7431. @kindex C-c [
  7432. @findex org-agenda-file-to-front
  7433. @cindex files, adding to agenda list
  7434. Add current file to the list of agenda files. The file is added
  7435. to the front of the list. If it was already in the list, it is
  7436. moved to the front. With a prefix argument, file is added/moved
  7437. to the end.
  7438. @item @kbd{C-c ]} (@code{org-remove-file})
  7439. @kindex C-c ]
  7440. @findex org-remove-file
  7441. Remove current file from the list of agenda files.
  7442. @item @kbd{C-'}
  7443. @itemx @kbd{C-,} (@code{org-cycle-agenda-files})
  7444. @kindex C-'
  7445. @kindex C-,
  7446. @findex org-cycle-agenda-files
  7447. @cindex cycling, of agenda files
  7448. Cycle through agenda file list, visiting one file after the other.
  7449. @item @kbd{M-x org-switchb}
  7450. @findex org-switchb
  7451. Command to use an iswitchb-like interface to switch to and
  7452. between Org buffers.
  7453. @end table
  7454. @noindent
  7455. The Org menu contains the current list of files and can be used to
  7456. visit any of them.
  7457. If you would like to focus the agenda temporarily on a file not in
  7458. this list, or on just one file in the list, or even on only a subtree
  7459. in a file, then this can be done in different ways. For a single
  7460. agenda command, you may press @kbd{<} once or several times in
  7461. the dispatcher (see @ref{Agenda Dispatcher}). To restrict the agenda
  7462. scope for an extended period, use the following commands:
  7463. @table @asis
  7464. @item @kbd{C-c C-x <} (@code{org-agenda-set-restriction-lock})
  7465. @kindex C-c C-x <
  7466. @findex org-agenda-set-restriction-lock
  7467. Permanently restrict the agenda to the current subtree. When
  7468. called with a prefix argument, or with the cursor before the
  7469. first headline in a file, set the agenda scope to the entire
  7470. file. This restriction remains in effect until removed with
  7471. @kbd{C-c C-x >}, or by typing either @kbd{<} or
  7472. @kbd{>} in the agenda dispatcher. If there is a window
  7473. displaying an agenda view, the new restriction takes effect
  7474. immediately.
  7475. @item @kbd{C-c C-x >} (@code{org-agenda-remove-restriction-lock})
  7476. @kindex C-c C-x >
  7477. @findex org-agenda-remove-restriction-lock
  7478. Remove the permanent restriction created by @kbd{C-c C-x <}.
  7479. @end table
  7480. @noindent
  7481. When working with @samp{speedbar.el}, you can use the following commands in
  7482. the Speedbar frame:
  7483. @table @asis
  7484. @item @kbd{<} (@code{org-speedbar-set-agenda-restriction})
  7485. @findex org-speedbar-set-agenda-restriction
  7486. Permanently restrict the agenda to the item---either an Org file
  7487. or a subtree in such a file---at the cursor in the Speedbar
  7488. frame. If there is a window displaying an agenda view, the new
  7489. restriction takes effect immediately.
  7490. @item @kbd{>} (@code{org-agenda-remove-restriction-lock})
  7491. @findex org-agenda-remove-restriction-lock
  7492. Lift the restriction.
  7493. @end table
  7494. @node Agenda Dispatcher
  7495. @section The Agenda Dispatcher
  7496. @cindex agenda dispatcher
  7497. @cindex dispatching agenda commands
  7498. The views are created through a dispatcher, accessible with @kbd{M-x org-agenda}, or, better, bound to a global key (see @ref{Activation}).
  7499. It displays a menu from which an additional letter is required to
  7500. execute a command. The dispatcher offers the following default
  7501. commands:
  7502. @table @asis
  7503. @item @kbd{a}
  7504. Create the calendar-like agenda (see @ref{Weekly/daily agenda}).
  7505. @item @kbd{t} or @kbd{T}
  7506. Create a list of all TODO items (see @ref{Global TODO list}).
  7507. @item @kbd{m} or @kbd{M}
  7508. Create a list of headlines matching a given expression (see
  7509. @ref{Matching tags and properties}).
  7510. @item @kbd{s}
  7511. @kindex s @r{(Agenda dispatcher)}
  7512. Create a list of entries selected by a boolean expression of
  7513. keywords and/or regular expressions that must or must not occur
  7514. in the entry.
  7515. @item @kbd{/}
  7516. @kindex / @r{(Agenda dispatcher)}
  7517. @vindex org-agenda-text-search-extra-files
  7518. Search for a regular expression in all agenda files and
  7519. additionally in the files listed in
  7520. @code{org-agenda-text-search-extra-files}. This uses the Emacs
  7521. command @code{multi-occur}. A prefix argument can be used to specify
  7522. the number of context lines for each match, default is
  7523. @enumerate
  7524. @item
  7525. @end enumerate
  7526. @item @kbd{#} or @kbd{!}
  7527. Create a list of stuck projects (see @ref{Stuck projects}).
  7528. @item @kbd{<}
  7529. @kindex < @r{(Agenda dispatcher)}
  7530. Restrict an agenda command to the current buffer@footnote{For backward compatibility, you can also press @kbd{1} to
  7531. restrict to the current buffer.}. After
  7532. pressing @kbd{<}, you still need to press the character
  7533. selecting the command.
  7534. @item @kbd{< <}
  7535. @kindex < < @r{(Agenda dispatcher)}
  7536. If there is an active region, restrict the following agenda
  7537. command to the region. Otherwise, restrict it to the current
  7538. subtree@footnote{For backward compatibility, you can also press @kbd{0} to
  7539. restrict to the current region/subtree.}. After pressing @kbd{< <}, you still need to
  7540. press the character selecting the command.
  7541. @item @kbd{*}
  7542. @kindex * @r{(Agenda dispatcher)}
  7543. @vindex org-agenda-sticky
  7544. @findex org-toggle-sticky-agenda
  7545. Toggle sticky agenda views. By default, Org maintains only
  7546. a single agenda buffer and rebuilds it each time you change the
  7547. view, to make sure everything is always up to date. If you
  7548. switch between views often and the build time bothers you, you
  7549. can turn on sticky agenda buffers (make this the default by
  7550. customizing the variable @code{org-agenda-sticky}). With sticky
  7551. agendas, the dispatcher only switches to the selected view, you
  7552. need to update it by hand with @kbd{r} or @kbd{g}. You
  7553. can toggle sticky agenda view any time with
  7554. @code{org-toggle-sticky-agenda}.
  7555. @end table
  7556. You can also define custom commands that are accessible through the
  7557. dispatcher, just like the default commands. This includes the
  7558. possibility to create extended agenda buffers that contain several
  7559. blocks together, for example the weekly agenda, the global TODO list
  7560. and a number of special tags matches. See @ref{Custom Agenda Views}.
  7561. @node Built-in Agenda Views
  7562. @section The Built-in Agenda Views
  7563. In this section we describe the built-in views.
  7564. @menu
  7565. * Weekly/daily agenda:: The calendar page with current tasks.
  7566. * Global TODO list:: All unfinished action items.
  7567. * Matching tags and properties:: Structured information with fine-tuned search.
  7568. * Search view:: Find entries by searching for text.
  7569. * Stuck projects:: Find projects you need to review.
  7570. @end menu
  7571. @node Weekly/daily agenda
  7572. @subsection Weekly/daily agenda
  7573. @cindex agenda
  7574. @cindex weekly agenda
  7575. @cindex daily agenda
  7576. The purpose of the weekly/daily @emph{agenda} is to act like a page of
  7577. a paper agenda, showing all the tasks for the current week or day.
  7578. @table @asis
  7579. @item @kbd{M-x org-agenda a} (@code{org-agenda-list})
  7580. @kindex a @r{(Agenda dispatcher)}
  7581. @findex org-agenda-list
  7582. @cindex org-agenda, command
  7583. Compile an agenda for the current week from a list of Org files.
  7584. The agenda shows the entries for each day. With a numeric prefix
  7585. argument@footnote{For backward compatibility, the universal prefix argument
  7586. @kbd{C-u} causes all TODO entries to be listed before the agenda.
  7587. This feature is deprecated, use the dedicated TODO list, or a block
  7588. agenda instead (see @ref{Block agenda}).}---like @kbd{C-u 2 1 M-x org-agenda a}---you
  7589. may set the number of days to be displayed.
  7590. @end table
  7591. @vindex org-agenda-span
  7592. @vindex org-agenda-start-day
  7593. @vindex org-agenda-start-on-weekday
  7594. The default number of days displayed in the agenda is set by the
  7595. variable @code{org-agenda-span}. This variable can be set to any number of
  7596. days you want to see by default in the agenda, or to a span name, such
  7597. a @code{day}, @code{week}, @code{month} or @code{year}. For weekly agendas, the default
  7598. is to start on the previous Monday (see
  7599. @code{org-agenda-start-on-weekday}). You can also set the start date using
  7600. a date shift: @code{(setq org-agenda-start-day "+10d")} starts the agenda
  7601. ten days from today in the future.
  7602. Remote editing from the agenda buffer means, for example, that you can
  7603. change the dates of deadlines and appointments from the agenda buffer.
  7604. The commands available in the Agenda buffer are listed in @ref{Agenda Commands}.
  7605. @anchor{Calendar/Diary integration}
  7606. @subsubheading Calendar/Diary integration
  7607. @cindex calendar integration
  7608. @cindex diary integration
  7609. Emacs contains the calendar and diary by Edward M. Reingold. The
  7610. calendar displays a three-month calendar with holidays from different
  7611. countries and cultures. The diary allows you to keep track of
  7612. anniversaries, lunar phases, sunrise/set, recurrent appointments
  7613. (weekly, monthly) and more. In this way, it is quite complementary to
  7614. Org. It can be very useful to combine output from Org with the diary.
  7615. In order to include entries from the Emacs diary into Org mode's
  7616. agenda, you only need to customize the variable
  7617. @lisp
  7618. (setq org-agenda-include-diary t)
  7619. @end lisp
  7620. @noindent
  7621. After that, everything happens automatically. All diary entries
  7622. including holidays, anniversaries, etc., are included in the agenda
  7623. buffer created by Org mode. @kbd{@key{SPC}}, @kbd{@key{TAB}}, and
  7624. @kbd{@key{RET}} can be used from the agenda buffer to jump to the diary
  7625. file in order to edit existing diary entries. The @kbd{i}
  7626. command to insert new entries for the current date works in the agenda
  7627. buffer, as well as the commands @kbd{S}, @kbd{M}, and
  7628. @kbd{C} to display Sunrise/Sunset times, show lunar phases and to
  7629. convert to other calendars, respectively. @kbd{c} can be used to
  7630. switch back and forth between calendar and agenda.
  7631. If you are using the diary only for S-exp entries and holidays, it is
  7632. faster to not use the above setting, but instead to copy or even move
  7633. the entries into an Org file. Org mode evaluates diary-style sexp
  7634. entries, and does it faster because there is no overhead for first
  7635. creating the diary display. Note that the sexp entries must start at
  7636. the left margin, no whitespace is allowed before them, as seen in the
  7637. following segment of an Org file:@footnote{The variable @code{org-anniversary} used in the example is just
  7638. like @code{diary-anniversary}, but the argument order is always according
  7639. to ISO and therefore independent of the value of
  7640. @code{calendar-date-style}.}
  7641. @example
  7642. * Holidays
  7643. :PROPERTIES:
  7644. :CATEGORY: Holiday
  7645. :END:
  7646. %%(org-calendar-holiday) ; special function for holiday names
  7647. * Birthdays
  7648. :PROPERTIES:
  7649. :CATEGORY: Ann
  7650. :END:
  7651. %%(org-anniversary 1956 5 14) Arthur Dent is %d years old
  7652. %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old
  7653. @end example
  7654. @anchor{Anniversaries from BBDB}
  7655. @subsubheading Anniversaries from BBDB
  7656. @cindex BBDB, anniversaries
  7657. @cindex anniversaries, from BBDB
  7658. @findex org-bbdb-anniversaries
  7659. If you are using the Insidious Big Brother Database to store your
  7660. contacts, you very likely prefer to store anniversaries in BBDB rather
  7661. than in a separate Org or diary file. Org supports this and can show
  7662. BBDB anniversaries as part of the agenda. All you need to do is to
  7663. add the following to one of your agenda files:
  7664. @example
  7665. * Anniversaries
  7666. :PROPERTIES:
  7667. :CATEGORY: Anniv
  7668. :END:
  7669. %%(org-bbdb-anniversaries)
  7670. @end example
  7671. You can then go ahead and define anniversaries for a BBDB record.
  7672. Basically, you need to press @kbd{C-o anniversary @key{RET}} with the
  7673. cursor in a BBDB record and then add the date in the format
  7674. @samp{YYYY-MM-DD} or @samp{MM-DD}, followed by a space and the class of the
  7675. anniversary (@samp{birthday}, @samp{wedding}, or a format string). If you omit
  7676. the class, it defaults to @samp{birthday}. Here are a few examples, the
  7677. header for the file @samp{org-bbdb.el} contains more detailed information.
  7678. @example
  7679. 1973-06-22
  7680. 06-22
  7681. 1955-08-02 wedding
  7682. 2008-04-14 %s released version 6.01 of Org mode, %d years ago
  7683. @end example
  7684. After a change to BBDB, or for the first agenda display during an
  7685. Emacs session, the agenda display suffers a short delay as Org updates
  7686. its hash with anniversaries. However, from then on things will be
  7687. very fast, much faster in fact than a long list of
  7688. @samp{%%(diary-anniversary)} entries in an Org or Diary file.
  7689. @findex org-bbdb-anniversaries-future
  7690. If you would like to see upcoming anniversaries with a bit of
  7691. forewarning, you can use the following instead:
  7692. @example
  7693. * Anniversaries
  7694. :PROPERTIES:
  7695. :CATEGORY: Anniv
  7696. :END:
  7697. %%(org-bbdb-anniversaries-future 3)
  7698. @end example
  7699. That will give you three days' warning: on the anniversary date itself
  7700. and the two days prior. The argument is optional: if omitted, it
  7701. defaults to 7.
  7702. @anchor{Appointment reminders}
  7703. @subsubheading Appointment reminders
  7704. @cindex @file{appt.el}
  7705. @cindex appointment reminders
  7706. @cindex appointment
  7707. @cindex reminders
  7708. @cindex APPT_WARNTIME, keyword
  7709. Org can interact with Emacs appointments notification facility. To
  7710. add the appointments of your agenda files, use the command
  7711. @code{org-agenda-to-appt}. This command lets you filter through the list
  7712. of your appointments and add only those belonging to a specific
  7713. category or matching a regular expression. It also reads
  7714. a @samp{APPT_WARNTIME} property which overrides the value of
  7715. @code{appt-message-warning-time} for this appointment. See the docstring
  7716. for details.
  7717. @node Global TODO list
  7718. @subsection The global TODO list
  7719. @cindex global TODO list
  7720. @cindex TODO list, global
  7721. The global TODO list contains all unfinished TODO items formatted and
  7722. collected into a single place.
  7723. @table @asis
  7724. @item @kbd{M-x org-agenda t} (@code{org-todo-list})
  7725. @kindex t @r{(Agenda dispatcher)}
  7726. @findex org-todo-list
  7727. Show the global TODO list. This collects the TODO items from all
  7728. agenda files (see @ref{Agenda Views}) into a single buffer. By
  7729. default, this lists items with a state the is not a DONE state.
  7730. The buffer is in @code{agenda-mode}, so there are commands to examine
  7731. and manipulate the TODO entries directly from that buffer (see
  7732. @ref{Agenda Commands}).
  7733. @item @kbd{M-x org-agenda T} (@code{org-todo-list})
  7734. @kindex T @r{(Agenda dispatcher)}
  7735. @findex org-todo-list
  7736. @cindex TODO keyword matching
  7737. @vindex org-todo-keywords
  7738. Like the above, but allows selection of a specific TODO keyword.
  7739. You can also do this by specifying a prefix argument to
  7740. @kbd{t}. You are prompted for a keyword, and you may also
  7741. specify several keywords by separating them with @samp{|} as the
  7742. boolean OR operator. With a numeric prefix, the Nth keyword in
  7743. @code{org-todo-keywords} is selected.
  7744. @kindex r
  7745. The @kbd{r} key in the agenda buffer regenerates it, and you
  7746. can give a prefix argument to this command to change the selected
  7747. TODO keyword, for example @kbd{3 r}. If you often need
  7748. a search for a specific keyword, define a custom command for it
  7749. (see @ref{Agenda Dispatcher}).
  7750. Matching specific TODO keywords can also be done as part of
  7751. a tags search (see @ref{Tag Searches}).
  7752. @end table
  7753. Remote editing of TODO items means that you can change the state of
  7754. a TODO entry with a single key press. The commands available in the
  7755. TODO list are described in @ref{Agenda Commands}.
  7756. @cindex sublevels, inclusion into TODO list
  7757. Normally the global TODO list simply shows all headlines with TODO
  7758. keywords. This list can become very long. There are two ways to keep
  7759. it more compact:
  7760. @itemize
  7761. @item
  7762. @vindex org-agenda-todo-ignore-scheduled
  7763. @vindex org-agenda-todo-ignore-deadlines
  7764. @vindex org-agenda-todo-ignore-timestamp
  7765. @vindex org-agenda-todo-ignore-with-date
  7766. Some people view a TODO item that has been @emph{scheduled} for execution
  7767. or have a @emph{deadline} (see @ref{Timestamps}) as
  7768. no longer @emph{open}. Configure the variables
  7769. @code{org-agenda-todo-ignore-scheduled},
  7770. @code{org-agenda-todo-ignore-deadlines},
  7771. @code{org-agenda-todo-ignore-timestamp} and/or
  7772. @code{org-agenda-todo-ignore-with-date} to exclude such items from the
  7773. global TODO list.
  7774. @item
  7775. @vindex org-agenda-todo-list-sublevels
  7776. TODO items may have sublevels to break up the task into subtasks.
  7777. In such cases it may be enough to list only the highest level TODO
  7778. headline and omit the sublevels from the global list. Configure the
  7779. variable @code{org-agenda-todo-list-sublevels} to get this behavior.
  7780. @end itemize
  7781. @node Matching tags and properties
  7782. @subsection Matching tags and properties
  7783. @cindex matching, of tags
  7784. @cindex matching, of properties
  7785. @cindex tags view
  7786. @cindex match view
  7787. If headlines in the agenda files are marked with @emph{tags} (see @ref{Tags}),
  7788. or have properties (see @ref{Properties and Columns}), you can select
  7789. headlines based on this metadata and collect them into an agenda
  7790. buffer. The match syntax described here also applies when creating
  7791. sparse trees with @kbd{C-c / m}.
  7792. @table @asis
  7793. @item @kbd{M-x org-agenda m} (@code{org-tags-view})
  7794. @kindex m @r{(Agenda dispatcher)}
  7795. @findex org-tags-view
  7796. Produce a list of all headlines that match a given set of tags.
  7797. The command prompts for a selection criterion, which is a boolean
  7798. logic expression with tags, like @samp{+work+urgent-withboss} or
  7799. @samp{work|home} (see @ref{Tags}). If you often need a specific search,
  7800. define a custom command for it (see @ref{Agenda Dispatcher}).
  7801. @item @kbd{M-x org-agenda M} (@code{org-tags-view})
  7802. @kindex M @r{(Agenda dispatcher)}
  7803. @findex org-tags-view
  7804. @vindex org-tags-match-list-sublevels
  7805. @vindex org-agenda-tags-todo-honor-ignore-options
  7806. Like @kbd{m}, but only select headlines that are also TODO
  7807. items and force checking subitems (see the variable
  7808. @code{org-tags-match-list-sublevels}). To exclude scheduled/deadline
  7809. items, see the variable
  7810. @code{org-agenda-tags-todo-honor-ignore-options}. Matching specific
  7811. TODO keywords together with a tags match is also possible, see
  7812. @ref{Tag Searches}.
  7813. @end table
  7814. The commands available in the tags list are described in @ref{Agenda Commands}.
  7815. @cindex boolean logic, for agenda searches
  7816. A search string can use Boolean operators @samp{&} for AND and @samp{|} for OR.
  7817. @samp{&} binds more strongly than @samp{|}. Parentheses are currently not
  7818. implemented. Each element in the search is either a tag, a regular
  7819. expression matching tags, or an expression like @samp{PROPERTY OPERATOR
  7820. VALUE} with a comparison operator, accessing a property value. Each
  7821. element may be preceded by @samp{-} to select against it, and @samp{+} is
  7822. syntactic sugar for positive selection. The AND operator @samp{&} is
  7823. optional when @samp{+} or @samp{-} is present. Here are some examples, using
  7824. only tags.
  7825. @table @asis
  7826. @item @code{+work-boss}
  7827. Select headlines tagged @samp{work}, but discard those also tagged
  7828. @samp{boss}.
  7829. @item @code{work|laptop}
  7830. Selects lines tagged @samp{work} or @samp{laptop}.
  7831. @item @code{work|laptop+night}
  7832. Like before, but require the @samp{laptop} lines to be tagged
  7833. also @samp{night}.
  7834. @end table
  7835. @cindex regular expressions, with tags search
  7836. Instead of a tag, you may also specify a regular expression enclosed
  7837. in curly braces. For example, @samp{work+@{^boss.*@}} matches headlines that
  7838. contain the tag @samp{:work:} and any tag @emph{starting} with @samp{boss}.
  7839. @cindex group tags, as regular expressions
  7840. Group tags (see @ref{Tag Hierarchy}) are expanded as regular expressions.
  7841. E.g., if @samp{work} is a group tag for the group @samp{:work:lab:conf:}, then
  7842. searching for @samp{work} also searches for @samp{@{\(?:work\|lab\|conf\)@}} and
  7843. searching for @samp{-work} searches for all headlines but those with one of
  7844. the tags in the group (i.e., @samp{-@{\(?:work\|lab\|conf\)@}}).
  7845. @cindex TODO keyword matching, with tags search
  7846. @cindex level, for tags/property match
  7847. @cindex category, for tags/property match
  7848. @vindex org-odd-levels-only
  7849. You may also test for properties (see @ref{Properties and Columns}) at the
  7850. same time as matching tags. The properties may be real properties, or
  7851. special properties that represent other metadata (see @ref{Special Properties}). For example, the property @samp{TODO} represents the TODO
  7852. keyword of the entry. Or, the property @samp{LEVEL} represents the level
  7853. of an entry. So searching @samp{+LEVEL=3+boss-TODO​="DONE"} lists all level
  7854. three headlines that have the tag @samp{boss} and are @emph{not} marked with the
  7855. TODO keyword @samp{DONE}. In buffers with @code{org-odd-levels-only} set,
  7856. @samp{LEVEL} does not count the number of stars, but @samp{LEVEL=2} corresponds
  7857. to 3 stars etc.
  7858. Here are more examples:
  7859. @table @asis
  7860. @item @samp{work+TODO​="WAITING"}
  7861. Select @samp{work}-tagged TODO lines with the specific TODO keyword
  7862. @samp{WAITING}.
  7863. @item @samp{work+TODO​="WAITING"|home+TODO​="WAITING"}
  7864. Waiting tasks both at work and at home.
  7865. @end table
  7866. When matching properties, a number of different operators can be used
  7867. to test the value of a property. Here is a complex example:
  7868. @example
  7869. +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2
  7870. +With=@{Sarah|Denny@}+SCHEDULED>="<2008-10-11>"
  7871. @end example
  7872. @noindent
  7873. The type of comparison depends on how the comparison value is written:
  7874. @itemize
  7875. @item
  7876. If the comparison value is a plain number, a numerical comparison is
  7877. done, and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=}, @samp{>=}, and
  7878. @samp{<>}.
  7879. @item
  7880. If the comparison value is enclosed in double-quotes, a string
  7881. comparison is done, and the same operators are allowed.
  7882. @item
  7883. If the comparison value is enclosed in double-quotes @emph{and} angular
  7884. brackets (like @samp{DEADLINE<​="<2008-12-24 18:30>"}), both values are
  7885. assumed to be date/time specifications in the standard Org way, and
  7886. the comparison is done accordingly. Valid values also include
  7887. @samp{"<now>"} for now (including time), @samp{"<today>"}, and @samp{"<tomorrow>"}
  7888. for these days at 0:00 hours, i.e., without a time specification.
  7889. You can also use strings like @samp{"<+5d>"} or @samp{"<-2m>"} with units @samp{d},
  7890. @samp{w}, @samp{m}, and @samp{y} for day, week, month, and year, respectively.
  7891. @item
  7892. If the comparison value is enclosed in curly braces, a regexp match
  7893. is performed, with @samp{=} meaning that the regexp matches the property
  7894. value, and @samp{<>} meaning that it does not match.
  7895. @end itemize
  7896. So the search string in the example finds entries tagged @samp{work} but
  7897. not @samp{boss}, which also have a priority value @samp{A}, a @samp{Coffee} property
  7898. with the value @samp{unlimited}, an @samp{EFFORT} property that is numerically
  7899. smaller than 2, a @samp{With} property that is matched by the regular
  7900. expression @samp{Sarah|Denny}, and that are scheduled on or after October
  7901. 11, 2008.
  7902. You can configure Org mode to use property inheritance during
  7903. a search, but beware that this can slow down searches considerably.
  7904. See @ref{Property Inheritance}, for details.
  7905. For backward compatibility, and also for typing speed, there is also
  7906. a different way to test TODO states in a search. For this, terminate
  7907. the tags/property part of the search string (which may include several
  7908. terms connected with @samp{|}) with a @samp{/} and then specify a Boolean
  7909. expression just for TODO keywords. The syntax is then similar to that
  7910. for tags, but should be applied with care: for example, a positive
  7911. selection on several TODO keywords cannot meaningfully be combined
  7912. with boolean AND. However, @emph{negative selection} combined with AND can
  7913. be meaningful. To make sure that only lines are checked that actually
  7914. have any TODO keyword (resulting in a speed-up), use @kbd{M-x org-agenda M}, or equivalently start the TODO part after the slash
  7915. with @samp{!}. Using @kbd{M-x org-agenda M} or @samp{/!} does not match
  7916. TODO keywords in a DONE state. Examples:
  7917. @table @asis
  7918. @item @samp{work/WAITING}
  7919. Same as @samp{work+TODO​="WAITING"}.
  7920. @item @samp{work/!-WAITING-NEXT}
  7921. Select @samp{work}-tagged TODO lines that are neither @samp{WAITING} nor
  7922. @samp{NEXT}.
  7923. @item @samp{work/!+WAITING|+NEXT}
  7924. Select @samp{work}-tagged TODO lines that are either @samp{WAITING} or
  7925. @samp{NEXT}.
  7926. @end table
  7927. @node Search view
  7928. @subsection Search view
  7929. @cindex search view
  7930. @cindex text search
  7931. @cindex searching, for text
  7932. This agenda view is a general text search facility for Org mode
  7933. entries. It is particularly useful to find notes.
  7934. @table @asis
  7935. @item @kbd{M-x org-agenda s} (@code{org-search-view})
  7936. @kindex s @r{(Agenda dispatcher)}
  7937. @findex org-search-view
  7938. This is a special search that lets you select entries by matching
  7939. a substring or specific words using a boolean logic.
  7940. @end table
  7941. For example, the search string @samp{computer equipment} matches entries
  7942. that contain @samp{computer equipment} as a substring, even if the two
  7943. words are separated by more space or a line break.
  7944. Search view can also search for specific keywords in the entry, using
  7945. Boolean logic. The search string @samp{+computer
  7946. +wifi -ethernet -@{8\.11[bg]@}} matches note entries that contain the
  7947. keywords @samp{computer} and @samp{wifi}, but not the keyword @samp{ethernet}, and
  7948. which are also not matched by the regular expression @samp{8\.11[bg]},
  7949. meaning to exclude both @samp{8.11b} and @samp{8.11g}. The first @samp{+} is
  7950. necessary to turn on boolean search, other @samp{+} characters are
  7951. optional. For more details, see the docstring of the command
  7952. @code{org-search-view}.
  7953. You can incrementally adjust a boolean search with the following keys
  7954. @multitable @columnfractions 0.1 0.6
  7955. @item @kbd{[}
  7956. @tab Add a positive search word
  7957. @item @kbd{]}
  7958. @tab Add a negative search word
  7959. @item @kbd{@{}
  7960. @tab Add a positive regular expression
  7961. @item @kbd{@}}
  7962. @tab Add a negative regular expression
  7963. @end multitable
  7964. @vindex org-agenda-text-search-extra-files
  7965. Note that in addition to the agenda files, this command also searches
  7966. the files listed in @code{org-agenda-text-search-extra-files}.
  7967. @node Stuck projects
  7968. @subsection Stuck projects
  7969. @pindex GTD, Getting Things Done
  7970. If you are following a system like David Allen's GTD to organize your
  7971. work, one of the ``duties'' you have is a regular review to make sure
  7972. that all projects move along. A @emph{stuck} project is a project that has
  7973. no defined next actions, so it never shows up in the TODO lists Org
  7974. mode produces. During the review, you need to identify such projects
  7975. and define next actions for them.
  7976. @table @asis
  7977. @item @kbd{M-x org-agenda #} (@code{org-agenda-list-stuck-projects})
  7978. @kindex # @r{(Agenda dispatcher)}
  7979. @findex org-agenda-list-stuck-projects
  7980. List projects that are stuck.
  7981. @item @kbd{M-x org-agenda !}
  7982. @kindex ! @r{(Agenda dispatcher)}
  7983. @vindex org-stuck-projects
  7984. Customize the variable @code{org-stuck-projects} to define what
  7985. a stuck project is and how to find it.
  7986. @end table
  7987. You almost certainly need to configure this view before it works for
  7988. you. The built-in default assumes that all your projects are level-2
  7989. headlines, and that a project is not stuck if it has at least one
  7990. entry marked with a TODO keyword @samp{TODO} or @samp{NEXT} or @samp{NEXTACTION}.
  7991. Let's assume that you, in your own way of using Org mode, identify
  7992. projects with a tag @samp{:PROJECT:}, and that you use a TODO keyword
  7993. @samp{MAYBE} to indicate a project that should not be considered yet.
  7994. Let's further assume that the TODO keyword @samp{DONE} marks finished
  7995. projects, and that @samp{NEXT} and @samp{TODO} indicate next actions. The tag
  7996. @samp{:@@shop:} indicates shopping and is a next action even without the
  7997. NEXT tag. Finally, if the project contains the special word @samp{IGNORE}
  7998. anywhere, it should not be listed either. In this case you would
  7999. start by identifying eligible projects with a tags/TODO match (see
  8000. @ref{Tag Searches}) @samp{+PROJECT/-MAYBE-DONE}, and then check for @samp{TODO},
  8001. @samp{NEXT}, @samp{@@shop}, and @samp{IGNORE} in the subtree to identify projects that
  8002. are not stuck. The correct customization for this is:
  8003. @lisp
  8004. (setq org-stuck-projects
  8005. '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@shop")
  8006. "\\<IGNORE\\>"))
  8007. @end lisp
  8008. Note that if a project is identified as non-stuck, the subtree of this
  8009. entry is searched for stuck projects.
  8010. @node Presentation and Sorting
  8011. @section Presentation and Sorting
  8012. @cindex presentation, of agenda items
  8013. @vindex org-agenda-prefix-format
  8014. @vindex org-agenda-tags-column
  8015. Before displaying items in an agenda view, Org mode visually prepares
  8016. the items and sorts them. Each item occupies a single line. The line
  8017. starts with a @emph{prefix} that contains the @emph{category} (see @ref{Categories})
  8018. of the item and other important information. You can customize in
  8019. which column tags are displayed through @code{org-agenda-tags-column}. You
  8020. can also customize the prefix using the option
  8021. @code{org-agenda-prefix-format}. This prefix is followed by a cleaned-up
  8022. version of the outline headline associated with the item.
  8023. @menu
  8024. * Categories:: Not all tasks are equal.
  8025. * Time-of-day specifications:: How the agenda knows the time.
  8026. * Sorting of agenda items:: The order of things.
  8027. * Filtering/limiting agenda times:: Dynamically narrow the agenda.
  8028. @end menu
  8029. @node Categories
  8030. @subsection Categories
  8031. @cindex category
  8032. @cindex @samp{CATEGORY}, keyword
  8033. The category is a broad label assigned to each agenda item. By
  8034. default, the category is simply derived from the file name, but you
  8035. can also specify it with a special line in the buffer, like
  8036. this:
  8037. @example
  8038. #+CATEGORY: Thesis
  8039. @end example
  8040. @noindent
  8041. @cindex @samp{CATEGORY}, property
  8042. If you would like to have a special category for a single entry or
  8043. a (sub)tree, give the entry a @samp{CATEGORY} property with the special
  8044. category you want to apply as the value.
  8045. @noindent
  8046. The display in the agenda buffer looks best if the category is not
  8047. longer than 10 characters.
  8048. @noindent
  8049. @vindex org-agenda-category-icon-alist
  8050. You can set up icons for category by customizing the
  8051. @code{org-agenda-category-icon-alist} variable.
  8052. @node Time-of-day specifications
  8053. @subsection Time-of-day specifications
  8054. @cindex time-of-day specification
  8055. Org mode checks each agenda item for a time-of-day specification. The
  8056. time can be part of the timestamp that triggered inclusion into the
  8057. agenda, for example
  8058. @example
  8059. <2005-05-10 Tue 19:00>
  8060. @end example
  8061. @noindent
  8062. Time ranges can be specified with two timestamps:
  8063. @example
  8064. <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
  8065. @end example
  8066. In the headline of the entry itself, a time(range) may also appear as
  8067. plain text (like @samp{12:45} or a @samp{8:30-1pm}). If the agenda integrates
  8068. the Emacs diary (see @ref{Weekly/daily agenda}), time specifications in
  8069. diary entries are recognized as well.
  8070. For agenda display, Org mode extracts the time and displays it in
  8071. a standard 24 hour format as part of the prefix. The example times in
  8072. the previous paragraphs would end up in the agenda like this:
  8073. @example
  8074. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  8075. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  8076. 19:00...... The Vogon reads his poem
  8077. 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
  8078. @end example
  8079. @cindex time grid
  8080. If the agenda is in single-day mode, or for the display of today, the
  8081. timed entries are embedded in a time grid, like
  8082. @example
  8083. 8:00...... ------------------
  8084. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  8085. 10:00...... ------------------
  8086. 12:00...... ------------------
  8087. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  8088. 14:00...... ------------------
  8089. 16:00...... ------------------
  8090. 18:00...... ------------------
  8091. 19:00...... The Vogon reads his poem
  8092. 20:00...... ------------------
  8093. 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
  8094. @end example
  8095. @vindex org-agenda-use-time-grid
  8096. @vindex org-agenda-time-grid
  8097. The time grid can be turned on and off with the variable
  8098. @code{org-agenda-use-time-grid}, and can be configured with
  8099. @code{org-agenda-time-grid}.
  8100. @node Sorting of agenda items
  8101. @subsection Sorting of agenda items
  8102. @cindex sorting, of agenda items
  8103. @cindex priorities, of agenda items
  8104. Before being inserted into a view, the items are sorted. How this is
  8105. done depends on the type of view.
  8106. @itemize
  8107. @item
  8108. @vindex org-agenda-files
  8109. For the daily/weekly agenda, the items for each day are sorted. The
  8110. default order is to first collect all items containing an explicit
  8111. time-of-day specification. These entries are shown at the beginning
  8112. of the list, as a @emph{schedule} for the day. After that, items remain
  8113. grouped in categories, in the sequence given by @code{org-agenda-files}.
  8114. Within each category, items are sorted by priority (see
  8115. @ref{Priorities}), which is composed of the base priority (2000 for
  8116. priority @samp{A}, 1000 for @samp{B}, and 0 for @samp{C}), plus additional
  8117. increments for overdue scheduled or deadline items.
  8118. @item
  8119. For the TODO list, items remain in the order of categories, but
  8120. within each category, sorting takes place according to priority (see
  8121. @ref{Priorities}). The priority used for sorting derives from the
  8122. priority cookie, with additions depending on how close an item is to
  8123. its due or scheduled date.
  8124. @item
  8125. For tags matches, items are not sorted at all, but just appear in
  8126. the sequence in which they are found in the agenda files.
  8127. @end itemize
  8128. @vindex org-agenda-sorting-strategy
  8129. Sorting can be customized using the variable
  8130. @code{org-agenda-sorting-strategy}, and may also include criteria based on
  8131. the estimated effort of an entry (see @ref{Effort Estimates}).
  8132. @node Filtering/limiting agenda times
  8133. @subsection Filtering/limiting agenda times
  8134. Agenda built-in or customized commands are statically defined. Agenda
  8135. filters and limits provide two ways of dynamically narrowing down the
  8136. list of agenda entries: @emph{filters} and @emph{limits}. Filters only act on
  8137. the display of the items, while limits take effect before the list of
  8138. agenda entries is built. Filters are more often used interactively,
  8139. while limits are mostly useful when defined as local variables within
  8140. custom agenda commands.
  8141. @anchor{Filtering in the agenda}
  8142. @subsubheading Filtering in the agenda
  8143. @cindex agenda filtering
  8144. @cindex filtering entries, in agenda
  8145. @cindex tag filtering, in agenda
  8146. @cindex category filtering, in agenda
  8147. @cindex top headline filtering, in agenda
  8148. @cindex effort filtering, in agenda
  8149. @cindex query editing, in agenda
  8150. @table @asis
  8151. @item @kbd{/} (@code{org-agenda-filter-by-tag})
  8152. @findex org-agenda-filter-by-tag
  8153. @vindex org-agenda-tag-filter-preset
  8154. Filter the agenda view with respect to a tag and/or effort
  8155. estimates. The difference between this and a custom agenda
  8156. command is that filtering is very fast, so that you can switch
  8157. quickly between different filters without having to recreate the
  8158. agenda.@footnote{Custom commands can preset a filter by binding the variable
  8159. @code{org-agenda-tag-filter-preset} as an option. This filter is then
  8160. applied to the view and persists as a basic filter through refreshes
  8161. and more secondary filtering. The filter is a global property of the
  8162. entire agenda view---in a block agenda, you should only set this in
  8163. the global options section, not in the section of an individual block.}
  8164. You are prompted for a tag selection letter; @kbd{@key{SPC}} means
  8165. any tag at all. Pressing @kbd{@key{TAB}} at that prompt offers
  8166. completion to select a tag, including any tags that do not have
  8167. a selection character. The command then hides all entries that
  8168. do not contain or inherit this tag. When called with prefix
  8169. argument, remove the entries that @emph{do} have the tag. A second
  8170. @kbd{/} at the prompt turns off the filter and shows any
  8171. hidden entries. Pressing @kbd{+} or @kbd{-} switches
  8172. between filtering and excluding the next tag.
  8173. @vindex org-agenda-auto-exclude-function
  8174. Org also supports automatic, context-aware tag filtering. If the
  8175. variable @code{org-agenda-auto-exclude-function} is set to
  8176. a user-defined function, that function can decide which tags
  8177. should be excluded from the agenda automatically. Once this is
  8178. set, the @kbd{/} command then accepts @kbd{@key{RET}} as
  8179. a sub-option key and runs the auto exclusion logic. For example,
  8180. let's say you use a @samp{Net} tag to identify tasks which need
  8181. network access, an @samp{Errand} tag for errands in town, and a @samp{Call}
  8182. tag for making phone calls. You could auto-exclude these tags
  8183. based on the availability of the Internet, and outside of
  8184. business hours, with something like this:
  8185. @lisp
  8186. (defun org-my-auto-exclude-function (tag)
  8187. (and (cond
  8188. ((string= tag "Net")
  8189. (/= 0 (call-process "/sbin/ping" nil nil nil
  8190. "-c1" "-q" "-t1" "mail.gnu.org")))
  8191. ((or (string= tag "Errand") (string= tag "Call"))
  8192. (let ((hour (nth 2 (decode-time))))
  8193. (or (< hour 8) (> hour 21)))))
  8194. (concat "-" tag)))
  8195. (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
  8196. @end lisp
  8197. @item @kbd{<} (@code{org-agenda-filter-by-category})
  8198. @findex org-agenda-filter-by-category
  8199. Filter the current agenda view with respect to the category of
  8200. the item at point. Pressing @kbd{<} another time removes
  8201. this filter. When called with a prefix argument exclude the
  8202. category of the item at point from the agenda.
  8203. @vindex org-agenda-category-filter-preset
  8204. You can add a filter preset in custom agenda commands through the
  8205. option @code{org-agenda-category-filter-preset}. See @ref{Setting options}.
  8206. @item @kbd{^} (@code{org-agenda-filter-by-top-headline})
  8207. @findex org-agenda-filter-by-top-headline
  8208. Filter the current agenda view and only display the siblings and
  8209. the parent headline of the one at point.
  8210. @item @kbd{=} (@code{org-agenda-filter-by-regexp})
  8211. @findex org-agenda-filter-by-regexp
  8212. Filter the agenda view by a regular expression: only show agenda
  8213. entries matching the regular expression the user entered. When
  8214. called with a prefix argument, it filters @emph{out} entries matching
  8215. the regexp. With two universal prefix arguments, it removes all
  8216. the regexp filters, which can be accumulated.
  8217. @vindex org-agenda-regexp-filter-preset
  8218. You can add a filter preset in custom agenda commands through the
  8219. option @code{org-agenda-regexp-filter-preset}. See @ref{Setting options}.
  8220. @item @kbd{_} (@code{org-agenda-filter-by-effort})
  8221. @findex org-agenda-filter-by-effort
  8222. Filter the agenda view with respect to effort estimates. You
  8223. first need to set up allowed efforts globally, for example
  8224. @lisp
  8225. (setq org-global-properties
  8226. '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
  8227. @end lisp
  8228. @vindex org-sort-agenda-noeffort-is-high
  8229. You can then filter for an effort by first typing an operator,
  8230. one of @kbd{<}, @kbd{>} and @kbd{=}, and then the
  8231. one-digit index of an effort estimate in your array of allowed
  8232. values, where @kbd{0} means the 10th value. The filter then
  8233. restricts to entries with effort smaller-or-equal, equal, or
  8234. larger-or-equal than the selected value. For application of the
  8235. operator, entries without a defined effort are treated according
  8236. to the value of @code{org-sort-agenda-noeffort-is-high}.
  8237. When called with a prefix argument, it removes entries matching
  8238. the condition. With two universal prefix arguments, it clears
  8239. effort filters, which can be accumulated.
  8240. @vindex org-agenda-effort-filter-preset
  8241. You can add a filter preset in custom agenda commands through the
  8242. option @code{org-agenda-effort-filter-preset}. See @ref{Setting options}.
  8243. @item @kbd{|} (@code{org-agenda-filter-remove-all})
  8244. Remove all filters in the current agenda view.
  8245. @end table
  8246. @anchor{Setting limits for the agenda}
  8247. @subsubheading Setting limits for the agenda
  8248. @cindex limits, in agenda
  8249. Here is a list of options that you can set, either globally, or
  8250. locally in your custom agenda views (see @ref{Custom Agenda Views}).
  8251. @table @asis
  8252. @item @code{org-agenda-max-entries}
  8253. @vindex org-agenda-max-entries
  8254. Limit the number of entries.
  8255. @item @code{org-agenda-max-effort}
  8256. @vindex org-agenda-max-effort
  8257. Limit the duration of accumulated efforts (as minutes).
  8258. @item @code{org-agenda-max-todos}
  8259. @vindex org-agenda-max-todos
  8260. Limit the number of entries with TODO keywords.
  8261. @item @code{org-agenda-max-tags}
  8262. @vindex org-agenda-max-tags
  8263. Limit the number of tagged entries.
  8264. @end table
  8265. When set to a positive integer, each option excludes entries from
  8266. other categories: for example, @code{(setq org-agenda-max-effort 100)}
  8267. limits the agenda to 100 minutes of effort and exclude any entry that
  8268. has no effort property. If you want to include entries with no effort
  8269. property, use a negative value for @code{org-agenda-max-effort}. One
  8270. useful setup is to use @code{org-agenda-max-entries} locally in a custom
  8271. command. For example, this custom command displays the next five
  8272. entries with a @samp{NEXT} TODO keyword.
  8273. @lisp
  8274. (setq org-agenda-custom-commands
  8275. '(("n" todo "NEXT"
  8276. ((org-agenda-max-entries 5)))))
  8277. @end lisp
  8278. Once you mark one of these five entry as DONE, rebuilding the agenda
  8279. will again the next five entries again, including the first entry that
  8280. was excluded so far.
  8281. You can also dynamically set temporary limits, which are lost when
  8282. rebuilding the agenda:
  8283. @table @asis
  8284. @item @kbd{~} (@code{org-agenda-limit-interactively})
  8285. @findex org-agenda-limit-interactively
  8286. This prompts for the type of limit to apply and its value.
  8287. @end table
  8288. @node Agenda Commands
  8289. @section Commands in the Agenda Buffer
  8290. @cindex commands, in agenda buffer
  8291. Entries in the agenda buffer are linked back to the Org file or diary
  8292. file where they originate. You are not allowed to edit the agenda
  8293. buffer itself, but commands are provided to show and jump to the
  8294. original entry location, and to edit the Org files ``remotely'' from the
  8295. agenda buffer. In this way, all information is stored only once,
  8296. removing the risk that your agenda and note files may diverge.
  8297. Some commands can be executed with mouse clicks on agenda lines. For
  8298. the other commands, the cursor needs to be in the desired line.
  8299. @anchor{Motion (1)}
  8300. @subheading Motion
  8301. @cindex motion commands in agenda
  8302. @table @asis
  8303. @item @kbd{n} (@code{org-agenda-next-line})
  8304. @kindex n
  8305. @findex org-agenda-next-line
  8306. Next line (same as @kbd{@key{DOWN}} and @kbd{C-n}).
  8307. @item @kbd{p} (@code{org-agenda-previous-line})
  8308. @kindex p
  8309. @findex org-agenda-previous-line
  8310. Previous line (same as @kbd{@key{UP}} and @kbd{C-p}).
  8311. @end table
  8312. @anchor{View/Go to Org file}
  8313. @subheading View/Go to Org file
  8314. @cindex view file commands in agenda
  8315. @table @asis
  8316. @item @kbd{@key{SPC}} or @kbd{mouse-3} (@code{org-agenda-show-and-scroll-up})
  8317. @kindex SPC
  8318. @kindex mouse-3
  8319. @findex org-agenda-show-and-scroll-up
  8320. Display the original location of the item in another window.
  8321. With a prefix argument, make sure that drawers stay folded.
  8322. @item @kbd{L} (@code{org-agenda-recenter})
  8323. @findex org-agenda-recenter
  8324. Display original location and recenter that window.
  8325. @item @kbd{@key{TAB}} or @kbd{mouse-2} (@code{org-agenda-goto})
  8326. @kindex TAB
  8327. @kindex mouse-2
  8328. @findex org-agenda-goto
  8329. Go to the original location of the item in another window.
  8330. @item @kbd{@key{RET}} (@code{org-agenda-switch-to})
  8331. @kindex RET
  8332. @findex org-agenda-switch-to
  8333. Go to the original location of the item and delete other windows.
  8334. @item @kbd{F} (@code{org-agenda-follow-mode})
  8335. @kindex F
  8336. @findex org-agenda-follow-mode
  8337. @vindex org-agenda-start-with-follow-mode
  8338. Toggle Follow mode. In Follow mode, as you move the cursor
  8339. through the agenda buffer, the other window always shows the
  8340. corresponding location in the Org file. The initial setting for
  8341. this mode in new agenda buffers can be set with the variable
  8342. @code{org-agenda-start-with-follow-mode}.
  8343. @item @kbd{C-c C-x b} (@code{org-agenda-tree-to-indirect-buffer})
  8344. @kindex C-c C-x b
  8345. @findex org-agenda-tree-to-indirect-buffer
  8346. Display the entire subtree of the current item in an indirect
  8347. buffer. With a numeric prefix argument N, go up to level N and
  8348. then take that tree. If N is negative, go up that many levels.
  8349. With a @kbd{C-u} prefix, do not remove the previously used
  8350. indirect buffer.
  8351. @item @kbd{C-c C-o} (@code{org-agenda-open-link})
  8352. @kindex C-c C-o
  8353. @findex org-agenda-open-link
  8354. Follow a link in the entry. This offers a selection of any links
  8355. in the text belonging to the referenced Org node. If there is
  8356. only one link, follow it without a selection prompt.
  8357. @end table
  8358. @anchor{Change display}
  8359. @subheading Change display
  8360. @cindex change agenda display
  8361. @cindex display changing, in agenda
  8362. @table @asis
  8363. @item @kbd{A}
  8364. @kindex A
  8365. Interactively select another agenda view and append it to the
  8366. current view.
  8367. @item @kbd{o}
  8368. @kindex o
  8369. Delete other windows.
  8370. @item @kbd{v d} or short @kbd{d} (@code{org-agenda-day-view})
  8371. @kindex v d
  8372. @kindex d
  8373. @findex org-agenda-day-view
  8374. Switch to day view. When switching to day view, this setting
  8375. becomes the default for subsequent agenda refreshes. A numeric
  8376. prefix argument may be used to jump directly to a specific day of
  8377. the year. For example, @kbd{32 d} jumps to February 1st.
  8378. When setting day view, a year may be encoded in the prefix
  8379. argument as well. For example, @kbd{200712 d} jumps to
  8380. January 12, 2007. If such a year specification has only one or
  8381. two digits, it is expanded into one of the 30 next years or the
  8382. last 69 years.
  8383. @item @kbd{v w} or short @kbd{w} (@code{org-agenda-week-view})
  8384. @kindex v w
  8385. @kindex w
  8386. @findex org-agenda-week-view
  8387. Switch to week view. When switching week view, this setting
  8388. becomes the default for subsequent agenda refreshes. A numeric
  8389. prefix argument may be used to jump directly to a specific day of
  8390. the ISO week. For example @kbd{9 w} to ISO week number 9.
  8391. When setting week view, a year may be encoded in the prefix
  8392. argument as well. For example, @kbd{200712 w} jumps to week
  8393. 12 in 2007. If such a year specification has only one or two
  8394. digits, it is expanded into one of the 30 next years or the last
  8395. 69 years.
  8396. @item @kbd{v m} (@code{org-agenda-month-view})
  8397. @kindex v m
  8398. @findex org-agenda-month-view
  8399. Switch to month view. Because month views are slow to create,
  8400. they do not become the default for subsequent agenda refreshes.
  8401. A numeric prefix argument may be used to jump directly to
  8402. a specific day of the month. When setting month view, a year may
  8403. be encoded in the prefix argument as well. For example,
  8404. @kbd{200712 m} jumps to December, 2007. If such a year
  8405. specification has only one or two digits, it is expanded into one
  8406. of the 30 next years or the last 69 years.
  8407. @item @kbd{v y} (@code{org-agenda-year-view})
  8408. @kindex v y
  8409. @findex org-agenda-year-view
  8410. Switch to year view. Because year views are slow to create, they
  8411. do not become the default for subsequent agenda refreshes.
  8412. A numeric prefix argument may be used to jump directly to
  8413. a specific day of the year.
  8414. @item @kbd{v @key{SPC}} (@code{org-agenda-reset-view})
  8415. @kindex v SPC
  8416. @findex org-agenda-reset-view
  8417. @vindex org-agenda-span
  8418. Reset the current view to @code{org-agenda-span}.
  8419. @item @kbd{f} (@code{org-agenda-later})
  8420. @kindex f
  8421. @findex org-agenda-later
  8422. Go forward in time to display the span following the current one.
  8423. For example, if the display covers a week, switch to the
  8424. following week. With a prefix argument, repeat that many times.
  8425. @item @kbd{b} (@code{org-agenda-earlier})
  8426. @kindex b
  8427. @findex org-agenda-earlier
  8428. Go backward in time to display earlier dates.
  8429. @item @kbd{.} (@code{org-agenda-goto-today})
  8430. @kindex .
  8431. @findex org-agenda-goto-today
  8432. Go to today.
  8433. @item @kbd{j} (@code{org-agenda-goto-date})
  8434. @kindex j
  8435. @findex org-agenda-goto-date
  8436. Prompt for a date and go there.
  8437. @item @kbd{J} (@code{org-agenda-clock-goto})
  8438. @kindex J
  8439. @findex org-agenda-clock-goto
  8440. Go to the currently clocked-in task @emph{in the agenda buffer}.
  8441. @item @kbd{D} (@code{org-agenda-toggle-diary})
  8442. @kindex D
  8443. @findex org-agenda-toggle-diary
  8444. Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
  8445. @item @kbd{v l} or @kbd{v L} or short @kbd{l} (@code{org-agenda-log-mode})
  8446. @kindex v l
  8447. @kindex l
  8448. @kindex v L
  8449. @findex org-agenda-log-mode
  8450. @vindex org-log-done
  8451. @vindex org-agenda-log-mode-items
  8452. Toggle Logbook mode. In Logbook mode, entries that were marked
  8453. DONE while logging was on (see the variable @code{org-log-done}) are
  8454. shown in the agenda, as are entries that have been clocked on
  8455. that day. You can configure the entry types that should be
  8456. included in log mode using the variable
  8457. @code{org-agenda-log-mode-items}. When called with a @kbd{C-u}
  8458. prefix, show all possible logbook entries, including state
  8459. changes. When called with two prefix arguments @kbd{C-u C-u}, show only logging information, nothing else. @kbd{v L} is equivalent to @kbd{C-u v l}.
  8460. @item @kbd{v [} or short @kbd{[} (@code{org-agenda-manipulate-query-add})
  8461. @kindex v [
  8462. @kindex [
  8463. @findex org-agenda-manipulate-query-add
  8464. Include inactive timestamps into the current view. Only for
  8465. weekly/daily agenda and timeline views.
  8466. @item @kbd{v a} (@code{org-agenda-archives-mode})
  8467. @kindex v a
  8468. @findex org-agenda-archives-mode
  8469. Toggle Archives mode. In Archives mode, trees that are archived
  8470. (see @ref{Internal archiving}) are also scanned when producing the
  8471. agenda. To exit archives mode, press @kbd{v a} again.
  8472. @item @kbd{v A}
  8473. @kindex v A
  8474. Toggle Archives mode. Include all archive files as well.
  8475. @item @kbd{v R} or short @kbd{R} (@code{org-agenda-clockreport-mode})
  8476. @kindex v R
  8477. @kindex R
  8478. @findex org-agenda-clockreport-mode
  8479. @vindex org-agenda-start-with-clockreport-mode
  8480. @vindex org-clock-report-include-clocking-task
  8481. Toggle Clockreport mode. In Clockreport mode, the daily/weekly
  8482. agenda always shows a table with the clocked times for the time
  8483. span and file scope covered by the current agenda view. The
  8484. initial setting for this mode in new agenda buffers can be set
  8485. with the variable @code{org-agenda-start-with-clockreport-mode}. By
  8486. using a prefix argument when toggling this mode (i.e., @kbd{C-u R}), the clock table does not show contributions from entries
  8487. that are hidden by agenda filtering@footnote{Only tags filtering is respected here, effort filtering is
  8488. ignored.}. See also the
  8489. variable @code{org-clock-report-include-clocking-task}.
  8490. @item @kbd{v c}
  8491. @kindex v c
  8492. @vindex org-agenda-clock-consistency-checks
  8493. Show overlapping clock entries, clocking gaps, and other clocking
  8494. problems in the current agenda range. You can then visit
  8495. clocking lines and fix them manually. See the variable
  8496. @code{org-agenda-clock-consistency-checks} for information on how to
  8497. customize the definition of what constituted a clocking problem.
  8498. To return to normal agenda display, press @kbd{l} to exit
  8499. Logbook mode.
  8500. @item @kbd{v E} or short @kbd{E} (@code{org-agenda-entry-text-mode})
  8501. @kindex v E
  8502. @kindex E
  8503. @findex org-agenda-entry-text-mode
  8504. @vindex org-agenda-start-with-entry-text-mode
  8505. @vindex org-agenda-entry-text-maxlines
  8506. Toggle entry text mode. In entry text mode, a number of lines
  8507. from the Org outline node referenced by an agenda line are
  8508. displayed below the line. The maximum number of lines is given
  8509. by the variable @code{org-agenda-entry-text-maxlines}. Calling this
  8510. command with a numeric prefix argument temporarily modifies that
  8511. number to the prefix value.
  8512. @item @kbd{G} (@code{org-agenda-toggle-time-grid})
  8513. @kindex G
  8514. @vindex org-agenda-use-time-grid
  8515. @vindex org-agenda-time-grid
  8516. Toggle the time grid on and off. See also the variables
  8517. @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
  8518. @item @kbd{r} (@code{org-agenda-redo})
  8519. @itemx @kbd{g}
  8520. @kindex r
  8521. @kindex g
  8522. @findex org-agenda-redo
  8523. Recreate the agenda buffer, for example to reflect the changes
  8524. after modification of the timestamps of items with
  8525. @kbd{S-@key{LEFT}} and @kbd{S-@key{RIGHT}}. When the
  8526. buffer is the global TODO list, a prefix argument is interpreted
  8527. to create a selective list for a specific TODO keyword.
  8528. @item @kbd{C-x C-s} or short @kbd{s} (@code{org-save-all-org-buffers})
  8529. @kindex C-x C-s
  8530. @findex org-save-all-org-buffers
  8531. @kindex s
  8532. Save all Org buffers in the current Emacs session, and also the
  8533. locations of IDs.
  8534. @item @kbd{C-c C-x C-c} (@code{org-agenda-columns})
  8535. @kindex C-c C-x C-c
  8536. @findex org-agenda-columns
  8537. @vindex org-columns-default-format
  8538. Invoke column view (see @ref{Column View}) in the agenda buffer. The
  8539. column view format is taken from the entry at point, or, if there
  8540. is no entry at point, from the first entry in the agenda view.
  8541. So whatever the format for that entry would be in the original
  8542. buffer (taken from a property, from a @samp{COLUMNS} keyword, or from
  8543. the default variable @code{org-columns-default-format}) is used in the
  8544. agenda.
  8545. @item @kbd{C-c C-x >} (@code{org-agenda-remove-restriction-lock})
  8546. @kindex C-c C-x >
  8547. @findex org-agenda-remove-restriction-lock
  8548. Remove the restriction lock on the agenda, if it is currently
  8549. restricted to a file or subtree (see @ref{Agenda Files}).
  8550. @item @kbd{M-@key{UP}} (@code{org-agenda-drag-line-backward})
  8551. @kindex M-UP
  8552. @findex org-agenda-drag-line-backward
  8553. Drag the line at point backward one line. With a numeric prefix
  8554. argument, drag backward by that many lines.
  8555. Moving agenda lines does not persist after an agenda refresh and
  8556. does not modify the contributing Org files.
  8557. @item @kbd{M-@key{DOWN}} (@code{org-agenda-drag-line-forward})
  8558. @kindex M-DOWN
  8559. @findex org-agenda-drag-line-forward
  8560. Drag the line at point forward one line. With a numeric prefix
  8561. argument, drag forward by that many lines.
  8562. @end table
  8563. @anchor{Remote editing}
  8564. @subheading Remote editing
  8565. @cindex remote editing, from agenda
  8566. @table @asis
  8567. @item @kbd{0--9}
  8568. Digit argument.
  8569. @item @kbd{C-_} (@code{org-agenda-undo})
  8570. @kindex C-_
  8571. @findex org-agenda-undo
  8572. @cindex undoing remote-editing events
  8573. @cindex remote editing, undo
  8574. Undo a change due to a remote editing command. The change is
  8575. undone both in the agenda buffer and in the remote buffer.
  8576. @item @kbd{t} (@code{org-agenda-todo})
  8577. @kindex t
  8578. @findex org-agenda-todo
  8579. Change the TODO state of the item, both in the agenda and in the
  8580. original Org file.
  8581. @item @kbd{C-S-@key{RIGHT}} (@code{org-agenda-todo-nextset})
  8582. @kindex C-S-RIGHT
  8583. @findex org-agenda-todo-nextset
  8584. Switch to the next set of TODO keywords.
  8585. @item @kbd{C-S-@key{LEFT}}, @code{org-agenda-todo-previousset}
  8586. @kindex C-S-LEFT
  8587. Switch to the previous set of TODO keywords.
  8588. @item @kbd{C-k} (@code{org-agenda-kill})
  8589. @kindex C-k
  8590. @findex org-agenda-kill
  8591. @vindex org-agenda-confirm-kill
  8592. Delete the current agenda item along with the entire subtree
  8593. belonging to it in the original Org file. If the text to be
  8594. deleted remotely is longer than one line, the kill needs to be
  8595. confirmed by the user. See variable @code{org-agenda-confirm-kill}.
  8596. @item @kbd{C-c C-w} (@code{org-agenda-refile})
  8597. @kindex C-c C-w
  8598. @findex org-agenda-refile
  8599. Refile the entry at point.
  8600. @item @kbd{C-c C-x C-a} or short @kbd{a} (@code{org-agenda-archive-default-with-confirmation})
  8601. @kindex C-c C-x C-a
  8602. @kindex a
  8603. @findex org-agenda-archive-default-with-confirmation
  8604. @vindex org-archive-default-command
  8605. Archive the subtree corresponding to the entry at point using the
  8606. default archiving command set in @code{org-archive-default-command}.
  8607. When using the @kbd{a} key, confirmation is required.
  8608. @item @kbd{C-c C-x a} (@code{org-agenda-toggle-archive-tag})
  8609. @kindex C-c C-x a
  8610. @findex org-agenda-toggle-archive-tag
  8611. Toggle the archive tag (see @ref{Internal archiving}) for the current
  8612. headline.
  8613. @item @kbd{C-c C-x A} (@code{org-agenda-archive-to-archive-sibling})
  8614. @kindex C-c C-x A
  8615. @findex org-agenda-archive-to-archive-sibling
  8616. Move the subtree corresponding to the current entry to its
  8617. @emph{archive sibling}.
  8618. @item @kbd{C-c C-x C-s} or short @kbd{$} (@code{org-agenda-archive})
  8619. @kindex C-c C-x C-s
  8620. @kindex $
  8621. @findex org-agenda-archive
  8622. Archive the subtree corresponding to the current headline. This
  8623. means the entry is moved to the configured archive location, most
  8624. likely a different file.
  8625. @item @kbd{T} (@code{org-agenda-show-tags})
  8626. @kindex T
  8627. @findex org-agenda-show-tags
  8628. @vindex org-agenda-show-inherited-tags
  8629. Show all tags associated with the current item. This is useful
  8630. if you have turned off @code{org-agenda-show-inherited-tags}, but
  8631. still want to see all tags of a headline occasionally.
  8632. @item @kbd{:} (@code{org-agenda-set-tags})
  8633. @kindex :
  8634. @findex org-agenda-set-tags
  8635. Set tags for the current headline. If there is an active region
  8636. in the agenda, change a tag for all headings in the region.
  8637. @item @kbd{,} (@code{org-agenda-priority})
  8638. @kindex ,
  8639. @findex org-agenda-priority
  8640. Set the priority for the current item. Org mode prompts for the
  8641. priority character. If you reply with @kbd{@key{SPC}}, the
  8642. priority cookie is removed from the entry.
  8643. @item @kbd{P} (@code{org-agenda-show-priority})
  8644. @kindex P
  8645. @findex org-agenda-show-priority
  8646. Display weighted priority of current item.
  8647. @item @kbd{+} or @kbd{S-@key{UP}} (@code{org-agenda-priority-up})
  8648. @kindex +
  8649. @kindex S-UP
  8650. @findex org-agenda-priority-up
  8651. Increase the priority of the current item. The priority is
  8652. changed in the original buffer, but the agenda is not resorted.
  8653. Use the @kbd{r} key for this.
  8654. @item @kbd{-} or @kbd{S-@key{DOWN}} (@code{org-agenda-priority-down})
  8655. @kindex -
  8656. @kindex S-DOWN
  8657. @findex org-agenda-priority-down
  8658. Decrease the priority of the current item.
  8659. @item @kbd{C-c C-z} or short @kbd{z} (@code{org-agenda-add-note})
  8660. @kindex z
  8661. @kindex C-c C-z
  8662. @findex org-agenda-add-note
  8663. @vindex org-log-into-drawer
  8664. Add a note to the entry. This note is recorded, and then filed
  8665. to the same location where state change notes are put. Depending
  8666. on @code{org-log-into-drawer}, this may be inside a drawer.
  8667. @item @kbd{C-c C-a} (@code{org-attach})
  8668. @kindex C-c C-a
  8669. @findex org-attach
  8670. Dispatcher for all command related to attachments.
  8671. @item @kbd{C-c C-s} (@code{org-agenda-schedule})
  8672. @kindex C-c C-s
  8673. @findex org-agenda-schedule
  8674. Schedule this item. With a prefix argument, remove the
  8675. scheduling timestamp
  8676. @item @kbd{C-c C-d} (@code{org-agenda-deadline})
  8677. @kindex C-c C-d
  8678. @findex org-agenda-deadline
  8679. Set a deadline for this item. With a prefix argument, remove the
  8680. deadline.
  8681. @item @kbd{S-@key{RIGHT}} (@code{org-agenda-do-date-later})
  8682. @kindex S-RIGHT
  8683. @findex org-agenda-do-date-later
  8684. Change the timestamp associated with the current line by one day
  8685. into the future. If the date is in the past, the first call to
  8686. this command moves it to today. With a numeric prefix argument,
  8687. change it by that many days. For example, @kbd{3 6 5 S-@key{RIGHT}} changes it by a year. With a @kbd{C-u}
  8688. prefix, change the time by one hour. If you immediately repeat
  8689. the command, it will continue to change hours even without the
  8690. prefix argument. With a double @kbd{C-u C-u} prefix, do the
  8691. same for changing minutes. The stamp is changed in the original
  8692. Org file, but the change is not directly reflected in the agenda
  8693. buffer. Use @kbd{r} or @kbd{g} to update the buffer.
  8694. @item @kbd{S-@key{LEFT}} (@code{org-agenda-do-date-earlier})
  8695. @kindex S-LEFT
  8696. @findex org-agenda-do-date-earlier
  8697. Change the timestamp associated with the current line by one day
  8698. into the past.
  8699. @item @kbd{>} (@code{org-agenda-date-prompt})
  8700. @kindex >
  8701. @findex org-agenda-date-prompt
  8702. Change the timestamp associated with the current line. The key
  8703. @kbd{>} has been chosen, because it is the same as
  8704. @kbd{S-.} on my keyboard.
  8705. @item @kbd{I} (@code{org-agenda-clock-in})
  8706. @kindex I
  8707. @findex org-agenda-clock-in
  8708. Start the clock on the current item. If a clock is running
  8709. already, it is stopped first.
  8710. @item @kbd{O} (@code{org-agenda-clock-out})
  8711. @kindex O
  8712. @findex org-agenda-clock-out
  8713. Stop the previously started clock.
  8714. @item @kbd{X} (@code{org-agenda-clock-cancel})
  8715. @kindex X
  8716. @findex org-agenda-clock-cancel
  8717. Cancel the currently running clock.
  8718. @item @kbd{J} (@code{org-agenda-clock-goto})
  8719. @kindex J
  8720. @findex org-agenda-clock-goto
  8721. Jump to the running clock in another window.
  8722. @item @kbd{k} (@code{org-agenda-capture})
  8723. @kindex k
  8724. @findex org-agenda-capture
  8725. @cindex capturing, from agenda
  8726. @vindex org-capture-use-agenda-date
  8727. Like @code{org-capture}, but use the date at point as the default date
  8728. for the capture template. See @code{org-capture-use-agenda-date} to
  8729. make this the default behavior of @code{org-capture}.
  8730. @end table
  8731. @anchor{Bulk remote editing selected entries}
  8732. @subheading Bulk remote editing selected entries
  8733. @cindex remote editing, bulk, from agenda
  8734. @vindex org-agenda-bulk-custom-functions
  8735. @table @asis
  8736. @item @kbd{m} (@code{org-agenda-bulk-mark})
  8737. @kindex m
  8738. @findex org-agenda-bulk-mark
  8739. Mark the entry at point for bulk action. If there is an active
  8740. region in the agenda, mark the entries in the region. With
  8741. numeric prefix argument, mark that many successive entries.
  8742. @item @kbd{*} (@code{org-agenda-bulk-mark-all})
  8743. @kindex *
  8744. @findex org-agenda-bulk-mark-all
  8745. Mark all visible agenda entries for bulk action.
  8746. @item @kbd{u} (@code{org-agenda-bulk-unmark})
  8747. @kindex u
  8748. @findex org-agenda-bulk-unmark
  8749. Unmark entry for bulk action.
  8750. @item @kbd{U} (@code{org-agenda-bulk-remove-all-marks})
  8751. @kindex U
  8752. @findex org-agenda-bulk-remove-all-marks
  8753. Unmark all marked entries for bulk action.
  8754. @item @kbd{M-m} (@code{org-agenda-bulk-toggle})
  8755. @kindex M-m
  8756. @findex org-agenda-bulk-toggle
  8757. Toggle mark of the entry at point for bulk action.
  8758. @item @kbd{M-*} (@code{org-agenda-bulk-toggle-all})
  8759. @kindex M-*
  8760. @findex org-agenda-bulk-toggle-all
  8761. Mark entries matching a regular expression for bulk action.
  8762. @item @kbd{%} (@code{org-agenda-bulk-mark-regexp})
  8763. @kindex %
  8764. @findex org-agenda-bulk-mark-regexp
  8765. Mark entries matching a regular expression for bulk action.
  8766. @item @kbd{B} (@code{org-agenda-bulk-action})
  8767. @kindex B
  8768. @findex org-agenda-bulk-action
  8769. @vindex org-agenda-bulk-persistent-marks
  8770. Bulk action: act on all marked entries in the agenda. This
  8771. prompts for another key to select the action to be applied. The
  8772. prefix argument to @kbd{B} is passed through to the
  8773. @kbd{s} and @kbd{d} commands, to bulk-remove these
  8774. special timestamps. By default, marks are removed after the
  8775. bulk. If you want them to persist, set
  8776. @code{org-agenda-bulk-persistent-marks} to @code{t} or hit @kbd{p} at
  8777. the prompt.
  8778. @table @asis
  8779. @item @kbd{*}
  8780. Toggle persistent marks.
  8781. @item @kbd{$}
  8782. Archive all selected entries.
  8783. @item @kbd{A}
  8784. Archive entries by moving them to their respective archive
  8785. siblings.
  8786. @item @kbd{t}
  8787. Change TODO state. This prompts for a single TODO keyword and
  8788. changes the state of all selected entries, bypassing blocking
  8789. and suppressing logging notes---but not timestamps.
  8790. @item @kbd{+}
  8791. Add a tag to all selected entries.
  8792. @item @kbd{-}
  8793. Remove a tag from all selected entries.
  8794. @item @kbd{s}
  8795. Schedule all items to a new date. To shift existing schedule
  8796. dates by a fixed number of days, use something starting with
  8797. double plus at the prompt, for example @samp{++8d} or @samp{++2w}.
  8798. @item @kbd{d}
  8799. Set deadline to a specific date.
  8800. @item @kbd{r}
  8801. Prompt for a single refile target and move all entries. The
  8802. entries are no longer in the agenda; refresh (@kbd{g}) to
  8803. bring them back.
  8804. @item @kbd{S}
  8805. Reschedule randomly into the coming N days. N is prompted for.
  8806. With a prefix argument (@kbd{C-u B S}), scatter only
  8807. across weekdays.
  8808. @item @kbd{f}
  8809. @vindex org-agenda-bulk-custom-functions
  8810. Apply a function@footnote{You can also create persistent custom functions through
  8811. @code{org-agenda-bulk-custom-functions}.} to marked entries. For example, the
  8812. function below sets the @samp{CATEGORY} property of the entries to
  8813. @samp{web}.
  8814. @lisp
  8815. (defun set-category ()
  8816. (interactive "P")
  8817. (let ((marker (or (org-get-at-bol 'org-hd-marker)
  8818. (org-agenda-error))))
  8819. (org-with-point-at marker
  8820. (org-back-to-heading t)
  8821. (org-set-property "CATEGORY" "web"))))
  8822. @end lisp
  8823. @end table
  8824. @end table
  8825. @anchor{Calendar commands}
  8826. @subheading Calendar commands
  8827. @cindex calendar commands, from agenda
  8828. @table @asis
  8829. @item @kbd{c} (@code{org-agenda-goto-calendar})
  8830. @kindex c
  8831. @findex org-agenda-goto-calendar
  8832. Open the Emacs calendar and move to the date at the agenda
  8833. cursor.
  8834. @item @kbd{c} (@code{org-calendar-goto-agenda})
  8835. @kindex c
  8836. @findex org-calendar-goto-agenda
  8837. When in the calendar, compute and show the Org agenda for the
  8838. date at the cursor.
  8839. @item @kbd{i} (@code{org-agenda-diary-entry})
  8840. @kindex i
  8841. @findex org-agenda-diary-entry
  8842. @cindex diary entries, creating from agenda
  8843. Insert a new entry into the diary, using the date at the cursor
  8844. and (for block entries) the date at the mark. This adds to the
  8845. Emacs diary file@footnote{This file is parsed for the agenda when
  8846. @code{org-agenda-include-diary} is set.}, in a way similar to the @kbd{i}
  8847. command in the calendar. The diary file pops up in another
  8848. window, where you can add the entry.
  8849. @vindex org-agenda-diary-file
  8850. If you configure @code{org-agenda-diary-file} to point to an Org file,
  8851. Org creates entries in that file instead. Most entries are
  8852. stored in a date-based outline tree that will later make it easy
  8853. to archive appointments from previous months/years. The tree is
  8854. built under an entry with a @samp{DATE_TREE} property, or else with
  8855. years as top-level entries. Emacs prompts you for the entry
  8856. text---if you specify it, the entry is created in
  8857. @code{org-agenda-diary-file} without further interaction. If you
  8858. directly press @kbd{@key{RET}} at the prompt without typing text,
  8859. the target file is shown in another window for you to finish the
  8860. entry there. See also the @kbd{k r} command.
  8861. @item @kbd{M} (@code{org-agenda-phases-of-moon})
  8862. @kindex M
  8863. @findex org-agenda-phases-of-moon
  8864. Show the phases of the moon for the three months around current
  8865. date.
  8866. @item @kbd{S} (@code{org-agenda-sunrise-sunset})
  8867. @kindex S
  8868. @findex org-agenda-sunrise-sunset
  8869. Show sunrise and sunset times. The geographical location must be
  8870. set with calendar variables, see the documentation for the Emacs
  8871. calendar.
  8872. @item @kbd{C} (@code{org-agenda-convert-date})
  8873. @kindex C
  8874. @findex org-agenda-convert-date
  8875. Convert the date at cursor into many other cultural and historic
  8876. calendars.
  8877. @item @kbd{H} (@code{org-agenda-holidays})
  8878. @kindex H
  8879. @findex org-agenda-holidays
  8880. Show holidays for three months around the cursor date.
  8881. @end table
  8882. @anchor{Quit and exit}
  8883. @subheading Quit and exit
  8884. @table @asis
  8885. @item @kbd{q} (@code{org-agenda-quit})
  8886. @kindex q
  8887. @findex org-agenda-quit
  8888. Quit agenda, remove the agenda buffer.
  8889. @item @kbd{x} (@code{org-agenda-exit})
  8890. @kindex x
  8891. @findex org-agenda-exit
  8892. @cindex agenda files, removing buffers
  8893. Exit agenda, remove the agenda buffer and all buffers loaded by
  8894. Emacs for the compilation of the agenda. Buffers created by the
  8895. user to visit Org files are not removed.
  8896. @end table
  8897. @node Custom Agenda Views
  8898. @section Custom Agenda Views
  8899. @cindex custom agenda views
  8900. @cindex agenda views, custom
  8901. Custom agenda commands serve two purposes: to store and quickly access
  8902. frequently used TODO and tags searches, and to create special
  8903. composite agenda buffers. Custom agenda commands are accessible
  8904. through the dispatcher (see @ref{Agenda Dispatcher}), just like the
  8905. default commands.
  8906. @menu
  8907. * Storing searches:: Type once, use often.
  8908. * Block agenda:: All the stuff you need in a single buffer.
  8909. * Setting options:: Changing the rules.
  8910. @end menu
  8911. @node Storing searches
  8912. @subsection Storing searches
  8913. The first application of custom searches is the definition of keyboard
  8914. shortcuts for frequently used searches, either creating an agenda
  8915. buffer, or a sparse tree (the latter covering of course only the
  8916. current buffer).
  8917. @kindex C @r{(Agenda dispatcher)}
  8918. @vindex org-agenda-custom-commands
  8919. @cindex agenda views, main example
  8920. @cindex agenda, as an agenda views
  8921. @cindex agenda*, as an agenda views
  8922. @cindex tags, as an agenda view
  8923. @cindex todo, as an agenda view
  8924. @cindex tags-todo
  8925. @cindex todo-tree
  8926. @cindex occur-tree
  8927. @cindex tags-tree
  8928. Custom commands are configured in the variable
  8929. @code{org-agenda-custom-commands}. You can customize this variable, for
  8930. example by pressing @kbd{C} from the agenda dispatcher (see @ref{Agenda Dispatcher}). You can also directly set it with Emacs Lisp in
  8931. the Emacs init file. The following example contains all valid agenda
  8932. views:
  8933. @lisp
  8934. (setq org-agenda-custom-commands
  8935. '(("x" agenda)
  8936. ("y" agenda*)
  8937. ("w" todo "WAITING")
  8938. ("W" todo-tree "WAITING")
  8939. ("u" tags "+boss-urgent")
  8940. ("v" tags-todo "+boss-urgent")
  8941. ("U" tags-tree "+boss-urgent")
  8942. ("f" occur-tree "\\<FIXME\\>")
  8943. ("h" . "HOME+Name tags searches") ;description for "h" prefix
  8944. ("hl" tags "+home+Lisa")
  8945. ("hp" tags "+home+Peter")
  8946. ("hk" tags "+home+Kim")))
  8947. @end lisp
  8948. @noindent
  8949. The initial string in each entry defines the keys you have to press
  8950. after the dispatcher command in order to access the command. Usually
  8951. this will be just a single character, but if you have many similar
  8952. commands, you can also define two-letter combinations where the first
  8953. character is the same in several combinations and serves as a prefix
  8954. key@footnote{You can provide a description for a prefix key by inserting
  8955. a cons cell with the prefix and the description.}. The second parameter is the search type, followed by the
  8956. string or regular expression to be used for the matching. The example
  8957. above will therefore define:
  8958. @table @asis
  8959. @item @kbd{x}
  8960. as a global search for agenda entries planned@footnote{@emph{Planned} means here that these entries have some planning
  8961. information attached to them, like a time-stamp, a scheduled or
  8962. a deadline string. See @code{org-agenda-entry-types} on how to set what
  8963. planning information is taken into account.} this
  8964. week/day.
  8965. @item @kbd{y}
  8966. as the same search, but only for entries with an hour
  8967. specification like @samp{[h]h:mm}---think of them as appointments.
  8968. @item @kbd{w}
  8969. as a global search for TODO entries with @samp{WAITING} as the TODO
  8970. keyword.
  8971. @item @kbd{W}
  8972. as the same search, but only in the current buffer and displaying
  8973. the results as a sparse tree.
  8974. @item @kbd{u}
  8975. as a global tags search for headlines tagged @samp{boss} but not
  8976. @samp{urgent}.
  8977. @item @kbd{v}
  8978. The same search, but limiting it to headlines that are also TODO
  8979. items.
  8980. @item @kbd{U}
  8981. as the same search, but only in the current buffer and displaying
  8982. the result as a sparse tree.
  8983. @item @kbd{f}
  8984. to create a sparse tree (again, current buffer only) with all
  8985. entries containing the word @samp{FIXME}.
  8986. @item @kbd{h}
  8987. as a prefix command for a @samp{HOME} tags search where you have to
  8988. press an additional key (@kbd{l}, @kbd{p} or
  8989. @kbd{k}) to select a name (Lisa, Peter, or Kim) as
  8990. additional tag to match.
  8991. @end table
  8992. Note that @code{*-tree} agenda views need to be called from an Org buffer
  8993. as they operate on the current buffer only.
  8994. @node Block agenda
  8995. @subsection Block agenda
  8996. @cindex block agenda
  8997. @cindex agenda, with block views
  8998. Another possibility is the construction of agenda views that comprise
  8999. the results of @emph{several} commands, each of which creates a block in
  9000. the agenda buffer. The available commands include @code{agenda} for the
  9001. daily or weekly agenda (as created with @kbd{a}) , @code{alltodo} for
  9002. the global TODO list (as constructed with @kbd{t}), and the
  9003. matching commands discussed above: @code{todo}, @code{tags}, and @code{tags-todo}.
  9004. Here are two examples:
  9005. @lisp
  9006. (setq org-agenda-custom-commands
  9007. '(("h" "Agenda and Home-related tasks"
  9008. ((agenda "")
  9009. (tags-todo "home")
  9010. (tags "garden")))
  9011. ("o" "Agenda and Office-related tasks"
  9012. ((agenda "")
  9013. (tags-todo "work")
  9014. (tags "office")))))
  9015. @end lisp
  9016. @noindent
  9017. This defines @kbd{h} to create a multi-block view for stuff you
  9018. need to attend to at home. The resulting agenda buffer contains your
  9019. agenda for the current week, all TODO items that carry the tag @samp{home},
  9020. and also all lines tagged with @samp{garden}. Finally the command
  9021. @kbd{o} provides a similar view for office tasks.
  9022. @node Setting options
  9023. @subsection Setting options for custom commands
  9024. @cindex options, for custom agenda views
  9025. @vindex org-agenda-custom-commands
  9026. Org mode contains a number of variables regulating agenda construction
  9027. and display. The global variables define the behavior for all agenda
  9028. commands, including the custom commands. However, if you want to
  9029. change some settings just for a single custom view, you can do so.
  9030. Setting options requires inserting a list of variable names and values
  9031. at the right spot in @code{org-agenda-custom-commands}. For example:
  9032. @lisp
  9033. (setq org-agenda-custom-commands
  9034. '(("w" todo "WAITING"
  9035. ((org-agenda-sorting-strategy '(priority-down))
  9036. (org-agenda-prefix-format " Mixed: ")))
  9037. ("U" tags-tree "+boss-urgent"
  9038. ((org-show-context-detail 'minimal)))
  9039. ("N" search ""
  9040. ((org-agenda-files '("~org/notes.org"))
  9041. (org-agenda-text-search-extra-files nil)))))
  9042. @end lisp
  9043. @noindent
  9044. Now the @kbd{w} command sorts the collected entries only by
  9045. priority, and the prefix format is modified to just say @samp{Mixed:}
  9046. instead of giving the category of the entry. The sparse tags tree of
  9047. @kbd{U} now turns out ultra-compact, because neither the headline
  9048. hierarchy above the match, nor the headline following the match are
  9049. shown. The command @kbd{N} does a text search limited to only
  9050. a single file.
  9051. For command sets creating a block agenda, @code{org-agenda-custom-commands}
  9052. has two separate spots for setting options. You can add options that
  9053. should be valid for just a single command in the set, and options that
  9054. should be valid for all commands in the set. The former are just
  9055. added to the command entry; the latter must come after the list of
  9056. command entries. Going back to the block agenda example (see @ref{Block agenda}), let's change the sorting strategy for the @kbd{h}
  9057. commands to @code{priority-down}, but let's sort the results for GARDEN
  9058. tags query in the opposite order, @code{priority-up}. This would look like
  9059. this:
  9060. @lisp
  9061. (setq org-agenda-custom-commands
  9062. '(("h" "Agenda and Home-related tasks"
  9063. ((agenda)
  9064. (tags-todo "home")
  9065. (tags "garden"
  9066. ((org-agenda-sorting-strategy '(priority-up)))))
  9067. ((org-agenda-sorting-strategy '(priority-down))))
  9068. ("o" "Agenda and Office-related tasks"
  9069. ((agenda)
  9070. (tags-todo "work")
  9071. (tags "office")))))
  9072. @end lisp
  9073. As you see, the values and parentheses setting is a little complex.
  9074. When in doubt, use the customize interface to set this variable---it
  9075. fully supports its structure. Just one caveat: when setting options
  9076. in this interface, the @emph{values} are just Lisp expressions. So if the
  9077. value is a string, you need to add the double-quotes around the value
  9078. yourself.
  9079. @vindex org-agenda-custom-commands-contexts
  9080. To control whether an agenda command should be accessible from
  9081. a specific context, you can customize
  9082. @code{org-agenda-custom-commands-contexts}. Let's say for example that you
  9083. have an agenda command @kbd{o} displaying a view that you only
  9084. need when reading emails. Then you would configure this option like
  9085. this:
  9086. @lisp
  9087. (setq org-agenda-custom-commands-contexts
  9088. '(("o" (in-mode . "message-mode"))))
  9089. @end lisp
  9090. You can also tell that the command key @kbd{o} should refer to
  9091. another command key @kbd{r}. In that case, add this command key
  9092. like this:
  9093. @lisp
  9094. (setq org-agenda-custom-commands-contexts
  9095. '(("o" "r" (in-mode . "message-mode"))))
  9096. @end lisp
  9097. See the docstring of the variable for more information.
  9098. @node Exporting Agenda Views
  9099. @section Exporting Agenda Views
  9100. @cindex agenda views, exporting
  9101. If you are away from your computer, it can be very useful to have
  9102. a printed version of some agenda views to carry around. Org mode can
  9103. export custom agenda views as plain text, HTML@footnote{For HTML you need to install Hrvoje Niksic's @samp{htmlize.el}
  9104. from @uref{https://github.com/hniksic/emacs-htmlize, Hrvoje Niksic's repository}.}, Postscript,
  9105. PDF@footnote{To create PDF output, the Ghostscript ps2pdf utility must be
  9106. installed on the system. Selecting a PDF file also creates the
  9107. postscript file.}, and iCalendar files. If you want to do this only
  9108. occasionally, use the following command:
  9109. @table @asis
  9110. @item @kbd{C-x C-w} (@code{org-agenda-write})
  9111. @kindex C-x C-w
  9112. @findex org-agenda-write
  9113. @cindex exporting agenda views
  9114. @cindex agenda views, exporting
  9115. @vindex org-agenda-exporter-settings
  9116. Write the agenda view to a file.
  9117. @end table
  9118. If you need to export certain agenda views frequently, you can
  9119. associate any custom agenda command with a list of output file
  9120. names@footnote{If you want to store standard views like the weekly agenda or
  9121. the global TODO list as well, you need to define custom commands for
  9122. them in order to be able to specify file names.}. Here is an example that first defines custom commands
  9123. for the agenda and the global TODO list, together with a number of
  9124. files to which to export them. Then we define two block agenda
  9125. commands and specify file names for them as well. File names can be
  9126. relative to the current working directory, or absolute.
  9127. @lisp
  9128. (setq org-agenda-custom-commands
  9129. '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  9130. ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  9131. ("h" "Agenda and Home-related tasks"
  9132. ((agenda "")
  9133. (tags-todo "home")
  9134. (tags "garden"))
  9135. nil
  9136. ("~/views/home.html"))
  9137. ("o" "Agenda and Office-related tasks"
  9138. ((agenda)
  9139. (tags-todo "work")
  9140. (tags "office"))
  9141. nil
  9142. ("~/views/office.ps" "~/calendars/office.ics"))))
  9143. @end lisp
  9144. The extension of the file name determines the type of export. If it
  9145. is @samp{.html}, Org mode uses the htmlize package to convert the buffer to
  9146. HTML and save it to this file name. If the extension is @samp{.ps},
  9147. @code{ps-print-buffer-with-faces} is used to produce Postscript output. If
  9148. the extension is @samp{.ics}, iCalendar export is run export over all files
  9149. that were used to construct the agenda, and limit the export to
  9150. entries listed in the agenda. Any other extension produces a plain
  9151. ASCII file.
  9152. The export files are @emph{not} created when you use one of those
  9153. commands interactively because this might use too much overhead.
  9154. Instead, there is a special command to produce @emph{all} specified
  9155. files in one step:
  9156. @table @asis
  9157. @item @kbd{e} (@code{org-store-agenda-views})
  9158. @kindex e @r{(Agenda dispatcher)}
  9159. @findex org-store-agenda-views
  9160. Export all agenda views that have export file names associated
  9161. with them.
  9162. @end table
  9163. You can use the options section of the custom agenda commands to also
  9164. set options for the export commands. For example:
  9165. @lisp
  9166. (setq org-agenda-custom-commands
  9167. '(("X" agenda ""
  9168. ((ps-number-of-columns 2)
  9169. (ps-landscape-mode t)
  9170. (org-agenda-prefix-format " [ ] ")
  9171. (org-agenda-with-colors nil)
  9172. (org-agenda-remove-tags t))
  9173. ("theagenda.ps"))))
  9174. @end lisp
  9175. @noindent
  9176. @vindex org-agenda-exporter-settings
  9177. This command sets two options for the Postscript exporter, to make it
  9178. print in two columns in landscape format---the resulting page can be
  9179. cut in two and then used in a paper agenda. The remaining settings
  9180. modify the agenda prefix to omit category and scheduling information,
  9181. and instead include a checkbox to check off items. We also remove the
  9182. tags to make the lines compact, and we do not want to use colors for
  9183. the black-and-white printer. Settings specified in
  9184. @code{org-agenda-exporter-settings} also apply, e.g.,
  9185. @lisp
  9186. (setq org-agenda-exporter-settings
  9187. '((ps-number-of-columns 2)
  9188. (ps-landscape-mode t)
  9189. (org-agenda-add-entry-text-maxlines 5)
  9190. (htmlize-output-type 'css)))
  9191. @end lisp
  9192. @noindent
  9193. but the settings in @code{org-agenda-custom-commands} take precedence.
  9194. @noindent
  9195. From the command line you may also use:
  9196. @example
  9197. emacs -eval (org-batch-store-agenda-views) -kill
  9198. @end example
  9199. @noindent
  9200. or, if you need to modify some parameters@footnote{Quoting depends on the system you use, please check the FAQ
  9201. for examples.}
  9202. @example
  9203. emacs -eval '(org-batch-store-agenda-views \
  9204. org-agenda-span (quote month) \
  9205. org-agenda-start-day "2007-11-01" \
  9206. org-agenda-include-diary nil \
  9207. org-agenda-files (quote ("~/org/project.org")))' \
  9208. -kill
  9209. @end example
  9210. @noindent
  9211. which creates the agenda views restricted to the file
  9212. @samp{~/org/project.org}, without diary entries and with a 30-day extent.
  9213. You can also extract agenda information in a way that allows further
  9214. processing by other programs. See @ref{Extracting Agenda Information}, for
  9215. more information.
  9216. @node Agenda Column View
  9217. @section Using Column View in the Agenda
  9218. @cindex column view, in agenda
  9219. @cindex agenda, column view
  9220. Column view (see @ref{Column View}) is normally used to view and edit
  9221. properties embedded in the hierarchical structure of an Org file. It
  9222. can be quite useful to use column view also from the agenda, where
  9223. entries are collected by certain criteria.
  9224. @table @asis
  9225. @item @kbd{C-c C-x C-c} (@code{org-agenda-columns})
  9226. @kindex C-c C-x C-c
  9227. @findex org-agenda-columns
  9228. Turn on column view in the agenda.
  9229. @end table
  9230. To understand how to use this properly, it is important to realize
  9231. that the entries in the agenda are no longer in their proper outline
  9232. environment. This causes the following issues:
  9233. @enumerate
  9234. @item
  9235. @vindex org-columns-default-format
  9236. @vindex org-overriding-columns-format
  9237. Org needs to make a decision which columns format to use. Since
  9238. the entries in the agenda are collected from different files, and
  9239. different files may have different columns formats, this is
  9240. a non-trivial problem. Org first checks if the variable
  9241. @code{org-agenda-overriding-columns-format} is currently set, and if so,
  9242. takes the format from there. Otherwise it takes the format
  9243. associated with the first item in the agenda, or, if that item does
  9244. not have a specific format (defined in a property, or in its file),
  9245. it uses @code{org-columns-default-format}.
  9246. @item
  9247. @cindex @samp{CLOCKSUM}, special property
  9248. If any of the columns has a summary type defined (see @ref{Column attributes}), turning on column view in the agenda visits all
  9249. relevant agenda files and make sure that the computations of this
  9250. property are up to date. This is also true for the special
  9251. @samp{CLOCKSUM} property. Org then sums the values displayed in the
  9252. agenda. In the daily/weekly agenda, the sums cover a single day;
  9253. in all other views they cover the entire block.
  9254. It is important to realize that the agenda may show the same entry
  9255. @emph{twice}---for example as scheduled and as a deadline---and it may
  9256. show two entries from the same hierarchy (for example a @emph{parent}
  9257. and its @emph{child}). In these cases, the summation in the agenda
  9258. leads to incorrect results because some values count double.
  9259. @item
  9260. When the column view in the agenda shows the @samp{CLOCKSUM} property,
  9261. that is always the entire clocked time for this item. So even in
  9262. the daily/weekly agenda, the clocksum listed in column view may
  9263. originate from times outside the current view. This has the
  9264. advantage that you can compare these values with a column listing
  9265. the planned total effort for a task---one of the major
  9266. applications for column view in the agenda. If you want
  9267. information about clocked time in the displayed period use clock
  9268. table mode (press @kbd{R} in the agenda).
  9269. @item
  9270. @cindex @samp{CLOCKSUM_T}, special property
  9271. When the column view in the agenda shows the @samp{CLOCKSUM_T} property,
  9272. that is always today's clocked time for this item. So even in the
  9273. weekly agenda, the clocksum listed in column view only originates
  9274. from today. This lets you compare the time you spent on a task for
  9275. today, with the time already spent---via @samp{CLOCKSUM}---and with
  9276. the planned total effort for it.
  9277. @end enumerate
  9278. @node Markup
  9279. @chapter Markup for Rich Export
  9280. When exporting Org documents, the exporter tries to reflect the
  9281. structure of the document as accurately as possible in the back-end.
  9282. Since export targets like HTML and @LaTeX{} allow much richer formatting,
  9283. Org mode has rules on how to prepare text for rich export. This
  9284. section summarizes the markup rules used in an Org mode buffer.
  9285. @menu
  9286. * Paragraphs:: The basic unit of text.
  9287. * Emphasis and Monospace:: Bold, italic, etc.
  9288. * Horizontal Rules:: Make a line.
  9289. * Images and Tables:: Images, tables and caption mechanism.
  9290. * Literal Examples:: Source code examples with special formatting.
  9291. * Special Symbols:: Greek letters and other symbols.
  9292. * Subscripts and Superscripts:: Simple syntax for raising/lowering text.
  9293. * Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents.
  9294. @end menu
  9295. @node Paragraphs
  9296. @section Paragraphs
  9297. @cindex paragraphs, markup rules
  9298. Paragraphs are separated by at least one empty line. If you need to
  9299. enforce a line break within a paragraph, use @code{\\} at the end of
  9300. a line.
  9301. To preserve the line breaks, indentation and blank lines in a region,
  9302. but otherwise use normal formatting, you can use this construct, which
  9303. can also be used to format poetry.
  9304. @cindex @samp{BEGIN_VERSE}
  9305. @cindex verse blocks
  9306. @example
  9307. #+BEGIN_VERSE
  9308. Great clouds overhead
  9309. Tiny black birds rise and fall
  9310. Snow covers Emacs
  9311. ---AlexSchroeder
  9312. #+END_VERSE
  9313. @end example
  9314. When quoting a passage from another document, it is customary to
  9315. format this as a paragraph that is indented on both the left and the
  9316. right margin. You can include quotations in Org documents like this:
  9317. @cindex @samp{BEGIN_QUOTE}
  9318. @cindex quote blocks
  9319. @example
  9320. #+BEGIN_QUOTE
  9321. Everything should be made as simple as possible,
  9322. but not any simpler ---Albert Einstein
  9323. #+END_QUOTE
  9324. @end example
  9325. If you would like to center some text, do it like this:
  9326. @cindex @samp{BEGIN_CENTER}
  9327. @cindex center blocks
  9328. @example
  9329. #+BEGIN_CENTER
  9330. Everything should be made as simple as possible, \\
  9331. but not any simpler
  9332. #+END_CENTER
  9333. @end example
  9334. @node Emphasis and Monospace
  9335. @section Emphasis and Monospace
  9336. @cindex underlined text, markup rules
  9337. @cindex bold text, markup rules
  9338. @cindex italic text, markup rules
  9339. @cindex verbatim text, markup rules
  9340. @cindex code text, markup rules
  9341. @cindex strike-through text, markup rules
  9342. You can make words @samp{*bold*}, @samp{/italic/}, @samp{_underlined_}, @samp{=verbatim=}
  9343. and @samp{~code~}, and, if you must, @samp{+strike-through+}. Text in the code
  9344. and verbatim string is not processed for Org mode specific syntax; it
  9345. is exported verbatim.
  9346. @vindex org-fontify-emphasized-text
  9347. To turn off fontification for marked up text, you can set
  9348. @code{org-fontify-emphasized-text} to @code{nil}. To narrow down the list of
  9349. available markup syntax, you can customize @code{org-emphasis-alist}.
  9350. @node Horizontal Rules
  9351. @section Horizontal Rules
  9352. @cindex horizontal rules, markup rules
  9353. A line consisting of only dashes, and at least 5 of them, is exported
  9354. as a horizontal line.
  9355. @node Images and Tables
  9356. @section Images and Tables
  9357. @cindex tables, markup rules
  9358. @cindex @samp{CAPTION}, keyword
  9359. @cindex @samp{NAME}, keyword
  9360. Both the native Org mode tables (see @ref{Tables}) and tables formatted
  9361. with the @samp{table.el} package are exported properly. For Org mode
  9362. tables, the lines before the first horizontal separator line become
  9363. table header lines. You can use the following lines somewhere before
  9364. the table to assign a caption and a label for cross references, and in
  9365. the text you can refer to the object with @samp{[[tab:basic-data]]} (see
  9366. @ref{Internal Links}):
  9367. @example
  9368. #+CAPTION: This is the caption for the next table (or link)
  9369. #+NAME: tab:basic-data
  9370. | ... | ... |
  9371. |-----+-----|
  9372. @end example
  9373. Optionally, the caption can take the form:
  9374. @example
  9375. #+CAPTION[Caption for list of tables]: Caption for table.
  9376. @end example
  9377. @cindex inlined images, markup rules
  9378. Some back-ends allow you to directly include images into the exported
  9379. document. Org does this, if a link to an image file does not have
  9380. a description part, for example @samp{[[./img/a.jpg]]}. If you wish to define
  9381. a caption for the image and maybe a label for internal cross
  9382. references, make sure that the link is on a line by itself and precede
  9383. it with @samp{CAPTION} and @samp{NAME} keywords as follows:
  9384. @example
  9385. #+CAPTION: This is the caption for the next figure link (or table)
  9386. #+NAME: fig:SED-HR4049
  9387. [[./img/a.jpg]]
  9388. @end example
  9389. @noindent
  9390. Such images can be displayed within the buffer. See @ref{Handling Links, , the discussion of
  9391. image links}.
  9392. Even though images and tables are prominent examples of captioned
  9393. structures, the same caption mechanism can apply to many
  9394. others---e.g., @LaTeX{} equations, source code blocks. Depending on the
  9395. export back-end, those may or may not be handled.
  9396. @node Literal Examples
  9397. @section Literal Examples
  9398. @cindex literal examples, markup
  9399. @cindex code line references, markup
  9400. You can include literal examples that should not be subjected to
  9401. markup. Such examples are typeset in monospace, so this is well
  9402. suited for source code and similar examples.
  9403. @cindex @samp{BEGIN_EXAMPLE}
  9404. @cindex example block
  9405. @example
  9406. #+BEGIN_EXAMPLE
  9407. Some example from a text file.
  9408. #+END_EXAMPLE
  9409. @end example
  9410. Note that such blocks may be @emph{indented} in order to align nicely with
  9411. indented text and in particular with plain list structure (see
  9412. @ref{Plain Lists}). For simplicity when using small examples, you can
  9413. also start the example lines with a colon followed by a space. There
  9414. may also be additional whitespace before the colon:
  9415. @example
  9416. Here is an example
  9417. : Some example from a text file.
  9418. @end example
  9419. @cindex formatting source code, markup rules
  9420. @vindex org-latex-listings
  9421. If the example is source code from a programming language, or any
  9422. other text that can be marked up by Font Lock in Emacs, you can ask
  9423. for the example to look like the fontified Emacs buffer@footnote{This works automatically for the HTML backend (it requires
  9424. version 1.34 of the @samp{htmlize.el} package, which you need to install).
  9425. Fontified code chunks in @LaTeX{} can be achieved using either the
  9426. listings package or the @uref{https://github.com/gpoore/minted, minted} package. Refer to
  9427. @code{org-export-latex-listings} for details.}. This
  9428. is done with the code block, where you also need to specify the name
  9429. of the major mode that should be used to fontify the example@footnote{Source code in code blocks may also be evaluated either
  9430. interactively or on export. See @ref{Working with Source Code} for more
  9431. information on evaluating code blocks.},
  9432. see @ref{Structure Templates} for shortcuts to easily insert code blocks.
  9433. @cindex @samp{BEGIN_SRC}
  9434. @cindex src block
  9435. @example
  9436. #+BEGIN_SRC emacs-lisp
  9437. (defun org-xor (a b)
  9438. "Exclusive or."
  9439. (if a (not b) b))
  9440. #+END_SRC
  9441. @end example
  9442. Both in @samp{example} and in @samp{src} snippets, you can add a @samp{-n} switch to
  9443. the end of the @samp{#+BEGIN} line, to get the lines of the example
  9444. numbered. The @samp{-n} takes an optional numeric argument specifying the
  9445. starting line number of the block. If you use a @samp{+n} switch, the
  9446. numbering from the previous numbered snippet is continued in the
  9447. current one. The @samp{+n} switch can also take a numeric argument. This
  9448. adds the value of the argument to the last line of the previous block
  9449. to determine the starting line number.
  9450. @example
  9451. #+BEGIN_SRC emacs-lisp -n 20
  9452. ;; This exports with line number 20.
  9453. (message "This is line 21")
  9454. #+END_SRC
  9455. #+BEGIN_SRC emacs-lisp +n 10
  9456. ;; This is listed as line 31.
  9457. (message "This is line 32")
  9458. #+END_SRC
  9459. @end example
  9460. In literal examples, Org interprets strings like @samp{(ref:name)} as
  9461. labels, and use them as targets for special hyperlinks like
  9462. @samp{[[(name)]]}---i.e., the reference name enclosed in single parenthesis.
  9463. In HTML, hovering the mouse over such a link remote-highlights the
  9464. corresponding code line, which is kind of cool.
  9465. You can also add a @samp{-r} switch which @emph{removes} the labels from the
  9466. source code@footnote{Adding @samp{-k} to @samp{-n -r} @emph{keeps} the labels in the source code
  9467. while using line numbers for the links, which might be useful to
  9468. explain those in an Org mode example code.}. With the @samp{-n} switch, links to these references
  9469. are labeled by the line numbers from the code listing. Otherwise
  9470. links use the labels with no parentheses. Here is an example:
  9471. @example
  9472. #+BEGIN_SRC emacs-lisp -n -r
  9473. (save-excursion (ref:sc)
  9474. (goto-char (point-min)) (ref:jump)
  9475. #+END_SRC
  9476. In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
  9477. jumps to point-min.
  9478. @end example
  9479. @cindex indentation, in source blocks
  9480. Finally, you can use @samp{-i} to preserve the indentation of a specific
  9481. code block (see @ref{Editing Source Code}).
  9482. @vindex org-coderef-label-format
  9483. If the syntax for the label format conflicts with the language syntax,
  9484. use a @samp{-l} switch to change the format, for example
  9485. @example
  9486. #+BEGIN_SRC pascal -n -r -l "((%s))"
  9487. @end example
  9488. @noindent
  9489. See also the variable @code{org-coderef-label-format}.
  9490. HTML export also allows examples to be published as text areas (see
  9491. @ref{Text areas in HTML export}).
  9492. Because the @samp{#+BEGIN} @dots{} @samp{#+END} patterns need to be added so often,
  9493. a shortcut is provided (see @ref{Structure Templates}).
  9494. @table @asis
  9495. @item @kbd{C-c '} (@code{org-edit-special})
  9496. @kindex C-c '
  9497. @findex org-edit-special
  9498. Edit the source code example at point in its native mode. This
  9499. works by switching to a temporary buffer with the source code.
  9500. You need to exit by pressing @kbd{C-c '} again@footnote{Upon exit, lines starting with @samp{*}, @samp{,*}, @samp{#+} and @samp{,#+} get
  9501. a comma prepended, to keep them from being interpreted by Org as
  9502. outline nodes or special syntax. These commas are stripped when
  9503. editing with @kbd{C-c '}, and also before export.}. The
  9504. edited version then replaces the old version in the Org buffer.
  9505. Fixed-width regions---where each line starts with a colon
  9506. followed by a space---are edited using @code{artist-mode}@footnote{You may select a different-mode with the variable
  9507. @code{org-edit-fixed-width-region-mode}.} to
  9508. allow creating ASCII drawings easily. Using this command in an
  9509. empty line creates a new fixed-width region.
  9510. @end table
  9511. @cindex storing link, in a source code buffer
  9512. Calling @code{org-store-link} (see @ref{Handling Links}) while editing a source
  9513. code example in a temporary buffer created with @kbd{C-c '}
  9514. prompts for a label. Make sure that it is unique in the current
  9515. buffer, and insert it with the proper formatting like @samp{(ref:label)} at
  9516. the end of the current line. Then the label is stored as a link
  9517. @samp{(label)}, for retrieval with @kbd{C-c C-l}.
  9518. @node Special Symbols
  9519. @section Special Symbols
  9520. @cindex math symbols
  9521. @cindex special symbols
  9522. @cindex @TeX{} macros
  9523. @cindex @LaTeX{} fragments, markup rules
  9524. @cindex HTML entities
  9525. @cindex @LaTeX{} entities
  9526. You can use @LaTeX{}-like syntax to insert special symbols---named
  9527. entities---like @samp{\alpha} to indicate the Greek letter, or @samp{\to} to indicate
  9528. an arrow. Completion for these symbols is available, just type @samp{\}
  9529. and maybe a few letters, and press @kbd{M-@key{TAB}} to see possible
  9530. completions. If you need such a symbol inside a word, terminate it
  9531. with a pair of curly brackets. For example
  9532. @example
  9533. Pro tip: Given a circle \Gamma of diameter d, the length of its
  9534. circumference is \pi@{@}d.
  9535. @end example
  9536. @findex org-entities-help
  9537. @vindex org-entities-user
  9538. A large number of entities is provided, with names taken from both
  9539. HTML and @LaTeX{}; you can comfortably browse the complete list from
  9540. a dedicated buffer using the command @code{org-entities-help}. It is also
  9541. possible to provide your own special symbols in the variable
  9542. @code{org-entities-user}.
  9543. During export, these symbols are transformed into the native format of
  9544. the exporter back-end. Strings like @samp{\alpha} are exported as @samp{&alpha;} in
  9545. the HTML output, and as @samp{\(\alpha\)} in the @LaTeX{} output. Similarly, @samp{\nbsp}
  9546. becomes @samp{&nbsp;} in HTML and @samp{~} in @LaTeX{}.
  9547. @cindex escaping characters
  9548. Entities may also be used as a way to escape markup in an Org
  9549. document, e.g., @samp{\under@{@}not underlined\under} exports as @samp{_not underlined_}.
  9550. @cindex special symbols, in-buffer display
  9551. If you would like to see entities displayed as UTF-8 characters, use
  9552. the following command@footnote{You can turn this on by default by setting the variable
  9553. @code{org-pretty-entities}, or on a per-file base with the @samp{STARTUP} option
  9554. @samp{entitiespretty}.}:
  9555. @table @asis
  9556. @item @kbd{C-c C-x \} (@code{org-toggle-pretty-entities})
  9557. @kindex C-c C-x \
  9558. @findex org-toggle-pretty-entities
  9559. Toggle display of entities as UTF-8 characters. This does not
  9560. change the buffer content which remains plain ASCII, but it
  9561. overlays the UTF-8 character for display purposes only.
  9562. @end table
  9563. @cindex shy hyphen, special symbol
  9564. @cindex dash, special symbol
  9565. @cindex ellipsis, special symbol
  9566. In addition to regular entities defined above, Org exports in
  9567. a special way@footnote{This behavior can be disabled with @samp{-} export setting (see
  9568. @ref{Export Settings}).} the following commonly used character
  9569. combinations: @samp{\-} is treated as a shy hyphen, @samp{--} and @samp{---} are
  9570. converted into dashes, and @samp{...} becomes a compact set of dots.
  9571. @node Subscripts and Superscripts
  9572. @section Subscripts and Superscripts
  9573. @cindex subscript
  9574. @cindex superscript
  9575. @samp{^} and @samp{_} are used to indicate super- and subscripts. To increase
  9576. the readability of ASCII text, it is not necessary, but OK, to
  9577. surround multi-character sub- and superscripts with curly braces. For
  9578. example
  9579. @example
  9580. The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand,
  9581. the radius of Alpha Centauri is R_@{Alpha Centauri@} = 1.28 x R_@{sun@}.
  9582. @end example
  9583. @vindex org-use-sub-superscripts
  9584. If you write a text where the underscore is often used in a different
  9585. context, Org's convention to always interpret these as subscripts can
  9586. get in your way. Configure the variable @code{org-use-sub-superscripts} to
  9587. change this convention. For example, when setting this variable to
  9588. @code{@{@}}, @samp{a_b} is not interpreted as a subscript, but @samp{a_@{b@}} is.
  9589. @table @asis
  9590. @item @kbd{C-c C-x \} (@code{org-toggle-pretty-entities~})
  9591. @kindex C-c C-x \
  9592. @findex org-toggle-pretty-entities
  9593. In addition to showing entities as UTF-8 characters, this command
  9594. also formats sub- and superscripts in a WYSIWYM way.
  9595. @end table
  9596. @node Embedded @LaTeX{}
  9597. @section Embedded @LaTeX{}
  9598. @cindex @TeX{} interpretation
  9599. @cindex @LaTeX{} interpretation
  9600. Plain ASCII is normally sufficient for almost all note taking.
  9601. Exceptions include scientific notes, which often require mathematical
  9602. symbols and the occasional formula. @LaTeX{}@footnote{@LaTeX{} is a macro system based on Donald@tie{}E.@tie{}Knuth's @TeX{}
  9603. system. Many of the features described here as ``@LaTeX{}'' are really
  9604. from @TeX{}, but for simplicity I am blurring this distinction.} is widely used to
  9605. typeset scientific documents. Org mode supports embedding @LaTeX{} code
  9606. into its files, because many academics are used to writing and reading
  9607. @LaTeX{} source code, and because it can be readily processed to produce
  9608. pretty output for a number of export back-ends.
  9609. @menu
  9610. * @LaTeX{} fragments:: Complex formulas made easy.
  9611. * Previewing @LaTeX{} fragments:: What will this snippet look like?
  9612. * CD@LaTeX{} mode:: Speed up entering of formulas.
  9613. @end menu
  9614. @node @LaTeX{} fragments
  9615. @subsection @LaTeX{} fragments
  9616. @cindex @LaTeX{} fragments
  9617. @vindex org-format-latex-header
  9618. Org mode can contain @LaTeX{} math fragments, and it supports ways to
  9619. process these for several export back-ends. When exporting to @LaTeX{},
  9620. the code is left as it is. When exporting to HTML, Org can use either
  9621. @uref{http://www.mathjax.org, MathJax} (see @ref{Math formatting in HTML export}) or transcode the math
  9622. into images (see @ref{Previewing @LaTeX{} fragments}).
  9623. @LaTeX{} fragments do not need any special marking at all. The following
  9624. snippets are identified as @LaTeX{} source code:
  9625. @itemize
  9626. @item
  9627. Environments of any kind@footnote{When MathJax is used, only the environments recognized by
  9628. MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is
  9629. used to create images, any @LaTeX{} environment is handled.}. The only requirement is that the
  9630. @samp{\begin} statement appears on a new line, preceded by only
  9631. whitespace.
  9632. @item
  9633. Text within the usual @LaTeX{} math delimiters. To avoid conflicts
  9634. with currency specifications, single @samp{$} characters are only
  9635. recognized as math delimiters if the enclosed text contains at most
  9636. two line breaks, is directly attached to the @samp{$} characters with no
  9637. whitespace in between, and if the closing @samp{$} is followed by
  9638. whitespace, punctuation or a dash. For the other delimiters, there
  9639. is no such restriction, so when in doubt, use @samp{\(...\)} as inline
  9640. math delimiters.
  9641. @end itemize
  9642. @noindent
  9643. For example:
  9644. @example
  9645. \begin@{equation@} % arbitrary environments,
  9646. x=\sqrt@{b@} % even tables, figures
  9647. \end@{equation@} % etc
  9648. If $a^2=b$ and \( b=2 \), then the solution must be
  9649. either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
  9650. @end example
  9651. @vindex org-export-with-latex
  9652. @LaTeX{} processing can be configured with the variable
  9653. @code{org-export-with-latex}. The default setting is @code{t} which means
  9654. MathJax for HTML, and no processing for ASCII and @LaTeX{} back-ends.
  9655. You can also set this variable on a per-file basis using one of these
  9656. lines:
  9657. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  9658. @item @samp{#+OPTIONS: tex:t}
  9659. @tab Do the right thing automatically (MathJax)
  9660. @item @samp{#+OPTIONS: tex:nil}
  9661. @tab Do not process @LaTeX{} fragments at all
  9662. @item @samp{#+OPTIONS: tex:verbatim}
  9663. @tab Verbatim export, for jsMath or so
  9664. @end multitable
  9665. @node Previewing @LaTeX{} fragments
  9666. @subsection Previewing @LaTeX{} fragments
  9667. @cindex @LaTeX{} fragments, preview
  9668. @vindex org-preview-latex-default-process
  9669. If you have a working @LaTeX{} installation and @samp{dvipng}, @samp{dvisvgm} or
  9670. @samp{convert} installed@footnote{These are respectively available at
  9671. @uref{http://sourceforge.net/projects/dvipng/}, @uref{http://dvisvgm.bplaced.net/}
  9672. and from the ImageMagick suite. Choose the converter by setting the
  9673. variable @code{org-preview-latex-default-process} accordingly.}, @LaTeX{} fragments can be processed to
  9674. produce images of the typeset expressions to be used for inclusion
  9675. while exporting to HTML (see @ref{@LaTeX{} fragments}), or for inline
  9676. previewing within Org mode.
  9677. @vindex org-format-latex-options
  9678. @vindex org-format-latex-header
  9679. You can customize the variables @code{org-format-latex-options} and
  9680. @code{org-format-latex-header} to influence some aspects of the preview.
  9681. In particular, the @code{:scale} (and for HTML export, @code{:html-scale})
  9682. property of the former can be used to adjust the size of the preview
  9683. images.
  9684. @table @asis
  9685. @item @kbd{C-c C-x C-l} (@code{org-toggle-latex-fragment})
  9686. @kindex C-c C-x C-l
  9687. @findex org-toggle-latex-fragment
  9688. Produce a preview image of the @LaTeX{} fragment at point and
  9689. overlay it over the source code. If there is no fragment at
  9690. point, process all fragments in the current entry (between two
  9691. headlines). When called with a prefix argument, process the
  9692. entire subtree. When called with two prefix arguments, or when
  9693. the cursor is before the first headline, process the entire
  9694. buffer.
  9695. @end table
  9696. @vindex org-startup-with-latex-preview
  9697. You can turn on the previewing of all @LaTeX{} fragments in a file with
  9698. @example
  9699. #+STARTUP: latexpreview
  9700. @end example
  9701. To disable it, simply use
  9702. @example
  9703. #+STARTUP: nolatexpreview
  9704. @end example
  9705. @node CD@LaTeX{} mode
  9706. @subsection Using CD@LaTeX{} to enter math
  9707. @cindex CD@LaTeX{}
  9708. CD@LaTeX{} mode is a minor mode that is normally used in combination with
  9709. a major @LaTeX{} mode like AUC@TeX{} in order to speed-up insertion of
  9710. environments and math templates. Inside Org mode, you can make use of
  9711. some of the features of CD@LaTeX{} mode. You need to install
  9712. @samp{cdlatex.el} and @samp{texmathp.el} (the latter comes also with AUC@TeX{})
  9713. from @uref{http://www.astro.uva.nl/~dominik/Tools/cdlatex}. Do not use
  9714. CD@LaTeX{} mode itself under Org mode, but use the light version
  9715. @code{org-cdlatex-mode} that comes as part of Org mode. Turn it on for the
  9716. current buffer with @kbd{M-x org-cdlatex-mode}, or for all Org
  9717. files with
  9718. @lisp
  9719. (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
  9720. @end lisp
  9721. When this mode is enabled, the following features are present (for
  9722. more details see the documentation of CD@LaTeX{} mode):
  9723. @table @asis
  9724. @item @kbd{C-c @{}
  9725. @kindex C-c @{
  9726. Insert an environment template.
  9727. @item @kbd{@key{TAB}}
  9728. @kindex TAB
  9729. The @kbd{@key{TAB}} key expands the template if the cursor is
  9730. inside a @LaTeX{} fragment@footnote{Org mode has a method to test if the cursor is inside such
  9731. a fragment, see the documentation of the function
  9732. @code{org-inside-LaTeX-fragment-p}.}. For example, @kbd{@key{TAB}}
  9733. expands @samp{fr} to @samp{\frac@{@}@{@}} and position the cursor correctly
  9734. inside the first brace. Another @kbd{@key{TAB}} gets you into the
  9735. second brace.
  9736. Even outside fragments, @kbd{@key{TAB}} expands environment
  9737. abbreviations at the beginning of a line. For example, if you
  9738. write @samp{equ} at the beginning of a line and press @kbd{@key{TAB}},
  9739. this abbreviation is expanded to an @samp{equation} environment. To
  9740. get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
  9741. @item @kbd{^}
  9742. @itemx @kbd{_}
  9743. @kindex _
  9744. @kindex ^
  9745. @vindex cdlatex-simplify-sub-super-scripts
  9746. Pressing @kbd{_} and @kbd{^} inside a @LaTeX{} fragment
  9747. inserts these characters together with a pair of braces. If you
  9748. use @kbd{@key{TAB}} to move out of the braces, and if the braces
  9749. surround only a single character or macro, they are removed again
  9750. (depending on the variable @code{cdlatex-simplify-sub-super-scripts}).
  9751. @item @kbd{`}
  9752. @kindex `
  9753. Pressing the backquote followed by a character inserts math
  9754. macros, also outside @LaTeX{} fragments. If you wait more than 1.5
  9755. seconds after the backquote, a help window pops up.
  9756. @item @kbd{'}
  9757. @kindex '
  9758. Pressing the single-quote followed by another character modifies
  9759. the symbol before point with an accent or a font. If you wait
  9760. more than 1.5 seconds after the single-quote, a help window pops
  9761. up. Character modification works only inside @LaTeX{} fragments;
  9762. outside the quote is normal.
  9763. @end table
  9764. @node Exporting
  9765. @chapter Exporting
  9766. @cindex exporting
  9767. Sometimes, you may want to pretty print your notes, publish them on
  9768. the web or even share them with people not using Org. In these cases,
  9769. the Org export facilities can be used to convert your documents to
  9770. a variety of other formats, while retaining as much structure (see
  9771. @ref{Document Structure}) and markup (see @ref{Markup}) as
  9772. possible.
  9773. @cindex export back-end
  9774. Libraries responsible for such translation are called back-ends. Org
  9775. ships with the following ones
  9776. @itemize
  9777. @item
  9778. @emph{ascii} (ASCII format)
  9779. @item
  9780. @emph{beamer} (@LaTeX{} Beamer format)
  9781. @item
  9782. @emph{html} (HTML format)
  9783. @item
  9784. @emph{icalendar} (iCalendar format)
  9785. @item
  9786. @emph{latex} (@LaTeX{} format)
  9787. @item
  9788. @emph{md} (Markdown format)
  9789. @item
  9790. @emph{odt} (OpenDocument Text format)
  9791. @item
  9792. @emph{org} (Org format)
  9793. @item
  9794. @emph{texinfo} (Texinfo format)
  9795. @item
  9796. @emph{man} (Man page format)
  9797. @end itemize
  9798. @noindent
  9799. Org also uses additional libraries located in @samp{contrib/} directory
  9800. (see @ref{Installation}). Users can install additional export libraries
  9801. for additional formats from the Emacs packaging system. For easy
  9802. discovery, these packages have a common naming scheme: @code{ox-NAME},
  9803. where @var{NAME} is one of the formats. For example,
  9804. @code{ox-koma-letter} @emph{koma-letter} back-end.
  9805. @vindex org-export-backends
  9806. Org loads back-ends for the following formats by default: ASCII, HTML,
  9807. iCalendar, @LaTeX{} and ODT. Org can load additional back-ends either of
  9808. two ways: through the @code{org-export-backends} variable configuration;
  9809. or, by requiring the library in the Emacs init file like this:
  9810. @lisp
  9811. (require 'ox-md)
  9812. @end lisp
  9813. @menu
  9814. * The Export Dispatcher:: The main interface.
  9815. * Export Settings:: Common export settings.
  9816. * Table of Contents:: The if and where of the table of contents.
  9817. * Include Files:: Include additional files into a document.
  9818. * Macro Replacement:: Use macros to create templates.
  9819. * Comment Lines:: What will not be exported.
  9820. * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding.
  9821. * Beamer Export::
  9822. * HTML Export:: Exporting to HTML.
  9823. * @LaTeX{} Export:: Exporting to @LaTeX{} and processing to PDF.
  9824. * Markdown Export:: Exporting to Markdown.
  9825. * OpenDocument Text Export:: Exporting to OpenDocument Text.
  9826. * Org Export:: Exporting to Org.
  9827. * Texinfo Export:: Exporting to Texinfo.
  9828. * iCalendar Export:: Exporting to iCalendar.
  9829. * Other Built-in Back-ends:: Exporting to a man page.
  9830. * Advanced Configuration:: Fine-tuning the export output.
  9831. * Export in Foreign Buffers:: Author tables and lists in Org syntax.
  9832. @end menu
  9833. @node The Export Dispatcher
  9834. @section The Export Dispatcher
  9835. @cindex dispatcher, for export commands
  9836. @cindex Export, dispatcher
  9837. The export dispatcher is the main interface for Org's exports.
  9838. A hierarchical menu presents the currently configured export formats.
  9839. Options are shown as easy toggle switches on the same screen.
  9840. @vindex org-export-dispatch-use-expert-ui
  9841. Org also has a minimal prompt interface for the export dispatcher.
  9842. When the variable @code{org-export-dispatch-use-expert-ui} is set to
  9843. a non-@code{nil} value, Org prompts in the minibuffer. To switch back to
  9844. the hierarchical menu, press @kbd{?}.
  9845. @table @asis
  9846. @item @kbd{C-c C-e} (@code{org-export})
  9847. @kindex C-c C-e
  9848. @findex org-export
  9849. Invokes the export dispatcher interface. The options show
  9850. default settings. The @kbd{C-u} prefix argument preserves
  9851. options from the previous export, including any sub-tree
  9852. selections.
  9853. @end table
  9854. Org exports the entire buffer by default. If the Org buffer has an
  9855. active region, then Org exports just that region.
  9856. Within the dispatcher interface, the following key combinations can
  9857. further alter what is exported, and how.
  9858. @table @asis
  9859. @item @kbd{C-a}
  9860. @kindex C-c C-e C-a
  9861. Toggle asynchronous export. Asynchronous export uses an external
  9862. Emacs process with a specially configured initialization file to
  9863. complete the exporting process in the background thereby
  9864. releasing the current interface. This is particularly useful
  9865. when exporting long documents.
  9866. Output from an asynchronous export is saved on the ``the export
  9867. stack''. To view this stack, call the export dispatcher with
  9868. a double @kbd{C-u} prefix argument. If already in the
  9869. export dispatcher menu, @kbd{&} displays the stack.
  9870. @vindex org-export-async-init-file
  9871. To make the background export process the default, customize the
  9872. variable, @code{org-export-in-background}. Additionally, you can set
  9873. the initialization file used by the background process with
  9874. @code{org-export-async-init-file}.
  9875. @vindex org-export-in-background
  9876. You can make asynchronous export the default by setting
  9877. @code{org-export-in-background}.
  9878. @item @kbd{C-b}
  9879. @kindex C-c C-e C-b
  9880. Toggle body-only export. Useful for excluding headers and
  9881. footers in the export. Affects only those back-end formats that
  9882. have such sections---like @samp{<head>...</head>} in HTML.
  9883. @item @{@{@{kbd(C-s@}@}@}
  9884. @kindex C-c C-e C-s
  9885. Toggle sub-tree export. When turned on, Org exports only the
  9886. sub-tree starting from the cursor position at the time the export
  9887. dispatcher was invoked. Org uses the top heading of this
  9888. sub-tree as the document's title. If the cursor is not on
  9889. a heading, Org uses the nearest enclosing header. If the cursor
  9890. is in the document preamble, Org signals an error and aborts
  9891. export.
  9892. @vindex org-export-initial-scope
  9893. To make the sub-tree export the default, customize the variable
  9894. @code{org-export-initial-scope}.
  9895. @item @kbd{C-v}
  9896. @kindex C-c C-e C-v
  9897. Toggle visible-only export. Useful for exporting only visible
  9898. parts of an Org document by adjusting outline visibility
  9899. settings.
  9900. @end table
  9901. @node Export Settings
  9902. @section Export Settings
  9903. @cindex options, for export
  9904. @cindex Export, settings
  9905. @cindex @samp{OPTIONS}, keyword
  9906. Export options can be set: globally with variables; for an individual
  9907. file by making variables buffer-local with in-buffer settings (see
  9908. @ref{In-buffer Settings}), by setting individual keywords, or by
  9909. specifying them in a compact form with the @samp{OPTIONS} keyword; or for
  9910. a tree by setting properties (see @ref{Properties and Columns}). Options
  9911. set at a specific level override options set at a more general level.
  9912. @cindex SETUPFILE, keyword
  9913. In-buffer settings may appear anywhere in the file, either directly or
  9914. indirectly through a file included using @samp{#+SETUPFILE: filename or
  9915. URL} syntax. Option keyword sets tailored to a particular back-end
  9916. can be inserted from the export dispatcher (see @ref{The Export Dispatcher}) using the @samp{Insert template} command by pressing
  9917. @kbd{#}. To insert keywords individually, a good way to make
  9918. sure the keyword is correct is to type @samp{#+} and then to use
  9919. @kbd{M-@key{TAB}}@footnote{Many desktops intercept @kbd{M-@key{TAB}} to switch windows.
  9920. Use @kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} instead.} for completion.
  9921. The export keywords available for every back-end, and their equivalent
  9922. global variables, include:
  9923. @table @asis
  9924. @item @samp{AUTHOR}
  9925. @cindex @samp{AUTHOR}, keyword
  9926. @vindex user-full-name
  9927. The document author (@code{user-full-name}).
  9928. @item @samp{CREATOR}
  9929. @cindex @samp{CREATOR}, keyword
  9930. @vindex org-expot-creator-string
  9931. Entity responsible for output generation
  9932. (@code{org-export-creator-string}).
  9933. @item @samp{DATE}
  9934. @cindex @samp{DATE}, keyword
  9935. @vindex org-export-date-timestamp-format
  9936. A date or a time-stamp@footnote{The variable @code{org-export-date-timestamp-format} defines how
  9937. this timestamp are exported.}.
  9938. @item @samp{EMAIL}
  9939. @cindex @samp{EMAIL}, keyword
  9940. @vindex user-mail-address
  9941. The email address (@code{user-mail-address}).
  9942. @item @samp{LANGUAGE}
  9943. @cindex @samp{LANGUAGE}, keyword
  9944. @vindex org-export-default-language
  9945. Language to use for translating certain strings
  9946. (@code{org-export-default-language}). With @samp{#+LANGUAGE: fr}, for
  9947. example, Org translates @samp{Table of contents} to the French @samp{Table
  9948. des matières}.
  9949. @item @samp{SELECT_TAGS}
  9950. @cindex @samp{SELECT_TAGS}, keyword
  9951. @vindex org-export-select-tags
  9952. The default value is @code{("export")}. When a tree is tagged with
  9953. @samp{export} (@code{org-export-select-tags}), Org selects that tree and
  9954. its sub-trees for export. Org excludes trees with @samp{noexport}
  9955. tags, see below. When selectively exporting files with @samp{export}
  9956. tags set, Org does not export any text that appears before the
  9957. first headline.
  9958. @item @samp{EXCLUDE_TAGS}
  9959. @cindex @samp{EXCLUDE_TAGS}, keyword
  9960. @vindex org-export-exclude-tags
  9961. The default value is @code{("noexport")}. When a tree is tagged with
  9962. @samp{noexport} (@code{org-export-exclude-tags}), Org excludes that tree
  9963. and its sub-trees from export. Entries tagged with @samp{noexport}
  9964. are unconditionally excluded from the export, even if they have
  9965. an @samp{export} tag. Even if a sub-tree is not exported, Org
  9966. executes any code blocks contained there.
  9967. @item @samp{TITLE}
  9968. @cindex @samp{TITLE}, keyword
  9969. @cindex document title
  9970. Org displays this title. For long titles, use multiple @samp{#+TITLE}
  9971. lines.
  9972. @item @samp{EXPORT_FILE_NAME}
  9973. @cindex @samp{EXPORT_FILE_NAME}, keyword
  9974. The name of the output file to be generated. Otherwise, Org
  9975. generates the file name based on the buffer name and the
  9976. extension based on the back-end format.
  9977. @end table
  9978. The @samp{OPTIONS} keyword is a compact form. To configure multiple
  9979. options, use several @samp{OPTIONS} lines. @samp{OPTIONS} recognizes the
  9980. following arguments.
  9981. @table @asis
  9982. @item @code{'}
  9983. @vindex org-export-with-smart-quotes
  9984. Toggle smart quotes (@code{org-export-with-smart-quotes}). Depending
  9985. on the language used, when activated, Org treats pairs of double
  9986. quotes as primary quotes, pairs of single quotes as secondary
  9987. quotes, and single quote marks as apostrophes.
  9988. @item @code{*}
  9989. @vindex org-export-with-emphasize
  9990. Toggle emphasized text (@code{org-export-with-emphasize}).
  9991. @item @code{-}
  9992. @vindex org-export-with-special-strings
  9993. Toggle conversion of special strings
  9994. (@code{org-export-with-special-strings}).
  9995. @item @code{:}
  9996. @vindex org-export-with-fixed-width
  9997. Toggle fixed-width sections (@code{org-export-with-fixed-width}).
  9998. @item @code{<}
  9999. @vindex org-export-with-timestamps
  10000. Toggle inclusion of time/date active/inactive stamps
  10001. (@code{org-export-with-timestamps}).
  10002. @item @code{\n}
  10003. @vindex org-export-preserve-breaks
  10004. Toggles whether to preserve line breaks
  10005. (@code{org-export-preserve-breaks}).
  10006. @item @code{^}
  10007. @vindex org-export-with-sub-superscripts
  10008. Toggle @TeX{}-like syntax for sub- and superscripts. If you write
  10009. @samp{^:@{@}}, @samp{a_@{b@}} is interpreted, but the simple @samp{a_b} is left as
  10010. it is (@code{org-export-with-sub-superscripts}).
  10011. @item @code{arch}
  10012. @vindex org-export-with-archived-trees
  10013. Configure how archived trees are exported. When set to
  10014. @code{headline}, the export process skips the contents and processes
  10015. only the headlines (@code{org-export-with-archived-trees}).
  10016. @item @code{author}
  10017. @vindex org-export-with-author
  10018. Toggle inclusion of author name into exported file
  10019. (@code{org-export-with-author}).
  10020. @item @code{broken-links}
  10021. @vindex org-export-with-broken-links
  10022. Toggles if Org should continue exporting upon finding a broken
  10023. internal link. When set to @code{mark}, Org clearly marks the problem
  10024. link in the output (@code{org-export-with-broken-links}).
  10025. @item @code{c}
  10026. @vindex org-export-with-clocks
  10027. Toggle inclusion of CLOCK keywords (@code{org-export-with-clocks}).
  10028. @item @code{creator}
  10029. @vindex org-export-with-creator
  10030. Toggle inclusion of creator information in the exported file
  10031. (@code{org-export-with-creator}).
  10032. @item @code{d}
  10033. @vindex org-export-with-drawers
  10034. Toggles inclusion of drawers, or list of drawers to include, or
  10035. list of drawers to exclude (@code{org-export-with-drawers}).
  10036. @item @code{date}
  10037. @vindex org-export-with-date
  10038. Toggle inclusion of a date into exported file
  10039. (@code{org-export-with-date}).
  10040. @item @code{e}
  10041. @vindex org-export-with-entities
  10042. Toggle inclusion of entities (@code{org-export-with-entities}).
  10043. @item @code{email}
  10044. @vindex org-export-with-email
  10045. Toggle inclusion of the author's e-mail into exported file
  10046. (@code{org-export-with-email}).
  10047. @item @code{f}
  10048. @vindex org-export-with-footnotes
  10049. Toggle the inclusion of footnotes (@code{org-export-with-footnotes}).
  10050. @item @code{H}
  10051. @vindex org-export-headline-levels
  10052. Set the number of headline levels for export
  10053. (@code{org-export-headline-levels}). Below that level, headlines are
  10054. treated differently. In most back-ends, they become list items.
  10055. @item @code{inline}
  10056. @vindex org-export-with-inlinetasks
  10057. Toggle inclusion of inlinetasks (@code{org-export-with-inlinetasks}).
  10058. @item @code{num}
  10059. @vindex org-export-with-section-numbers
  10060. @cindex @samp{UNNUMBERED}, property
  10061. Toggle section-numbers (@code{org-export-with-section-numbers}). When
  10062. set to number N, Org numbers only those headlines at level N or
  10063. above. Set @samp{UNNUMBERED} property to non-@code{nil} to disable
  10064. numbering of heading and subheadings entirely. Moreover, when
  10065. the value is @samp{notoc} the headline, and all its children, do not
  10066. appear in the table of contents either (see @ref{Table of Contents}).
  10067. @item @code{p}
  10068. @vindex org-export-with-planning
  10069. Toggle export of planning information
  10070. (@code{org-export-with-planning}). ``Planning information'' comes from
  10071. lines located right after the headline and contain any
  10072. combination of these cookies: @samp{SCHEDULED}, @samp{DEADLINE}, or
  10073. @samp{CLOSED}.
  10074. @item @code{pri}
  10075. @vindex org-export-with-priority
  10076. Toggle inclusion of priority cookies
  10077. (@code{org-export-with-priority}).
  10078. @item @code{prop}
  10079. @vindex org-export-with-properties
  10080. Toggle inclusion of property drawers, or list the properties to
  10081. include (@code{org-export-with-properties}).
  10082. @item @code{stat}
  10083. @vindex org-export-with-statistics-cookies
  10084. Toggle inclusion of statistics cookies
  10085. (@code{org-export-with-statistics-cookies}).
  10086. @item @code{tags}
  10087. @vindex org-export-with-tags
  10088. Toggle inclusion of tags, may also be @code{not-in-toc}
  10089. (@code{org-export-with-tags}).
  10090. @item @code{tasks}
  10091. @vindex org-export-with-tasks
  10092. Toggle inclusion of tasks (TODO items); or @code{nil} to remove all
  10093. tasks; or @code{todo} to remove DONE tasks; or list the keywords to
  10094. keep (@code{org-export-with-tasks}).
  10095. @item @code{tex}
  10096. @vindex org-export-with-latex
  10097. @code{nil} does not export; @code{t} exports; @code{verbatim} keeps everything
  10098. in verbatim (@code{org-export-with-latex}).
  10099. @item @code{timestamp}
  10100. @vindex org-export-time-stamp-file
  10101. Toggle inclusion of the creation time in the exported file
  10102. (@code{org-export-time-stamp-file}).
  10103. @item @code{title}
  10104. @vindex org-export-with-title
  10105. Toggle inclusion of title (@code{org-export-with-title}).
  10106. @item @code{toc}
  10107. @vindex org-export-with-toc
  10108. Toggle inclusion of the table of contents, or set the level limit
  10109. (@code{org-export-with-toc}).
  10110. @item @code{todo}
  10111. @vindex org-export-with-todo-keywords
  10112. Toggle inclusion of TODO keywords into exported text
  10113. (@code{org-export-with-todo-keywords}).
  10114. @item @code{|}
  10115. @vindex org-export-with-tables
  10116. Toggle inclusion of tables (@code{org-export-with-tables}).
  10117. @end table
  10118. When exporting sub-trees, special node properties in them can override
  10119. the above keywords. They are special because they have an @samp{EXPORT_}
  10120. prefix. For example, @samp{DATE} and @samp{EXPORT_FILE_NAME} keywords become,
  10121. respectively, @samp{EXPORT_DATE} and @samp{EXPORT_FILE_NAME}. Except for
  10122. @samp{SETUPFILE}, all other keywords listed above have an @samp{EXPORT_}
  10123. equivalent.
  10124. @cindex @samp{BIND}, keyword
  10125. @vindex org-export-allow-bind-keywords
  10126. If @code{org-export-allow-bind-keywords} is non-@code{nil}, Emacs variables can
  10127. become buffer-local during export by using the @samp{BIND} keyword. Its
  10128. syntax is @samp{#+BIND: variable value}. This is particularly useful for
  10129. in-buffer settings that cannot be changed using keywords.
  10130. @node Table of Contents
  10131. @section Table of Contents
  10132. @cindex table of contents
  10133. @cindex list of tables
  10134. @cindex list of listings
  10135. @cindex @samp{toc}, in @samp{OPTIONS} keyword
  10136. @vindex org-export-with-toc
  10137. The table of contents includes all headlines in the document. Its
  10138. depth is therefore the same as the headline levels in the file. If
  10139. you need to use a different depth, or turn it off entirely, set the
  10140. @code{org-export-with-toc} variable accordingly. You can achieve the same
  10141. on a per file basis, using the following @samp{toc} item in @samp{OPTIONS}
  10142. keyword:
  10143. @example
  10144. #+OPTIONS: toc:2 (only include two levels in TOC)
  10145. #+OPTIONS: toc:nil (no default TOC at all)
  10146. @end example
  10147. @cindex excluding entries from table of contents
  10148. @cindex table of contents, exclude entries
  10149. Org includes both numbered and unnumbered headlines in the table of
  10150. contents@footnote{At the moment, some export back-ends do not obey this
  10151. specification. For example, @LaTeX{} export excludes every unnumbered
  10152. headline from the table of contents.}. If you need to exclude an unnumbered headline,
  10153. along with all its children, set the @samp{UNNUMBERED} property to @samp{notoc}
  10154. value.
  10155. @example
  10156. * Subtree not numbered, not in table of contents either
  10157. :PROPERTIES:
  10158. :UNNUMBERED: notoc
  10159. :END:
  10160. @end example
  10161. @cindex @samp{TOC}, keyword
  10162. Org normally inserts the table of contents directly before the first
  10163. headline of the file. To move the table of contents to a different
  10164. location, first turn off the default with @code{org-export-with-toc}
  10165. variable or with @samp{#+OPTIONS: toc:nil}. Then insert @samp{#+TOC: headlines
  10166. N} at the desired location(s).
  10167. @example
  10168. #+OPTIONS: toc:nil
  10169. ...
  10170. #+TOC: headlines 2
  10171. @end example
  10172. To adjust the table of contents depth for a specific section of the
  10173. Org document, append an additional @samp{local} parameter. This parameter
  10174. becomes a relative depth for the current level. The following example
  10175. inserts a local table of contents, with direct children only.
  10176. @example
  10177. * Section
  10178. #+TOC: headlines 1 local
  10179. @end example
  10180. Note that for this feature to work properly in @LaTeX{} export, the Org
  10181. file requires the inclusion of the titletoc package. Because of
  10182. compatibility issues, titletoc has to be loaded @emph{before} hyperref.
  10183. Customize the @code{org-latex-default-packages-alist} variable.
  10184. Use the @samp{TOC} keyword to generate list of tables---respectively, all
  10185. listings---with captions.
  10186. @example
  10187. #+TOC: listings
  10188. #+TOC: tables
  10189. @end example
  10190. @cindex @samp{ALT_TITLE}, property
  10191. Normally Org uses the headline for its entry in the table of contents.
  10192. But with @samp{ALT_TITLE} property, a different entry can be specified for
  10193. the table of contents.
  10194. @node Include Files
  10195. @section Include Files
  10196. @cindex include files, during export
  10197. @cindex Export, include files
  10198. @cindex @samp{INCLUDE}, keyword
  10199. During export, you can include the content of another file. For
  10200. example, to include your @samp{.emacs} file, you could use:
  10201. @example
  10202. #+INCLUDE: "~/.emacs" src emacs-lisp
  10203. @end example
  10204. @noindent
  10205. The optional second and third parameter are the markup (e.g., @samp{quote},
  10206. @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the language for
  10207. formatting the contents. The markup is optional; if it is not given,
  10208. assume text is in Org syntax and process it normally. The @samp{INCLUDE}
  10209. keyword also allows additional parameters @samp{:prefix1} and @samp{:prefix} to
  10210. specify prefixes for the first line and for each following line,
  10211. @samp{:minlevel} in order to get Org mode content demoted to a specified
  10212. level, as well as any options accepted by the selected markup. For
  10213. example, to include a file as an item, use:
  10214. @example
  10215. #+INCLUDE: "~/snippets/xx" :prefix1 " + " :prefix " "
  10216. @end example
  10217. You can also include a portion of a file by specifying a lines range
  10218. using the @samp{:lines} parameter. The line at the upper end of the range
  10219. is not included. The start and/or the end of the range may be omitted
  10220. to use the obvious defaults.
  10221. @table @asis
  10222. @item @samp{#+INCLUDE: "~/.emacs" :lines "5-10"}
  10223. Include lines 5 to 10, 10 excluded.
  10224. @item @samp{#+INCLUDE: "~/.emacs" :lines "-10"}
  10225. Include lines 1 to 10, 10 excluded.
  10226. @item @samp{#+INCLUDE: "~/.emacs" :lines "10-"}
  10227. Include lines from 10 to EOF.
  10228. @end table
  10229. You can visit the file being included with the following command.
  10230. @table @asis
  10231. @item @kbd{C-c '} (@code{org-edit~special})
  10232. @kindex C-c '
  10233. @findex org-edit-special
  10234. Visit the include file at point.
  10235. @end table
  10236. @node Macro Replacement
  10237. @section Macro Replacement
  10238. @cindex macro replacement, during export
  10239. @cindex @samp{MACRO}, keyword
  10240. @vindex org-export-global-macros
  10241. Macros replace text snippets during export. Macros are defined
  10242. globally in @code{org-export-global-macros}, or document-wise with the
  10243. following syntax:
  10244. @example
  10245. #+MACRO: name replacement text; $1, $2 are arguments
  10246. @end example
  10247. @noindent
  10248. which can be referenced using @samp{@{@{@{name(arg1, arg2)@}@}@}}@footnote{Since commas separate the arguments, commas within arguments
  10249. have to be escaped with the backslash character. So only those
  10250. backslash characters before a comma need escaping with another
  10251. backslash character.}. For
  10252. example
  10253. @example
  10254. #+MACRO: poem The rose is $1, The violet's $2. Life's ordered: Org assists you.
  10255. @{@{@{poem(red,blue)@}@}@}
  10256. @end example
  10257. @noindent
  10258. becomes
  10259. @example
  10260. The rose is red, The violet's blue. Life's ordered: Org assists you.
  10261. @end example
  10262. As a special case, Org parses any replacement text starting with
  10263. @samp{(eval} as an Emacs Lisp expression and evaluates it accordingly.
  10264. Within such templates, arguments become strings. Thus, the following
  10265. macro
  10266. @example
  10267. #+MACRO: gnucheck (eval (concat "GNU/" (capitalize $1)))
  10268. @end example
  10269. @noindent
  10270. turns @samp{@{@{@{gnucheck(linux)@}@}@}} into @samp{GNU/Linux} during export.
  10271. Org recognizes macro references in following Org markup areas:
  10272. paragraphs, headlines, verse blocks, tables cells and lists. Org also
  10273. recognizes macro references in keywords, such as @samp{CAPTION}, @samp{TITLE},
  10274. @samp{AUTHOR}, @samp{DATE}, and for some back-end specific export options.
  10275. Org comes with following pre-defined macros:
  10276. @table @asis
  10277. @item @samp{@{@{@{keyword(NAME)@}@}@}}
  10278. @itemx @samp{@{@{@{title@}@}@}}
  10279. @itemx @samp{@{@{@{author@}@}@}}
  10280. @itemx @samp{@{@{@{email@}@}@}}
  10281. @cindex @samp{keyword}, macro
  10282. @cindex @samp{title}, macro
  10283. @cindex @samp{author}, macro
  10284. @cindex @samp{email}, macro
  10285. The @samp{keyword} macro collects all values from @var{NAME}
  10286. keywords throughout the buffer, separated with white space.
  10287. @samp{title}, @samp{author} and @samp{email} macros are shortcuts for,
  10288. respectively, @samp{@{@{@{keyword(TITLE)@}@}@}}, @samp{@{@{@{keyword(AUTHOR)@}@}@}} and
  10289. @samp{@{@{@{keyword(EMAIL)@}@}@}}.
  10290. @item @samp{@{@{@{date@}@}@}}
  10291. @itemx @samp{@{@{@{date(FORMAT)@}@}@}}
  10292. @cindex @samp{date}, macro
  10293. This macro refers to the @samp{DATE} keyword. @var{FORMAT} is an
  10294. optional argument to the @samp{date} macro that is used only if @samp{DATE}
  10295. is a single timestamp. @var{FORMAT} should be a format
  10296. string understood by @code{format-time-string}.
  10297. @item @samp{@{@{@{time(FORMAT)@}@}@}}
  10298. @itemx @samp{@{@{@{modification-time(FORMAT, VC)@}@}@}}
  10299. @cindex @samp{time}, macro
  10300. @cindex @samp{modification-time}, macro
  10301. These macros refer to the document's date and time of export and
  10302. date and time of modification. @var{FORMAT} is a string
  10303. understood by @code{format-time-string}. If the second argument to
  10304. the @code{modification-time} macro is non-@code{nil}, Org uses @samp{vc.el} to
  10305. retrieve the document's modification time from the version
  10306. control system. Otherwise Org reads the file attributes.
  10307. @item @samp{@{@{@{input-file@}@}@}}
  10308. @cindex @samp{input-file}, macro
  10309. This macro refers to the filename of the exported file.
  10310. @item @samp{@{@{@{property(PROPERTY-NAME)@}@}@}}
  10311. @itemx @samp{@{@{@{property(PROPERTY-NAME, SEARCH OPTION)@}@}@}}
  10312. @cindex @samp{property}, macro
  10313. This macro returns the value of property @var{PROPERTY-NAME}
  10314. in the current entry. If @var{SEARCH-OPTION} (see @ref{Search Options}) refers to a remote entry, use it instead.
  10315. @item @samp{@{@{@{n@}@}@}}
  10316. @itemx @samp{@{@{@{n(NAME)@}@}@}}
  10317. @itemx @samp{@{@{@{n(NAME, ACTION)@}@}@}}
  10318. @cindex @samp{n}, macro
  10319. @cindex counter, macro
  10320. This macro implements custom counters by returning the number of
  10321. times the macro has been expanded so far while exporting the
  10322. buffer. You can create more than one counter using different
  10323. @var{NAME} values. If @var{ACTION} is @samp{-}, previous
  10324. value of the counter is held, i.e., the specified counter is not
  10325. incremented. If the value is a number, the specified counter is
  10326. set to that value. If it is any other non-empty string, the
  10327. specified counter is reset to 1. You may leave @var{NAME}
  10328. empty to reset the default counter.
  10329. @end table
  10330. @vindex org-hide-macro-markers
  10331. The surrounding brackets can be made invisible by setting
  10332. @code{org-hide-macro-markers} non-@code{nil}.
  10333. Org expands macros at the very beginning of the export process.
  10334. @node Comment Lines
  10335. @section Comment Lines
  10336. @cindex exporting, not
  10337. @cindex comment lines
  10338. Lines starting with zero or more whitespace characters followed by one
  10339. @samp{#} and a whitespace are treated as comments and, as such, are not
  10340. exported.
  10341. @cindex @samp{BEGIN_COMMENT}
  10342. @cindex comment block
  10343. Likewise, regions surrounded by @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT}
  10344. are not exported.
  10345. @cindex comment trees
  10346. Finally, a @samp{COMMENT} keyword at the beginning of an entry, but after
  10347. any other keyword or priority cookie, comments out the entire subtree.
  10348. In this case, the subtree is not exported and no code block within it
  10349. is executed either@footnote{For a less drastic behavior, consider using a select tag (see
  10350. @ref{Export Settings}) instead.}. The command below helps changing the
  10351. comment status of a headline.
  10352. @table @asis
  10353. @item @kbd{C-c ;} (@code{org-toggle-comment})
  10354. @kindex C-c ;
  10355. @findex org-toggle-comment
  10356. Toggle the @samp{COMMENT} keyword at the beginning of an entry.
  10357. @end table
  10358. @node ASCII/Latin-1/UTF-8 export
  10359. @section ASCII/Latin-1/UTF-8 export
  10360. @cindex ASCII export
  10361. @cindex Latin-1 export
  10362. @cindex UTF-8 export
  10363. ASCII export produces an output file containing only plain ASCII
  10364. characters. This is the simplest and most direct text output. It
  10365. does not contain any Org markup. Latin-1 and UTF-8 export use
  10366. additional characters and symbols available in these encoding
  10367. standards. All three of these export formats offer the most basic of
  10368. text output for maximum portability.
  10369. @vindex org-ascii-text-width
  10370. On export, Org fills and justifies text according to the text width
  10371. set in @code{org-ascii-text-width}.
  10372. @vindex org-ascii-links-to-notes
  10373. Org exports links using a footnote-like style where the descriptive
  10374. part is in the text and the link is in a note before the next heading.
  10375. See the variable @code{org-ascii-links-to-notes} for details.
  10376. @anchor{ASCII export commands}
  10377. @subheading ASCII export commands
  10378. @table @asis
  10379. @item @kbd{C-c C-e t a} (@code{org-ascii-export-to-ascii})
  10380. @itemx @kbd{C-c C-e t l}
  10381. @itemx @kbd{C-c C-e t u}
  10382. @kindex C-c C-e t a
  10383. @kindex C-c C-e t l
  10384. @kindex C-c C-e t u
  10385. @findex org-ascii-export-to-ascii
  10386. Export as an ASCII file with a @samp{.txt} extension. For
  10387. @samp{myfile.org}, Org exports to @samp{myfile.txt}, overwriting without
  10388. warning. For @samp{myfile.txt}, Org exports to @samp{myfile.txt.txt} in
  10389. order to prevent data loss.
  10390. @end table
  10391. @table @asis
  10392. @item @kbd{C-c C-e t A} (@code{org-ascii-export-to-ascii})
  10393. @itemx @kbd{C-c C-e t L}
  10394. @itemx @kbd{C-c C-e t U}
  10395. @kindex C-c C-e t A
  10396. @kindex C-c C-e t L
  10397. @kindex C-c C-e t U
  10398. @findex org-ascii-export-to-ascii
  10399. Export to a temporary buffer. Does not create a file.
  10400. @end table
  10401. @anchor{ASCII specific export settings}
  10402. @subheading ASCII specific export settings
  10403. The ASCII export back-end has one extra keyword for customizing ASCII
  10404. output. Setting this keyword works similar to the general options
  10405. (see @ref{Export Settings}).
  10406. @table @asis
  10407. @item @samp{SUBTITLE}
  10408. @cindex @samp{SUBTITLE}, keyword
  10409. The document subtitle. For long subtitles, use multiple
  10410. @samp{#+SUBTITLE} lines in the Org file. Org prints them on one
  10411. continuous line, wrapping into multiple lines if necessary.
  10412. @end table
  10413. @anchor{Header and sectioning structure}
  10414. @subheading Header and sectioning structure
  10415. Org converts the first three outline levels into headlines for ASCII
  10416. export. The remaining levels are turned into lists. To change this
  10417. cut-off point where levels become lists, see @ref{Export Settings}.
  10418. @anchor{Quoting ASCII text}
  10419. @subheading Quoting ASCII text
  10420. To insert text within the Org file by the ASCII back-end, use one the
  10421. following constructs, inline, keyword, or export block:
  10422. @cindex @samp{ASCII}, keyword
  10423. @cindex @samp{BEGIN_EXPORT ascii}
  10424. @example
  10425. Inline text @@@@ascii:and additional text@@@@ within a paragraph.
  10426. #+ASCII: Some text
  10427. #+BEGIN_EXPORT ascii
  10428. Org exports text in this block only when using ASCII back-end.
  10429. #+END_EXPORT
  10430. @end example
  10431. @anchor{ASCII specific attributes}
  10432. @subheading ASCII specific attributes
  10433. @cindex @samp{ATTR_ASCII}, keyword
  10434. @cindex horizontal rules, in ASCII export
  10435. ASCII back-end recognizes only one attribute, @code{:width}, which
  10436. specifies the width of an horizontal rule in number of characters.
  10437. The keyword and syntax for specifying widths is:
  10438. @example
  10439. #+ATTR_ASCII: :width 10
  10440. -----
  10441. @end example
  10442. @anchor{ASCII special blocks}
  10443. @subheading ASCII special blocks
  10444. @cindex special blocks, in ASCII export
  10445. @cindex @samp{BEGIN_JUSTIFYLEFT}
  10446. @cindex @samp{BEGIN_JUSTIFYRIGHT}
  10447. Besides @samp{#+BEGIN_CENTER} blocks (see @ref{Paragraphs}), ASCII back-end has
  10448. these two left and right justification blocks:
  10449. @example
  10450. #+BEGIN_JUSTIFYLEFT
  10451. It's just a jump to the left...
  10452. #+END_JUSTIFYLEFT
  10453. #+BEGIN_JUSTIFYRIGHT
  10454. ...and then a step to the right.
  10455. #+END_JUSTIFYRIGHT
  10456. @end example
  10457. @node Beamer Export
  10458. @section Beamer Export
  10459. @cindex Beamer export
  10460. Org uses Beamer export to convert an Org file tree structure into
  10461. high-quality interactive slides for presentations. Beamer is a @LaTeX{}
  10462. document class for creating presentations in PDF, HTML, and other
  10463. popular display formats.
  10464. @menu
  10465. * Beamer export commands:: For creating Beamer documents.
  10466. * Beamer specific export settings:: For customizing Beamer export.
  10467. * Frames and Blocks in Beamer:: For composing Beamer slides.
  10468. * Beamer specific syntax:: For using in Org documents.
  10469. * Editing support:: Editing support.
  10470. * A Beamer example:: A complete presentation.
  10471. @end menu
  10472. @node Beamer export commands
  10473. @subsection Beamer export commands
  10474. @table @asis
  10475. @item @kbd{C-c C-e l b} (@code{org-beamer-export-to-latex})
  10476. @kindex C-c C-e l b
  10477. @findex org-beamer-export-to-latex
  10478. Export as @LaTeX{} file with a @samp{.tex} extension. For @samp{myfile.org},
  10479. Org exports to @samp{myfile.tex}, overwriting without warning.
  10480. @item @kbd{C-c C-e l B} (@code{org-beamer-export-as-latex})
  10481. @kindex C-c C-e l B
  10482. @findex org-beamer-export-as-latex
  10483. Export to a temporary buffer. Does not create a file.
  10484. @item @kbd{C-c C-e l P} (@code{org-beamer-export-to-pdf})
  10485. @kindex C-c C-e l P
  10486. @findex org-beamer-export-to-pdf
  10487. Export as @LaTeX{} file and then convert it to PDF format.
  10488. @item @kbd{C-c C-e l O}
  10489. @kindex C-c C-e l O
  10490. Export as @LaTeX{} file, convert it to PDF format, and then open the
  10491. PDF file.
  10492. @end table
  10493. @node Beamer specific export settings
  10494. @subsection Beamer specific export settings
  10495. Beamer export back-end has several additional keywords for customizing
  10496. Beamer output. These keywords work similar to the general options
  10497. settings (see @ref{Export Settings}).
  10498. @table @asis
  10499. @item @samp{BEAMER_THEME}
  10500. @cindex @samp{BEAMER_THEME}, keyword
  10501. @vindex org-beamer-theme
  10502. The Beamer layout theme (@code{org-beamer-theme}). Use square
  10503. brackets for options. For example:
  10504. @example
  10505. #+BEAMER_THEME: Rochester [height=20pt]
  10506. @end example
  10507. @item @samp{BEAMER_FONT_THEME}
  10508. @cindex @samp{BEAMER_FONT_THEME}, keyword
  10509. The Beamer font theme.
  10510. @item @samp{BEAMER_INNER_THEME}
  10511. @cindex @samp{BEAMER_INNER_THEME}, keyword
  10512. The Beamer inner theme.
  10513. @item @samp{BEAMER_OUTER_THEME}
  10514. @cindex @samp{BEAMER_OUTER_THEME}, keyword
  10515. The Beamer outer theme.
  10516. @item @samp{BEAMER_HEADER}
  10517. @cindex @samp{BEAMER_HEADER}, keyword
  10518. Arbitrary lines inserted in the preamble, just before the
  10519. @samp{hyperref} settings.
  10520. @item @samp{DESCRIPTION}
  10521. @cindex @samp{DESCRIPTION}, keyword
  10522. The document description. For long descriptions, use multiple
  10523. @samp{DESCRIPTION} keywords. By default, @samp{hyperref} inserts
  10524. @samp{DESCRIPTION} as metadata. Use @code{org-latex-hyperref-template} to
  10525. configure document metadata. Use @code{org-latex-title-command} to
  10526. configure typesetting of description as part of front matter.
  10527. @item @samp{KEYWORDS}
  10528. @cindex @samp{KEYWORDS}, keyword
  10529. The keywords for defining the contents of the document. Use
  10530. multiple @samp{KEYWORDS} lines if necessary. By default, @samp{hyperref}
  10531. inserts @samp{KEYWORDS} as metadata. Use
  10532. @code{org-latex-hyperref-template} to configure document metadata.
  10533. Use @code{org-latex-title-command} to configure typesetting of
  10534. keywords as part of front matter.
  10535. @item @samp{SUBTITLE}
  10536. @cindex @samp{SUBTITLE}, keyword
  10537. Document's subtitle. For typesetting, use
  10538. @code{org-beamer-subtitle-format} string. Use
  10539. @code{org-latex-hyperref-template} to configure document metadata.
  10540. Use @code{org-latex-title-command} to configure typesetting of
  10541. subtitle as part of front matter.
  10542. @end table
  10543. @node Frames and Blocks in Beamer
  10544. @subsection Frames and Blocks in Beamer
  10545. Org transforms heading levels into Beamer's sectioning elements,
  10546. frames and blocks. Any Org tree with a not-too-deep-level nesting
  10547. should in principle be exportable as a Beamer presentation.
  10548. @itemize
  10549. @item
  10550. @vindex org-beamer-frame-level
  10551. Org headlines become Beamer frames when the heading level in Org is
  10552. equal to @code{org-beamer-frame-level} or @samp{H} value in a @samp{OPTIONS} line
  10553. (see @ref{Export Settings}).
  10554. @cindex @samp{BEAMER_ENV}, property
  10555. Org overrides headlines to frames conversion for the current tree of
  10556. an Org file if it encounters the @samp{BEAMER_ENV} property set to
  10557. @samp{frame} or @samp{fullframe}. Org ignores whatever
  10558. @code{org-beamer-frame-level} happens to be for that headline level in
  10559. the Org tree. In Beamer terminology, a full frame is a frame
  10560. without its title.
  10561. @item
  10562. Org exports a Beamer frame's objects as block environments. Org can
  10563. enforce wrapping in special block types when @samp{BEAMER_ENV} property
  10564. is set@footnote{If @samp{BEAMER_ENV} is set, Org export adds @samp{B_environment} tag
  10565. to make it visible. The tag serves as a visual aid and has no
  10566. semantic relevance.}. For valid values see
  10567. @code{org-beamer-environments-default}. To add more values, see
  10568. @code{org-beamer-environments-extra}.
  10569. @vindex org-beamer-environments-default
  10570. @vindex org-beamer-environments-extra
  10571. @item
  10572. @cindex @samp{BEAMER_REF}, property
  10573. If @samp{BEAMER_ENV} is set to @samp{appendix}, Org exports the entry as an
  10574. appendix. When set to @samp{note}, Org exports the entry as a note
  10575. within the frame or between frames, depending on the entry's heading
  10576. level. When set to @samp{noteNH}, Org exports the entry as a note
  10577. without its title. When set to @samp{againframe}, Org exports the entry
  10578. with @samp{\againframe} command, which makes setting the @samp{BEAMER_REF}
  10579. property mandatory because @samp{\againframe} needs frame to resume.
  10580. When @samp{ignoreheading} is set, Org export ignores the entry's headline
  10581. but not its content. This is useful for inserting content between
  10582. frames. It is also useful for properly closing a @samp{column}
  10583. environment. @@end itemize
  10584. @cindex @samp{BEAMER_ACT}, property
  10585. @cindex @samp{BEAMER_OPT}, property
  10586. When @samp{BEAMER_ACT} is set for a headline, Org export translates that
  10587. headline as an overlay or action specification. When enclosed in
  10588. square brackets, Org export makes the overlay specification
  10589. a default. Use @samp{BEAMER_OPT} to set any options applicable to the
  10590. current Beamer frame or block. The Beamer export back-end wraps
  10591. with appropriate angular or square brackets. It also adds the
  10592. @samp{fragile} option for any code that may require a verbatim block.
  10593. @cindex @samp{BEAMER_COL}, property
  10594. To create a column on the Beamer slide, use the @samp{BEAMER_COL}
  10595. property for its headline in the Org file. Set the value of
  10596. @samp{BEAMER_COL} to a decimal number representing the fraction of the
  10597. total text width. Beamer export uses this value to set the column's
  10598. width and fills the column with the contents of the Org entry. If
  10599. the Org entry has no specific environment defined, Beamer export
  10600. ignores the heading. If the Org entry has a defined environment,
  10601. Beamer export uses the heading as title. Behind the scenes, Beamer
  10602. export automatically handles @LaTeX{} column separations for contiguous
  10603. headlines. To manually adjust them for any unique configurations
  10604. needs, use the @samp{BEAMER_ENV} property.
  10605. @end itemize
  10606. @node Beamer specific syntax
  10607. @subsection Beamer specific syntax
  10608. Since Org's Beamer export back-end is an extension of the @LaTeX{}
  10609. back-end, it recognizes other @LaTeX{} specific syntax---for example,
  10610. @samp{#+LATEX:} or @samp{#+ATTR_LATEX:}. See @ref{@LaTeX{} Export}, for details.
  10611. Beamer export wraps the table of contents generated with @samp{toc:t}
  10612. @samp{OPTION} keyword in a @samp{frame} environment. Beamer export does not
  10613. wrap the table of contents generated with @samp{TOC} keyword (see @ref{Table of Contents}). Use square brackets for specifying options.
  10614. @example
  10615. #+TOC: headlines [currentsection]
  10616. @end example
  10617. Insert Beamer-specific code using the following constructs:
  10618. @cindex @samp{BEAMER}, keyword
  10619. @cindex @samp{BEGIN_EXPORT beamer}
  10620. @example
  10621. #+BEAMER: \pause
  10622. #+BEGIN_EXPORT beamer
  10623. Only Beamer export back-end exports this.
  10624. #+END_BEAMER
  10625. Text @@@@beamer:some code@@@@ within a paragraph.
  10626. @end example
  10627. Inline constructs, such as the last one above, are useful for adding
  10628. overlay specifications to objects with @code{bold}, @code{item}, @code{link},
  10629. @code{radio-target} and @code{target} types. Enclose the value in angular
  10630. brackets and place the specification at the beginning of the object as
  10631. shown in this example:
  10632. @example
  10633. A *@@@@beamer:<2->@@@@useful* feature
  10634. @end example
  10635. @cindex @samp{ATTR_BEAMER}, keyword
  10636. Beamer export recognizes the @samp{ATTR_BEAMER} keyword with the following
  10637. attributes from Beamer configurations: @samp{:environment} for changing
  10638. local Beamer environment, @samp{:overlay} for specifying Beamer overlays in
  10639. angular or square brackets, and @samp{:options} for inserting optional
  10640. arguments.
  10641. @example
  10642. #+ATTR_BEAMER: :environment nonindentlist
  10643. - item 1, not indented
  10644. - item 2, not indented
  10645. - item 3, not indented
  10646. @end example
  10647. @example
  10648. #+ATTR_BEAMER: :overlay <+->
  10649. - item 1
  10650. - item 2
  10651. @end example
  10652. @example
  10653. #+ATTR_BEAMER: :options [Lagrange]
  10654. Let $G$ be a finite group, and let $H$ be
  10655. a subgroup of $G$. Then the order of $H$ divides the order of $G$.
  10656. @end example
  10657. @node Editing support
  10658. @subsection Editing support
  10659. The @code{org-beamer-mode} is a special minor mode for faster editing of
  10660. Beamer documents.
  10661. @example
  10662. #+STARTUP: beamer
  10663. @end example
  10664. @table @asis
  10665. @item @kbd{C-c C-b} (@code{org-beamer-select-environment})
  10666. @kindex C-c C-b
  10667. @findex org-beamer-select-environment
  10668. The @code{org-beamer-mode} provides this key for quicker selections in
  10669. Beamer normal environments, and for selecting the @samp{BEAMER_COL}
  10670. property.
  10671. @end table
  10672. @node A Beamer example
  10673. @subsection A Beamer example
  10674. Here is an example of an Org document ready for Beamer export.
  10675. @example
  10676. ;#+TITLE: Example Presentation
  10677. ;#+AUTHOR: Carsten Dominik
  10678. ;#+OPTIONS: H:2 toc:t num:t
  10679. ;#+LATEX_CLASS: beamer
  10680. ;#+LATEX_CLASS_OPTIONS: [presentation]
  10681. ;#+BEAMER_THEME: Madrid
  10682. ;#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) %8BEAMER_OPT(Opt)
  10683. * This is the first structural section
  10684. ** Frame 1
  10685. *** Thanks to Eric Fraga :B_block:
  10686. :PROPERTIES:
  10687. :BEAMER_COL: 0.48
  10688. :BEAMER_ENV: block
  10689. :END:
  10690. for the first viable Beamer setup in Org
  10691. *** Thanks to everyone else :B_block:
  10692. :PROPERTIES:
  10693. :BEAMER_COL: 0.48
  10694. :BEAMER_ACT: <2->
  10695. :BEAMER_ENV: block
  10696. :END:
  10697. for contributing to the discussion
  10698. **** This will be formatted as a beamer note :B_note:
  10699. :PROPERTIES:
  10700. :BEAMER_env: note
  10701. :END:
  10702. ** Frame 2 (where we will not use columns)
  10703. *** Request
  10704. Please test this stuff!
  10705. @end example
  10706. @node HTML Export
  10707. @section HTML Export
  10708. @cindex HTML export
  10709. Org mode contains an HTML exporter with extensive HTML formatting
  10710. compatible with XHTML 1.0 strict standard.
  10711. @menu
  10712. * HTML export commands:: Invoking HTML export.
  10713. * HTML specific export settings:: Settings for HTML export.
  10714. * HTML doctypes:: Exporting various (X)HTML flavors.
  10715. * HTML preamble and postamble:: Inserting preamble and postamble.
  10716. * Quoting HTML tags:: Using direct HTML in Org files.
  10717. * Links in HTML export:: Inserting and formatting links.
  10718. * Tables in HTML export:: How to modify the formatting of tables.
  10719. * Images in HTML export:: How to insert figures into HTML output.
  10720. * Math formatting in HTML export:: Beautiful math also on the web.
  10721. * Text areas in HTML export:: An alternate way to show an example.
  10722. * CSS support:: Changing the appearance of the output.
  10723. * JavaScript support:: Info and folding in a web browser.
  10724. @end menu
  10725. @node HTML export commands
  10726. @subsection HTML export commands
  10727. @table @asis
  10728. @item @kbd{C-c C-e h h} (@code{org-html-export-to-html})
  10729. @kindex C-c C-e h h
  10730. @kindex C-c C-e h o
  10731. @findex org-html-export-to-html
  10732. Export as HTML file with a @samp{.html} extension. For @samp{myfile.org},
  10733. Org exports to @samp{myfile.html}, overwriting without warning.
  10734. @{@{@{kbd@{C-c C-e h o)@}@}@} exports to HTML and opens it in a web
  10735. browser.
  10736. @item @kbd{C-c C-e h H} (@code{org-html-export-as-html})
  10737. @kindex C-c C-e h H
  10738. @findex org-html-export-as-html
  10739. Exports to a temporary buffer. Does not create a file.
  10740. @end table
  10741. @node HTML specific export settings
  10742. @subsection HTML specific export settings
  10743. HTML export has a number of keywords, similar to the general options
  10744. settings described in @ref{Export Settings}.
  10745. @table @asis
  10746. @item @samp{DESCRIPTION}
  10747. @cindex @samp{DESCRIPTION}, keyword
  10748. This is the document's description, which the HTML exporter
  10749. inserts it as a HTML meta tag in the HTML file. For long
  10750. descriptions, use multiple @samp{DESCRIPTION} lines. The exporter
  10751. takes care of wrapping the lines properly.
  10752. @item @samp{HTML_DOCTYPE}
  10753. @cindex @samp{HTML_DOCTYPE}, keyword
  10754. @vindex org-html-doctype
  10755. Specify the document type, for example: HTML5
  10756. (@code{org-html-doctype}).
  10757. @item @samp{HTML_CONTAINER}
  10758. @cindex @samp{HTML_CONTAINER}, keyword
  10759. @vindex org-html-container-element
  10760. Specify the HTML container, such as @samp{div}, for wrapping sections
  10761. and elements (@code{org-html-container-element}).
  10762. @item @samp{HTML_LINK_HOME}
  10763. @cindex @samp{HTML_LINK_HOME}, keyword
  10764. @vindex org-html-link-home
  10765. The URL for home link (@code{org-html-link-home}).
  10766. @item @samp{HTML_LINK_UP}
  10767. @cindex @samp{HTML_LINK_UP}, keyword
  10768. @vindex org-html-link-up
  10769. The URL for the up link of exported HTML pages
  10770. (@code{org-html-link-up}).
  10771. @item @samp{HTML_MATHJAX}
  10772. @cindex @samp{HTML_MATHJAX}, keyword
  10773. @vindex org-html-mathjax-options
  10774. Options for MathJax (@code{org-html-mathjax-options}). MathJax is
  10775. used to typeset @LaTeX{} math in HTML documents. See @ref{Math formatting in HTML export}, for an example.
  10776. @item @samp{HTML_HEAD}
  10777. @cindex @samp{HTML_HEAD}, keyword
  10778. @vindex org-html-head
  10779. Arbitrary lines for appending to the HTML document's head
  10780. (@code{org-html-head}).
  10781. @item @samp{HTML_HEAD_EXTRA}
  10782. @cindex @samp{HTML_HEAD_EXTRA}, keyword
  10783. @vindex org-html-head-extra
  10784. More arbitrary lines for appending to the HTML document's head
  10785. (@code{org-html-head-extra}).
  10786. @item @samp{KEYWORDS}
  10787. @cindex @samp{KEYWORDS}, keyword
  10788. Keywords to describe the document's content. HTML exporter
  10789. inserts these keywords as HTML meta tags. For long keywords, use
  10790. multiple @samp{KEYWORDS} lines.
  10791. @item @samp{LATEX_HEADER}
  10792. @cindex @samp{LATEX_HEADER}, keyword
  10793. Arbitrary lines for appending to the preamble; HTML exporter
  10794. appends when transcoding @LaTeX{} fragments to images (see @ref{Math formatting in HTML export}).
  10795. @item @samp{SUBTITLE}
  10796. @cindex @samp{SUBTITLE}, keyword
  10797. The document's subtitle. HTML exporter formats subtitle if
  10798. document type is @samp{HTML5} and the CSS has a @samp{subtitle} class.
  10799. @end table
  10800. Some of these keywords are explained in more detail in the following
  10801. sections of the manual.
  10802. @node HTML doctypes
  10803. @subsection HTML doctypes
  10804. Org can export to various (X)HTML flavors.
  10805. @vindex org-html-doctype
  10806. @vindex org-html-doctype-alist
  10807. Set the @code{org-html-doctype} variable for different (X)HTML variants.
  10808. Depending on the variant, the HTML exporter adjusts the syntax of HTML
  10809. conversion accordingly. Org includes the following ready-made
  10810. variants:
  10811. @itemize
  10812. @item
  10813. @code{"html4-strict"}
  10814. @item
  10815. @code{"html4-transitional"}
  10816. @item
  10817. @code{"html4-frameset"}
  10818. @item
  10819. @code{"xhtml-strict"}
  10820. @item
  10821. @code{"xhtml-transitional"}
  10822. @item
  10823. @code{"xhtml-frameset"}
  10824. @item
  10825. @code{"xhtml-11"}
  10826. @item
  10827. @code{"html5"}
  10828. @item
  10829. @code{"xhtml5"}
  10830. @end itemize
  10831. @noindent
  10832. See the variable @code{org-html-doctype-alist} for details. The default is
  10833. @code{"xhtml-strict"}.
  10834. @vindex org-html-html5-fancy
  10835. @cindex @samp{HTML5}, export new elements
  10836. Org's HTML exporter does not by default enable new block elements
  10837. introduced with the HTML5 standard. To enable them, set
  10838. @code{org-html-html5-fancy} to non-@code{nil}. Or use an @samp{OPTIONS} line in the
  10839. file to set @samp{html5-fancy}.
  10840. HTML5 documents can now have arbitrary @samp{#+BEGIN} @dots{} @samp{#+END} blocks.
  10841. For example:
  10842. @example
  10843. #+BEGIN_aside
  10844. Lorem ipsum
  10845. #+END_aside
  10846. @end example
  10847. @noindent
  10848. exports to:
  10849. @example
  10850. <aside>
  10851. <p>Lorem ipsum</p>
  10852. </aside>
  10853. @end example
  10854. @noindent
  10855. while this:
  10856. @example
  10857. #+ATTR_HTML: :controls controls :width 350
  10858. #+BEGIN_video
  10859. #+HTML: <source src="movie.mp4" type="video/mp4">
  10860. #+HTML: <source src="movie.ogg" type="video/ogg">
  10861. Your browser does not support the video tag.
  10862. #+END_video
  10863. @end example
  10864. @noindent
  10865. exports to:
  10866. @example
  10867. <video controls="controls" width="350">
  10868. <source src="movie.mp4" type="video/mp4">
  10869. <source src="movie.ogg" type="video/ogg">
  10870. <p>Your browser does not support the video tag.</p>
  10871. </video>
  10872. @end example
  10873. @vindex org-html-html5-elements
  10874. When special blocks do not have a corresponding HTML5 element, the
  10875. HTML exporter reverts to standard translation (see
  10876. @code{org-html-html5-elements}). For example, @samp{#+BEGIN_lederhosen} exports
  10877. to @code{<div class="lederhosen">}.
  10878. Special blocks cannot have headlines. For the HTML exporter to wrap
  10879. the headline and its contents in @code{<section>} or @code{<article>} tags, set
  10880. the @samp{HTML_CONTAINER} property for the headline.
  10881. @node HTML preamble and postamble
  10882. @subsection HTML preamble and postamble
  10883. @vindex org-html-preamble
  10884. @vindex org-html-postamble
  10885. @vindex org-html-preamble-format
  10886. @vindex org-html-postamble-format
  10887. @vindex org-html-validation-link
  10888. @vindex org-export-creator-string
  10889. @vindex org-export-time-stamp-file
  10890. The HTML exporter has delineations for preamble and postamble. The
  10891. default value for @code{org-html-preamble} is @code{t}, which makes the HTML
  10892. exporter insert the preamble. See the variable
  10893. @code{org-html-preamble-format} for the format string.
  10894. Set @code{org-html-preamble} to a string to override the default format
  10895. string. If the string is a function, the HTML exporter expects the
  10896. function to return a string upon execution. The HTML exporter inserts
  10897. this string in the preamble. The HTML exporter does not insert
  10898. a preamble if @code{org-html-preamble} is set @code{nil}.
  10899. The default value for @code{org-html-postamble} is @code{auto}, which makes the
  10900. HTML exporter build a postamble from looking up author's name, email
  10901. address, creator's name, and date. Set @code{org-html-postamble} to @code{t} to
  10902. insert the postamble in the format specified in the
  10903. @code{org-html-postamble-format} variable. The HTML exporter does not
  10904. insert a postamble if @code{org-html-postamble} is set to @code{nil}.
  10905. @node Quoting HTML tags
  10906. @subsection Quoting HTML tags
  10907. The HTML export back-end transforms @samp{<} and @samp{>} to @samp{&lt;} and @samp{&gt;}.
  10908. To include raw HTML code in the Org file so the HTML export back-end
  10909. can insert that HTML code in the output, use this inline syntax:
  10910. @samp{@@@@html:...@@@@}. For example:
  10911. @example
  10912. @@@@html:<b>@@@@bold text@@@@html:</b>@@@@
  10913. @end example
  10914. @cindex @samp{HTML}, keyword
  10915. @cindex @samp{BEGIN_EXPORT html}
  10916. For larger raw HTML code blocks, use these HTML export code blocks:
  10917. @example
  10918. #+HTML: Literal HTML code for export
  10919. #+BEGIN_EXPORT html
  10920. All lines between these markers are exported literally
  10921. #+END_EXPORT
  10922. @end example
  10923. @node Links in HTML export
  10924. @subsection Links in HTML export
  10925. @cindex links, in HTML export
  10926. @cindex internal links, in HTML export
  10927. @cindex external links, in HTML export
  10928. The HTML export back-end transforms Org's internal links (see
  10929. @ref{Internal Links}) to equivalent HTML links in the output. The back-end
  10930. similarly handles Org's automatic links created by radio targets (see
  10931. @ref{Radio Targets}) similarly. For Org links to external files, the
  10932. back-end transforms the links to @emph{relative} paths.
  10933. @vindex org-html-link-org-files-as-html
  10934. For Org links to other @samp{.org} files, the back-end automatically
  10935. changes the file extension to @samp{.html} and makes file paths relative.
  10936. If the @samp{.org} files have an equivalent @samp{.html} version at the same
  10937. location, then the converted links should work without any further
  10938. manual intervention. However, to disable this automatic path
  10939. translation, set @code{org-html-link-org-files-as-html} to @code{nil}. When
  10940. disabled, the HTML export back-end substitutes the ID-based links in
  10941. the HTML output. For more about linking files when publishing to
  10942. a directory, see @ref{Publishing links}.
  10943. Org files can also have special directives to the HTML export
  10944. back-end. For example, by using @samp{#+ATTR_HTML} lines to specify new
  10945. format attributes to @code{<a>} or @code{<img>} tags. This example shows
  10946. changing the link's title and style:
  10947. @cindex @samp{ATTR_HTML}, keyword
  10948. @example
  10949. #+ATTR_HTML: :title The Org mode homepage :style color:red;
  10950. [[https://orgmode.org]]
  10951. @end example
  10952. @node Tables in HTML export
  10953. @subsection Tables in HTML export
  10954. @cindex tables, in HTML
  10955. @vindex org-export-html-table-tag
  10956. The HTML export back-end uses @code{org-html-table-default-attributes} when
  10957. exporting Org tables to HTML. By default, the exporter does not draw
  10958. frames and cell borders. To change for this for a table, use the
  10959. following lines before the table in the Org file:
  10960. @cindex @samp{CAPTION}, keyword
  10961. @cindex @samp{ATTR_HTML}, keyword
  10962. @example
  10963. #+CAPTION: This is a table with lines around and between cells
  10964. #+ATTR_HTML: border="2" rules="all" frame="border"
  10965. @end example
  10966. The HTML export back-end preserves column groupings in Org tables (see
  10967. @ref{Column Groups}) when exporting to HTML.
  10968. Additional options for customizing tables for HTML export.
  10969. @table @asis
  10970. @item @code{org-html-table-align-individual-fields}
  10971. @vindex org-html-table-align-individual-fields
  10972. Non-@code{nil} attaches style attributes for alignment to each table
  10973. field.
  10974. @item @code{org-html-table-caption-above}
  10975. @vindex org-html-table-caption-above
  10976. Non-@code{nil} places caption string at the beginning of the table.
  10977. @item @code{org-html-table-data-tags}
  10978. @vindex org-html-table-data-tags
  10979. Opening and ending tags for table data fields.
  10980. @item @code{org-html-table-default-attributes}
  10981. @vindex org-html-table-default-attributes
  10982. Default attributes and values for table tags.
  10983. @item @code{org-html-table-header-tags}
  10984. @vindex org-html-table-header-tags
  10985. Opening and ending tags for table's header fields.
  10986. @item @code{org-html-table-row-tags}
  10987. @vindex org-html-table-row-tags
  10988. Opening and ending tags for table rows.
  10989. @item @code{org-html-table-use-header-tags-for-first-column}
  10990. @vindex org-html-table-use-header-tags-for-first-column
  10991. Non-@code{nil} formats column one in tables with header tags.
  10992. @end table
  10993. @node Images in HTML export
  10994. @subsection Images in HTML export
  10995. @cindex images, inline in HTML
  10996. @cindex inlining images in HTML
  10997. The HTML export back-end has features to convert Org image links to
  10998. HTML inline images and HTML clickable image links.
  10999. @vindex org-html-inline-images
  11000. When the link in the Org file has no description, the HTML export
  11001. back-end by default in-lines that image. For example:
  11002. @samp{[[file:myimg.jpg]]} is in-lined, while @samp{[[file:myimg.jpg][the image]]} links to the text,
  11003. @samp{the image}. For more details, see the variable
  11004. @code{org-html-inline-images}.
  11005. On the other hand, if the description part of the Org link is itself
  11006. another link, such as @samp{file:} or @samp{http:} URL pointing to an image, the
  11007. HTML export back-end in-lines this image and links to the main image.
  11008. This Org syntax enables the back-end to link low-resolution thumbnail
  11009. to the high-resolution version of the image, as shown in this example:
  11010. @example
  11011. [[file:highres.jpg][file:thumb.jpg]]
  11012. @end example
  11013. To change attributes of in-lined images, use @samp{#+ATTR_HTML} lines in
  11014. the Org file. This example shows realignment to right, and adds @code{alt}
  11015. and @code{title} attributes in support of text viewers and modern web
  11016. accessibility standards.
  11017. @cindex @samp{CAPTION}, keyword
  11018. @cindex @samp{ATTR_HTML}, keyword
  11019. @example
  11020. #+CAPTION: A black cat stalking a spider
  11021. #+ATTR_HTML: :alt cat/spider image :title Action! :align right
  11022. [[./img/a.jpg]]
  11023. @end example
  11024. @noindent
  11025. The HTML export back-end copies the @samp{http} links from the Org file as
  11026. is.
  11027. @node Math formatting in HTML export
  11028. @subsection Math formatting in HTML export
  11029. @cindex MathJax
  11030. @cindex dvipng
  11031. @cindex dvisvgm
  11032. @cindex ImageMagick
  11033. @vindex org-html-mathjax-options~
  11034. @LaTeX{} math snippets (see @ref{@LaTeX{} fragments}) can be displayed in two
  11035. different ways on HTML pages. The default is to use the @uref{http://www.mathjax.org, MathJax},
  11036. which should work out of the box with Org@footnote{By default Org loads MathJax from @uref{https://cdnjs.com, cdnjs.com} as recommended by
  11037. @uref{http://www.mathjax.org, MathJax}.}. Some MathJax
  11038. display options can be configured via @code{org-html-mathjax-options}, or
  11039. in the buffer. For example, with the following settings,
  11040. @example
  11041. #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
  11042. #+HTML_MATHJAX: cancel.js noErrors.js
  11043. @end example
  11044. @noindent
  11045. equation labels are displayed on the left margin and equations are
  11046. five em from the left margin. In addition, it loads the two MathJax
  11047. extensions @samp{cancel.js} and @samp{noErrors.js}@footnote{See @uref{http://docs.mathjax.org/en/latest/tex.html#tex-extensions, @TeX{} and @LaTeX{} extensions} in the @uref{http://docs.mathjax.org, MathJax manual} to learn
  11048. about extensions.}.
  11049. @vindex org-html-mathjax-template
  11050. See the docstring of @code{org-html-mathjax-options} for all supported
  11051. variables. The MathJax template can be configure via
  11052. @code{org-html-mathjax-template}.
  11053. If you prefer, you can also request that @LaTeX{} fragments are processed
  11054. into small images that will be inserted into the browser page. Before
  11055. the availability of MathJax, this was the default method for Org
  11056. files. This method requires that the dvipng program, dvisvgm or
  11057. ImageMagick suite is available on your system. You can still get this
  11058. processing with
  11059. @example
  11060. #+OPTIONS: tex:dvipng
  11061. @end example
  11062. @example
  11063. #+OPTIONS: tex:dvisvgm
  11064. @end example
  11065. @noindent
  11066. or
  11067. @example
  11068. #+OPTIONS: tex:imagemagick
  11069. @end example
  11070. @node Text areas in HTML export
  11071. @subsection Text areas in HTML export
  11072. @cindex text areas, in HTML
  11073. Before Org mode's Babel, one popular approach to publishing code in
  11074. HTML was by using @samp{:textarea}. The advantage of this approach was
  11075. that copying and pasting was built into browsers with simple
  11076. JavaScript commands. Even editing before pasting was made simple.
  11077. The HTML export back-end can create such text areas. It requires an
  11078. @samp{#+ATTR_HTML} line as shown in the example below with the @samp{:textarea}
  11079. option. This must be followed by either an example or a source code
  11080. block. Other Org block types do not honor the @samp{:textarea} option.
  11081. By default, the HTML export back-end creates a text area 80 characters
  11082. wide and height just enough to fit the content. Override these
  11083. defaults with @samp{:width} and @samp{:height} options on the @samp{#+ATTR_HTML}
  11084. line.
  11085. @example
  11086. #+ATTR_HTML: :textarea t :width 40
  11087. #+BEGIN_EXAMPLE
  11088. (defun org-xor (a b)
  11089. "Exclusive or."
  11090. (if a (not b) b))
  11091. #+END_EXAMPLE
  11092. @end example
  11093. @node CSS support
  11094. @subsection CSS support
  11095. @cindex CSS, for HTML export
  11096. @cindex HTML export, CSS
  11097. @vindex org-export-html-todo-kwd-class-prefix
  11098. @vindex org-export-html-tag-class-prefix
  11099. You can modify the CSS style definitions for the exported file. The
  11100. HTML exporter assigns the following special CSS classes@footnote{If the classes on TODO keywords and tags lead to conflicts,
  11101. use the variables @code{org-html-todo-kwd-class-prefix} and
  11102. @code{org-html-tag-class-prefix} to make them unique.} to
  11103. appropriate parts of the document---your style specifications may
  11104. change these, in addition to any of the standard classes like for
  11105. headlines, tables, etc.
  11106. @multitable {aaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  11107. @item @code{p.author}
  11108. @tab author information, including email
  11109. @item @code{p.date}
  11110. @tab publishing date
  11111. @item @code{p.creator}
  11112. @tab creator info, about org mode version
  11113. @item @code{.title}
  11114. @tab document title
  11115. @item @code{.subtitle}
  11116. @tab document subtitle
  11117. @item @code{.todo}
  11118. @tab TODO keywords, all not-done states
  11119. @item @code{.done}
  11120. @tab the DONE keywords, all states that count as done
  11121. @item @code{.WAITING}
  11122. @tab each TODO keyword also uses a class named after itself
  11123. @item @code{.timestamp}
  11124. @tab timestamp
  11125. @item @code{.timestamp-kwd}
  11126. @tab keyword associated with a timestamp, like @samp{SCHEDULED}
  11127. @item @code{.timestamp-wrapper}
  11128. @tab span around keyword plus timestamp
  11129. @item @code{.tag}
  11130. @tab tag in a headline
  11131. @item @code{._HOME}
  11132. @tab each tag uses itself as a class, ``@@'' replaced by ``_''
  11133. @item @code{.target}
  11134. @tab target for links
  11135. @item @code{.linenr}
  11136. @tab the line number in a code example
  11137. @item @code{.code-highlighted}
  11138. @tab for highlighting referenced code lines
  11139. @item @code{div.outline-N}
  11140. @tab div for outline level N (headline plus text)
  11141. @item @code{div.outline-text-N}
  11142. @tab extra div for text at outline level N
  11143. @item @code{.section-number-N}
  11144. @tab section number in headlines, different for each level
  11145. @item @code{.figure-number}
  11146. @tab label like ``Figure 1:''
  11147. @item @code{.table-number}
  11148. @tab label like ``Table 1:''
  11149. @item @code{.listing-number}
  11150. @tab label like ``Listing 1:''
  11151. @item @code{div.figure}
  11152. @tab how to format an in-lined image
  11153. @item @code{pre.src}
  11154. @tab formatted source code
  11155. @item @code{pre.example}
  11156. @tab normal example
  11157. @item @code{p.verse}
  11158. @tab verse paragraph
  11159. @item @code{div.footnotes}
  11160. @tab footnote section headline
  11161. @item @code{p.footnote}
  11162. @tab footnote definition paragraph, containing a footnote
  11163. @item @code{.footref}
  11164. @tab a footnote reference number (always a <sup>)
  11165. @item @code{.footnum}
  11166. @tab footnote number in footnote definition (always <sup>)
  11167. @item @code{.org-svg}
  11168. @tab default class for a linked @samp{.svg} image
  11169. @end multitable
  11170. @vindex org-html-style-default
  11171. @vindex org-html-head
  11172. @vindex org-html-head-extra
  11173. @cindex @samp{HTML_INCLUDE_STYLE}, keyword
  11174. The HTML export back-end includes a compact default style in each
  11175. exported HTML file. To override the default style with another style,
  11176. use these keywords in the Org file. They will replace the global
  11177. defaults the HTML exporter uses.
  11178. @cindex @samp{HTML_HEAD}, keyword
  11179. @cindex @samp{HTML_HEAD_EXTRA}, keyword
  11180. @example
  11181. #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
  11182. #+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />
  11183. @end example
  11184. @vindex org-html-head-include-default-style
  11185. To just turn off the default style, customize
  11186. @code{org-html-head-include-default-style} variable, or use this option
  11187. line in the Org file.
  11188. @cindex @samp{html-style}, @samp{OPTIONS} item
  11189. @example
  11190. #+OPTIONS: html-style:nil
  11191. @end example
  11192. For longer style definitions, either use several @samp{HTML_HEAD} and
  11193. @samp{HTML_HEAD_EXTRA} keywords, or use @code{<style> ... </style>} blocks
  11194. around them. Both of these approaches can avoid referring to an
  11195. external file.
  11196. @cindex @samp{HTML_CONTAINER_CLASS}, property
  11197. In order to add styles to a sub-tree, use the @samp{HTML_CONTAINER_CLASS}
  11198. property to assign a class to the tree. In order to specify CSS
  11199. styles for a particular headline, you can use the id specified in
  11200. a @samp{CUSTOM_ID} property.
  11201. Never change the @code{org-html-style-default} constant. Instead use other
  11202. simpler ways of customizing as described above.
  11203. @node JavaScript support
  11204. @subsection JavaScript supported display of web pages
  11205. Sebastian Rose has written a JavaScript program especially designed to
  11206. enhance the web viewing experience of HTML files created with Org.
  11207. This program enhances large files in two different ways of viewing.
  11208. One is an @emph{Info}-like mode where each section is displayed separately
  11209. and navigation can be done with the @kbd{n} and @kbd{p}
  11210. keys, and some other keys as well, press @kbd{?} for an overview
  11211. of the available keys. The second one has a @emph{folding} view, much like
  11212. Org provides inside Emacs. The script is available at
  11213. @uref{https://orgmode.org/org-info.js} and the documentation at
  11214. @uref{https://orgmode.org/worg/code/org-info-js/}. The script is hosted on
  11215. @uref{https://orgmode.org}, but for reliability, prefer installing it on your
  11216. own web server.
  11217. To use this program, just add this line to the Org file:
  11218. @cindex @samp{INFOJS_OPT}, keyword
  11219. @example
  11220. #+INFOJS_OPT: view:info toc:nil
  11221. @end example
  11222. @noindent
  11223. The HTML header now has the code needed to automatically invoke the
  11224. script. For setting options, use the syntax from the above line for
  11225. options described below:
  11226. @table @asis
  11227. @item @samp{path:}
  11228. The path to the script. The default is to grab the script from
  11229. @uref{https://orgmode.org/org-info.js}, but you might want to have
  11230. a local copy and use a path like @samp{../scripts/org-info.js}.
  11231. @item @samp{view:}
  11232. Initial view when the website is first shown. Possible values are:
  11233. @multitable {aaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  11234. @item @samp{info}
  11235. @tab Info-like interface with one section per page
  11236. @item @samp{overview}
  11237. @tab Folding interface, initially showing only top-level
  11238. @item @samp{content}
  11239. @tab Folding interface, starting with all headlines visible
  11240. @item @samp{showall}
  11241. @tab Folding interface, all headlines and text visible
  11242. @end multitable
  11243. @item @samp{sdepth:}
  11244. Maximum headline level still considered as an independent section
  11245. for info and folding modes. The default is taken from
  11246. @code{org-export-headline-levels}, i.e., the @samp{H} switch in @samp{OPTIONS}.
  11247. If this is smaller than in @code{org-export-headline-levels}, each
  11248. info/folding section can still contain child headlines.
  11249. @item @samp{toc:}
  11250. Should the table of contents @emph{initially} be visible? Even when
  11251. @samp{nil}, you can always get to the ``toc'' with @kbd{i}.
  11252. @item @samp{tdepth:}
  11253. The depth of the table of contents. The defaults are taken from
  11254. the variables @code{org-export-headline-levels} and
  11255. @code{org-export-with-toc}.
  11256. @item @samp{ftoc:}
  11257. Does the CSS of the page specify a fixed position for the ``toc''?
  11258. If yes, the toc is displayed as a section.
  11259. @item @samp{ltoc:}
  11260. Should there be short contents (children) in each section? Make
  11261. this @samp{above} if the section should be above initial text.
  11262. @item @samp{mouse:}
  11263. Headings are highlighted when the mouse is over them. Should be
  11264. @samp{underline} (default) or a background color like @samp{#cccccc}.
  11265. @item @samp{buttons:}
  11266. Should view-toggle buttons be everywhere? When @samp{nil} (the
  11267. default), only one such button is present.
  11268. @end table
  11269. @noindent
  11270. @vindex org-infojs-options
  11271. @vindex org-export-html-use-infojs
  11272. You can choose default values for these options by customizing the
  11273. variable @code{org-infojs-options}. If you always want to apply the script
  11274. to your pages, configure the variable @code{org-export-html-use-infojs}.
  11275. @node @LaTeX{} Export
  11276. @section @LaTeX{} Export
  11277. @cindex @LaTeX{} export
  11278. @cindex PDF export
  11279. The @LaTeX{} export back-end can handle complex documents, incorporate
  11280. standard or custom @LaTeX{} document classes, generate documents using
  11281. alternate @LaTeX{} engines, and produce fully linked PDF files with
  11282. indexes, bibliographies, and tables of contents, destined for
  11283. interactive online viewing or high-quality print publication.
  11284. While the details are covered in-depth in this section, here are some
  11285. quick references to variables for the impatient: for engines, see
  11286. @code{org-latex-compiler}; for build sequences, see
  11287. @code{org-latex-pdf-process}; for packages, see
  11288. @code{org-latex-default-packages-alist} and @code{org-latex-packages-alist}.
  11289. An important note about the @LaTeX{} export back-end: it is sensitive to
  11290. blank lines in the Org document. That's because @LaTeX{} itself depends
  11291. on blank lines to tell apart syntactical elements, such as paragraphs.
  11292. @menu
  11293. * @LaTeX{}/PDF export commands:: For producing @LaTeX{} and PDF documents.
  11294. * @LaTeX{} specific export settings:: Unique to this @LaTeX{} back-end.
  11295. * @LaTeX{} header and sectioning:: Setting up the export file structure.
  11296. * Quoting @LaTeX{} code:: Incorporating literal @LaTeX{} code.
  11297. * Tables in @LaTeX{} export:: Options for exporting tables to @LaTeX{}.
  11298. * Images in @LaTeX{} export:: How to insert figures into @LaTeX{} output.
  11299. * Plain lists in @LaTeX{} export:: Attributes specific to lists.
  11300. * Source blocks in @LaTeX{} export:: Attributes specific to source code blocks.
  11301. * Example blocks in @LaTeX{} export:: Attributes specific to example blocks.
  11302. * Special blocks in @LaTeX{} export:: Attributes specific to special blocks.
  11303. * Horizontal rules in @LaTeX{} export:: Attributes specific to horizontal rules.
  11304. @end menu
  11305. @node @LaTeX{}/PDF export commands
  11306. @subsection @LaTeX{}/PDF export commands
  11307. @table @asis
  11308. @item @kbd{C-c C-e l l} (@code{org-latex-export-to-latex})
  11309. @kindex C-c C-e l l
  11310. @findex org-latex-export-to-latex~
  11311. Export to a @LaTeX{} file with a @samp{.tex} extension. For
  11312. @samp{myfile.org}, Org exports to @samp{myfile.tex}, overwriting without
  11313. warning.
  11314. @item @kbd{C-c C-e l L} (@code{org-latex-export-as-latex})
  11315. @kindex C-c C-e l L
  11316. @findex org-latex-export-as-latex
  11317. Export to a temporary buffer. Do not create a file.
  11318. @item @kbd{C-c C-e l p} (@code{org-latex-export-to-pdf})
  11319. @kindex C-c C-e l p
  11320. @findex org-latex-export-to-pdf
  11321. Export as @LaTeX{} file and convert it to PDF file.
  11322. @item @kbd{C-c C-e l o}
  11323. @kindex C-c C-e l o
  11324. Export as @LaTeX{} file and convert it to PDF, then open the PDF
  11325. using the default viewer.
  11326. @item @kbd{M-x org-export-region-as-latex}
  11327. Convert the region to @LaTeX{} under the assumption that it was in Org
  11328. mode syntax before. This is a global command that can be invoked in
  11329. any buffer.
  11330. @end table
  11331. @vindex org-latex-compiler
  11332. @vindex org-latex-bibtex-compiler
  11333. @vindex org-latex-default-packages-alist
  11334. @cindex pdflatex
  11335. @cindex xelatex
  11336. @cindex lualatex
  11337. @cindex @samp{LATEX_COMPILER}, keyword
  11338. The @LaTeX{} export back-end can use any of these @LaTeX{} engines:
  11339. @samp{pdflatex}, @samp{xelatex}, and @samp{lualatex}. These engines compile @LaTeX{}
  11340. files with different compilers, packages, and output options. The
  11341. @LaTeX{} export back-end finds the compiler version to use from
  11342. @code{org-latex-compiler} variable or the @samp{#+LATEX_COMPILER} keyword in the
  11343. Org file. See the docstring for the
  11344. @code{org-latex-default-packages-alist} for loading packages with certain
  11345. compilers. Also see @code{org-latex-bibtex-compiler} to set the
  11346. bibliography compiler@footnote{This does not allow setting different bibliography compilers
  11347. for different files. However, ``smart'' @LaTeX{} compilation systems, such
  11348. as latexmk, can select the correct bibliography compiler.}.
  11349. @node @LaTeX{} specific export settings
  11350. @subsection @LaTeX{} specific export settings
  11351. The @LaTeX{} export back-end has several additional keywords for
  11352. customizing @LaTeX{} output. Setting these keywords works similar to the
  11353. general options (see @ref{Export Settings}).
  11354. @table @asis
  11355. @item @samp{DESCRIPTION}
  11356. @cindex @samp{DESCRIPTION}, keyword
  11357. @vindex org-latex-hyperref-template
  11358. @vindex org-latex-title-command
  11359. The document's description. The description along with author
  11360. name, keywords, and related file metadata are inserted in the
  11361. output file by the hyperref package. See
  11362. @code{org-latex-hyperref-template} for customizing metadata items.
  11363. See @code{org-latex-title-command} for typesetting description into
  11364. the document's front matter. Use multiple @samp{DESCRIPTION} keywords
  11365. for long descriptions.
  11366. @item @samp{LATEX_CLASS}
  11367. @cindex @samp{LATEX_CLASS}, keyword
  11368. @vindex org-latex-default-class
  11369. @vindex org-latex-classes
  11370. This is @LaTeX{} document class, such as @emph{article}, @emph{report},
  11371. @emph{book}, and so on, which contain predefined preamble and headline
  11372. level mapping that the @LaTeX{} export back-end needs. The back-end
  11373. reads the default class name from the @code{org-latex-default-class}
  11374. variable. Org has @emph{article} as the default class. A valid
  11375. default class must be an element of @code{org-latex-classes}.
  11376. @item @samp{LATEX_CLASS_OPTIONS}
  11377. @cindex @samp{LATEX_CLASS_OPTIONS}, keyword
  11378. Options the @LaTeX{} export back-end uses when calling the @LaTeX{}
  11379. document class.
  11380. @item @samp{LATEX_COMPILER}
  11381. @cindex @samp{LATEX_COMPILER}, keyword
  11382. @vindex org-latex-compiler
  11383. The compiler, such as @samp{pdflatex}, @samp{xelatex}, @samp{lualatex}, for
  11384. producing the PDF. See @code{org-latex-compiler}.
  11385. @item @samp{LATEX_HEADER}
  11386. @itemx @samp{LATEX_HEADER_EXTRA}
  11387. @cindex @samp{LATEX_HEADER}, keyword
  11388. @cindex @samp{LATEX_HEADER_EXTRA}, keyword
  11389. @vindex org-latex-classes
  11390. Arbitrary lines to add to the document's preamble, before the
  11391. hyperref settings. See @code{org-latex-classes} for adjusting the
  11392. structure and order of the @LaTeX{} headers.
  11393. @item @samp{KEYWORDS}
  11394. @cindex @samp{KEYWORDS}, keyword
  11395. @vindex org-latex-hyperref-template
  11396. @vindex org-latex-title-command
  11397. The keywords for the document. The description along with author
  11398. name, keywords, and related file metadata are inserted in the
  11399. output file by the hyperref package. See
  11400. @code{org-latex-hyperref-template} for customizing metadata items.
  11401. See @code{org-latex-title-command} for typesetting description into
  11402. the document's front matter. Use multiple @samp{KEYWORDS} lines if
  11403. necessary.
  11404. @item @samp{SUBTITLE}
  11405. @cindex @samp{SUBTITLE}, keyword
  11406. @vindex org-latex-subtitle-separate
  11407. @vindex org-latex-subtitle-format
  11408. The document's subtitle. It is typeset as per
  11409. @code{org-latex-subtitle-format}. If @code{org-latex-subtitle-separate} is
  11410. non-@code{nil}, it is typed as part of the @code{\title} macro. See
  11411. @code{org-latex-hyperref-template} for customizing metadata items.
  11412. See @code{org-latex-title-command} for typesetting description
  11413. into the document's front matter.
  11414. @end table
  11415. The following sections have further details.
  11416. @node @LaTeX{} header and sectioning
  11417. @subsection @LaTeX{} header and sectioning structure
  11418. @cindex @LaTeX{} class
  11419. @cindex @LaTeX{} sectioning structure
  11420. @cindex @LaTeX{} header
  11421. @cindex header, for @LaTeX{} files
  11422. @cindex sectioning structure, for @LaTeX{} export
  11423. The @LaTeX{} export back-end converts the first three of Org's outline
  11424. levels into @LaTeX{} headlines. The remaining Org levels are exported as
  11425. lists. To change this globally for the cut-off point between levels
  11426. and lists, (see @ref{Export Settings}).
  11427. By default, the @LaTeX{} export back-end uses the @emph{article} class.
  11428. @vindex org-latex-default-class
  11429. @vindex org-latex-classes
  11430. @vindex org-latex-default-packages-alist
  11431. @vindex org-latex-packages-alist
  11432. To change the default class globally, edit @code{org-latex-default-class}.
  11433. To change the default class locally in an Org file, add option lines
  11434. @samp{#+LATEX_CLASS: myclass}. To change the default class for just a part
  11435. of the Org file, set a sub-tree property, @samp{EXPORT_LATEX_CLASS}. The
  11436. class name entered here must be valid member of @code{org-latex-classes}.
  11437. This variable defines a header template for each class into which the
  11438. exporter splices the values of @code{org-latex-default-packages-alist} and
  11439. @code{org-latex-packages-alist}. Use the same three variables to define
  11440. custom sectioning or custom classes.
  11441. @cindex @samp{LATEX_CLASS}, keyword
  11442. @cindex @samp{LATEX_CLASS_OPTIONS}, keyword
  11443. @cindex @samp{EXPORT_LATEX_CLASS}, property
  11444. @cindex @samp{EXPORT_LATEX_CLASS_OPTIONS}, property
  11445. The @LaTeX{} export back-end sends the @samp{LATEX_CLASS_OPTIONS} keyword and
  11446. @samp{EXPORT_LATEX_CLASS_OPTIONS} property as options to the @LaTeX{}
  11447. @code{\documentclass} macro. The options and the syntax for specifying
  11448. them, including enclosing them in square brackets, follow @LaTeX{}
  11449. conventions.
  11450. @example
  11451. #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]
  11452. @end example
  11453. @cindex @samp{LATEX_HEADER}, keyword
  11454. @cindex @samp{LATEX_HEADER_EXTRA}, keyword
  11455. The @LaTeX{} export back-end appends values from @samp{LATEX_HEADER} and
  11456. @samp{LATEX_HEADER_EXTRA} keywords to the @LaTeX{} header. The docstring for
  11457. @code{org-latex-classes} explains in more detail. Also note that @LaTeX{}
  11458. export back-end does not append @samp{LATEX_HEADER_EXTRA} to the header
  11459. when previewing @LaTeX{} snippets (see @ref{Previewing @LaTeX{} fragments}).
  11460. A sample Org file with the above headers:
  11461. @example
  11462. #+LATEX_CLASS: article
  11463. #+LATEX_CLASS_OPTIONS: [a4paper]
  11464. #+LATEX_HEADER: \usepackage@{xyz@}
  11465. * Headline 1
  11466. some text
  11467. * Headline 2
  11468. some more text
  11469. @end example
  11470. @node Quoting @LaTeX{} code
  11471. @subsection Quoting @LaTeX{} code
  11472. The @LaTeX{} export back-end can insert any arbitrary @LaTeX{} code, see
  11473. @ref{Embedded @LaTeX{}}. There are three ways to embed such code in the Org
  11474. file and they all use different quoting syntax.
  11475. @cindex inline, in @LaTeX{} export
  11476. Inserting in-line quoted with @@ symbols:
  11477. @example
  11478. Code embedded in-line @@@@latex:any arbitrary LaTeX code@@@@ in a paragraph.
  11479. @end example
  11480. @cindex @samp{LATEX}, keyword
  11481. Inserting as one or more keyword lines in the Org file:
  11482. @example
  11483. #+LATEX: any arbitrary LaTeX code
  11484. @end example
  11485. @cindex @samp{BEGIN_EXPORT latex}
  11486. Inserting as an export block in the Org file, where the back-end
  11487. exports any code between begin and end markers:
  11488. @example
  11489. #+BEGIN_EXPORT latex
  11490. any arbitrary LaTeX code
  11491. #+END_EXPORT
  11492. @end example
  11493. @node Tables in @LaTeX{} export
  11494. @subsection Tables in @LaTeX{} export
  11495. @cindex tables, in @LaTeX{} export
  11496. The @LaTeX{} export back-end can pass several @LaTeX{} attributes for table
  11497. contents and layout. Besides specifying label and caption (see
  11498. @ref{Images and Tables}), the other valid @LaTeX{} attributes include:
  11499. @table @asis
  11500. @item @samp{:mode}
  11501. @vindex org-latex-default-table-mode
  11502. The @LaTeX{} export back-end wraps the table differently depending
  11503. on the mode for accurate rendering of math symbols. Mode is
  11504. either @samp{table}, @samp{math}, @samp{inline-math} or @samp{verbatim}.
  11505. For @samp{math} or @samp{inline-math} mode, @LaTeX{} export back-end wraps the
  11506. table in a math environment, but every cell in it is exported
  11507. as-is. The @LaTeX{} export back-end determines the default mode
  11508. from @code{org-latex-default-table-mode}. The @LaTeX{} export back-end
  11509. merges contiguous tables in the same mode into a single
  11510. environment.
  11511. @item @samp{:environment}
  11512. @vindex org-latex-default-table-environment
  11513. Set the default @LaTeX{} table environment for the @LaTeX{} export
  11514. back-end to use when exporting Org tables. Common @LaTeX{} table
  11515. environments are provided by these packages: tabularx, longtable,
  11516. array, tabu, and bmatrix. For packages, such as tabularx and
  11517. tabu, or any newer replacements, include them in the
  11518. @code{org-latex-packages-alist} variable so the @LaTeX{} export back-end
  11519. can insert the appropriate load package headers in the converted
  11520. @LaTeX{} file. Look in the docstring for the
  11521. @code{org-latex-packages-alist} variable for configuring these
  11522. packages for @LaTeX{} snippet previews, if any.
  11523. @item @samp{:caption}
  11524. Use @samp{CAPTION} keyword to set a simple caption for a table (see
  11525. @ref{Images and Tables}). For custom captions, use @samp{:caption}
  11526. attribute, which accepts raw @LaTeX{} code. @samp{:caption} value
  11527. overrides @samp{CAPTION} value.
  11528. @item @samp{:float}
  11529. @itemx @samp{:placement}
  11530. The table environments by default are not floats in @LaTeX{}. To
  11531. make them floating objects use @samp{:float} with one of the following
  11532. options: @samp{sideways}, @samp{multicolumn}, @samp{t}, and @samp{nil}.
  11533. @LaTeX{} floats can also have additional layout @samp{:placement}
  11534. attributes. These are the usual @samp{[h t b p ! H]} permissions
  11535. specified in square brackets. Note that for @samp{:float sideways}
  11536. tables, the @LaTeX{} export back-end ignores @samp{:placement}
  11537. attributes.
  11538. @item @samp{:align}
  11539. @itemx @samp{:font}
  11540. @itemx @samp{:width}
  11541. The @LaTeX{} export back-end uses these attributes for regular
  11542. tables to set their alignments, fonts, and widths.
  11543. @item @samp{:spread}
  11544. When @samp{:spread} is non-@code{nil}, the @LaTeX{} export back-end spreads or
  11545. shrinks the table by the @samp{:width} for tabu and longtabu
  11546. environments. @samp{:spread} has no effect if @samp{:width} is not set.
  11547. @item @samp{:booktabs}
  11548. @itemx @samp{:center}
  11549. @itemx @samp{:rmlines}
  11550. @vindex org-latex-tables-booktabs
  11551. @vindex org-latex-tables-centered
  11552. All three commands are toggles. @samp{:booktabs} brings in modern
  11553. typesetting enhancements to regular tables. The booktabs package
  11554. has to be loaded through @code{org-latex-packages-alist}. @samp{:center}
  11555. is for centering the table. @samp{:rmlines} removes all but the very
  11556. first horizontal line made of ASCII characters from ``table.el''
  11557. tables only.
  11558. @item @samp{:math-prefix}
  11559. @itemx @samp{:math-suffix}
  11560. @itemx @samp{:math-arguments}
  11561. The @LaTeX{} export back-end inserts @samp{:math-prefix} string value in
  11562. a math environment before the table. The @LaTeX{} export back-end
  11563. inserts @samp{:math-suffix} string value in a math environment after
  11564. the table. The @LaTeX{} export back-end inserts @samp{:math-arguments}
  11565. string value between the macro name and the table's contents.
  11566. @samp{:math-arguments} comes in use for matrix macros that require
  11567. more than one argument, such as @samp{qbordermatrix}.
  11568. @end table
  11569. @LaTeX{} table attributes help formatting tables for a wide range of
  11570. situations, such as matrix product or spanning multiple pages:
  11571. @example
  11572. #+ATTR_LATEX: :environment longtable :align l|lp@{3cm@}r|l
  11573. | ... | ... |
  11574. | ... | ... |
  11575. #+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times
  11576. | a | b |
  11577. | c | d |
  11578. #+ATTR_LATEX: :mode math :environment bmatrix
  11579. | 1 | 2 |
  11580. | 3 | 4 |
  11581. @end example
  11582. Set the caption with the @LaTeX{} command
  11583. @samp{\bicaption@{HeadingA@}@{HeadingB@}}:
  11584. @example
  11585. #+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
  11586. | ... | ... |
  11587. | ... | ... |
  11588. @end example
  11589. @node Images in @LaTeX{} export
  11590. @subsection Images in @LaTeX{} export
  11591. @cindex images, inline in LaTeX
  11592. @cindex inlining images in LaTeX
  11593. @cindex @samp{ATTR_LATEX}, keyword
  11594. The @LaTeX{} export back-end processes image links in Org files that do
  11595. not have descriptions, such as these links @samp{[[file:img.jpg]]} or
  11596. @samp{[[./img.jpg]]}, as direct image insertions in the final PDF output. In
  11597. the PDF, they are no longer links but actual images embedded on the
  11598. page. The @LaTeX{} export back-end uses @samp{\includegraphics} macro to
  11599. insert the image. But for TikZ (@uref{http://sourceforge.net/projects/pgf/})
  11600. images, the back-end uses an @code{\input} macro wrapped within
  11601. a @code{tikzpicture} environment.
  11602. For specifying image @samp{:width}, @samp{:height}, and other @samp{:options}, use
  11603. this syntax:
  11604. @example
  11605. #+ATTR_LATEX: :width 5cm :options angle=90
  11606. [[./img/sed-hr4049.pdf]]
  11607. @end example
  11608. For custom commands for captions, use the @samp{:caption} attribute. It
  11609. overrides the default @samp{#+CAPTION} value:
  11610. @example
  11611. #+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
  11612. [[./img/sed-hr4049.pdf]]
  11613. @end example
  11614. When captions follow the method as described in @ref{Images and Tables},
  11615. the @LaTeX{} export back-end wraps the picture in a floating @samp{figure}
  11616. environment. To float an image without specifying a caption, set the
  11617. @samp{:float} attribute to one of the following:
  11618. @table @asis
  11619. @item @samp{t}
  11620. For a standard @samp{figure} environment; used by default whenever an
  11621. image has a caption.
  11622. @item @samp{multicolumn}
  11623. To span the image across multiple columns of a page; the back-end
  11624. wraps the image in a @samp{figure*} environment.
  11625. @item @samp{wrap}
  11626. For text to flow around the image on the right; the figure
  11627. occupies the left half of the page.
  11628. @item @samp{sideways}
  11629. For a new page with the image sideways, rotated ninety degrees,
  11630. in a @samp{sidewaysfigure} environment; overrides @samp{:placement}
  11631. setting.
  11632. @item @samp{nil}
  11633. To avoid a @samp{:float} even if using a caption.
  11634. @end table
  11635. @noindent
  11636. Use the @samp{placement} attribute to modify a floating environment's
  11637. placement.
  11638. @example
  11639. #+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement @{r@}@{0.4\textwidth@}
  11640. [[./img/hst.png]]
  11641. @end example
  11642. @vindex org-latex-images-centered
  11643. @cindex center image in LaTeX export
  11644. @cindex image, centering in LaTeX export
  11645. The @LaTeX{} export back-end centers all images by default. Setting
  11646. @samp{:center} to @samp{nil} disables centering. To disable centering globally,
  11647. set @code{org-latex-images-centered} to @samp{t}.
  11648. Set the @samp{:comment-include} attribute to non-@code{nil} value for the @LaTeX{}
  11649. export back-end to comment out the @samp{\includegraphics} macro.
  11650. @node Plain lists in @LaTeX{} export
  11651. @subsection Plain lists in @LaTeX{} export
  11652. @cindex plain lists, in @LaTeX{} export
  11653. @cindex @samp{ATTR_LATEX}, keyword
  11654. The @LaTeX{} export back-end accepts the @samp{environment} and @samp{options}
  11655. attributes for plain lists. Both attributes work together for
  11656. customizing lists, as shown in the examples:
  11657. @example
  11658. #+LATEX_HEADER: \usepackage[inline]@{enumitem@}
  11659. Some ways to say "Hello":
  11660. #+ATTR_LATEX: :environment itemize*
  11661. #+ATTR_LATEX: :options [label=@{@}, itemjoin=@{,@}, itemjoin*=@{, and@}]
  11662. - Hola
  11663. - Bonjour
  11664. - Guten Tag.
  11665. @end example
  11666. Since @LaTeX{} supports only four levels of nesting for lists, use an
  11667. external package, such as @samp{enumitem} in @LaTeX{}, for levels deeper than
  11668. four:
  11669. @example
  11670. #+LATEX_HEADER: \usepackage@{enumitem@}
  11671. #+LATEX_HEADER: \renewlist@{itemize@}@{itemize@}@{9@}
  11672. #+LATEX_HEADER: \setlist[itemize]@{label=$\circ$@}
  11673. - One
  11674. - Two
  11675. - Three
  11676. - Four
  11677. - Five
  11678. @end example
  11679. @node Source blocks in @LaTeX{} export
  11680. @subsection Source blocks in @LaTeX{} export
  11681. @cindex source blocks, in @LaTeX{} export
  11682. @cindex @samp{ATTR_LATEX}, keyword
  11683. The @LaTeX{} export back-end can make source code blocks into floating
  11684. objects through the attributes @samp{:float} and @samp{:options}. For @samp{:float}:
  11685. @table @asis
  11686. @item @samp{t}
  11687. Makes a source block float; by default floats any source block
  11688. with a caption.
  11689. @item @samp{multicolumn}
  11690. Spans the source block across multiple columns of a page.
  11691. @item @samp{nil}
  11692. Avoids a @samp{:float} even if using a caption; useful for source code
  11693. blocks that may not fit on a page.
  11694. @end table
  11695. @example
  11696. #+ATTR_LATEX: :float nil
  11697. #+BEGIN_SRC emacs-lisp
  11698. Lisp code that may not fit in a single page.
  11699. #+END_SRC
  11700. @end example
  11701. @vindex org-latex-listings-options
  11702. @vindex org-latex-minted-options
  11703. The @LaTeX{} export back-end passes string values in @samp{:options} to @LaTeX{}
  11704. packages for customization of that specific source block. In the
  11705. example below, the @samp{:options} are set for Minted. Minted is a source
  11706. code highlighting @LaTeX{} package with many configurable options.
  11707. @example
  11708. #+ATTR_LATEX: :options commentstyle=\bfseries
  11709. #+BEGIN_SRC emacs-lisp
  11710. (defun Fib (n)
  11711. (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
  11712. #+END_SRC
  11713. @end example
  11714. To apply similar configuration options for all source blocks in
  11715. a file, use the @code{org-latex-listings-options} and
  11716. @code{org-latex-minted-options} variables.
  11717. @node Example blocks in @LaTeX{} export
  11718. @subsection Example blocks in @LaTeX{} export
  11719. @cindex example blocks, in @LaTeX{} export
  11720. @cindex verbatim blocks, in @LaTeX{} export
  11721. @cindex @samp{ATTR_LATEX}, keyword
  11722. The @LaTeX{} export back-end wraps the contents of example blocks in
  11723. a @samp{verbatim} environment. To change this behavior to use another
  11724. environment globally, specify an appropriate export filter (see
  11725. @ref{Advanced Configuration}). To change this behavior to use another
  11726. environment for each block, use the @samp{:environment} parameter to
  11727. specify a custom environment.
  11728. @example
  11729. #+ATTR_LATEX: :environment myverbatim
  11730. #+BEGIN_EXAMPLE
  11731. This sentence is false.
  11732. #+END_EXAMPLE
  11733. @end example
  11734. @node Special blocks in @LaTeX{} export
  11735. @subsection Special blocks in @LaTeX{} export
  11736. @cindex special blocks, in @LaTeX{} export
  11737. @cindex abstract, in @LaTeX{} export
  11738. @cindex proof, in @LaTeX{} export
  11739. @cindex @samp{ATTR_LATEX}, keyword
  11740. For other special blocks in the Org file, the @LaTeX{} export back-end
  11741. makes a special environment of the same name. The back-end also takes
  11742. @samp{:options}, if any, and appends as-is to that environment's opening
  11743. string. For example:
  11744. @example
  11745. #+BEGIN_abstract
  11746. We demonstrate how to solve the Syracuse problem.
  11747. #+END_abstract
  11748. #+ATTR_LATEX: :options [Proof of important theorem]
  11749. #+BEGIN_proof
  11750. ...
  11751. Therefore, any even number greater than 2 is the sum of two primes.
  11752. #+END_proof
  11753. @end example
  11754. @noindent
  11755. exports to
  11756. @example
  11757. \begin@{abstract@}
  11758. We demonstrate how to solve the Syracuse problem.
  11759. \end@{abstract@}
  11760. \begin@{proof@}[Proof of important theorem]
  11761. ...
  11762. Therefore, any even number greater than 2 is the sum of two primes.
  11763. \end@{proof@}
  11764. @end example
  11765. If you need to insert a specific caption command, use @samp{:caption}
  11766. attribute. It overrides standard @samp{CAPTION} value, if any. For
  11767. example:
  11768. @example
  11769. #+ATTR_LATEX: :caption \MyCaption@{HeadingA@}
  11770. #+BEGIN_proof
  11771. ...
  11772. #+END_proof
  11773. @end example
  11774. @node Horizontal rules in @LaTeX{} export
  11775. @subsection Horizontal rules in @LaTeX{} export
  11776. @cindex horizontal rules, in @LaTeX{} export
  11777. @cindex @samp{ATTR_LATEX}, keyword
  11778. The @LaTeX{} export back-end converts horizontal rules by the specified
  11779. @samp{:width} and @samp{:thickness} attributes. For example:
  11780. @example
  11781. #+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt
  11782. -----
  11783. @end example
  11784. @node Markdown Export
  11785. @section Markdown Export
  11786. @cindex Markdown export
  11787. The Markdown export back-end, ``md'', converts an Org file to a Markdown
  11788. format, as defined at @uref{http://daringfireball.net/projects/markdown/}.
  11789. Since ``md'' is built on top of the HTML back-end, any Org constructs
  11790. not supported by Markdown, such as tables, the underlying ``html''
  11791. back-end (see @ref{HTML Export}) converts them.
  11792. @anchor{Markdown export commands}
  11793. @subheading Markdown export commands
  11794. @table @asis
  11795. @item @kbd{C-c C-e m m} (@code{org-md-export-to-markdown})
  11796. @kindex C-c C-c m m
  11797. @findex org-md-export-to-markdown
  11798. Export to a text file with Markdown syntax. For @samp{myfile.org},
  11799. Org exports to @samp{myfile.md}, overwritten without warning.
  11800. @item @kbd{C-c C-e m M} (@code{org-md-export-as-markdown})
  11801. @kindex C-c C-c m M
  11802. @findex org-md-export-as-markdown
  11803. Export to a temporary buffer. Does not create a file.
  11804. @item @kbd{C-c C-e m o}
  11805. @kindex C-c C-e m o
  11806. Export as a text file with Markdown syntax, then open it.
  11807. @end table
  11808. @anchor{Header and sectioning structure (1)}
  11809. @subheading Header and sectioning structure
  11810. @vindex org-md-headline-style
  11811. Based on @code{org-md-headline-style}, Markdown export can generate
  11812. headlines of both @emph{atx} and @emph{setext} types. @emph{atx} limits headline
  11813. levels to two whereas @emph{setext} limits headline levels to six. Beyond
  11814. these limits, the export back-end converts headlines to lists. To set
  11815. a limit to a level before the absolute limit (see @ref{Export Settings}).
  11816. @node OpenDocument Text Export
  11817. @section OpenDocument Text Export
  11818. @cindex ODT
  11819. @cindex OpenDocument
  11820. @cindex export, OpenDocument
  11821. @cindex LibreOffice
  11822. The ODT export back-end handles creating of OpenDocument Text (ODT)
  11823. format. Documents created by this exporter use the
  11824. @cite{OpenDocument-v1.2 specification}@footnote{See @uref{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, Open Document Format for Office Applications
  11825. (OpenDocument) Version 1.2}.} and are compatible
  11826. with LibreOffice 3.4.
  11827. @menu
  11828. * Pre-requisites for ODT export:: Required packages.
  11829. * ODT export commands:: Invoking export.
  11830. * ODT specific export settings:: Configuration options.
  11831. * Extending ODT export:: Producing DOC, PDF files.
  11832. * Applying custom styles:: Styling the output.
  11833. * Links in ODT export:: Handling and formatting links.
  11834. * Tables in ODT export:: Org tables conversions.
  11835. * Images in ODT export:: Inserting images.
  11836. * Math formatting in ODT export:: Formatting @LaTeX{} fragments.
  11837. * Labels and captions in ODT export:: Rendering objects.
  11838. * Literal examples in ODT export:: For source code and example blocks.
  11839. * Advanced topics in ODT export:: For power users.
  11840. @end menu
  11841. @node Pre-requisites for ODT export
  11842. @subsection Pre-requisites for ODT export
  11843. @cindex zip
  11844. The ODT export back-end relies on the zip program to create the final
  11845. compressed ODT output. Check if @samp{zip} is locally available and
  11846. executable. Without it, export cannot finish.
  11847. @node ODT export commands
  11848. @subsection ODT export commands
  11849. @table @asis
  11850. @item @kbd{C-c C-e o o} (@code{org-export-to-odt})
  11851. @kindex C-c C-e o o
  11852. @findex org-export-to-odt
  11853. Export as OpenDocument Text file.
  11854. @cindex @samp{EXPORT_FILE_NAME}, property
  11855. @vindex org-odt-preferred-output-format
  11856. If @code{org-odt-preferred-output-format} is specified, the ODT export
  11857. back-end automatically converts the exported file to that format.
  11858. For @samp{myfile.org}, Org exports to @samp{myfile.odt}, overwriting
  11859. without warning. The ODT export back-end exports a region only
  11860. if a region was active.
  11861. If the selected region is a single tree, the ODT export back-end
  11862. makes the tree head the document title. Incidentally, @kbd{C-c @@} selects the current sub-tree. If the tree head entry has,
  11863. or inherits, an @samp{EXPORT_FILE_NAME} property, the ODT export
  11864. back-end uses that for file name.
  11865. @item @kbd{C-c C-e o O}
  11866. @kindex C-c C-e o O
  11867. Export as an OpenDocument Text file and open the resulting file.
  11868. @vindex org-export-odt-preferred-output-format
  11869. If @code{org-export-odt-preferred-output-format} is specified, open
  11870. the converted file instead. See @ref{Automatically exporting to other formats}.
  11871. @end table
  11872. @node ODT specific export settings
  11873. @subsection ODT specific export settings
  11874. The ODT export back-end has several additional keywords for
  11875. customizing ODT output. Setting these keywords works similar to the
  11876. general options (see @ref{Export Settings}).
  11877. @table @asis
  11878. @item @samp{DESCRIPTION}
  11879. @cindex @samp{DESCRIPTION}, keyword
  11880. This is the document's description, which the ODT export back-end
  11881. inserts as document metadata. For long descriptions, use
  11882. multiple lines, prefixed with @samp{DESCRIPTION}.
  11883. @item @samp{KEYWORDS}
  11884. @cindex @samp{KEYWORDS}, keyword
  11885. The keywords for the document. The ODT export back-end inserts
  11886. the description along with author name, keywords, and related
  11887. file metadata as metadata in the output file. Use multiple
  11888. @samp{KEYWORDS} if necessary.
  11889. @item @samp{ODT_STYLES_FILE}
  11890. @cindex @samp{ODT_STYLES_FILE}, keyword
  11891. @vindex org-odt-styles-file
  11892. The ODT export back-end uses the @code{org-odt-styles-file} by
  11893. default. See @ref{Applying custom styles} for details.
  11894. @item @samp{SUBTITLE}
  11895. @cindex @samp{SUBTITLE}, keyword
  11896. The document subtitle.
  11897. @end table
  11898. @node Extending ODT export
  11899. @subsection Extending ODT export
  11900. The ODT export back-end can produce documents in other formats besides
  11901. ODT using a specialized ODT converter process. Its common interface
  11902. works with popular converters to produce formats such as @samp{doc}, or
  11903. convert a document from one format, say @samp{csv}, to another format, say
  11904. @samp{xls}.
  11905. @cindex @file{unoconv}
  11906. @vindex org-odt-convert-process
  11907. Customize @code{org-odt-convert-process} variable to point to @samp{unoconv},
  11908. which is the ODT's preferred converter. Working installations of
  11909. LibreOffice would already have @samp{unoconv} installed. Alternatively,
  11910. other converters may be substituted here. See @ref{Configuring a document converter}.
  11911. @anchor{Automatically exporting to other formats}
  11912. @subsubheading Automatically exporting to other formats
  11913. @vindex org-odt-preferred-output-format
  11914. If ODT format is just an intermediate step to get to other formats,
  11915. such as @samp{doc}, @samp{docx}, @samp{rtf}, or @samp{pdf}, etc., then extend the ODT
  11916. export back-end to directly produce that format. Specify the final
  11917. format in the @code{org-odt-preferred-output-format} variable. This is one
  11918. way to extend (see @ref{ODT export commands}).
  11919. @anchor{Converting between document formats}
  11920. @subsubheading Converting between document formats
  11921. The Org export back-end is made to be inter-operable with a wide range
  11922. of text document format converters. Newer generation converters, such
  11923. as LibreOffice and Pandoc, can handle hundreds of formats at once.
  11924. Org provides a consistent interaction with whatever converter is
  11925. installed. Here are some generic commands:
  11926. @table @asis
  11927. @item @kbd{M-x org-odt-convert}
  11928. @findex org-odt-convert
  11929. Convert an existing document from one format to another. With
  11930. a prefix argument, opens the newly produced file.
  11931. @end table
  11932. @node Applying custom styles
  11933. @subsection Applying custom styles
  11934. @cindex styles, custom
  11935. @cindex template, custom
  11936. The ODT export back-end comes with many OpenDocument styles (see
  11937. @ref{Working with OpenDocument style files}). To expand or further
  11938. customize these built-in style sheets, either edit the style sheets
  11939. directly or generate them using an application such as LibreOffice.
  11940. The example here shows creating a style using LibreOffice.
  11941. @anchor{Applying custom styles the easy way}
  11942. @subsubheading Applying custom styles: the easy way
  11943. @enumerate
  11944. @item
  11945. Create a sample @samp{example.org} file with settings as shown below,
  11946. and export it to ODT format.
  11947. @example
  11948. #+OPTIONS: H:10 num:t
  11949. @end example
  11950. @item
  11951. Open the above @samp{example.odt} using LibreOffice. Use the @emph{Stylist}
  11952. to locate the target styles, which typically have the ``Org'' prefix.
  11953. Open one, modify, and save as either OpenDocument Text (ODT) or
  11954. OpenDocument Template (OTT) file.
  11955. @item
  11956. @vindex org-odt-styles-file
  11957. Customize the variable @code{org-odt-styles-file} and point it to the
  11958. newly created file. For additional configuration options, see
  11959. @ref{x-overriding-factory-styles, , Overriding factory styles}.
  11960. @cindex @samp{ODT_STYLES_FILE}, keyword
  11961. To apply an ODT style to a particular file, use the
  11962. @samp{ODT_STYLES_FILE} keyword as shown in the example below:
  11963. @example
  11964. #+ODT_STYLES_FILE: "/path/to/example.ott"
  11965. @end example
  11966. @noindent
  11967. or
  11968. @example
  11969. #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
  11970. @end example
  11971. @end enumerate
  11972. @anchor{Using third-party styles and templates}
  11973. @subsubheading Using third-party styles and templates
  11974. The ODT export back-end relies on many templates and style names.
  11975. Using third-party styles and templates can lead to mismatches.
  11976. Templates derived from built in ODT templates and styles seem to have
  11977. fewer problems.
  11978. @node Links in ODT export
  11979. @subsection Links in ODT export
  11980. @cindex links, in ODT export
  11981. ODT exporter creates native cross-references for internal links. It
  11982. creates Internet-style links for all other links.
  11983. A link with no description and pointing to a regular, un-itemized,
  11984. outline heading is replaced with a cross-reference and section number
  11985. of the heading.
  11986. A @samp{\ref@{label@}}-style reference to an image, table etc., is replaced
  11987. with a cross-reference and sequence number of the labeled entity. See
  11988. @ref{Labels and captions in ODT export}.
  11989. @node Tables in ODT export
  11990. @subsection Tables in ODT export
  11991. @cindex tables, in ODT export
  11992. The ODT export back-end handles native Org mode tables (see @ref{Tables})
  11993. and simple @samp{table.el} tables. Complex @samp{table.el} tables having column
  11994. or row spans are not supported. Such tables are stripped from the
  11995. exported document.
  11996. By default, the ODT export back-end exports a table with top and
  11997. bottom frames and with ruled lines separating row and column groups
  11998. (see @ref{Column Groups}). All tables are typeset to occupy the same
  11999. width. The ODT export back-end honors any table alignments and
  12000. relative widths for columns (see @ref{Column Width and Alignment}).
  12001. Note that the ODT export back-end interprets column widths as weighted
  12002. ratios, the default weight being 1.
  12003. @cindex @samp{ATTR_ODT}, keyword
  12004. Specifying @samp{:rel-width} property on an @samp{ATTR_ODT} line controls the
  12005. width of the table. For example:
  12006. @example
  12007. #+ATTR_ODT: :rel-width 50
  12008. | Area/Month | Jan | Feb | Mar | Sum |
  12009. |---------------+-------+-------+-------+-------|
  12010. | / | < | | | < |
  12011. | <l13> | <r5> | <r5> | <r5> | <r6> |
  12012. | North America | 1 | 21 | 926 | 948 |
  12013. | Middle East | 6 | 75 | 844 | 925 |
  12014. | Asia Pacific | 9 | 27 | 790 | 826 |
  12015. |---------------+-------+-------+-------+-------|
  12016. | Sum | 16 | 123 | 2560 | 2699 |
  12017. @end example
  12018. On export, the above table takes 50% of text width area. The exporter
  12019. sizes the columns in the ratio: 13:5:5:5:6. The first column is
  12020. left-aligned and rest of the columns, right-aligned. Vertical rules
  12021. separate the header and the last column. Horizontal rules separate
  12022. the header and the last row.
  12023. For even more customization, create custom table styles and associate
  12024. them with a table using the @samp{ATTR_ODT} keyword. See @ref{Customizing tables in ODT export}.
  12025. @node Images in ODT export
  12026. @subsection Images in ODT export
  12027. @cindex images, embedding in ODT
  12028. @cindex embedding images in ODT
  12029. @anchor{Embedding images}
  12030. @subsubheading Embedding images
  12031. The ODT export back-end processes image links in Org files that do not
  12032. have descriptions, such as these links @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]},
  12033. as direct image insertions in the final output. Either of these
  12034. examples works:
  12035. @example
  12036. [[file:img.png]]
  12037. @end example
  12038. @example
  12039. [[./img.png]]
  12040. @end example
  12041. @anchor{Embedding clickable images}
  12042. @subsubheading Embedding clickable images
  12043. For clickable images, provide a link whose description is another link
  12044. to an image file. For example, to embed an image
  12045. @samp{org-mode-unicorn.png} which when clicked jumps to @uref{https://orgmode.org}
  12046. website, do the following
  12047. @example
  12048. [[https://orgmode.org][./org-mode-unicorn.png]]
  12049. @end example
  12050. @anchor{Sizing and scaling of embedded images}
  12051. @subsubheading Sizing and scaling of embedded images
  12052. @cindex @samp{ATTR_ODT}, keyword
  12053. Control the size and scale of the embedded images with the @samp{ATTR_ODT}
  12054. attribute.
  12055. @cindex identify, ImageMagick
  12056. @vindex org-odt-pixels-per-inch
  12057. The ODT export back-end starts with establishing the size of the image
  12058. in the final document. The dimensions of this size are measured in
  12059. centimeters. The back-end then queries the image file for its
  12060. dimensions measured in pixels. For this measurement, the back-end
  12061. relies on ImageMagick's identify program or Emacs @code{create-image} and
  12062. @code{image-size} API. ImageMagick is the preferred choice for large file
  12063. sizes or frequent batch operations. The back-end then converts the
  12064. pixel dimensions using @code{org-odt-pixels-per-inch} into the familiar 72
  12065. dpi or 96 dpi. The default value for this is in
  12066. @code{display-pixels-per-inch}, which can be tweaked for better results
  12067. based on the capabilities of the output device. Here are some common
  12068. image scaling operations:
  12069. @table @asis
  12070. @item Explicitly size the image
  12071. To embed @samp{img.png} as a 10 cm x 10 cm image, do the following:
  12072. @example
  12073. #+ATTR_ODT: :width 10 :height 10
  12074. [[./img.png]]
  12075. @end example
  12076. @item Scale the image
  12077. To embed @samp{img.png} at half its size, do the following:
  12078. @example
  12079. #+ATTR_ODT: :scale 0.5
  12080. [[./img.png]]
  12081. @end example
  12082. @item Scale the image to a specific width
  12083. To embed @samp{img.png} with a width of 10 cm while retaining the
  12084. original height:width ratio, do the following:
  12085. @example
  12086. #+ATTR_ODT: :width 10
  12087. [[./img.png]]
  12088. @end example
  12089. @item Scale the image to a specific height
  12090. To embed @samp{img.png} with a height of 10 cm while retaining the
  12091. original height:width ratio, do the following:
  12092. @example
  12093. #+ATTR_ODT: :height 10
  12094. [[./img.png]]
  12095. @end example
  12096. @end table
  12097. @anchor{Anchoring of images}
  12098. @subsubheading Anchoring of images
  12099. @cindex @samp{ATTR_ODT}, keyword
  12100. The ODT export back-end can anchor images to @samp{"as-char"},
  12101. @samp{"paragraph"}, or @samp{"page"}. Set the preferred anchor using the
  12102. @samp{:anchor} property of the @samp{ATTR_ODT} line.
  12103. To create an image that is anchored to a page:
  12104. @example
  12105. #+ATTR_ODT: :anchor "page"
  12106. [[./img.png]]
  12107. @end example
  12108. @node Math formatting in ODT export
  12109. @subsection Math formatting in ODT export
  12110. The ODT exporter has special support for handling math.
  12111. @menu
  12112. * @LaTeX{} math snippets:: Embedding in @LaTeX{} format.
  12113. * MathML and OpenDocument formula files:: Embedding in native format.
  12114. @end menu
  12115. @node @LaTeX{} math snippets
  12116. @subsubsection @LaTeX{} math snippets
  12117. @LaTeX{} math snippets (see @ref{@LaTeX{} fragments}) can be embedded in the ODT
  12118. document in one of the following ways:
  12119. @table @asis
  12120. @item MathML
  12121. @cindex MathML
  12122. Add this line to the Org file. This option is activated on
  12123. a per-file basis.
  12124. @example
  12125. #+OPTIONS: tex:t
  12126. @end example
  12127. With this option, @LaTeX{} fragments are first converted into MathML
  12128. fragments using an external @LaTeX{}-to-MathML converter program.
  12129. The resulting MathML fragments are then embedded as an
  12130. OpenDocument Formula in the exported document.
  12131. @vindex org-latex-to-mathml-convert-command
  12132. @vindex org-latex-to-mathml-jar-file
  12133. You can specify the @LaTeX{}-to-MathML converter by customizing the
  12134. variables @code{org-latex-to-mathml-convert-command} and
  12135. @code{org-latex-to-mathml-jar-file}.
  12136. If you prefer to use MathToWeb@footnote{See @uref{http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl, MathToWeb}.} as your converter, you can
  12137. configure the above variables as shown below.
  12138. @lisp
  12139. (setq org-latex-to-mathml-convert-command
  12140. "java -jar %j -unicode -force -df %o %I"
  12141. org-latex-to-mathml-jar-file
  12142. "/path/to/mathtoweb.jar")
  12143. @end lisp
  12144. To use @LaTeX{}​ML@footnote{See @uref{http://dlmf.nist.gov/LaTeXML/}.} use
  12145. @lisp
  12146. (setq org-latex-to-mathml-convert-command
  12147. "latexmlmath \"%i\" --presentationmathml=%o")
  12148. @end lisp
  12149. To quickly verify the reliability of the @LaTeX{}-to-MathML
  12150. converter, use the following commands:
  12151. @table @asis
  12152. @item @kbd{M-x org-export-as-odf}
  12153. Convert a @LaTeX{} math snippet to an OpenDocument formula
  12154. (@samp{.odf}) file.
  12155. @item @kbd{M-x org-export-as-odf-and-open}
  12156. Convert a @LaTeX{} math snippet to an OpenDocument formula
  12157. (@samp{.odf}) file and open the formula file with the
  12158. system-registered application.
  12159. @end table
  12160. @item PNG images
  12161. @cindex dvipng
  12162. @cindex dvisvgm
  12163. @cindex ImageMagick
  12164. Add this line to the Org file. This option is activated on
  12165. a per-file basis.
  12166. @example
  12167. #+OPTIONS: tex:dvipng
  12168. @end example
  12169. @example
  12170. #+OPTIONS: tex:dvisvgm
  12171. @end example
  12172. @noindent
  12173. or
  12174. @example
  12175. #+OPTIONS: tex:imagemagick
  12176. @end example
  12177. Under this option, @LaTeX{} fragments are processed into PNG or SVG
  12178. images and the resulting images are embedded in the exported
  12179. document. This method requires dvipng program, dvisvgm or
  12180. ImageMagick programs.
  12181. @end table
  12182. @node MathML and OpenDocument formula files
  12183. @subsubsection MathML and OpenDocument formula files
  12184. When embedding @LaTeX{} math snippets in ODT documents is not reliable,
  12185. there is one more option to try. Embed an equation by linking to its
  12186. MathML (@samp{.mml}) source or its OpenDocument formula (@samp{.odf}) file as
  12187. shown below:
  12188. @example
  12189. [[./equation.mml]]
  12190. @end example
  12191. @noindent
  12192. or
  12193. @example
  12194. [[./equation.odf]]
  12195. @end example
  12196. @node Labels and captions in ODT export
  12197. @subsection Labels and captions in ODT export
  12198. ODT format handles labeling and captioning of objects based on their
  12199. types. Inline images, tables, @LaTeX{} fragments, and Math formulas are
  12200. numbered and captioned separately. Each object also gets a unique
  12201. sequence number based on its order of first appearance in the Org
  12202. file. Each category has its own sequence. A caption is just a label
  12203. applied to these objects.
  12204. @example
  12205. #+CAPTION: Bell curve
  12206. #+NAME: fig:SED-HR4049
  12207. [[./img/a.png]]
  12208. @end example
  12209. When rendered, it may show as follows in the exported document:
  12210. @example
  12211. Figure 2: Bell curve
  12212. @end example
  12213. @vindex org-odt-category-map-alist
  12214. To modify the category component of the caption, customize the option
  12215. @code{org-odt-category-map-alist}. For example, to tag embedded images
  12216. with the string ``Illustration'' instead of the default string ``Figure'',
  12217. use the following setting:
  12218. @lisp
  12219. (setq org-odt-category-map-alist
  12220. '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)))
  12221. @end lisp
  12222. With the above modification, the previous example changes to:
  12223. @example
  12224. Illustration 2: Bell curve
  12225. @end example
  12226. @node Literal examples in ODT export
  12227. @subsection Literal examples in ODT export
  12228. The ODT export back-end supports literal examples (see @ref{Literal Examples}) with full fontification. Internally, the ODT export
  12229. back-end relies on @samp{htmlfontify.el} to generate the style definitions
  12230. needed for fancy listings. The auto-generated styles get @samp{OrgSrc}
  12231. prefix and inherit colors from the faces used by Emacs Font Lock
  12232. library for that source language.
  12233. @vindex org-odt-fontify-srcblocks
  12234. For custom fontification styles, customize the
  12235. @code{org-odt-create-custom-styles-for-srcblocks} option.
  12236. @vindex org-odt-create-custom-styles-for-srcblocks
  12237. To turn off fontification of literal examples, customize the
  12238. @code{org-odt-fontify-srcblocks} option.
  12239. @node Advanced topics in ODT export
  12240. @subsection Advanced topics in ODT export
  12241. The ODT export back-end has extensive features useful for power users
  12242. and frequent uses of ODT formats.
  12243. @anchor{Configuring a document converter}
  12244. @subsubheading Configuring a document converter
  12245. @cindex convert
  12246. @cindex doc, docx, rtf
  12247. @cindex converter
  12248. The ODT export back-end works with popular converters with little or
  12249. no extra configuration. See @ref{Extending ODT export}. The following is
  12250. for unsupported converters or tweaking existing defaults.
  12251. @table @asis
  12252. @item Register the converter
  12253. @vindex org-export-odt-convert-processes
  12254. Add the name of the converter to the @code{org-odt-convert-processes}
  12255. variable. Note that it also requires how the converter is
  12256. invoked on the command line. See the variable's docstring for
  12257. details.
  12258. @item Configure its capabilities
  12259. @vindex org-export-odt-convert-capabilities
  12260. Specify which formats the converter can handle by customizing the
  12261. variable @code{org-odt-convert-capabilities}. Use the entry for the
  12262. default values in this variable for configuring the new
  12263. converter. Also see its docstring for details.
  12264. @item Choose the converter
  12265. @vindex org-export-odt-convert-process
  12266. Select the newly added converter as the preferred one by
  12267. customizing the option @code{org-odt-convert-process}.
  12268. @end table
  12269. @anchor{Working with OpenDocument style files}
  12270. @subsubheading Working with OpenDocument style files
  12271. @cindex styles, custom
  12272. @cindex template, custom
  12273. This section explores the internals of the ODT exporter; the means by which
  12274. it produces styled documents; the use of automatic and custom OpenDocument
  12275. styles.
  12276. The ODT exporter relies on two files for generating its output. These
  12277. files are bundled with the distribution under the directory pointed to
  12278. by the variable @code{org-odt-styles-dir}. The two files are:
  12279. @table @asis
  12280. @item @samp{OrgOdtStyles.xml} @anchor{x-orgodtstyles-xml}
  12281. This file contributes to the @samp{styles.xml} file of the final ODT
  12282. document. This file gets modified for the following purposes:
  12283. @enumerate
  12284. @item
  12285. To control outline numbering based on user settings;
  12286. @item
  12287. To add styles generated by @samp{htmlfontify.el} for fontification of
  12288. code blocks.
  12289. @end enumerate
  12290. @item @samp{OrgOdtContentTemplate.xml} @anchor{x-orgodtcontenttemplate-xml}
  12291. This file contributes to the @samp{content.xml} file of the final ODT
  12292. document. The contents of the Org outline are inserted between the
  12293. @samp{<office:text>} @dots{} @samp{</office:text>} elements of this file.
  12294. Apart from serving as a template file for the final @samp{content.xml},
  12295. the file serves the following purposes:
  12296. @enumerate
  12297. @item
  12298. It contains automatic styles for formatting of tables which are
  12299. referenced by the exporter;
  12300. @item
  12301. It contains @samp{<text:sequence-decl>} @dots{} @samp{</text:sequence-decl>}
  12302. elements that control numbering of tables, images, equations, and
  12303. similar entities.
  12304. @end enumerate
  12305. @end table
  12306. @anchor{x-overriding-factory-styles} The following two variables control
  12307. the location from where the ODT exporter picks up the custom styles
  12308. and content template files. Customize these variables to override the
  12309. factory styles used by the exporter.
  12310. @table @asis
  12311. @item @code{org-odt-styles-file}
  12312. The ODT export back-end uses the file pointed to by this
  12313. variable, such as @samp{styles.xml}, for the final output. It can
  12314. take one of the following values:
  12315. @table @asis
  12316. @item @samp{FILE.xml}
  12317. Use this file instead of the default @samp{styles.xml}
  12318. @item @samp{FILE.odt} or @samp{FILE.ott}
  12319. Use the @samp{styles.xml} contained in the specified OpenDocument
  12320. Text or Template file
  12321. @item @samp{FILE.odt} or @samp{FILE.ott} and a subset of included files
  12322. Use the @samp{styles.xml} contained in the specified OpenDocument
  12323. Text or Template file. Additionally extract the specified
  12324. member files and embed those within the final ODT document.
  12325. Use this option if the @samp{styles.xml} file references additional
  12326. files like header and footer images.
  12327. @item @code{nil}
  12328. Use the default @samp{styles.xml}.
  12329. @end table
  12330. @item @code{org-odt-content-template-file}
  12331. Use this variable to specify the blank @samp{content.xml} used in the
  12332. final output.
  12333. @end table
  12334. @anchor{Creating one-off styles}
  12335. @subsubheading Creating one-off styles
  12336. The ODT export back-end can read embedded raw OpenDocument XML from
  12337. the Org file. Such direct formatting is useful for one-off instances.
  12338. @table @asis
  12339. @item Embedding ODT tags as part of regular text
  12340. Enclose OpenDocument syntax in @samp{@@@@odt:...@@@@} for inline markup.
  12341. For example, to highlight a region of text do the following:
  12342. @example
  12343. @@@@odt:<text:span text:style-name="Highlight">This is highlighted
  12344. text</text:span>@@@@. But this is regular text.
  12345. @end example
  12346. @strong{Hint:} To see the above example in action, edit the @samp{styles.xml}
  12347. (see @ref{x-orgodtstyles-xml, , Factory styles}) and add a custom @emph{Highlight} style as shown
  12348. below:
  12349. @example
  12350. <style:style style:name="Highlight" style:family="text">
  12351. <style:text-properties fo:background-color="#ff0000"/>
  12352. </style:style>
  12353. @end example
  12354. @item Embedding a one-line OpenDocument XML
  12355. @cindex @samp{ODT}, keyword
  12356. The ODT export back-end can read one-liner options with @samp{#+ODT:}
  12357. in the Org file. For example, to force a page break:
  12358. @example
  12359. #+ODT: <text:p text:style-name="PageBreak"/>
  12360. @end example
  12361. @strong{Hint:} To see the above example in action, edit your
  12362. @samp{styles.xml} (see @ref{x-orgodtstyles-xml, , Factory styles}) and add a custom @samp{PageBreak}
  12363. style as shown below.
  12364. @example
  12365. <style:style style:name="PageBreak" style:family="paragraph"
  12366. style:parent-style-name="Text_20_body">
  12367. <style:paragraph-properties fo:break-before="page"/>
  12368. </style:style>
  12369. @end example
  12370. @item Embedding a block of OpenDocument XML
  12371. The ODT export back-end can also read ODT export blocks for
  12372. OpenDocument XML. Such blocks use the @samp{#+BEGIN_EXPORT odt}
  12373. @dots{} @samp{#+END_EXPORT} constructs.
  12374. For example, to create a one-off paragraph that uses bold text,
  12375. do the following:
  12376. @example
  12377. #+BEGIN_EXPORT odt
  12378. <text:p text:style-name="Text_20_body_20_bold">
  12379. This paragraph is specially formatted and uses bold text.
  12380. </text:p>
  12381. #+END_EXPORT
  12382. @end example
  12383. @end table
  12384. @anchor{Customizing tables in ODT export}
  12385. @subsubheading Customizing tables in ODT export
  12386. @cindex tables, in ODT export
  12387. @cindex @samp{ATTR_ODT}, keyword
  12388. Override the default table format by specifying a custom table style
  12389. with the @samp{#+ATTR_ODT} line. For a discussion on default formatting of
  12390. tables, see @ref{Tables in ODT export}.
  12391. This feature closely mimics the way table templates are defined in the
  12392. OpenDocument-v1.2 specification.@footnote{@uref{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, OpenDocument-v1.2 Specification}}
  12393. @vindex org-odt-table-styles
  12394. For quick preview of this feature, install the settings below and export the
  12395. table that follows:
  12396. @lisp
  12397. (setq org-export-odt-table-styles
  12398. (append org-export-odt-table-styles
  12399. '(("TableWithHeaderRowAndColumn" "Custom"
  12400. ((use-first-row-styles . t)
  12401. (use-first-column-styles . t)))
  12402. ("TableWithFirstRowandLastRow" "Custom"
  12403. ((use-first-row-styles . t)
  12404. (use-last-row-styles . t))))))
  12405. @end lisp
  12406. @example
  12407. #+ATTR_ODT: :style TableWithHeaderRowAndColumn
  12408. | Name | Phone | Age |
  12409. | Peter | 1234 | 17 |
  12410. | Anna | 4321 | 25 |
  12411. @end example
  12412. The example above used @samp{Custom} template and installed two table
  12413. styles @samp{TableWithHeaderRowAndColumn} and
  12414. @samp{TableWithFirstRowandLastRow}. @strong{Important:} The OpenDocument styles
  12415. needed for producing the above template were pre-defined. They are
  12416. available in the section marked @samp{Custom Table Template} in
  12417. @samp{OrgOdtContentTemplate.xml} (see @ref{x-orgodtcontenttemplate-xml, , Factory styles}). For adding new
  12418. templates, define new styles there.
  12419. To use this feature proceed as follows:
  12420. @enumerate
  12421. @item
  12422. Create a table template@footnote{See the @samp{<table:table-template>} element of the
  12423. OpenDocument-v1.2 specification.}.
  12424. A table template is set of @samp{table-cell} and @samp{paragraph} styles for
  12425. each of the following table cell categories:
  12426. @itemize
  12427. @item
  12428. Body
  12429. @item
  12430. First column
  12431. @item
  12432. Last column
  12433. @item
  12434. First row
  12435. @item
  12436. Last row
  12437. @item
  12438. Even row
  12439. @item
  12440. Odd row
  12441. @item
  12442. Even column
  12443. @item
  12444. Odd Column
  12445. @end itemize
  12446. The names for the above styles must be chosen based on the name of
  12447. the table template using a well-defined convention.
  12448. The naming convention is better illustrated with an example. For
  12449. a table template with the name @samp{Custom}, the needed style names are
  12450. listed in the following table.
  12451. @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  12452. @headitem Cell type
  12453. @tab Cell style
  12454. @tab Paragraph style
  12455. @item Body
  12456. @tab @samp{CustomTableCell}
  12457. @tab @samp{CustomTableParagraph}
  12458. @item First column
  12459. @tab @samp{CustomFirstColumnTableCell}
  12460. @tab @samp{CustomFirstColumnTableParagraph}
  12461. @item Last column
  12462. @tab @samp{CustomLastColumnTableCell}
  12463. @tab @samp{CustomLastColumnTableParagraph}
  12464. @item First row
  12465. @tab @samp{CustomFirstRowTableCell}
  12466. @tab @samp{CustomFirstRowTableParagraph}
  12467. @item Last row
  12468. @tab @samp{CustomLastRowTableCell}
  12469. @tab @samp{CustomLastRowTableParagraph}
  12470. @item Even row
  12471. @tab @samp{CustomEvenRowTableCell}
  12472. @tab @samp{CustomEvenRowTableParagraph}
  12473. @item Odd row
  12474. @tab @samp{CustomOddRowTableCell}
  12475. @tab @samp{CustomOddRowTableParagraph}
  12476. @item Even column
  12477. @tab @samp{CustomEvenColumnTableCell}
  12478. @tab @samp{CustomEvenColumnTableParagraph}
  12479. @item Odd column
  12480. @tab @samp{CustomOddColumnTableCell}
  12481. @tab @samp{CustomOddColumnTableParagraph}
  12482. @end multitable
  12483. To create a table template with the name @samp{Custom}, define the above
  12484. styles in the @samp{<office:automatic-styles>} @dots{}
  12485. @samp{</office:automatic-styles>} element of the content template file
  12486. (see @ref{x-orgodtcontenttemplate-xml, , Factory styles}).
  12487. @item
  12488. Define a table style@footnote{See the attributes @samp{table:template-name},
  12489. @samp{table:use-first-row-styles}, @samp{table:use-last-row-styles},
  12490. @samp{table:use-first-column-styles}, @samp{table:use-last-column-styles},
  12491. @samp{table:use-banding-rows-styles}, and @samp{table:use-banding-column-styles}
  12492. of the @samp{<table:table>} element in the OpenDocument-v1.2 specification.}.
  12493. @vindex org-odt-table-styles
  12494. To define a table style, create an entry for the style in the
  12495. variable @code{org-odt-table-styles} and specify the following:
  12496. @itemize
  12497. @item
  12498. the name of the table template created in step (1),
  12499. @item
  12500. the set of cell styles in that template that are to be activated.
  12501. @end itemize
  12502. For example, the entry below defines two different table styles
  12503. @samp{TableWithHeaderRowAndColumn} and @samp{TableWithFirstRowandLastRow}
  12504. based on the same template @samp{Custom}. The styles achieve their
  12505. intended effect by selectively activating the individual cell
  12506. styles in that template.
  12507. @lisp
  12508. (setq org-export-odt-table-styles
  12509. (append org-export-odt-table-styles
  12510. '(("TableWithHeaderRowAndColumn" "Custom"
  12511. ((use-first-row-styles . t)
  12512. (use-first-column-styles . t)))
  12513. ("TableWithFirstRowandLastRow" "Custom"
  12514. ((use-first-row-styles . t)
  12515. (use-last-row-styles . t))))))
  12516. @end lisp
  12517. @item
  12518. Associate a table with the table style.
  12519. To do this, specify the table style created in step (2) as part of
  12520. the @samp{ATTR_ODT} line as shown below.
  12521. @example
  12522. #+ATTR_ODT: :style TableWithHeaderRowAndColumn
  12523. | Name | Phone | Age |
  12524. | Peter | 1234 | 17 |
  12525. | Anna | 4321 | 25 |
  12526. @end example
  12527. @end enumerate
  12528. @anchor{Validating OpenDocument XML}
  12529. @subsubheading Validating OpenDocument XML
  12530. Sometimes ODT format files may not open due to @samp{.odt} file corruption.
  12531. To verify if such a file is corrupt, validate it against the
  12532. OpenDocument Relax NG Compact (RNC) syntax schema. But first the
  12533. @samp{.odt} files have to be decompressed using @samp{zip}. Note that @samp{.odt}
  12534. files are ZIP archives: @ref{File Archives,,,emacs,}. The contents of
  12535. ODT files are in XML. For general help with validation---and
  12536. schema-sensitive editing---of XML files:
  12537. @ref{Introduction,,,nxml-mode,}.
  12538. @vindex org-export-odt-schema-dir
  12539. Customize @code{org-odt-schema-dir} to point to a directory with
  12540. OpenDocument RNC files and the needed schema-locating rules. The ODT
  12541. export back-end takes care of updating the
  12542. @code{rng-schema-locating-files}.
  12543. @node Org Export
  12544. @section Org Export
  12545. @cindex Org export
  12546. @emph{org} export back-end creates a normalized version of the Org document
  12547. in current buffer. The exporter evaluates Babel code (see @ref{Evaluating Code Blocks}) and removes content specific to other back-ends.
  12548. @anchor{Org export commands}
  12549. @subheading Org export commands
  12550. @table @asis
  12551. @item @kbd{C-c C-e O o} (@code{org-org-export-to-org})
  12552. @kindex C-c C-e O o
  12553. @findex org-org-export-to-org
  12554. Export as an Org file with a @samp{.org} extension. For @samp{myfile.org},
  12555. Org exports to @samp{myfile.org.org}, overwriting without warning.
  12556. @item @kbd{C-c C-e O v} (~~)
  12557. @kindex C-c C-e O v
  12558. Export to an Org file, then open it.
  12559. @end table
  12560. @node Texinfo Export
  12561. @section Texinfo Export
  12562. @menu
  12563. * Texinfo export commands:: Invoking commands.
  12564. * Texinfo specific export settings:: Setting the environment.
  12565. * Texinfo file header:: Generating the header.
  12566. * Texinfo title and copyright page:: Creating preamble pages.
  12567. * Info directory file:: Installing a manual in Info file hierarchy.
  12568. * Headings and sectioning structure:: Building document structure.
  12569. * Indices:: Creating indices.
  12570. * Quoting Texinfo code:: Incorporating literal Texinfo code.
  12571. * Plain lists in Texinfo export:: List attributes.
  12572. * Tables in Texinfo export:: Table attributes.
  12573. * Images in Texinfo export:: Image attributes.
  12574. * Special blocks in Texinfo export:: Special block attributes.
  12575. * A Texinfo example:: Processing Org to Texinfo.
  12576. @end menu
  12577. @node Texinfo export commands
  12578. @subsection Texinfo export commands
  12579. @table @asis
  12580. @item @kbd{C-c C-e i t} (@code{org-texinfo-export-to-texinfo})
  12581. @kindex C-c C-e i t
  12582. @findex org-texinfo-export-to-texinfo
  12583. Export as a Texinfo file with @samp{.texi} extension. For
  12584. @samp{myfile.org}, Org exports to @samp{myfile.texi}, overwriting without
  12585. warning.
  12586. @item @kbd{C-c C-e i i} (@code{org-texinfo-export-to-info})
  12587. @kindex C-c C-e i i
  12588. @findex org-texinfo-export-to-info
  12589. @vindex org-texinfo-info-process
  12590. Export to Texinfo format first and then process it to make an
  12591. Info file. To generate other formats, such as DocBook, customize
  12592. the @code{org-texinfo-info-process} variable.
  12593. @end table
  12594. @node Texinfo specific export settings
  12595. @subsection Texinfo specific export settings
  12596. The Texinfo export back-end has several additional keywords for
  12597. customizing Texinfo output. Setting these keywords works similar to
  12598. the general options (see @ref{Export Settings}).
  12599. @table @asis
  12600. @item @samp{SUBTITLE}
  12601. @cindex @samp{SUBTITLE}, keyword
  12602. The document subtitle.
  12603. @item @samp{SUBAUTHOR}
  12604. @cindex @samp{SUBAUTHOR}, keyword
  12605. Additional authors for the document.
  12606. @item @samp{TEXINFO_FILENAME}
  12607. @cindex @samp{TEXINFO_FILENAME}, keyword
  12608. The Texinfo filename.
  12609. @item @samp{TEXINFO_CLASS}
  12610. @cindex @samp{TEXINFO_CLASS}, keyword
  12611. @vindex org-texinfo-default-class
  12612. The default document class (@code{org-texinfo-default-class}), which
  12613. must be a member of @code{org-texinfo-classes}.
  12614. @item @samp{TEXINFO_HEADER}
  12615. @cindex @samp{TEXINFO_HEADER}, keyword
  12616. Arbitrary lines inserted at the end of the header.
  12617. @item @samp{TEXINFO_POST_HEADER}
  12618. @cindex @samp{TEXINFO_POST_HEADER}, keyword
  12619. Arbitrary lines inserted after the end of the header.
  12620. @item @samp{TEXINFO_DIR_CATEGORY}
  12621. @cindex @samp{TEXINFO_DIR_CATEGORY}, keyword
  12622. The directory category of the document.
  12623. @item @samp{TEXINFO_DIR_TITLE}
  12624. @cindex @samp{TEXINFO_DIR_TITLE}, keyword
  12625. The directory title of the document.
  12626. @item @samp{TEXINFO_DIR_DESC}
  12627. @cindex @samp{TEXINFO_DIR_DESC}, keyword
  12628. The directory description of the document.
  12629. @item @samp{TEXINFO_PRINTED_TITLE}
  12630. @cindex @samp{TEXINFO_PRINTED_TITLE}, keyword
  12631. The printed title of the document.
  12632. @end table
  12633. @node Texinfo file header
  12634. @subsection Texinfo file header
  12635. @cindex @samp{TEXINFO_FILENAME}, keyword
  12636. After creating the header for a Texinfo file, the Texinfo back-end
  12637. automatically generates a name and destination path for the Info file.
  12638. To override this default with a more sensible path and name, specify
  12639. the @samp{TEXINFO_FILENAME} keyword.
  12640. @vindex org-texinfo-coding-system
  12641. @cindex @samp{TEXINFO_HEADER}, keyword
  12642. Along with the output's file name, the Texinfo header also contains
  12643. language details (see @ref{Export Settings}) and encoding system as set in
  12644. the @code{org-texinfo-coding-system} variable. Insert @samp{TEXINFO_HEADER}
  12645. keywords for each additional command in the header, for example:
  12646. @example
  12647. #+TEXINFO_HEADER: @@synindex
  12648. @end example
  12649. @cindex @samp{TEXINFO_CLASS}, keyword
  12650. @vindex org-texinfo-classes
  12651. Instead of repeatedly installing the same set of commands, define
  12652. a class in @code{org-texinfo-classes} once, and then activate it in the
  12653. document by setting the @samp{TEXINFO_CLASS} keyword to that class.
  12654. @node Texinfo title and copyright page
  12655. @subsection Texinfo title and copyright page
  12656. @cindex @samp{TEXINFO_PRINTED_TITLE}, keyword
  12657. The default template for hard copy output has a title page with
  12658. @samp{TITLE} and @samp{AUTHOR} keywords (see @ref{Export Settings}). To replace the
  12659. regular title with something different for the printed version, use
  12660. the @samp{TEXINFO_PRINTED_TITLE} and @samp{SUBTITLE} keywords. Both expect raw
  12661. Texinfo code for setting their values.
  12662. @cindex @samp{SUBAUTHOR}, keyword
  12663. If one @samp{AUTHOR} line is not sufficient, add multiple @samp{SUBAUTHOR}
  12664. keywords. They have to be set in raw Texinfo code.
  12665. @example
  12666. #+AUTHOR: Jane Smith
  12667. #+SUBAUTHOR: John Doe
  12668. #+TEXINFO_PRINTED_TITLE: This Long Title@@@@inlinefmt@{tex,@@*@} Is Broken in @@TeX@{@}
  12669. @end example
  12670. @cindex @samp{COPYING}, property
  12671. Copying material is defined in a dedicated headline with a non-@code{nil}
  12672. @samp{COPYING} property. The back-end inserts the contents within
  12673. a @samp{@@copying} command at the beginning of the document. The heading
  12674. itself does not appear in the structure of the document.
  12675. Copyright information is printed on the back of the title page.
  12676. @example
  12677. * Legalese
  12678. :PROPERTIES:
  12679. :COPYING: t
  12680. :END:
  12681. This is a short example of a complete Texinfo file, version 1.0.
  12682. Copyright \copy 2016 Free Software Foundation, Inc.
  12683. @end example
  12684. @node Info directory file
  12685. @subsection Info directory file
  12686. @cindex @samp{dir} file, in Texinfo export
  12687. @cindex Info directory file, in Texinfo export
  12688. @cindex @code{install-info}, in Texinfo export
  12689. @cindex @samp{TEXINFO_DIR_CATEGORY}, keyword
  12690. @cindex @samp{TEXINFO_DIR_TITLE}, keyword
  12691. @cindex @samp{TEXINFO_DIR_DESC}, keyword
  12692. The end result of the Texinfo export process is the creation of an
  12693. Info file. This Info file's metadata has variables for category,
  12694. title, and description: @samp{TEXINFO_DIR_CATEGORY}, @samp{TEXINFO_DIR_TITLE},
  12695. and @samp{TEXINFO_DIR_DESC} keywords that establish where in the Info
  12696. hierarchy the file fits.
  12697. Here is an example that writes to the Info directory file:
  12698. @example
  12699. #+TEXINFO_DIR_CATEGORY: Emacs
  12700. #+TEXINFO_DIR_TITLE: Org Mode: (org)
  12701. #+TEXINFO_DIR_DESC: Outline-based notes management and organizer
  12702. @end example
  12703. @node Headings and sectioning structure
  12704. @subsection Headings and sectioning structure
  12705. @vindex org-texinfo-classes
  12706. @vindex org-texinfo-default-class
  12707. @cindex @samp{TEXINFO_CLASS}, keyword
  12708. The Texinfo export back-end uses a pre-defined scheme to convert Org
  12709. headlines to equivalent Texinfo structuring commands. A scheme like
  12710. this maps top-level headlines to numbered chapters tagged as
  12711. @code{@@chapter} and lower-level headlines to unnumbered chapters tagged as
  12712. @code{@@unnumbered}. To override such mappings to introduce @code{@@part} or
  12713. other Texinfo structuring commands, define a new class in
  12714. @code{org-texinfo-classes}. Activate the new class with the
  12715. @samp{TEXINFO_CLASS} keyword. When no new class is defined and activated,
  12716. the Texinfo export back-end defaults to the
  12717. @code{org-texinfo-default-class}.
  12718. If an Org headline's level has no associated Texinfo structuring
  12719. command, or is below a certain threshold (see @ref{Export Settings}), then
  12720. the Texinfo export back-end makes it into a list item.
  12721. @cindex @samp{APPENDIX}, property
  12722. The Texinfo export back-end makes any headline with a non-@code{nil}
  12723. @samp{APPENDIX} property into an appendix. This happens independent of the
  12724. Org headline level or the @samp{TEXINFO_CLASS} keyword.
  12725. @cindex @samp{ALT_TITLE}, property
  12726. @cindex @samp{DESCRIPTION}, property
  12727. The Texinfo export back-end creates a menu entry after the Org
  12728. headline for each regular sectioning structure. To override this with
  12729. a shorter menu entry, use the @samp{ALT_TITLE} property (see @ref{Table of Contents}). Texinfo menu entries also have an option for a longer
  12730. @samp{DESCRIPTION} property. Here's an example that uses both to override
  12731. the default menu entry:
  12732. @example
  12733. * Controlling Screen Display
  12734. :PROPERTIES:
  12735. :ALT_TITLE: Display
  12736. :DESCRIPTION: Controlling Screen Display
  12737. :END:
  12738. @end example
  12739. @cindex Top node, in Texinfo export
  12740. The text before the first headline belongs to the @emph{Top} node, i.e.,
  12741. the node in which a reader enters an Info manual. As such, it is
  12742. expected not to appear in printed output generated from the @samp{.texi}
  12743. file. See @ref{The Top Node,,,texinfo,}, for more information.
  12744. @node Indices
  12745. @subsection Indices
  12746. @cindex @samp{CINDEX}, keyword
  12747. @cindex concept index, in Texinfo export
  12748. @cindex @samp{FINDEX}, keyword
  12749. @cindex function index, in Texinfo export
  12750. @cindex @samp{KINDEX}, keyword
  12751. @cindex keystroke index, in Texinfo export
  12752. @cindex @samp{PINDEX}, keyword
  12753. @cindex program index, in Texinfo export
  12754. @cindex @samp{TINDEX}, keyword
  12755. @cindex data type index, in Texinfo export
  12756. @cindex @samp{VINDEX}, keyword
  12757. @cindex variable index, in Texinfo export
  12758. The Texinfo export back-end recognizes these indexing keywords if used
  12759. in the Org file: @samp{CINDEX}, @samp{FINDEX}, @samp{KINDEX}, @samp{PINDEX}, @samp{TINDEX} and
  12760. @samp{VINDEX}. Write their value as verbatim Texinfo code; in particular,
  12761. @samp{@{}, @samp{@}} and @samp{@@} characters need to be escaped with @samp{@@} if they do not
  12762. belong to a Texinfo command.
  12763. @example
  12764. #+CINDEX: Defining indexing entries
  12765. @end example
  12766. @cindex @samp{INDEX}, property
  12767. For the back-end to generate an index entry for a headline, set the
  12768. @samp{INDEX} property to @samp{cp} or @samp{vr}. These abbreviations come from
  12769. Texinfo that stand for concept index and variable index. The Texinfo
  12770. manual has abbreviations for all other kinds of indexes. The back-end
  12771. exports the headline as an unnumbered chapter or section command, and
  12772. then inserts the index after its contents.
  12773. @example
  12774. * Concept Index
  12775. :PROPERTIES:
  12776. :INDEX: cp
  12777. :END:
  12778. @end example
  12779. @node Quoting Texinfo code
  12780. @subsection Quoting Texinfo code
  12781. Use any of the following three methods to insert or escape raw Texinfo
  12782. code:
  12783. @cindex @samp{TEXINFO}, keyword
  12784. @cindex @samp{BEGIN_EXPORT texinfo}
  12785. @example
  12786. Richard @@@@texinfo:@@sc@{@@@@Stallman@@@@texinfo:@}@@@@ commence' GNU.
  12787. #+TEXINFO: @@need800
  12788. This paragraph is preceded by...
  12789. #+BEGIN_EXPORT texinfo
  12790. @@auindex Johnson, Mark
  12791. @@auindex Lakoff, George
  12792. #+END_EXPORT
  12793. @end example
  12794. @node Plain lists in Texinfo export
  12795. @subsection Plain lists in Texinfo export
  12796. @cindex @samp{ATTR_TEXINFO}, keyword
  12797. @cindex two-column tables, in Texinfo export
  12798. @cindex table types, in Texinfo export
  12799. The Texinfo export back-end by default converts description lists in
  12800. the Org file using the default command @samp{@@table}, which results in
  12801. a table with two columns. To change this behavior, specify
  12802. @samp{:table-type} with @samp{ftable} or @samp{vtable} attributes. For more
  12803. information, see @ref{Two-column Tables,,,texinfo,}.
  12804. @vindex org-texinfo-table-default-markup
  12805. The Texinfo export back-end by default also applies a text highlight
  12806. based on the defaults stored in @code{org-texinfo-table-default-markup}.
  12807. To override the default highlight command, specify another one with
  12808. the @samp{:indic} attribute.
  12809. @cindex multiple items in Texinfo lists
  12810. Org syntax is limited to one entry per list item. Nevertheless, the
  12811. Texinfo export back-end can split that entry according to any text
  12812. provided through the @samp{:sep} attribute. Each part then becomes a new
  12813. entry in the first column of the table.
  12814. The following example illustrates all the attributes above:
  12815. @example
  12816. #+ATTR_TEXINFO: :table-type vtable :sep , :indic asis
  12817. - foo, bar :: This is the common text for variables foo and bar.
  12818. @end example
  12819. @noindent
  12820. becomes
  12821. @example
  12822. @@vtable @@asis
  12823. @@item foo
  12824. @@itemx bar
  12825. This is the common text for variables foo and bar.
  12826. @@end table
  12827. @end example
  12828. @node Tables in Texinfo export
  12829. @subsection Tables in Texinfo export
  12830. @cindex @samp{ATTR_TEXINFO}, keyword
  12831. When exporting tables, the Texinfo export back-end uses the widest
  12832. cell width in each column. To override this and instead specify as
  12833. fractions of line length, use the @samp{:columns} attribute. See example
  12834. below.
  12835. @example
  12836. #+ATTR_TEXINFO: :columns .5 .5
  12837. | a cell | another cell |
  12838. @end example
  12839. @node Images in Texinfo export
  12840. @subsection Images in Texinfo export
  12841. @cindex @samp{ATTR_TEXINFO}, keyword
  12842. Insert a file link to the image in the Org file, and the Texinfo
  12843. export back-end inserts the image. These links must have the usual
  12844. supported image extensions and no descriptions. To scale the image,
  12845. use @samp{:width} and @samp{:height} attributes. For alternate text, use @samp{:alt}
  12846. and specify the text using Texinfo code, as shown in the example:
  12847. @example
  12848. #+ATTR_TEXINFO: :width 1in :alt Alternate @@i@{text@}
  12849. [[ridt.pdf]]
  12850. @end example
  12851. @node Special blocks in Texinfo export
  12852. @subsection Special blocks in Texinfo export
  12853. @cindex @samp{ATTR_TEXINFO}, keyword
  12854. The Texinfo export back-end converts special blocks to commands with
  12855. the same name. It also adds any @samp{:options} attributes to the end of
  12856. the command, as shown in this example:
  12857. @example
  12858. #+ATTR_TEXINFO: :options org-org-export-to-org ...
  12859. #+BEGIN_defun
  12860. A somewhat obsessive function name.
  12861. #+END_defun
  12862. @end example
  12863. @noindent
  12864. becomes
  12865. @example
  12866. @@defun org-org-export-to-org ...
  12867. A somewhat obsessive function name.
  12868. @@end defun
  12869. @end example
  12870. @node A Texinfo example
  12871. @subsection A Texinfo example
  12872. Here is a more detailed example Org file. See
  12873. @ref{GNU Sample Texts,,,texinfo,} for an equivalent example using
  12874. Texinfo code.
  12875. @example
  12876. #+TITLE: GNU Sample @{@{@{version@}@}@}
  12877. #+SUBTITLE: for version @{@{@{version@}@}@}, @{@{@{updated@}@}@}
  12878. #+AUTHOR: A.U. Thor
  12879. #+EMAIL: bug-sample@@gnu.org
  12880. #+OPTIONS: ':t toc:t author:t email:t
  12881. #+LANGUAGE: en
  12882. #+MACRO: version 2.0
  12883. #+MACRO: updated last updated 4 March 2014
  12884. #+TEXINFO_FILENAME: sample.info
  12885. #+TEXINFO_HEADER: @@syncodeindex pg cp
  12886. #+TEXINFO_DIR_CATEGORY: Texinfo documentation system
  12887. #+TEXINFO_DIR_TITLE: sample: (sample)
  12888. #+TEXINFO_DIR_DESC: Invoking sample
  12889. #+TEXINFO_PRINTED_TITLE: GNU Sample
  12890. This manual is for GNU Sample (version @{@{@{version@}@}@},
  12891. @{@{@{updated@}@}@}).
  12892. * Copying
  12893. :PROPERTIES:
  12894. :COPYING: t
  12895. :END:
  12896. This manual is for GNU Sample (version @{@{@{version@}@}@},
  12897. @{@{@{updated@}@}@}), which is an example in the Texinfo documentation.
  12898. Copyright \copy 2016 Free Software Foundation, Inc.
  12899. #+BEGIN_QUOTE
  12900. Permission is granted to copy, distribute and/or modify this
  12901. document under the terms of the GNU Free Documentation License,
  12902. Version 1.3 or any later version published by the Free Software
  12903. Foundation; with no Invariant Sections, with no Front-Cover Texts,
  12904. and with no Back-Cover Texts. A copy of the license is included in
  12905. the section entitled "GNU Free Documentation License".
  12906. #+END_QUOTE
  12907. * Invoking sample
  12908. #+PINDEX: sample
  12909. #+CINDEX: invoking @@command@{sample@}
  12910. This is a sample manual. There is no sample program to invoke, but
  12911. if there were, you could see its basic usage and command line
  12912. options here.
  12913. * GNU Free Documentation License
  12914. :PROPERTIES:
  12915. :APPENDIX: t
  12916. :END:
  12917. #+TEXINFO: @@include fdl.texi
  12918. * Index
  12919. :PROPERTIES:
  12920. :INDEX: cp
  12921. :END:
  12922. @end example
  12923. @node iCalendar Export
  12924. @section iCalendar Export
  12925. @cindex iCalendar export
  12926. A large part of Org mode's interoperability success is its ability to
  12927. easily export to or import from external applications. The iCalendar
  12928. export back-end takes calendar data from Org files and exports to the
  12929. standard iCalendar format.
  12930. @vindex org-icalendar-include-todo
  12931. @vindex org-icalendar-use-deadline
  12932. @vindex org-icalendar-use-scheduled
  12933. The iCalendar export back-end can also incorporate TODO entries based
  12934. on the configuration of the @code{org-icalendar-include-todo} variable.
  12935. The back-end exports plain timestamps as @samp{VEVENT}, TODO items as
  12936. @samp{VTODO}, and also create events from deadlines that are in non-TODO
  12937. items. The back-end uses the deadlines and scheduling dates in Org
  12938. TODO items for setting the start and due dates for the iCalendar TODO
  12939. entry. Consult the @code{org-icalendar-use-deadline} and
  12940. @code{org-icalendar-use-scheduled} variables for more details.
  12941. @vindex org-icalendar-categories
  12942. @vindex org-icalendar-alarm-time
  12943. For tags on the headline, the iCalendar export back-end makes them
  12944. into iCalendar categories. To tweak the inheritance of tags and TODO
  12945. states, configure the variable @code{org-icalendar-categories}. To assign
  12946. clock alarms based on time, configure the @code{org-icalendar-alarm-time}
  12947. variable.
  12948. @vindex org-icalendar-store-UID
  12949. @cindex @samp{ID}, property
  12950. The iCalendar format standard requires globally unique identifier---or
  12951. UID---for each entry. The iCalendar export back-end creates UIDs
  12952. during export. To save a copy of the UID in the Org file set the
  12953. variable @code{org-icalendar-store-UID}. The back-end looks for the @samp{ID}
  12954. property of the entry for re-using the same UID for subsequent
  12955. exports.
  12956. Since a single Org entry can result in multiple iCalendar
  12957. entries---timestamp, deadline, scheduled item, or TODO item---Org adds
  12958. prefixes to the UID, depending on which part of the Org entry
  12959. triggered the creation of the iCalendar entry. Prefixing ensures UIDs
  12960. remains unique, yet enable synchronization programs trace the
  12961. connections.
  12962. @table @asis
  12963. @item @kbd{C-c C-e c f} (@code{org-icalendar-export-to-ics})
  12964. @kindex C-c C-e c f
  12965. @findex org-icalendar-export-to-ics
  12966. Create iCalendar entries from the current Org buffer and store
  12967. them in the same directory, using a file extension @samp{.ics}.
  12968. @item @kbd{C-c C-e c a} (@code{org-icalendar-export-agenda-files})
  12969. @kindex C-c C-e c a
  12970. @findex org-icalendar-export-agenda-files
  12971. Create iCalendar entries from Org files in @code{org-agenda-files} and
  12972. store in a separate iCalendar file for each Org file.
  12973. @item @kbd{C-c C-e c c} (@code{org-icalendar-combine-agenda-files})
  12974. @kindex C-c C-e c c
  12975. @findex org-icalendar-combine-agenda-files
  12976. @vindex org-icalendar-combined-agenda-file
  12977. Create a combined iCalendar file from Org files in
  12978. @code{org-agenda-files} and write it to
  12979. @code{org-icalendar-combined-agenda-file} file name.
  12980. @end table
  12981. @cindex @samp{SUMMARY}, property
  12982. @cindex @samp{DESCRIPTION}, property
  12983. @cindex @samp{LOCATION}, property
  12984. @cindex @samp{TIMEZONE}, property
  12985. The iCalendar export back-end includes @samp{SUMMARY}, @samp{DESCRIPTION},
  12986. @samp{LOCATION} and @samp{TIMEZONE} properties from the Org entries when
  12987. exporting. To force the back-end to inherit the @samp{LOCATION} and
  12988. @samp{TIMEZONE} properties, configure the @code{org-use-property-inheritance}
  12989. variable.
  12990. @vindex org-icalendar-include-body
  12991. When Org entries do not have @samp{SUMMARY}, @samp{DESCRIPTION} and @samp{LOCATION}
  12992. properties, the iCalendar export back-end derives the summary from the
  12993. headline, and derives the description from the body of the Org item.
  12994. The @code{org-icalendar-include-body} variable limits the maximum number of
  12995. characters of the content are turned into its description.
  12996. The @samp{TIMEZONE} property can be used to specify a per-entry time zone,
  12997. and is applied to any entry with timestamp information. Time zones
  12998. should be specified as per the IANA time zone database format, e.g.,
  12999. @samp{Asia/Almaty}. Alternately, the property value can be @samp{UTC}, to force
  13000. UTC time for this entry only.
  13001. Exporting to iCalendar format depends in large part on the
  13002. capabilities of the destination application. Some are more lenient
  13003. than others. Consult the Org mode FAQ for advice on specific
  13004. applications.
  13005. @node Other Built-in Back-ends
  13006. @section Other Built-in Back-ends
  13007. Other export back-ends included with Org are:
  13008. @itemize
  13009. @item
  13010. @samp{ox-man.el}: Export to a man page.
  13011. @end itemize
  13012. To activate such back-ends, either customize @code{org-export-backends} or
  13013. load directly with @code{(require 'ox-man)}. On successful load, the
  13014. back-end adds new keys in the export dispatcher (see @ref{The Export Dispatcher}).
  13015. Follow the comment section of such files, for example, @samp{ox-man.el},
  13016. for usage and configuration details.
  13017. @node Advanced Configuration
  13018. @section Advanced Configuration
  13019. @anchor{Hooks}
  13020. @subheading Hooks
  13021. @vindex org-export-before-processing-hook
  13022. @vindex org-export-before-parsing-hook
  13023. The export process executes two hooks before the actual exporting
  13024. begins. The first hook, @code{org-export-before-processing-hook}, runs
  13025. before any expansions of macros, Babel code, and include keywords in
  13026. the buffer. The second hook, @code{org-export-before-parsing-hook}, runs
  13027. before the buffer is parsed.
  13028. Functions added to these hooks are called with a single argument: the
  13029. export back-end actually used, as a symbol. You may use them for
  13030. heavy duty structural modifications of the document. For example, you
  13031. can remove every headline in the buffer during export like this:
  13032. @lisp
  13033. (defun my-headline-removal (backend)
  13034. "Remove all headlines in the current buffer.
  13035. BACKEND is the export back-end being used, as a symbol."
  13036. (org-map-entries
  13037. (lambda () (delete-region (point) (line-beginning-position 2)))))
  13038. (add-hook 'org-export-before-parsing-hook 'my-headline-removal)
  13039. @end lisp
  13040. @anchor{Filters}
  13041. @subheading Filters
  13042. @cindex Filters, exporting
  13043. Filters are lists of functions to be applied to certain parts for
  13044. a given back-end. The output from the first function in the filter is
  13045. passed on to the next function in the filter. The final output is the
  13046. output from the final function in the filter.
  13047. The Org export process has many filter sets applicable to different
  13048. types of objects, plain text, parse trees, export options, and final
  13049. output formats. The filters are named after the element type or
  13050. object type: @code{org-export-filter-TYPE-functions}, where @var{TYPE}
  13051. is the type targeted by the filter. Valid types are:
  13052. @multitable @columnfractions 0.33 0.33 0.33
  13053. @item body
  13054. @tab bold
  13055. @tab babel-call
  13056. @item center-block
  13057. @tab clock
  13058. @tab code
  13059. @item diary-sexp
  13060. @tab drawer
  13061. @tab dynamic-block
  13062. @item entity
  13063. @tab example-block
  13064. @tab export-block
  13065. @item export-snippet
  13066. @tab final-output
  13067. @tab fixed-width
  13068. @item footnote-definition
  13069. @tab footnote-reference
  13070. @tab headline
  13071. @item horizontal-rule
  13072. @tab inline-babel-call
  13073. @tab inline-src-block
  13074. @item inlinetask
  13075. @tab italic
  13076. @tab item
  13077. @item keyword
  13078. @tab latex-environment
  13079. @tab latex-fragment
  13080. @item line-break
  13081. @tab link
  13082. @tab node-property
  13083. @item options
  13084. @tab paragraph
  13085. @tab parse-tree
  13086. @item plain-list
  13087. @tab plain-text
  13088. @tab planning
  13089. @item property-drawer
  13090. @tab quote-block
  13091. @tab radio-target
  13092. @item section
  13093. @tab special-block
  13094. @tab src-block
  13095. @item statistics-cookie
  13096. @tab strike-through
  13097. @tab subscript
  13098. @item superscript
  13099. @tab table
  13100. @tab table-cell
  13101. @item table-row
  13102. @tab target
  13103. @tab timestamp
  13104. @item underline
  13105. @tab verbatim
  13106. @tab verse-block
  13107. @end multitable
  13108. Here is an example filter that replaces non-breaking spaces @code{ } in the
  13109. Org buffer with @samp{~} for the @LaTeX{} back-end.
  13110. @lisp
  13111. (defun my-latex-filter-nobreaks (text backend info)
  13112. "Ensure \" \" are properly handled in LaTeX export."
  13113. (when (org-export-derived-backend-p backend 'latex)
  13114. (replace-regexp-in-string " " "~" text)))
  13115. (add-to-list 'org-export-filter-plain-text-functions
  13116. 'my-latex-filter-nobreaks)
  13117. @end lisp
  13118. A filter requires three arguments: the code to be transformed, the
  13119. name of the back-end, and some optional information about the export
  13120. process. The third argument can be safely ignored. Note the use of
  13121. @code{org-export-derived-backend-p} predicate that tests for @emph{latex}
  13122. back-end or any other back-end, such as @emph{beamer}, derived from
  13123. @emph{latex}.
  13124. @anchor{Defining filters for individual files}
  13125. @subheading Defining filters for individual files
  13126. The Org export can filter not just for back-ends, but also for
  13127. specific files through the @samp{BIND} keyword. Here is an example with
  13128. two filters; one removes brackets from time stamps, and the other
  13129. removes strike-through text. The filter functions are defined in
  13130. a code block in the same Org file, which is a handy location for
  13131. debugging.
  13132. @example
  13133. #+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
  13134. #+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
  13135. #+BEGIN_SRC emacs-lisp :exports results :results none
  13136. (defun tmp-f-timestamp (s backend info)
  13137. (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
  13138. (defun tmp-f-strike-through (s backend info) "")
  13139. #+END_SRC
  13140. @end example
  13141. @anchor{Extending an existing back-end}
  13142. @subheading Extending an existing back-end
  13143. Some parts of the conversion process can be extended for certain
  13144. elements so as to introduce a new or revised translation. That is how
  13145. the HTML export back-end was extended to handle Markdown format. The
  13146. extensions work seamlessly so any aspect of filtering not done by the
  13147. extended back-end is handled by the original back-end. Of all the
  13148. export customization in Org, extending is very powerful as it operates
  13149. at the parser level.
  13150. For this example, make the @emph{ascii} back-end display the language used
  13151. in a source code block. Also make it display only when some attribute
  13152. is non-@code{nil}, like the following:
  13153. @example
  13154. #+ATTR_ASCII: :language t
  13155. @end example
  13156. Then extend ASCII back-end with a custom ``my-ascii'' back-end.
  13157. @lisp
  13158. (defun my-ascii-src-block (src-block contents info)
  13159. "Transcode a SRC-BLOCK element from Org to ASCII.
  13160. CONTENTS is nil. INFO is a plist used as a communication
  13161. channel."
  13162. (if (not (org-export-read-attribute :attr_ascii src-block :language))
  13163. (org-export-with-backend 'ascii src-block contents info)
  13164. (concat
  13165. (format ",--[ %s ]--\n%s`----"
  13166. (org-element-property :language src-block)
  13167. (replace-regexp-in-string
  13168. "^" "| "
  13169. (org-element-normalize-string
  13170. (org-export-format-code-default src-block info)))))))
  13171. (org-export-define-derived-backend 'my-ascii 'ascii
  13172. :translate-alist '((src-block . my-ascii-src-block)))
  13173. @end lisp
  13174. The @code{my-ascii-src-block} function looks at the attribute above the
  13175. current element. If not true, hands over to @emph{ascii} back-end. If
  13176. true, which it is in this example, it creates a box around the code
  13177. and leaves room for the inserting a string for language. The last
  13178. form creates the new back-end that springs to action only when
  13179. translating @code{src-block} type elements.
  13180. To use the newly defined back-end, evaluate the following from an Org
  13181. buffer:
  13182. @lisp
  13183. (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*")
  13184. @end lisp
  13185. Further steps to consider would be an interactive function,
  13186. self-installing an item in the export dispatcher menu, and other
  13187. user-friendly improvements.
  13188. @node Export in Foreign Buffers
  13189. @section Export in Foreign Buffers
  13190. The export back-ends in Org often include commands to convert selected
  13191. regions. A convenient feature of this in-place conversion is that the
  13192. exported output replaces the original source. Here are such
  13193. functions:
  13194. @table @asis
  13195. @item @code{org-html-convert-region-to-html}
  13196. @findex org-html-convert-region-to-html
  13197. Convert the selected region into HTML.
  13198. @item @code{org-latex-convert-region-to-latex}
  13199. @findex org-latex-convert-region-to-latex
  13200. Convert the selected region into @LaTeX{}.
  13201. @item @code{org-texinfo-convert-region-to-texinfo}
  13202. @findex org-texinfo-convert-region-to-texinfo
  13203. Convert the selected region into Texinfo.
  13204. @item @code{org-md-convert-region-to-md}
  13205. @findex org-md-convert-region-to-md
  13206. Convert the selected region into Markdown.
  13207. @end table
  13208. In-place conversions are particularly handy for quick conversion of
  13209. tables and lists in foreign buffers. For example, turn on the minor
  13210. mode @kbd{M-x orgstruct-mode} in an HTML buffer, then use the
  13211. convenient Org keyboard commands to create a list, select it, and
  13212. covert it to HTML with @kbd{M-x org-html-convert-region-to-html}.
  13213. @node Publishing
  13214. @chapter Publishing
  13215. @cindex publishing
  13216. Org includes a publishing management system that allows you to
  13217. configure automatic HTML conversion of @emph{projects} composed of
  13218. interlinked Org files. You can also configure Org to automatically
  13219. upload your exported HTML pages and related attachments, such as
  13220. images and source code files, to a web server.
  13221. You can also use Org to convert files into PDF, or even combine HTML
  13222. and PDF conversion so that files are available in both formats on the
  13223. server.
  13224. Publishing has been contributed to Org by David O'Toole.
  13225. @menu
  13226. * Configuration:: Defining projects.
  13227. * Uploading Files:: How to get files up on the server.
  13228. * Sample Configuration:: Example projects.
  13229. * Triggering Publication:: Publication commands.
  13230. @end menu
  13231. @node Configuration
  13232. @section Configuration
  13233. Publishing needs significant configuration to specify files,
  13234. destination and many other properties of a project.
  13235. @menu
  13236. * Project alist:: The central configuration variable.
  13237. * Sources and destinations:: From here to there.
  13238. * Selecting files:: What files are part of the project?
  13239. * Publishing action:: Setting the function doing the publishing.
  13240. * Publishing options:: Tweaking HTML/@LaTeX{} export.
  13241. * Publishing links:: Which links keep working after publishing?
  13242. * Site map:: Generating a list of all pages.
  13243. * Generating an index:: An index that reaches across pages.
  13244. @end menu
  13245. @node Project alist
  13246. @subsection The variable @code{org-publish-project-alist}
  13247. @cindex projects, for publishing
  13248. @vindex org-publish-project-alist
  13249. Publishing is configured almost entirely through setting the value of
  13250. one variable, called @code{org-publish-project-alist}. Each element of the
  13251. list configures one project, and may be in one of the two following
  13252. forms:
  13253. @lisp
  13254. ("project-name" :property value :property value ...)
  13255. @end lisp
  13256. @noindent
  13257. i.e., a well-formed property list with alternating keys and values,
  13258. or:
  13259. @lisp
  13260. ("project-name" :components ("project-name" "project-name" ...))
  13261. @end lisp
  13262. In both cases, projects are configured by specifying property values.
  13263. A project defines the set of files that are to be published, as well
  13264. as the publishing configuration to use when publishing those files.
  13265. When a project takes the second form listed above, the individual
  13266. members of the @code{:components} property are taken to be sub-projects,
  13267. which group together files requiring different publishing options.
  13268. When you publish such a ``meta-project'', all the components are also
  13269. published, in the sequence given.
  13270. @node Sources and destinations
  13271. @subsection Sources and destinations for files
  13272. @cindex directories, for publishing
  13273. Most properties are optional, but some should always be set. In
  13274. particular, Org needs to know where to look for source files, and
  13275. where to put published files.
  13276. @table @asis
  13277. @item @code{:base-directory}
  13278. Directory containing publishing source files.
  13279. @item @code{:publishing-directory}
  13280. Directory where output files are published. You can directly
  13281. publish to a webserver using a file name syntax appropriate for
  13282. the Emacs tramp package. Or you can publish to a local directory
  13283. and use external tools to upload your website (see @ref{Uploading Files}).
  13284. @item @code{:preparation-function}
  13285. Function or list of functions to be called before starting the
  13286. publishing process, for example, to run @samp{make} for updating files
  13287. to be published. Each preparation function is called with
  13288. a single argument, the project property list.
  13289. @item @code{:completion-function}
  13290. Function or list of functions called after finishing the
  13291. publishing process, for example, to change permissions of the
  13292. resulting files. Each completion function is called with
  13293. a single argument, the project property list.
  13294. @end table
  13295. @node Selecting files
  13296. @subsection Selecting files
  13297. @cindex files, selecting for publishing
  13298. By default, all files with extension @samp{.org} in the base directory are
  13299. considered part of the project. This can be modified by setting the
  13300. following properties
  13301. @table @asis
  13302. @item @code{:base-extension}
  13303. Extension---without the dot---of source files. This actually
  13304. is a regular expression. Set this to the symbol @code{any} if you
  13305. want to get all files in @code{:base-directory}, even without
  13306. extension.
  13307. @item @code{:exclude}
  13308. Regular expression to match file names that should not be published,
  13309. even though they have been selected on the basis of their extension.
  13310. @item @code{:include}
  13311. List of files to be included regardless of @code{:base-extension} and
  13312. @code{:exclude}.
  13313. @item @code{:recursive}
  13314. Non-@code{nil} means, check base-directory recursively for files to
  13315. publish.
  13316. @end table
  13317. @node Publishing action
  13318. @subsection Publishing action
  13319. @cindex action, for publishing
  13320. Publishing means that a file is copied to the destination directory
  13321. and possibly transformed in the process. The default transformation
  13322. is to export Org files as HTML files, and this is done by the function
  13323. @code{org-publish-org-to-html} which calls the HTML exporter (see @ref{HTML Export}). But you can also publish your content as PDF files using
  13324. @code{org-publish-org-to-pdf}, or as ASCII, Texinfo, etc., using the
  13325. corresponding functions.
  13326. If you want to publish the Org file as an @samp{.org} file but with
  13327. @emph{archived}, @emph{commented}, and @emph{tag-excluded} trees removed, use
  13328. @code{org-publish-org-to-org}. This produces @samp{file.org} and put it in the
  13329. publishing directory. If you want a htmlized version of this file,
  13330. set the parameter @code{:htmlized-source} to @code{t}. It produces
  13331. @samp{file.org.html} in the publishing directory@footnote{If the publishing directory is the same as the source
  13332. directory, @samp{file.org} is exported as @samp{file.org.org}, so you probably
  13333. do not want to do this.}.
  13334. Other files like images only need to be copied to the publishing
  13335. destination; for this you can use @code{org-publish-attachment}. For
  13336. non-Org files, you always need to specify the publishing function:
  13337. @table @asis
  13338. @item @code{:publishing-function}
  13339. Function executing the publication of a file. This may also be
  13340. a list of functions, which are all called in turn.
  13341. @item @code{:plain-source}
  13342. Non-@code{nil} means, publish plain source.
  13343. @item @code{:htmlized-source}
  13344. Non-@code{nil} means, publish htmlized source.
  13345. @end table
  13346. The function must accept three arguments: a property list containing
  13347. at least a @code{:publishing-directory} property, the name of the file to
  13348. be published, and the path to the publishing directory of the output
  13349. file. It should take the specified file, make the necessary
  13350. transformation, if any, and place the result into the destination
  13351. folder.
  13352. @node Publishing options
  13353. @subsection Options for the exporters
  13354. @cindex options, for publishing
  13355. @cindex publishing options
  13356. The property list can be used to set many export options for the HTML
  13357. and @LaTeX{} exporters. In most cases, these properties correspond to
  13358. user variables in Org. The table below lists these properties along
  13359. with the variable they belong to. See the documentation string for
  13360. the respective variable for details.
  13361. @vindex org-publish-project-alist
  13362. When a property is given a value in @code{org-publish-project-alist}, its
  13363. setting overrides the value of the corresponding user variable, if
  13364. any, during publishing. Options set within a file (see @ref{Export Settings}), however, override everything.
  13365. @anchor{Generic properties}
  13366. @subsubheading Generic properties
  13367. @multitable {aaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13368. @item @code{:archived-trees}
  13369. @tab @code{org-export-with-archived-trees}
  13370. @item @code{:exclude-tags}
  13371. @tab @code{org-export-exclude-tags}
  13372. @item @code{:headline-levels}
  13373. @tab @code{org-export-headline-levels}
  13374. @item @code{:language}
  13375. @tab @code{org-export-default-language}
  13376. @item @code{:preserve-breaks}
  13377. @tab @code{org-export-preserve-breaks}
  13378. @item @code{:section-numbers}
  13379. @tab @code{org-export-with-section-numbers}
  13380. @item @code{:select-tags}
  13381. @tab @code{org-export-select-tags}
  13382. @item @code{:with-author}
  13383. @tab @code{org-export-with-author}
  13384. @item @code{:with-broken-links}
  13385. @tab @code{org-export-with-broken-links}
  13386. @item @code{:with-clocks}
  13387. @tab @code{org-export-with-clocks}
  13388. @item @code{:with-creator}
  13389. @tab @code{org-export-with-creator}
  13390. @item @code{:with-date}
  13391. @tab @code{org-export-with-date}
  13392. @item @code{:with-drawers}
  13393. @tab @code{org-export-with-drawers}
  13394. @item @code{:with-email}
  13395. @tab @code{org-export-with-email}
  13396. @item @code{:with-emphasize}
  13397. @tab @code{org-export-with-emphasize}
  13398. @item @code{:with-fixed-width}
  13399. @tab @code{org-export-with-fixed-width}
  13400. @item @code{:with-footnotes}
  13401. @tab @code{org-export-with-footnotes}
  13402. @item @code{:with-latex}
  13403. @tab @code{org-export-with-latex}
  13404. @item @code{:with-planning}
  13405. @tab @code{org-export-with-planning}
  13406. @item @code{:with-priority}
  13407. @tab @code{org-export-with-priority}
  13408. @item @code{:with-properties}
  13409. @tab @code{org-export-with-properties}
  13410. @item @code{:with-special-strings}
  13411. @tab @code{org-export-with-special-strings}
  13412. @item @code{:with-sub-superscript}
  13413. @tab @code{org-export-with-sub-superscripts}
  13414. @item @code{:with-tables}
  13415. @tab @code{org-export-with-tables}
  13416. @item @code{:with-tags}
  13417. @tab @code{org-export-with-tags}
  13418. @item @code{:with-tasks}
  13419. @tab @code{org-export-with-tasks}
  13420. @item @code{:with-timestamps}
  13421. @tab @code{org-export-with-timestamps}
  13422. @item @code{:with-title}
  13423. @tab @code{org-export-with-title}
  13424. @item @code{:with-toc}
  13425. @tab @code{org-export-with-toc}
  13426. @item @code{:with-todo-keywords}
  13427. @tab @code{org-export-with-todo-keywords}
  13428. @end multitable
  13429. @anchor{ASCII specific properties}
  13430. @subsubheading ASCII specific properties
  13431. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13432. @item @code{:ascii-bullets}
  13433. @tab @code{org-ascii-bullets}
  13434. @item @code{:ascii-caption-above}
  13435. @tab @code{org-ascii-caption-above}
  13436. @item @code{:ascii-charset}
  13437. @tab @code{org-ascii-charset}
  13438. @item @code{:ascii-global-margin}
  13439. @tab @code{org-ascii-global-margin}
  13440. @item @code{:ascii-format-drawer-function}
  13441. @tab @code{org-ascii-format-drawer-function}
  13442. @item @code{:ascii-format-inlinetask-function}
  13443. @tab @code{org-ascii-format-inlinetask-function}
  13444. @item @code{:ascii-headline-spacing}
  13445. @tab @code{org-ascii-headline-spacing}
  13446. @item @code{:ascii-indented-line-width}
  13447. @tab @code{org-ascii-indented-line-width}
  13448. @item @code{:ascii-inlinetask-width}
  13449. @tab @code{org-ascii-inlinetask-width}
  13450. @item @code{:ascii-inner-margin}
  13451. @tab @code{org-ascii-inner-margin}
  13452. @item @code{:ascii-links-to-notes}
  13453. @tab @code{org-ascii-links-to-notes}
  13454. @item @code{:ascii-list-margin}
  13455. @tab @code{org-ascii-list-margin}
  13456. @item @code{:ascii-paragraph-spacing}
  13457. @tab @code{org-ascii-paragraph-spacing}
  13458. @item @code{:ascii-quote-margin}
  13459. @tab @code{org-ascii-quote-margin}
  13460. @item @code{:ascii-table-keep-all-vertical-lines}
  13461. @tab @code{org-ascii-table-keep-all-vertical-lines}
  13462. @item @code{:ascii-table-use-ascii-art}
  13463. @tab @code{org-ascii-table-use-ascii-art}
  13464. @item @code{:ascii-table-widen-columns}
  13465. @tab @code{org-ascii-table-widen-columns}
  13466. @item @code{:ascii-text-width}
  13467. @tab @code{org-ascii-text-width}
  13468. @item @code{:ascii-underline}
  13469. @tab @code{org-ascii-underline}
  13470. @item @code{:ascii-verbatim-format}
  13471. @tab @code{org-ascii-verbatim-format}
  13472. @end multitable
  13473. @anchor{Beamer specific properties}
  13474. @subsubheading Beamer specific properties
  13475. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13476. @item @code{:beamer-theme}
  13477. @tab @code{org-beamer-theme}
  13478. @item @code{:beamer-column-view-format}
  13479. @tab @code{org-beamer-column-view-format}
  13480. @item @code{:beamer-environments-extra}
  13481. @tab @code{org-beamer-environments-extra}
  13482. @item @code{:beamer-frame-default-options}
  13483. @tab @code{org-beamer-frame-default-options}
  13484. @item @code{:beamer-outline-frame-options}
  13485. @tab @code{org-beamer-outline-frame-options}
  13486. @item @code{:beamer-outline-frame-title}
  13487. @tab @code{org-beamer-outline-frame-title}
  13488. @item @code{:beamer-subtitle-format}
  13489. @tab @code{org-beamer-subtitle-format}
  13490. @end multitable
  13491. @anchor{HTML specific properties}
  13492. @subsubheading HTML specific properties
  13493. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13494. @item @code{:html-allow-name-attribute-in-anchors}
  13495. @tab @code{org-html-allow-name-attribute-in-anchors}
  13496. @item @code{:html-checkbox-type}
  13497. @tab @code{org-html-checkbox-type}
  13498. @item @code{:html-container}
  13499. @tab @code{org-html-container-element}
  13500. @item @code{:html-divs}
  13501. @tab @code{org-html-divs}
  13502. @item @code{:html-doctype}
  13503. @tab @code{org-html-doctype}
  13504. @item @code{:html-extension}
  13505. @tab @code{org-html-extension}
  13506. @item @code{:html-footnote-format}
  13507. @tab @code{org-html-footnote-format}
  13508. @item @code{:html-footnote-separator}
  13509. @tab @code{org-html-footnote-separator}
  13510. @item @code{:html-footnotes-section}
  13511. @tab @code{org-html-footnotes-section}
  13512. @item @code{:html-format-drawer-function}
  13513. @tab @code{org-html-format-drawer-function}
  13514. @item @code{:html-format-headline-function}
  13515. @tab @code{org-html-format-headline-function}
  13516. @item @code{:html-format-inlinetask-function}
  13517. @tab @code{org-html-format-inlinetask-function}
  13518. @item @code{:html-head-extra}
  13519. @tab @code{org-html-head-extra}
  13520. @item @code{:html-head-include-default-style}
  13521. @tab @code{org-html-head-include-default-style}
  13522. @item @code{:html-head-include-scripts}
  13523. @tab @code{org-html-head-include-scripts}
  13524. @item @code{:html-head}
  13525. @tab @code{org-html-head}
  13526. @item @code{:html-home/up-format}
  13527. @tab @code{org-html-home/up-format}
  13528. @item @code{:html-html5-fancy}
  13529. @tab @code{org-html-html5-fancy}
  13530. @item @code{:html-indent}
  13531. @tab @code{org-html-indent}
  13532. @item @code{:html-infojs-options}
  13533. @tab @code{org-html-infojs-options}
  13534. @item @code{:html-infojs-template}
  13535. @tab @code{org-html-infojs-template}
  13536. @item @code{:html-inline-image-rules}
  13537. @tab @code{org-html-inline-image-rules}
  13538. @item @code{:html-inline-images}
  13539. @tab @code{org-html-inline-images}
  13540. @item @code{:html-link-home}
  13541. @tab @code{org-html-link-home}
  13542. @item @code{:html-link-org-files-as-html}
  13543. @tab @code{org-html-link-org-files-as-html}
  13544. @item @code{:html-link-up}
  13545. @tab @code{org-html-link-up}
  13546. @item @code{:html-link-use-abs-url}
  13547. @tab @code{org-html-link-use-abs-url}
  13548. @item @code{:html-mathjax-options}
  13549. @tab @code{org-html-mathjax-options}
  13550. @item @code{:html-mathjax-template}
  13551. @tab @code{org-html-mathjax-template}
  13552. @item @code{:html-metadata-timestamp-format}
  13553. @tab @code{org-html-metadata-timestamp-format}
  13554. @item @code{:html-postamble-format}
  13555. @tab @code{org-html-postamble-format}
  13556. @item @code{:html-postamble}
  13557. @tab @code{org-html-postamble}
  13558. @item @code{:html-preamble-format}
  13559. @tab @code{org-html-preamble-format}
  13560. @item @code{:html-preamble}
  13561. @tab @code{org-html-preamble}
  13562. @item @code{:html-table-align-individual-field}
  13563. @tab @code{de@{org-html-table-align-individual-fields}
  13564. @item @code{:html-table-attributes}
  13565. @tab @code{org-html-table-default-attributes}
  13566. @item @code{:html-table-caption-above}
  13567. @tab @code{org-html-table-caption-above}
  13568. @item @code{:html-table-data-tags}
  13569. @tab @code{org-html-table-data-tags}
  13570. @item @code{:html-table-header-tags}
  13571. @tab @code{org-html-table-header-tags}
  13572. @item @code{:html-table-row-tags}
  13573. @tab @code{org-html-table-row-tags}
  13574. @item @code{:html-table-use-header-tags-for-first-column}
  13575. @tab @code{org-html-table-use-header-tags-for-first-column}
  13576. @item @code{:html-tag-class-prefix}
  13577. @tab @code{org-html-tag-class-prefix}
  13578. @item @code{:html-text-markup-alist}
  13579. @tab @code{org-html-text-markup-alist}
  13580. @item @code{:html-todo-kwd-class-prefix}
  13581. @tab @code{org-html-todo-kwd-class-prefix}
  13582. @item @code{:html-toplevel-hlevel}
  13583. @tab @code{org-html-toplevel-hlevel}
  13584. @item @code{:html-use-infojs}
  13585. @tab @code{org-html-use-infojs}
  13586. @item @code{:html-validation-link}
  13587. @tab @code{org-html-validation-link}
  13588. @item @code{:html-viewport}
  13589. @tab @code{org-html-viewport}
  13590. @item @code{:html-xml-declaration}
  13591. @tab @code{org-html-xml-declaration}
  13592. @end multitable
  13593. @anchor{@LaTeX{} specific properties}
  13594. @subsubheading @LaTeX{} specific properties
  13595. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13596. @item @code{:latex-active-timestamp-format}
  13597. @tab @code{org-latex-active-timestamp-format}
  13598. @item @code{:latex-caption-above}
  13599. @tab @code{org-latex-caption-above}
  13600. @item @code{:latex-classes}
  13601. @tab @code{org-latex-classes}
  13602. @item @code{:latex-class}
  13603. @tab @code{org-latex-default-class}
  13604. @item @code{:latex-compiler}
  13605. @tab @code{org-latex-compiler}
  13606. @item @code{:latex-default-figure-position}
  13607. @tab @code{org-latex-default-figure-position}
  13608. @item @code{:latex-default-table-environment}
  13609. @tab @code{org-latex-default-table-environment}
  13610. @item @code{:latex-default-table-mode}
  13611. @tab @code{org-latex-default-table-mode}
  13612. @item @code{:latex-diary-timestamp-format}
  13613. @tab @code{org-latex-diary-timestamp-format}
  13614. @item @code{:latex-footnote-defined-format}
  13615. @tab @code{org-latex-footnote-defined-format}
  13616. @item @code{:latex-footnote-separator}
  13617. @tab @code{org-latex-footnote-separator}
  13618. @item @code{:latex-format-drawer-function}
  13619. @tab @code{org-latex-format-drawer-function}
  13620. @item @code{:latex-format-headline-function}
  13621. @tab @code{org-latex-format-headline-function}
  13622. @item @code{:latex-format-inlinetask-function}
  13623. @tab @code{org-latex-format-inlinetask-function}
  13624. @item @code{:latex-hyperref-template}
  13625. @tab @code{org-latex-hyperref-template}
  13626. @item @code{:latex-image-default-height}
  13627. @tab @code{org-latex-image-default-height}
  13628. @item @code{:latex-image-default-option}
  13629. @tab @code{org-latex-image-default-option}
  13630. @item @code{:latex-image-default-width}
  13631. @tab @code{org-latex-image-default-width}
  13632. @item @code{:latex-images-centered}
  13633. @tab @code{org-latex-images-centered}
  13634. @item @code{:latex-inactive-timestamp-format}
  13635. @tab @code{org-latex-inactive-timestamp-format}
  13636. @item @code{:latex-inline-image-rules}
  13637. @tab @code{org-latex-inline-image-rules}
  13638. @item @code{:latex-link-with-unknown-path-format}
  13639. @tab @code{org-latex-link-with-unknown-path-format}
  13640. @item @code{:latex-listings-langs}
  13641. @tab @code{org-latex-listings-langs}
  13642. @item @code{:latex-listings-options}
  13643. @tab @code{org-latex-listings-options}
  13644. @item @code{:latex-listings}
  13645. @tab @code{org-latex-listings}
  13646. @item @code{:latex-minted-langs}
  13647. @tab @code{org-latex-minted-langs}
  13648. @item @code{:latex-minted-options}
  13649. @tab @code{org-latex-minted-options}
  13650. @item @code{:latex-prefer-user-labels}
  13651. @tab @code{org-latex-prefer-user-labels}
  13652. @item @code{:latex-subtitle-format}
  13653. @tab @code{org-latex-subtitle-format}
  13654. @item @code{:latex-subtitle-separate}
  13655. @tab @code{org-latex-subtitle-separate}
  13656. @item @code{:latex-table-scientific-notation}
  13657. @tab @code{org-latex-table-scientific-notation}
  13658. @item @code{:latex-tables-booktabs}
  13659. @tab @code{org-latex-tables-booktabs}
  13660. @item @code{:latex-tables-centered}
  13661. @tab @code{org-latex-tables-centered}
  13662. @item @code{:latex-text-markup-alist}
  13663. @tab @code{org-latex-text-markup-alist}
  13664. @item @code{:latex-title-command}
  13665. @tab @code{org-latex-title-command}
  13666. @item @code{:latex-toc-command}
  13667. @tab @code{org-latex-toc-command}
  13668. @end multitable
  13669. @anchor{Markdown specific properties}
  13670. @subsubheading Markdown specific properties
  13671. @multitable {aaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaa}
  13672. @item @code{:md-footnote-format}
  13673. @tab @code{org-md-footnote-format}
  13674. @item @code{:md-footnotes-section}
  13675. @tab @code{org-md-footnotes-section}
  13676. @item @code{:md-headline-style}
  13677. @tab @code{org-md-headline-style}
  13678. @end multitable
  13679. @anchor{ODT specific properties}
  13680. @subsubheading ODT specific properties
  13681. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13682. @item @code{:odt-content-template-file}
  13683. @tab @code{org-odt-content-template-file}
  13684. @item @code{:odt-display-outline-level}
  13685. @tab @code{org-odt-display-outline-level}
  13686. @item @code{:odt-fontify-srcblocks}
  13687. @tab @code{org-odt-fontify-srcblocks}
  13688. @item @code{:odt-format-drawer-function}
  13689. @tab @code{org-odt-format-drawer-function}
  13690. @item @code{:odt-format-headline-function}
  13691. @tab @code{org-odt-format-headline-function}
  13692. @item @code{:odt-format-inlinetask-function}
  13693. @tab @code{org-odt-format-inlinetask-function}
  13694. @item @code{:odt-inline-formula-rules}
  13695. @tab @code{org-odt-inline-formula-rules}
  13696. @item @code{:odt-inline-image-rules}
  13697. @tab @code{org-odt-inline-image-rules}
  13698. @item @code{:odt-pixels-per-inch}
  13699. @tab @code{org-odt-pixels-per-inch}
  13700. @item @code{:odt-styles-file}
  13701. @tab @code{org-odt-styles-file}
  13702. @item @code{:odt-table-styles}
  13703. @tab @code{org-odt-table-styles}
  13704. @item @code{:odt-use-date-fields}
  13705. @tab @code{org-odt-use-date-fields}
  13706. @end multitable
  13707. @anchor{Texinfo specific properties}
  13708. @subsubheading Texinfo specific properties
  13709. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13710. @item @code{:texinfo-active-timestamp-format}
  13711. @tab @code{org-texinfo-active-timestamp-format}
  13712. @item @code{:texinfo-classes}
  13713. @tab @code{org-texinfo-classes}
  13714. @item @code{:texinfo-class}
  13715. @tab @code{org-texinfo-default-class}
  13716. @item @code{:texinfo-table-default-markup}
  13717. @tab @code{org-texinfo-table-default-markup}
  13718. @item @code{:texinfo-diary-timestamp-format}
  13719. @tab @code{org-texinfo-diary-timestamp-format}
  13720. @item @code{:texinfo-filename}
  13721. @tab @code{org-texinfo-filename}
  13722. @item @code{:texinfo-format-drawer-function}
  13723. @tab @code{org-texinfo-format-drawer-function}
  13724. @item @code{:texinfo-format-headline-function}
  13725. @tab @code{org-texinfo-format-headline-function}
  13726. @item @code{:texinfo-format-inlinetask-function}
  13727. @tab @code{org-texinfo-format-inlinetask-function}
  13728. @item @code{:texinfo-inactive-timestamp-format}
  13729. @tab @code{org-texinfo-inactive-timestamp-format}
  13730. @item @code{:texinfo-link-with-unknown-path-format}
  13731. @tab @code{org-texinfo-link-with-unknown-path-format}
  13732. @item @code{:texinfo-node-description-column}
  13733. @tab @code{org-texinfo-node-description-column}
  13734. @item @code{:texinfo-table-scientific-notation}
  13735. @tab @code{org-texinfo-table-scientific-notation}
  13736. @item @code{:texinfo-tables-verbatim}
  13737. @tab @code{org-texinfo-tables-verbatim}
  13738. @item @code{:texinfo-text-markup-alist}
  13739. @tab @code{org-texinfo-text-markup-alist}
  13740. @end multitable
  13741. @node Publishing links
  13742. @subsection Publishing links
  13743. @cindex links, publishing
  13744. To create a link from one Org file to another, you would use something
  13745. like @samp{[[file:foo.org][The foo]]} or simply @samp{[[file:foo.org]]} (see @ref{External Links}). When
  13746. published, this link becomes a link to @samp{foo.html}. You can thus
  13747. interlink the pages of your ``Org web'' project and the links will work
  13748. as expected when you publish them to HTML. If you also publish the
  13749. Org source file and want to link to it, use an @samp{http} link instead of
  13750. a @samp{file:} link, because @samp{file} links are converted to link to the
  13751. corresponding @samp{.html} file.
  13752. You may also link to related files, such as images. Provided you are
  13753. careful with relative file names, and provided you have also
  13754. configured Org to upload the related files, these links will work too.
  13755. See @ref{Complex example}, for an example of this
  13756. usage.
  13757. Eventually, links between published documents can contain some search
  13758. options (see @ref{Search Options}), which will be resolved to
  13759. the appropriate location in the linked file. For example, once
  13760. published to HTML, the following links all point to a dedicated anchor
  13761. in @samp{foo.html}.
  13762. @example
  13763. [[file:foo.org::*heading]]
  13764. [[file:foo.org::#custom-id]]
  13765. [[file:foo.org::target]]
  13766. @end example
  13767. @node Site map
  13768. @subsection Generating a sitemap
  13769. @cindex sitemap, of published pages
  13770. The following properties may be used to control publishing of
  13771. a map of files for a given project.
  13772. @table @asis
  13773. @item @code{:auto-sitemap}
  13774. When non-@code{nil}, publish a sitemap during
  13775. @code{org-publish-current-project} or @code{org-publish-all}.
  13776. @item @code{:sitemap-filename}
  13777. Filename for output of sitemap. Defaults to @samp{sitemap.org}, which
  13778. becomes @samp{sitemap.html}.
  13779. @item @code{:sitemap-title}
  13780. Title of sitemap page. Defaults to name of file.
  13781. @item @code{:sitemap-format-entry}
  13782. @findex org-publish-find-date
  13783. @findex org-publish-find-property
  13784. @findex org-publish-find-title
  13785. With this option one can tell how a site-map entry is formatted
  13786. in the site-map. It is a function called with three arguments:
  13787. the file or directory name relative to base directory of the
  13788. project, the site-map style and the current project. It is
  13789. expected to return a string. Default value turns file names into
  13790. links and use document titles as descriptions. For specific
  13791. formatting needs, one can use @code{org-publish-find-date},
  13792. @code{org-publish-find-title} and @code{org-publish-find-property}, to
  13793. retrieve additional information about published documents.
  13794. @item @code{:sitemap-function}
  13795. Plug-in function to use for generation of the sitemap. It is
  13796. called with two arguments: the title of the site-map and
  13797. a representation of the files and directories involved in the
  13798. project as a nested list, which can further be transformed using
  13799. @code{org-list-to-generic}, @code{org-list-to-subtree} and alike. Default
  13800. value generates a plain list of links to all files in the
  13801. project.
  13802. @item @code{:sitemap-sort-folders}
  13803. Where folders should appear in the sitemap. Set this to @code{first}
  13804. (default) or @code{last} to display folders first or last,
  13805. respectively. When set to @code{ignore}, folders are ignored
  13806. altogether. Any other value mixes files and folders. This
  13807. variable has no effect when site-map style is @code{tree}.
  13808. @item @code{:sitemap-sort-files}
  13809. How the files are sorted in the site map. Set this to
  13810. @code{alphabetically} (default), @code{chronologically} or
  13811. @code{anti-chronologically}. @code{chronologically} sorts the files with
  13812. older date first while @code{anti-chronologically} sorts the files
  13813. with newer date first. @code{alphabetically} sorts the files
  13814. alphabetically. The date of a file is retrieved with
  13815. @code{org-publish-find-date}.
  13816. @item @code{:sitemap-ignore-case}
  13817. Should sorting be case-sensitive? Default @code{nil}.
  13818. @item @code{:sitemap-file-entry-format}
  13819. With this option one can tell how a sitemap's entry is formatted
  13820. in the sitemap. This is a format string with some escape
  13821. sequences: @code{%t} stands for the title of the file, @code{%a} stands for
  13822. the author of the file and @code{%d} stands for the date of the file.
  13823. The date is retrieved with the @code{org-publish-find-date} function
  13824. and formatted with @code{org-publish-sitemap-date-format}. Default
  13825. @code{%t}.
  13826. @item @code{:sitemap-date-format}
  13827. Format string for the @code{format-time-string} function that tells
  13828. how a sitemap entry's date is to be formatted. This property
  13829. bypasses @code{org-publish-sitemap-date-format} which defaults to
  13830. @code{%Y-%m-%d}.
  13831. @end table
  13832. @node Generating an index
  13833. @subsection Generating an index
  13834. @cindex index, in a publishing project
  13835. Org mode can generate an index across the files of a publishing project.
  13836. @table @asis
  13837. @item @code{:makeindex}
  13838. When non-@code{nil}, generate in index in the file @samp{theindex.org} and
  13839. publish it as @samp{theindex.html}.
  13840. @end table
  13841. The file is created when first publishing a project with the
  13842. @code{:makeindex} set. The file only contains a statement @samp{#+INCLUDE:
  13843. "theindex.inc"}. You can then build around this include statement by
  13844. adding a title, style information, etc.
  13845. @cindex @samp{INDEX}, keyword
  13846. Index entries are specified with @samp{INDEX} keyword. An entry that
  13847. contains an exclamation mark creates a sub item.
  13848. @example
  13849. *** Curriculum Vitae
  13850. #+INDEX: CV
  13851. #+INDEX: Application!CV
  13852. @end example
  13853. @node Uploading Files
  13854. @section Uploading Files
  13855. @cindex rsync
  13856. @cindex unison
  13857. For those people already utilizing third party sync tools such as
  13858. Rsync or Unison, it might be preferable not to use the built-in remote
  13859. publishing facilities of Org mode which rely heavily on Tramp. Tramp,
  13860. while very useful and powerful, tends not to be so efficient for
  13861. multiple file transfer and has been known to cause problems under
  13862. heavy usage.
  13863. Specialized synchronization utilities offer several advantages. In
  13864. addition to timestamp comparison, they also do content and
  13865. permissions/attribute checks. For this reason you might prefer to
  13866. publish your web to a local directory---possibly even @emph{in place} with
  13867. your Org files---and then use Unison or Rsync to do the
  13868. synchronization with the remote host.
  13869. Since Unison, for example, can be configured as to which files to
  13870. transfer to a certain remote destination, it can greatly simplify the
  13871. project publishing definition. Simply keep all files in the correct
  13872. location, process your Org files with @code{org-publish} and let the
  13873. synchronization tool do the rest. You do not need, in this scenario,
  13874. to include attachments such as JPG, CSS or PNG files in the project
  13875. definition since the third-party tool syncs them.
  13876. Publishing to a local directory is also much faster than to a remote
  13877. one, so that you can afford more easily to republish entire projects.
  13878. If you set @code{org-publish-use-timestamps-flag} to @code{nil}, you gain the
  13879. main benefit of re-including any changed external files such as source
  13880. example files you might include with @samp{INCLUDE} keyword. The timestamp
  13881. mechanism in Org is not smart enough to detect if included files have
  13882. been modified.
  13883. @node Sample Configuration
  13884. @section Sample Configuration
  13885. Below we provide two example configurations. The first one is
  13886. a simple project publishing only a set of Org files. The second
  13887. example is more complex, with a multi-component project.
  13888. @menu
  13889. * Simple example:: One-component publishing.
  13890. * Complex example:: A multi-component publishing example.
  13891. @end menu
  13892. @node Simple example
  13893. @subsection Example: simple publishing configuration
  13894. This example publishes a set of Org files to the @samp{public_html}
  13895. directory on the local machine.
  13896. @lisp
  13897. (setq org-publish-project-alist
  13898. '(("org"
  13899. :base-directory "~/org/"
  13900. :publishing-directory "~/public_html"
  13901. :section-numbers nil
  13902. :table-of-contents nil
  13903. :style "<link rel=\"stylesheet\"
  13904. href=\"../other/mystyle.css\"
  13905. type=\"text/css\"/>")))
  13906. @end lisp
  13907. @node Complex example
  13908. @subsection Example: complex publishing configuration
  13909. This more complicated example publishes an entire website, including
  13910. Org files converted to HTML, image files, Emacs Lisp source code, and
  13911. style sheets. The publishing directory is remote and private files
  13912. are excluded.
  13913. To ensure that links are preserved, care should be taken to replicate
  13914. your directory structure on the web server, and to use relative file
  13915. paths. For example, if your Org files are kept in @samp{~/org/} and your
  13916. publishable images in @samp{~/images/}, you would link to an image with
  13917. @example
  13918. file:../images/myimage.png
  13919. @end example
  13920. On the web server, the relative path to the image should be the same.
  13921. You can accomplish this by setting up an @samp{images/} folder in the right
  13922. place on the web server, and publishing images to it.
  13923. @lisp
  13924. (setq org-publish-project-alist
  13925. '(("orgfiles"
  13926. :base-directory "~/org/"
  13927. :base-extension "org"
  13928. :publishing-directory "/ssh:user@@host:~/html/notebook/"
  13929. :publishing-function org-html-publish-to-html
  13930. :exclude "PrivatePage.org" ;; regexp
  13931. :headline-levels 3
  13932. :section-numbers nil
  13933. :with-toc nil
  13934. :html-head "<link rel=\"stylesheet\"
  13935. href=\"../other/mystyle.css\" type=\"text/css\"/>"
  13936. :html-preamble t)
  13937. ("images"
  13938. :base-directory "~/images/"
  13939. :base-extension "jpg\\|gif\\|png"
  13940. :publishing-directory "/ssh:user@@host:~/html/images/"
  13941. :publishing-function org-publish-attachment)
  13942. ("other"
  13943. :base-directory "~/other/"
  13944. :base-extension "css\\|el"
  13945. :publishing-directory "/ssh:user@@host:~/html/other/"
  13946. :publishing-function org-publish-attachment)
  13947. ("website" :components ("orgfiles" "images" "other"))))
  13948. @end lisp
  13949. @node Triggering Publication
  13950. @section Triggering Publication
  13951. Once properly configured, Org can publish with the following commands:
  13952. @table @asis
  13953. @item @kbd{C-c C-e X} (@code{org-publish})
  13954. @kindex C-c C-e X
  13955. @findex org-publish
  13956. Prompt for a specific project and publish all files that belong
  13957. to it.
  13958. @item @kbd{C-c C-e P} (@code{org-publish-current-project})
  13959. @kindex C-c C-e P
  13960. @findex org-publish-current-project
  13961. Publish the project containing the current file.
  13962. @item @kbd{C-c C-e F} (@code{org-publish-current-file})
  13963. @kindex C-c C-e F
  13964. @findex org-publish-current-file
  13965. Publish only the current file.
  13966. @item @kbd{C-c C-e E} (@code{org-publish-all})
  13967. @kindex C-c C-e E
  13968. @findex org-publish-all
  13969. Publish every project.
  13970. @end table
  13971. @vindex org-publish-use-timestamps-flag
  13972. Org uses timestamps to track when a file has changed. The above
  13973. functions normally only publish changed files. You can override this
  13974. and force publishing of all files by giving a prefix argument to any
  13975. of the commands above, or by customizing the variable
  13976. @code{org-publish-use-timestamps-flag}. This may be necessary in
  13977. particular if files include other files via @samp{SETUPFILE} or @samp{INCLUDE}
  13978. keywords.
  13979. @node Working with Source Code
  13980. @chapter Working with Source Code
  13981. @cindex source code, working with
  13982. Source code here refers to any plain text collection of computer
  13983. instructions, possibly with comments, written using a human-readable
  13984. programming language. Org can manage source code in an Org document
  13985. when the source code is identified with begin and end markers.
  13986. Working with source code begins with identifying source code blocks.
  13987. A source code block can be placed almost anywhere in an Org document;
  13988. it is not restricted to the preamble or the end of the document.
  13989. However, Org cannot manage a source code block if it is placed inside
  13990. an Org comment or within a fixed width section.
  13991. Here is an example source code block in the Emacs Lisp language:
  13992. @example
  13993. #+BEGIN_SRC emacs-lisp
  13994. (defun org-xor (a b)
  13995. "Exclusive or."
  13996. (if a (not b) b))
  13997. #+END_SRC
  13998. @end example
  13999. Org can manage the source code in the block delimited by @samp{#+BEGIN_SRC}
  14000. @dots{} @samp{#+END_SRC} in several ways that can simplify housekeeping tasks
  14001. essential to modern source code maintenance. Org can edit, format,
  14002. extract, export, and publish source code blocks. Org can also compile
  14003. and execute a source code block, then capture the results. The Org
  14004. mode literature sometimes refers to source code blocks as @emph{live code}
  14005. blocks because they can alter the content of the Org document or the
  14006. material that it exports. Users can control how live they want each
  14007. source code block by tweaking the header arguments (see @ref{Using Header Arguments}) for compiling, execution, extraction, and
  14008. exporting.
  14009. Source code blocks are one of many Org block types, which also include
  14010. @samp{quote}, @samp{export}, @samp{verse}, @samp{latex}, @samp{example}, and @samp{verbatim}. This
  14011. section pertains to blocks between @samp{#+BEGIN_SRC} and @samp{#+END_SRC}.
  14012. For editing and formatting a source code block, Org uses an
  14013. appropriate Emacs major mode that includes features specifically
  14014. designed for source code in that language.
  14015. Org can extract one or more source code blocks and write them to one
  14016. or more source files---a process known as @emph{tangling} in literate
  14017. programming terminology.
  14018. For exporting and publishing, Org's back-ends can format a source code
  14019. block appropriately, often with native syntax highlighting.
  14020. For executing and compiling a source code block, the user can
  14021. configure Org to select the appropriate compiler. Org provides
  14022. facilities to collect the result of the execution or compiler output,
  14023. insert it into the Org document, and/or export it. In addition to
  14024. text results, Org can insert links to other data types, including
  14025. audio, video, and graphics. Org can also link a compiler error
  14026. message to the appropriate line in the source code block.
  14027. An important feature of Org's management of source code blocks is the
  14028. ability to pass variables, functions, and results to one another using
  14029. a common syntax for source code blocks in any language. Although most
  14030. literate programming facilities are restricted to one language or
  14031. another, Org's language-agnostic approach lets the literate programmer
  14032. match each programming task with the appropriate computer language and
  14033. to mix them all together in a single Org document. This
  14034. interoperability among languages explains why Org's source code
  14035. management facility was named @emph{Org Babel} by its originators, Eric
  14036. Schulte and Dan Davison.
  14037. Org mode fulfills the promise of easy verification and maintenance of
  14038. publishing reproducible research by keeping text, data, code,
  14039. configuration settings of the execution environment, the results of
  14040. the execution, and associated narratives, claims, references, and
  14041. internal and external links in a single Org document.
  14042. Details of Org's facilities for working with source code are described
  14043. in the following sections.
  14044. @menu
  14045. * Structure of Code Blocks:: Code block syntax described.
  14046. * Using Header Arguments:: Different ways to set header arguments.
  14047. * Environment of a Code Block:: Arguments, sessions, working directory...
  14048. * Evaluating Code Blocks:: Place results of evaluation in the Org buffer.
  14049. * Results of Evaluation:: Choosing a results type, post-processing...
  14050. * Exporting Code Blocks:: Export contents and/or results.
  14051. * Extracting Source Code:: Create pure source code files.
  14052. * Languages:: List of supported code block languages.
  14053. * Editing Source Code:: Language major-mode editing.
  14054. * Noweb Reference Syntax:: Literate programming in Org mode.
  14055. * Library of Babel:: Use and contribute to a library of useful code blocks.
  14056. * Key bindings and Useful Functions:: Work quickly with code blocks.
  14057. * Batch Execution:: Call functions from the command line.
  14058. @end menu
  14059. @node Structure of Code Blocks
  14060. @section Structure of Code Blocks
  14061. @cindex code block, structure
  14062. @cindex source code, block structure
  14063. @cindex @samp{NAME} keyword, in source blocks
  14064. @cindex @samp{BEGIN_SRC}
  14065. Org offers two ways to structure source code in Org documents: in
  14066. a source code block, and directly inline. Both specifications are
  14067. shown below.
  14068. A source code block conforms to this structure:
  14069. @example
  14070. #+NAME: <name>
  14071. #+BEGIN_SRC <language> <switches> <header arguments>
  14072. <body>
  14073. #+END_SRC
  14074. @end example
  14075. Do not be put-off by having to remember the source block syntax. Org
  14076. mode offers a command for wrapping existing text in a block (see
  14077. @ref{Structure Templates}). Org also works with other completion systems
  14078. in Emacs, some of which predate Org and have custom domain-specific
  14079. languages for defining templates. Regular use of templates reduces
  14080. errors, increases accuracy, and maintains consistency.
  14081. @cindex source code, inline
  14082. An inline code block conforms to this structure:
  14083. @example
  14084. src_<language>@{<body>@}
  14085. @end example
  14086. @noindent
  14087. or
  14088. @example
  14089. src_<language>[<header arguments>]@{<body>@}
  14090. @end example
  14091. @table @asis
  14092. @item @samp{#+NAME: <name>}
  14093. Optional. Names the source block so it can be called, like
  14094. a function, from other source blocks or inline code to evaluate
  14095. or to capture the results. Code from other blocks, other files,
  14096. and from table formulas (see @ref{The spreadsheet}) can use the name
  14097. to reference a source block. This naming serves the same purpose
  14098. as naming Org tables. Org mode requires unique names. For
  14099. duplicate names, Org mode's behavior is undefined.
  14100. @item @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}
  14101. Mandatory. They mark the start and end of a block that Org
  14102. requires. The @samp{#+BEGIN_SRC} line takes additional arguments, as
  14103. described next.
  14104. @item @samp{<language>}
  14105. @cindex language, in code blocks
  14106. Mandatory. It is the identifier of the source code language in
  14107. the block. See @ref{Languages}, for identifiers of supported
  14108. languages.
  14109. @item @samp{<switches>}
  14110. @cindex switches, in code blocks
  14111. Optional. Switches provide finer control of the code execution,
  14112. export, and format (see the discussion of switches in @ref{Literal Examples}).
  14113. @item @samp{<header arguments>}
  14114. @cindex header arguments, in code blocks
  14115. Optional. Heading arguments control many aspects of evaluation,
  14116. export and tangling of code blocks (see @ref{Using Header Arguments}).
  14117. Using Org's properties feature, header arguments can be
  14118. selectively applied to the entire buffer or specific sub-trees of
  14119. the Org document.
  14120. @item @samp{<body>}
  14121. Source code in the dialect of the specified language identifier.
  14122. @end table
  14123. @node Using Header Arguments
  14124. @section Using Header Arguments
  14125. Org comes with many header arguments common to all languages. New
  14126. header arguments are added for specific languages as they become
  14127. available for use in source code blocks. A header argument is
  14128. specified with an initial colon followed by the argument's name in
  14129. lowercase.
  14130. Since header arguments can be set in several ways, Org prioritizes
  14131. them in case of overlaps or conflicts by giving local settings
  14132. a higher priority. Header values in function calls, for example,
  14133. override header values from global defaults.
  14134. @anchor{System-wide header arguments}
  14135. @subheading System-wide header arguments
  14136. @vindex org-babel-default-header-args
  14137. @vindex org-babel-default-header-args
  14138. System-wide values of header arguments can be specified by customizing
  14139. the @code{org-babel-default-header-args} variable, which defaults to the
  14140. following values:
  14141. @example
  14142. :session => "none"
  14143. :results => "replace"
  14144. :exports => "code"
  14145. :cache => "no"
  14146. :noweb => "no"
  14147. @end example
  14148. The example below sets @samp{:noweb} header arguments to @samp{yes}, which makes
  14149. Org expand @samp{:noweb} references by default.
  14150. @lisp
  14151. (setq org-babel-default-header-args
  14152. (cons '(:noweb . "yes")
  14153. (assq-delete-all :noweb org-babel-default-header-args)))
  14154. @end lisp
  14155. @cindex language specific default header arguments
  14156. @cindex default header arguments per language
  14157. Each language can have separate default header arguments by
  14158. customizing the variable @code{org-babel-default-header-args:<LANG>}, where
  14159. @var{<LANG>} is the name of the language. For details, see the
  14160. language-specific online documentation at
  14161. @uref{https://orgmode.org/worg/org-contrib/babel/}.
  14162. @anchor{Header arguments in Org mode properties}
  14163. @subheading Header arguments in Org mode properties
  14164. For header arguments applicable to the buffer, use @samp{PROPERTY} keyword
  14165. anywhere in the Org file (see @ref{Property Syntax}).
  14166. The following example makes all the R code blocks execute in the same
  14167. session. Setting @samp{:results} to @samp{silent} ignores the results of
  14168. executions for all blocks, not just R code blocks; no results inserted
  14169. for any block.
  14170. @example
  14171. #+PROPERTY: header-args:R :session *R*
  14172. #+PROPERTY: header-args :results silent
  14173. @end example
  14174. @vindex org-use-property-inheritance
  14175. Header arguments set through Org's property drawers (see @ref{Property Syntax}) apply at the sub-tree level on down. Since these property
  14176. drawers can appear anywhere in the file hierarchy, Org uses outermost
  14177. call or source block to resolve the values. Org ignores
  14178. @code{org-use-property-inheritance} setting.
  14179. In this example, @samp{:cache} defaults to @samp{yes} for all code blocks in the
  14180. sub-tree.
  14181. @example
  14182. * sample header
  14183. :PROPERTIES:
  14184. :header-args: :cache yes
  14185. :END:
  14186. @end example
  14187. @kindex C-c C-x p
  14188. @findex org-set-property
  14189. Properties defined through @code{org-set-property} function, bound to
  14190. @kbd{C-c C-x p}, apply to all active languages. They override
  14191. properties set in @code{org-babel-default-header-args}.
  14192. @cindex language specific header arguments properties
  14193. @cindex header arguments per language
  14194. Language-specific header arguments are also read from properties
  14195. @samp{header-args:<LANG>} where @var{<LANG>} is the language
  14196. identifier. For example,
  14197. @example
  14198. * Heading
  14199. :PROPERTIES:
  14200. :header-args:clojure: :session *clojure-1*
  14201. :header-args:R: :session *R*
  14202. :END:
  14203. ** Subheading
  14204. :PROPERTIES:
  14205. :header-args:clojure: :session *clojure-2*
  14206. :END:
  14207. @end example
  14208. @noindent
  14209. would force separate sessions for Clojure blocks in @samp{Heading} and
  14210. @samp{Subheading}, but use the same session for all R blocks. Blocks in
  14211. @samp{Subheading} inherit settings from @samp{Heading}.
  14212. @anchor{Code block specific header arguments}
  14213. @subheading Code block specific header arguments
  14214. Header arguments are most commonly set at the source code block level,
  14215. on the @samp{#+BEGIN_SRC} line. Arguments set at this level take
  14216. precedence over those set in the @code{org-babel-default-header-args}
  14217. variable, and also those set as header properties.
  14218. In the following example, setting @samp{:results} to @samp{silent} makes it
  14219. ignore results of the code execution. Setting @samp{:exports} to @samp{code}
  14220. exports only the body of the code block to HTML or @LaTeX{}.
  14221. @example
  14222. #+NAME: factorial
  14223. #+BEGIN_SRC haskell :results silent :exports code :var n=0
  14224. fac 0 = 1
  14225. fac n = n * fac (n-1)
  14226. #+END_SRC
  14227. @end example
  14228. The same header arguments in an inline code block:
  14229. @example
  14230. src_haskell[:exports both]@{fac 5@}
  14231. @end example
  14232. @cindex @samp{HEADER}, keyword
  14233. Code block header arguments can span multiple lines using @samp{#+HEADER:}
  14234. on each line. Note that Org currently accepts the plural spelling of
  14235. @samp{#+HEADER:} only as a convenience for backward-compatibility. It may
  14236. be removed at some point.
  14237. Multi-line header arguments on an unnamed code block:
  14238. @example
  14239. #+HEADER: :var data1=1
  14240. #+BEGIN_SRC emacs-lisp :var data2=2
  14241. (message "data1:%S, data2:%S" data1 data2)
  14242. #+END_SRC
  14243. #+RESULTS:
  14244. : data1:1, data2:2
  14245. @end example
  14246. Multi-line header arguments on a named code block:
  14247. @example
  14248. #+NAME: named-block
  14249. #+HEADER: :var data=2
  14250. #+BEGIN_SRC emacs-lisp
  14251. (message "data:%S" data)
  14252. #+END_SRC
  14253. #+RESULTS: named-block
  14254. : data:2
  14255. @end example
  14256. @anchor{Header arguments in function calls}
  14257. @subheading Header arguments in function calls
  14258. Header arguments in function calls are the most specific and override
  14259. all other settings in case of an overlap. They get the highest
  14260. priority. Two @samp{#+CALL:} examples are shown below. For the complete
  14261. syntax of @samp{CALL} keyword, see @ref{Evaluating Code Blocks}.
  14262. In this example, @samp{:exports results} header argument is applied to the
  14263. evaluation of the @samp{#+CALL:} line.
  14264. @example
  14265. #+CALL: factorial(n=5) :exports results
  14266. @end example
  14267. In this example, @samp{:session special} header argument is applied to the
  14268. evaluation of @samp{factorial} code block.
  14269. @example
  14270. #+CALL: factorial[:session special](n=5)
  14271. @end example
  14272. @node Environment of a Code Block
  14273. @section Environment of a Code Block
  14274. @anchor{Passing arguments}
  14275. @subheading Passing arguments
  14276. @cindex passing arguments to code blocks
  14277. @cindex arguments, in code blocks
  14278. @cindex @samp{var}, header argument
  14279. Use @samp{var} for passing arguments to source code blocks. The specifics
  14280. of variables in code blocks vary by the source language and are
  14281. covered in the language-specific documentation. The syntax for @samp{var},
  14282. however, is the same for all languages. This includes declaring
  14283. a variable, and assigning a default value.
  14284. The following syntax is used to pass arguments to code blocks using
  14285. the @samp{var} header argument.
  14286. @example
  14287. :var NAME=ASSIGN
  14288. @end example
  14289. @noindent
  14290. @var{NAME} is the name of the variable bound in the code block
  14291. body. @var{ASSIGN} is a literal value, such as a string,
  14292. a number, a reference to a table, a list, a literal example, another
  14293. code block---with or without arguments---or the results of evaluating
  14294. a code block.
  14295. Here are examples of passing values by reference:
  14296. @table @asis
  14297. @item table
  14298. A table named with a @samp{NAME} keyword.
  14299. @example
  14300. #+NAME: example-table
  14301. | 1 |
  14302. | 2 |
  14303. | 3 |
  14304. | 4 |
  14305. #+NAME: table-length
  14306. #+BEGIN_SRC emacs-lisp :var table=example-table
  14307. (length table)
  14308. #+END_SRC
  14309. #+RESULTS: table-length
  14310. : 4
  14311. @end example
  14312. When passing a table, you can treat specially the row, or the
  14313. column, containing labels for the columns, or the rows, in the
  14314. table.
  14315. @cindex @samp{colnames}, header argument
  14316. The @samp{colnames} header argument accepts @samp{yes}, @samp{no}, or @samp{nil}
  14317. values. The default value is @samp{nil}: if an input table has column
  14318. names---because the second row is a horizontal rule---then Org
  14319. removes the column names, processes the table, puts back the
  14320. column names, and then writes the table to the results block.
  14321. Using @samp{yes}, Org does the same to the first row, even if the
  14322. initial table does not contain any horizontal rule. When set to
  14323. @samp{no}, Org does not pre-process column names at all.
  14324. @example
  14325. #+NAME: less-cols
  14326. | a |
  14327. |---|
  14328. | b |
  14329. | c |
  14330. #+BEGIN_SRC python :var tab=less-cols :colnames nil
  14331. return [[val + '*' for val in row] for row in tab]
  14332. #+END_SRC
  14333. #+RESULTS:
  14334. | a |
  14335. |----|
  14336. | b* |
  14337. | c* |
  14338. @end example
  14339. @cindex @samp{rownames}, header argument
  14340. Similarly, the @samp{rownames} header argument can take two values:
  14341. @samp{yes} or @samp{no}. When set to @samp{yes}, Org removes the first column,
  14342. processes the table, puts back the first column, and then writes
  14343. the table to the results block. The default is @samp{no}, which means
  14344. Org does not pre-process the first column. Note that Emacs Lisp
  14345. code blocks ignore @samp{rownames} header argument because of the ease
  14346. of table-handling in Emacs.
  14347. @example
  14348. #+NAME: with-rownames
  14349. | one | 1 | 2 | 3 | 4 | 5 |
  14350. | two | 6 | 7 | 8 | 9 | 10 |
  14351. #+BEGIN_SRC python :var tab=with-rownames :rownames yes
  14352. return [[val + 10 for val in row] for row in tab]
  14353. #+END_SRC
  14354. #+RESULTS:
  14355. | one | 11 | 12 | 13 | 14 | 15 |
  14356. | two | 16 | 17 | 18 | 19 | 20 |
  14357. @end example
  14358. @item list
  14359. A simple named list.
  14360. @example
  14361. #+NAME: example-list
  14362. - simple
  14363. - not
  14364. - nested
  14365. - list
  14366. #+BEGIN_SRC emacs-lisp :var x=example-list
  14367. (print x)
  14368. #+END_SRC
  14369. #+RESULTS:
  14370. | simple | list |
  14371. @end example
  14372. Note that only the top level list items are passed along. Nested
  14373. list items are ignored.
  14374. @item code block without arguments
  14375. A code block name, as assigned by @samp{NAME} keyword from the example
  14376. above, optionally followed by parentheses.
  14377. @example
  14378. #+BEGIN_SRC emacs-lisp :var length=table-length()
  14379. (* 2 length)
  14380. #+END_SRC
  14381. #+RESULTS:
  14382. : 8
  14383. @end example
  14384. @item code block with arguments
  14385. A code block name, as assigned by @samp{NAME} keyword, followed by
  14386. parentheses and optional arguments passed within the parentheses.
  14387. @example
  14388. #+NAME: double
  14389. #+BEGIN_SRC emacs-lisp :var input=8
  14390. (* 2 input)
  14391. #+END_SRC
  14392. #+RESULTS: double
  14393. : 16
  14394. #+NAME: squared
  14395. #+BEGIN_SRC emacs-lisp :var input=double(input=1)
  14396. (* input input)
  14397. #+END_SRC
  14398. #+RESULTS: squared
  14399. : 4
  14400. @end example
  14401. @item literal example
  14402. A literal example block named with a @samp{NAME} keyword.
  14403. @example
  14404. #+NAME: literal-example
  14405. #+BEGIN_EXAMPLE
  14406. A literal example
  14407. on two lines
  14408. #+END_EXAMPLE
  14409. #+NAME: read-literal-example
  14410. #+BEGIN_SRC emacs-lisp :var x=literal-example
  14411. (concatenate #'string x " for you.")
  14412. #+END_SRC
  14413. #+RESULTS: read-literal-example
  14414. : A literal example
  14415. : on two lines for you.
  14416. @end example
  14417. @end table
  14418. Indexing variable values enables referencing portions of a variable.
  14419. Indexes are 0 based with negative values counting backwards from the
  14420. end. If an index is separated by commas then each subsequent section
  14421. indexes as the next dimension. Note that this indexing occurs
  14422. @emph{before} other table-related header arguments are applied, such as
  14423. @samp{hlines}, @samp{colnames} and @samp{rownames}. The following example assigns
  14424. the last cell of the first row the table @samp{example-table} to the
  14425. variable @samp{data}:
  14426. @example
  14427. #+NAME: example-table
  14428. | 1 | a |
  14429. | 2 | b |
  14430. | 3 | c |
  14431. | 4 | d |
  14432. #+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
  14433. data
  14434. #+END_SRC
  14435. #+RESULTS:
  14436. : a
  14437. @end example
  14438. Two integers separated by a colon reference a range of variable
  14439. values. In that case the entire inclusive range is referenced. For
  14440. example the following assigns the middle three rows of @samp{example-table}
  14441. to @samp{data}.
  14442. @example
  14443. #+NAME: example-table
  14444. | 1 | a |
  14445. | 2 | b |
  14446. | 3 | c |
  14447. | 4 | d |
  14448. | 5 | 3 |
  14449. #+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
  14450. data
  14451. #+END_SRC
  14452. #+RESULTS:
  14453. | 2 | b |
  14454. | 3 | c |
  14455. | 4 | d |
  14456. @end example
  14457. To pick the entire range, use an empty index, or the single character
  14458. @samp{*}. @samp{0:-1} does the same thing. Example below shows how to
  14459. reference the first column only.
  14460. @example
  14461. #+NAME: example-table
  14462. | 1 | a |
  14463. | 2 | b |
  14464. | 3 | c |
  14465. | 4 | d |
  14466. #+BEGIN_SRC emacs-lisp :var data=example-table[,0]
  14467. data
  14468. #+END_SRC
  14469. #+RESULTS:
  14470. | 1 | 2 | 3 | 4 |
  14471. @end example
  14472. Index referencing can be used for tables and code blocks. Index
  14473. referencing can handle any number of dimensions. Commas delimit
  14474. multiple dimensions, as shown below.
  14475. @example
  14476. #+NAME: 3D
  14477. #+BEGIN_SRC emacs-lisp
  14478. '(((1 2 3) (4 5 6) (7 8 9))
  14479. ((10 11 12) (13 14 15) (16 17 18))
  14480. ((19 20 21) (22 23 24) (25 26 27)))
  14481. #+END_SRC
  14482. #+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
  14483. data
  14484. #+END_SRC
  14485. #+RESULTS:
  14486. | 11 | 14 | 17 |
  14487. @end example
  14488. Note that row names and column names are not removed prior to variable
  14489. indexing. You need to take them into account, even when @samp{colnames} or
  14490. @samp{rownames} header arguments remove them.
  14491. Emacs lisp code can also set the values for variables. To
  14492. differentiate a value from Lisp code, Org interprets any value
  14493. starting with @samp{(}, @samp{[}, @samp{'} or @samp{`} as Emacs Lisp code. The result of
  14494. evaluating that code is then assigned to the value of that variable.
  14495. The following example shows how to reliably query and pass the file
  14496. name of the Org mode buffer to a code block using headers. We need
  14497. reliability here because the file's name could change once the code in
  14498. the block starts executing.
  14499. @example
  14500. #+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
  14501. wc -w $filename
  14502. #+END_SRC
  14503. @end example
  14504. Note that values read from tables and lists are not mistakenly
  14505. evaluated as Emacs Lisp code, as illustrated in the following example.
  14506. @example
  14507. #+NAME: table
  14508. | (a b c) |
  14509. #+HEADER: :var data=table[0,0]
  14510. #+BEGIN_SRC perl
  14511. $data
  14512. #+END_SRC
  14513. #+RESULTS:
  14514. : (a b c)
  14515. @end example
  14516. @anchor{Using sessions}
  14517. @subheading Using sessions
  14518. @cindex using sessions in code blocks
  14519. @cindex @samp{session}, header argument
  14520. Two code blocks can share the same environment. The @samp{session} header
  14521. argument is for running multiple source code blocks under one session.
  14522. Org runs code blocks with the same session name in the same
  14523. interpreter process.
  14524. @table @asis
  14525. @item @samp{none}
  14526. Default. Each code block gets a new interpreter process to
  14527. execute. The process terminates once the block is evaluated.
  14528. @item @var{STRING}
  14529. Any string besides @samp{none} turns that string into the name of that
  14530. session. For example, @samp{:session STRING} names it @samp{STRING}. If
  14531. @samp{session} has no value, then the session name is derived from the
  14532. source language identifier. Subsequent blocks with the same
  14533. source code language use the same session. Depending on the
  14534. language, state variables, code from other blocks, and the
  14535. overall interpreted environment may be shared. Some interpreted
  14536. languages support concurrent sessions when subsequent source code
  14537. language blocks change session names.
  14538. @end table
  14539. Only languages that provide interactive evaluation can have session
  14540. support. Not all languages provide this support, such as C and ditaa.
  14541. Even languages, such as Python and Haskell, that do support
  14542. interactive evaluation impose limitations on allowable language
  14543. constructs that can run interactively. Org inherits those limitations
  14544. for those code blocks running in a session.
  14545. @anchor{Choosing a working directory}
  14546. @subheading Choosing a working directory
  14547. @cindex working directory, in a code block
  14548. @cindex @samp{dir}, header argument
  14549. The @samp{dir} header argument specifies the default directory during code
  14550. block execution. If it is absent, then the directory associated with
  14551. the current buffer is used. In other words, supplying @samp{:dir PATH}
  14552. temporarily has the same effect as changing the current directory with
  14553. @kbd{M-x cd PATH}, and then not setting @samp{dir}. Under the
  14554. surface, @samp{dir} simply sets the value of the Emacs variable
  14555. @code{default-directory}.
  14556. For example, to save the plot file in the @samp{Work/} folder of the home
  14557. directory---notice tilde is expanded:
  14558. @example
  14559. #+BEGIN_SRC R :file myplot.png :dir ~/Work
  14560. matplot(matrix(rnorm(100), 10), type="l")
  14561. #+END_SRC
  14562. @end example
  14563. To evaluate the code block on a remote machine, supply a remote
  14564. directory name using Tramp syntax. For example:
  14565. @example
  14566. #+BEGIN_SRC R :file plot.png :dir /scp:dand@@yakuba.princeton.edu:
  14567. plot(1:10, main=system("hostname", intern=TRUE))
  14568. #+END_SRC
  14569. @end example
  14570. Org first captures the text results as usual for insertion in the Org
  14571. file. Then Org also inserts a link to the remote file, thanks to
  14572. Emacs Tramp. Org constructs the remote path to the file name from
  14573. @samp{dir} and @code{default-directory}, as illustrated here:
  14574. @example
  14575. [[file:/scp:dand@@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
  14576. @end example
  14577. When @samp{dir} is used with @samp{session}, Org sets the starting directory for
  14578. a new session. But Org does not alter the directory of an already
  14579. existing session.
  14580. Do not use @samp{dir} with @samp{:exports results} or with @samp{:exports both} to
  14581. avoid Org inserting incorrect links to remote files. That is because
  14582. Org does not expand @code{default directory} to avoid some underlying
  14583. portability issues.
  14584. @anchor{Inserting headers and footers}
  14585. @subheading Inserting headers and footers
  14586. @cindex headers, in code blocks
  14587. @cindex footers, in code blocks
  14588. @cindex @samp{prologue}, header argument
  14589. The @samp{prologue} header argument is for appending to the top of the code
  14590. block for execution, like a reset instruction. For example, you may
  14591. use @samp{:prologue "reset"} in a Gnuplot code block or, for every such
  14592. block:
  14593. @lisp
  14594. (add-to-list 'org-babel-default-header-args:gnuplot
  14595. '((:prologue . "reset")))
  14596. @end lisp
  14597. @cindex @samp{epilogue}, header argument
  14598. Likewise, the value of the @samp{epilogue} header argument is for appending
  14599. to the end of the code block for execution.
  14600. @node Evaluating Code Blocks
  14601. @section Evaluating Code Blocks
  14602. @cindex code block, evaluating
  14603. @cindex source code, evaluating
  14604. @cindex @samp{RESULTS}, keyword
  14605. A note about security: With code evaluation comes the risk of harm.
  14606. Org safeguards by prompting for user's permission before executing any
  14607. code in the source block. To customize this safeguard, or disable it,
  14608. see @ref{Code Evaluation Security}.
  14609. @anchor{How to evaluate source code}
  14610. @subheading How to evaluate source code
  14611. Org captures the results of the code block evaluation and inserts them
  14612. in the Org file, right after the code block. The insertion point is
  14613. after a newline and the @samp{RESULTS} keyword. Org creates the @samp{RESULTS}
  14614. keyword if one is not already there.
  14615. By default, Org enables only Emacs Lisp code blocks for execution.
  14616. See @ref{Languages} to enable other languages.
  14617. @kindex C-c C-c
  14618. @kindex C-c C-v e
  14619. @findex org-babel-execute-src-block
  14620. Org provides many ways to execute code blocks. @kbd{C-c C-c} or
  14621. @kbd{C-c C-v e} with the point on a code block@footnote{The option @code{org-babel-no-eval-on-ctrl-c-ctrl-c} can be used
  14622. to remove code evaluation from the @kbd{C-c C-c} key binding.} calls the
  14623. @code{org-babel-execute-src-block} function, which executes the code in the
  14624. block, collects the results, and inserts them in the buffer.
  14625. @cindex @samp{CALL}, keyword
  14626. @vindex org-babel-inline-result-wrap
  14627. By calling a named code block@footnote{Actually, the constructs @samp{call_<name>()} and @samp{src_<lang>@{@}}
  14628. are not evaluated when they appear in a keyword line---i.e. lines
  14629. starting with @samp{#+KEYWORD:}, see @ref{In-buffer Settings}.} from an Org mode buffer or
  14630. a table. Org can call the named code blocks from the current Org mode
  14631. buffer or from the ``Library of Babel'' (see @ref{Library of Babel}).
  14632. The syntax for @samp{CALL} keyword is:
  14633. @example
  14634. #+CALL: <name>(<arguments>)
  14635. #+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
  14636. @end example
  14637. The syntax for inline named code blocks is:
  14638. @example
  14639. ... call_<name>(<arguments>) ...
  14640. ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
  14641. @end example
  14642. When inline syntax is used, the result is wrapped based on the
  14643. variable @code{org-babel-inline-result-wrap}, which by default is set to
  14644. @code{"=%s="} to produce verbatim text suitable for markup.
  14645. @table @asis
  14646. @item @samp{<name>}
  14647. This is the name of the code block (see @ref{Structure of Code Blocks}) to be evaluated in the current document. If the block is
  14648. located in another file, start @samp{<name>} with the file name
  14649. followed by a colon. For example, in order to execute a block
  14650. named @samp{clear-data} in @samp{file.org}, you can write the following:
  14651. @example
  14652. #+CALL: file.org:clear-data()
  14653. @end example
  14654. @item @samp{<arguments>}
  14655. Org passes arguments to the code block using standard function
  14656. call syntax. For example, a @samp{#+CALL:} line that passes @samp{4} to
  14657. a code block named @samp{double}, which declares the header argument
  14658. @samp{:var n=2}, would be written as:
  14659. @example
  14660. #+CALL: double(n=4)
  14661. @end example
  14662. @noindent
  14663. Note how this function call syntax is different from the header
  14664. argument syntax.
  14665. @item @samp{<inside header arguments>}
  14666. Org passes inside header arguments to the named code block using
  14667. the header argument syntax. Inside header arguments apply to
  14668. code block evaluation. For example, @samp{[:results output]} collects
  14669. results printed to stdout during code execution of that block.
  14670. Note how this header argument syntax is different from the
  14671. function call syntax.
  14672. @item @samp{<end header arguments>}
  14673. End header arguments affect the results returned by the code
  14674. block. For example, @samp{:results html} wraps the results in
  14675. a @samp{#+BEGIN_EXPORT html} block before inserting the results in the
  14676. Org buffer.
  14677. @end table
  14678. @anchor{Limit code block evaluation}
  14679. @subheading Limit code block evaluation
  14680. @cindex @samp{eval}, header argument
  14681. @cindex control code block evaluation
  14682. The @samp{eval} header argument can limit evaluation of specific code
  14683. blocks and @samp{CALL} keyword. It is useful for protection against
  14684. evaluating untrusted code blocks by prompting for a confirmation.
  14685. @table @asis
  14686. @item @samp{never} or @samp{no}
  14687. Org never evaluates the source code.
  14688. @item @samp{query}
  14689. Org prompts the user for permission to evaluate the source code.
  14690. @item @samp{never-export} or @samp{no-export}
  14691. Org does not evaluate the source code when exporting, yet the
  14692. user can evaluate it interactively.
  14693. @item @samp{query-export}
  14694. Org prompts the user for permission to evaluate the source code
  14695. during export.
  14696. @end table
  14697. If @samp{eval} header argument is not set, then Org determines whether to
  14698. evaluate the source code from the @code{org-confirm-babel-evaluate}
  14699. variable (see @ref{Code Evaluation Security}).
  14700. @anchor{Cache results of evaluation}
  14701. @subheading Cache results of evaluation
  14702. @cindex @samp{cache}, header argument
  14703. @cindex cache results of code evaluation
  14704. The @samp{cache} header argument is for caching results of evaluating code
  14705. blocks. Caching results can avoid re-evaluating a code block that
  14706. have not changed since the previous run. To benefit from the cache
  14707. and avoid redundant evaluations, the source block must have a result
  14708. already present in the buffer, and neither the header
  14709. arguments---including the value of @samp{var} references---nor the text of
  14710. the block itself has changed since the result was last computed. This
  14711. feature greatly helps avoid long-running calculations. For some edge
  14712. cases, however, the cached results may not be reliable.
  14713. The caching feature is best for when code blocks are pure functions,
  14714. that is functions that return the same value for the same input
  14715. arguments (see @ref{Environment of a Code Block}), and that do not have
  14716. side effects, and do not rely on external variables other than the
  14717. input arguments. Functions that depend on a timer, file system
  14718. objects, and random number generators are clearly unsuitable for
  14719. caching.
  14720. A note of warning: when @samp{cache} is used in a session, caching may
  14721. cause unexpected results.
  14722. When the caching mechanism tests for any source code changes, it does
  14723. not expand Noweb style references (see @ref{Noweb Reference Syntax}). For
  14724. reasons why, see @uref{http://thread.gmane.org/gmane.emacs.orgmode/79046}.
  14725. The @samp{cache} header argument can have one of two values: @samp{yes} or @samp{no}.
  14726. @table @asis
  14727. @item @samp{no}
  14728. Default. No caching of results; code block evaluated every
  14729. time.
  14730. @item @samp{yes}
  14731. Whether to run the code or return the cached results is
  14732. determined by comparing the SHA1 hash value of the combined code
  14733. block and arguments passed to it. This hash value is packed on
  14734. the @samp{#+RESULTS:} line from previous evaluation. When hash values
  14735. match, Org does not evaluate the code block. When hash values
  14736. mismatch, Org evaluates the code block, inserts the results,
  14737. recalculates the hash value, and updates @samp{#+RESULTS:} line.
  14738. @end table
  14739. In this example, both functions are cached. But @samp{caller} runs only if
  14740. the result from @samp{random} has changed since the last run.
  14741. @example
  14742. #+NAME: random
  14743. #+BEGIN_SRC R :cache yes
  14744. runif(1)
  14745. #+END_SRC
  14746. #+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
  14747. 0.4659510825295
  14748. #+NAME: caller
  14749. #+BEGIN_SRC emacs-lisp :var x=random :cache yes
  14750. x
  14751. #+END_SRC
  14752. #+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
  14753. 0.254227238707244
  14754. @end example
  14755. @node Results of Evaluation
  14756. @section Results of Evaluation
  14757. @cindex code block, results of evaluation
  14758. @cindex source code, results of evaluation
  14759. @cindex @samp{results}, header argument
  14760. How Org handles results of a code block execution depends on many
  14761. header arguments working together. The primary determinant, however,
  14762. is the @samp{results} header argument. It accepts four classes of options.
  14763. Each code block can take only one option per class:
  14764. @table @asis
  14765. @item collection
  14766. For how the results should be collected from the code block;
  14767. @item type
  14768. For which type of result the code block will return; affects how
  14769. Org processes and inserts results in the Org buffer;
  14770. @item format
  14771. For the result; affects how Org processes and inserts results in
  14772. the Org buffer;
  14773. @item handling
  14774. For processing results after evaluation of the code block;
  14775. @end table
  14776. @anchor{Collection}
  14777. @subheading Collection
  14778. Collection options specify the results. Choose one of the options;
  14779. they are mutually exclusive.
  14780. @table @asis
  14781. @item @samp{value}
  14782. Default. Functional mode. Org gets the value by wrapping the
  14783. code in a function definition in the language of the source
  14784. block. That is why when using @samp{:results value}, code should
  14785. execute like a function and return a value. For languages like
  14786. Python, an explicit @code{return} statement is mandatory when using
  14787. @samp{:results value}. Result is the value returned by the last
  14788. statement in the code block.
  14789. When evaluating the code block in a session (see @ref{Environment of a Code Block}), Org passes the code to an interpreter running as
  14790. an interactive Emacs inferior process. Org gets the value from
  14791. the source code interpreter's last statement output. Org has to
  14792. use language-specific methods to obtain the value. For example,
  14793. from the variable @code{_} in Python and Ruby, and the value of
  14794. @code{.Last.value} in R.
  14795. @item @samp{output}
  14796. Scripting mode. Org passes the code to an external process
  14797. running the interpreter. Org returns the contents of the
  14798. standard output stream as text results.
  14799. When using a session, Org passes the code to the interpreter
  14800. running as an interactive Emacs inferior process. Org
  14801. concatenates any text output from the interpreter and returns the
  14802. collection as a result.
  14803. Note that this collection is not the same as that would be
  14804. collected from stdout of a non-interactive interpreter running as
  14805. an external process. Compare for example these two blocks:
  14806. @example
  14807. #+BEGIN_SRC python :results output
  14808. print "hello"
  14809. 2
  14810. print "bye"
  14811. #+END_SRC
  14812. #+RESULTS:
  14813. : hello
  14814. : bye
  14815. @end example
  14816. In the above non-session mode, the ``2'' is not printed; so it does
  14817. not appear in results.
  14818. @example
  14819. #+BEGIN_SRC python :results output :session
  14820. print "hello"
  14821. 2
  14822. print "bye"
  14823. #+END_SRC
  14824. #+RESULTS:
  14825. : hello
  14826. : 2
  14827. : bye
  14828. @end example
  14829. In the above session, the interactive interpreter receives and
  14830. prints ``2''. Results show that.
  14831. @end table
  14832. @anchor{Type}
  14833. @subheading Type
  14834. Type tells what result types to expect from the execution of the code
  14835. block. Choose one of the options; they are mutually exclusive. The
  14836. default behavior is to automatically determine the result type.
  14837. @table @asis
  14838. @item @samp{table}
  14839. @itemx @samp{vector}
  14840. Interpret the results as an Org table. If the result is a single
  14841. value, create a table with one row and one column. Usage
  14842. example: @samp{:results value table}.
  14843. @cindex @samp{hlines}, header argument
  14844. In-between each table row or below the table headings, sometimes
  14845. results have horizontal lines, which are also known as ``hlines''.
  14846. The @samp{hlines} argument with the default @samp{no} value strips such
  14847. lines from the input table. For most code, this is desirable, or
  14848. else those @samp{hline} symbols raise unbound variable errors.
  14849. A @samp{yes} accepts such lines, as demonstrated in the following
  14850. example.
  14851. @example
  14852. #+NAME: many-cols
  14853. | a | b | c |
  14854. |---+---+---|
  14855. | d | e | f |
  14856. |---+---+---|
  14857. | g | h | i |
  14858. #+NAME: no-hline
  14859. #+BEGIN_SRC python :var tab=many-cols :hlines no
  14860. return tab
  14861. #+END_SRC
  14862. #+RESULTS: no-hline
  14863. | a | b | c |
  14864. | d | e | f |
  14865. | g | h | i |
  14866. #+NAME: hlines
  14867. #+BEGIN_SRC python :var tab=many-cols :hlines yes
  14868. return tab
  14869. #+END_SRC
  14870. #+RESULTS: hlines
  14871. | a | b | c |
  14872. |---+---+---|
  14873. | d | e | f |
  14874. |---+---+---|
  14875. | g | h | i |
  14876. @end example
  14877. @item @samp{list}
  14878. Interpret the results as an Org list. If the result is a single
  14879. value, create a list of one element.
  14880. @item @samp{scalar}
  14881. @itemx @samp{verbatim}
  14882. Interpret literally and insert as quoted text. Do not create
  14883. a table. Usage example: @samp{:results value verbatim}.
  14884. @item @samp{file}
  14885. Interpret as a filename. Save the results of execution of the
  14886. code block to that file, then insert a link to it. You can
  14887. control both the filename and the description associated to the
  14888. link.
  14889. @cindex @samp{file}, header argument
  14890. @cindex @samp{output-dir}, header argument
  14891. Org first tries to generate the filename from the value of the
  14892. @samp{file} header argument and the directory specified using the
  14893. @samp{output-dir} header arguments. If @samp{output-dir} is not specified,
  14894. Org assumes it is the current directory.
  14895. @example
  14896. #+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/
  14897. size(2cm);
  14898. draw(unitcircle);
  14899. #+END_SRC
  14900. @end example
  14901. @cindex @samp{file-ext}, header argument
  14902. If @samp{file} is missing, Org generates the base name of the output
  14903. file from the name of the code block, and its extension from the
  14904. @samp{file-ext} header argument. In that case, both the name and the
  14905. extension are mandatory.
  14906. @example
  14907. #+name: circle
  14908. #+BEGIN_SRC asymptote :results value file :file-ext pdf
  14909. size(2cm);
  14910. draw(unitcircle);
  14911. #+END_SRC
  14912. @end example
  14913. @cindex @samp{file-desc}, header argument
  14914. The @samp{file-desc} header argument defines the description (see
  14915. @ref{Link Format}) for the link. If @samp{file-desc} has no value, Org
  14916. uses the generated file name for both the ``link'' and
  14917. ``description'' parts of the link.
  14918. @end table
  14919. @anchor{Format}
  14920. @subheading Format
  14921. Format pertains to the type of the result returned by the code block.
  14922. Choose one of the options; they are mutually exclusive. The default
  14923. follows from the type specified above.
  14924. @table @asis
  14925. @item @samp{raw}
  14926. Interpreted as raw Org mode. Inserted directly into the buffer.
  14927. Aligned if it is a table. Usage example: @samp{:results value raw}.
  14928. @item @samp{org}
  14929. Results enclosed in a @samp{BEGIN_SRC org} block. For comma-escape,
  14930. either @kbd{@key{TAB}} in the block, or export the file. Usage
  14931. example: @samp{:results value org}.
  14932. @item @samp{html}
  14933. Results enclosed in a @samp{BEGIN_EXPORT html} block. Usage example:
  14934. @samp{:results value html}.
  14935. @item @samp{latex}
  14936. Results enclosed in a @samp{BEGIN_EXPORT latex} block. Usage example:
  14937. @samp{:results value latex}.
  14938. @item @samp{code}
  14939. Result enclosed in a code block. Useful for parsing. Usage
  14940. example: @samp{:results value code}.
  14941. @item @samp{pp}
  14942. Result converted to pretty-print source code. Enclosed in a code
  14943. block. Languages supported: Emacs Lisp, Python, and Ruby. Usage
  14944. example: @samp{:results value pp}.
  14945. @item @samp{drawer}
  14946. Result wrapped in a @samp{RESULTS} drawer. Useful for containing
  14947. @samp{raw} or @samp{org} results for later scripting and automated
  14948. processing. Usage example: @samp{:results value drawer}.
  14949. @end table
  14950. @anchor{Handling}
  14951. @subheading Handling
  14952. Handling options after collecting the results.
  14953. @table @asis
  14954. @item @samp{silent}
  14955. Do not insert results in the Org mode buffer, but echo them in
  14956. the minibuffer. Usage example: @samp{:results output silent}.
  14957. @item @samp{replace}
  14958. Default. Insert results in the Org buffer. Remove previous
  14959. results. Usage example: @samp{:results output replace}.
  14960. @item @samp{append}
  14961. Append results to the Org buffer. Latest results are at the
  14962. bottom. Does not remove previous results. Usage example:
  14963. @samp{:results output append}.
  14964. @item @samp{prepend}
  14965. Prepend results to the Org buffer. Latest results are at the
  14966. top. Does not remove previous results. Usage example: @samp{:results
  14967. output prepend}.
  14968. @end table
  14969. @anchor{Post-processing}
  14970. @subheading Post-processing
  14971. @cindex @samp{post}, header argument
  14972. @cindex @samp{*this*}, in @samp{post} header argument
  14973. The @samp{post} header argument is for post-processing results from block
  14974. evaluation. When @samp{post} has any value, Org binds the results to
  14975. @code{*this*} variable for easy passing to @samp{var} header argument
  14976. specifications (see @ref{Environment of a Code Block}). That makes results
  14977. available to other code blocks, or even for direct Emacs Lisp code
  14978. execution.
  14979. The following two examples illustrate @samp{post} header argument in
  14980. action. The first one shows how to attach an @samp{ATTR_LATEX} keyword
  14981. using @samp{post}.
  14982. @example
  14983. #+NAME: attr_wrap
  14984. #+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output
  14985. echo "#+ATTR_LATEX: :width $width"
  14986. echo "$data"
  14987. #+END_SRC
  14988. #+HEADER: :file /tmp/it.png
  14989. #+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer
  14990. digraph@{
  14991. a -> b;
  14992. b -> c;
  14993. c -> a;
  14994. @}
  14995. #+end_src
  14996. #+RESULTS:
  14997. :RESULTS:
  14998. #+ATTR_LATEX :width 5cm
  14999. [[file:/tmp/it.png]]
  15000. :END:
  15001. @end example
  15002. The second example shows use of @samp{colnames} header argument in @samp{post}
  15003. to pass data between code blocks.
  15004. @example
  15005. #+NAME: round-tbl
  15006. #+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f"
  15007. (mapcar (lambda (row)
  15008. (mapcar (lambda (cell)
  15009. (if (numberp cell)
  15010. (format fmt cell)
  15011. cell))
  15012. row))
  15013. tbl)
  15014. #+end_src
  15015. #+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*)
  15016. set.seed(42)
  15017. data.frame(foo=rnorm(1))
  15018. #+END_SRC
  15019. #+RESULTS:
  15020. | foo |
  15021. |-------|
  15022. | 1.371 |
  15023. @end example
  15024. @node Exporting Code Blocks
  15025. @section Exporting Code Blocks
  15026. @cindex code block, exporting
  15027. @cindex source code, exporting
  15028. It is possible to export the @emph{code} of code blocks, the @emph{results} of
  15029. code block evaluation, @emph{both} the code and the results of code block
  15030. evaluation, or @emph{none}. Org defaults to exporting @emph{code} for most
  15031. languages. For some languages, such as ditaa, Org defaults to
  15032. @emph{results}. To export just the body of code blocks, see @ref{Literal Examples}. To selectively export sub-trees of an Org document, see
  15033. @ref{Exporting}.
  15034. @cindex @samp{export}, header argument
  15035. The @samp{exports} header argument is to specify if that part of the Org
  15036. file is exported to, say, HTML or @LaTeX{} formats.
  15037. @table @asis
  15038. @item @samp{code}
  15039. The default. The body of code is included into the exported
  15040. file. Example: @samp{:exports code}.
  15041. @item @samp{results}
  15042. The results of evaluation of the code is included in the exported
  15043. file. Example: @samp{:exports results}.
  15044. @item @samp{both}
  15045. Both the code and results of evaluation are included in the
  15046. exported file. Example: @samp{:exports both}.
  15047. @item @samp{none}
  15048. Neither the code nor the results of evaluation is included in the
  15049. exported file. Whether the code is evaluated at all depends on
  15050. other options. Example: @samp{:exports none}.
  15051. @end table
  15052. @vindex org-export-use-babel
  15053. To stop Org from evaluating code blocks to speed exports, use the
  15054. header argument @samp{:eval never-export} (see @ref{Evaluating Code Blocks}).
  15055. To stop Org from evaluating code blocks for greater security, set the
  15056. @code{org-export-use-babel} variable to @code{nil}, but understand that header
  15057. arguments will have no effect.
  15058. Turning off evaluation comes in handy when batch processing. For
  15059. example, markup languages for wikis, which have a high risk of
  15060. untrusted code. Stopping code block evaluation also stops evaluation
  15061. of all header arguments of the code block. This may not be desirable
  15062. in some circumstances. So during export, to allow evaluation of just
  15063. the header arguments but not any code evaluation in the source block,
  15064. set @samp{:eval never-export} (see @ref{Evaluating Code Blocks}).
  15065. Org never evaluates code blocks in commented sub-trees when exporting
  15066. (see @ref{Comment Lines}). On the other hand, Org does evaluate code
  15067. blocks in sub-trees excluded from export (see @ref{Export Settings}).
  15068. @node Extracting Source Code
  15069. @section Extracting Source Code
  15070. @cindex tangling
  15071. @cindex source code, extracting
  15072. @cindex code block, extracting source code
  15073. Extracting source code from code blocks is a basic task in literate
  15074. programming. Org has features to make this easy. In literate
  15075. programming parlance, documents on creation are @emph{woven} with code and
  15076. documentation, and on export, the code is tangled for execution by
  15077. a computer. Org facilitates weaving and tangling for producing,
  15078. maintaining, sharing, and exporting literate programming documents.
  15079. Org provides extensive customization options for extracting source
  15080. code.
  15081. When Org tangles code blocks, it expands, merges, and transforms them.
  15082. Then Org recomposes them into one or more separate files, as
  15083. configured through the options. During this tangling process, Org
  15084. expands variables in the source code, and resolves any Noweb style
  15085. references (see @ref{Noweb Reference Syntax}).
  15086. @anchor{Header arguments}
  15087. @subheading Header arguments
  15088. @cindex @samp{tangle}, header argument
  15089. The @samp{tangle} header argument specifies if the code block is exported
  15090. to source file(s).
  15091. @table @asis
  15092. @item @samp{yes}
  15093. Export the code block to source file. The file name for the
  15094. source file is derived from the name of the Org file, and the
  15095. file extension is derived from the source code language
  15096. identifier. Example: @samp{:tangle yes}.
  15097. @item @samp{no}
  15098. The default. Do not extract the code in a source code file.
  15099. Example: @samp{:tangle no}.
  15100. @item @var{FILENAME}
  15101. Export the code block to source file whose file name is derived
  15102. from any string passed to the @samp{tangle} header argument. Org
  15103. derives the file name as being relative to the directory of the
  15104. Org file's location. Example: @samp{:tangle FILENAME}.
  15105. @end table
  15106. @cindex @samp{mkdirp}, header argument
  15107. The @samp{mkdirp} header argument creates parent directories for tangled
  15108. files if the directory does not exist. @samp{yes} enables directory
  15109. creation and @samp{no} inhibits directory creation.
  15110. @cindex @samp{comments}, header argument
  15111. The @samp{comments} header argument controls inserting comments into
  15112. tangled files. These are above and beyond whatever comments may
  15113. already exist in the code block.
  15114. @table @asis
  15115. @item @samp{no}
  15116. The default. Do not insert any extra comments during tangling.
  15117. @item @samp{link}
  15118. Wrap the code block in comments. Include links pointing back to
  15119. the place in the Org file from where the code was tangled.
  15120. @item @samp{yes}
  15121. Kept for backward compatibility; same as @samp{link}.
  15122. @item @samp{org}
  15123. Nearest headline text from Org file is inserted as comment. The
  15124. exact text that is inserted is picked from the leading context of
  15125. the source block.
  15126. @item @samp{both}
  15127. Includes both @samp{link} and @samp{org} options.
  15128. @item @samp{noweb}
  15129. Includes @samp{link} option, expands Noweb references (see @ref{Noweb Reference Syntax}), and wraps them in link comments inside the
  15130. body of the code block.
  15131. @end table
  15132. @cindex @samp{padline}, header argument
  15133. The @samp{padline} header argument controls insertion of newlines to pad
  15134. source code in the tangled file.
  15135. @table @asis
  15136. @item @samp{yes}
  15137. Default. Insert a newline before and after each code block in
  15138. the tangled file.
  15139. @item @samp{no}
  15140. Do not insert newlines to pad the tangled code blocks.
  15141. @end table
  15142. @cindex @samp{shebang}, header argument
  15143. The @samp{shebang} header argument can turn results into executable script
  15144. files. By setting it to a string value---for example, @samp{:shebang
  15145. "#!/bin/bash"}---Org inserts that string as the first line of the
  15146. tangled file that the code block is extracted to. Org then turns on
  15147. the tangled file's executable permission.
  15148. @cindex @samp{no-expand}, header argument
  15149. By default Org expands code blocks during tangling. The @samp{no-expand}
  15150. header argument turns off such expansions. Note that one side-effect
  15151. of expansion by @code{org-babel-expand-src-block} also assigns values (see
  15152. @ref{Environment of a Code Block}) to variables. Expansions also replace
  15153. Noweb references with their targets (see @ref{Noweb Reference Syntax}).
  15154. Some of these expansions may cause premature assignment, hence this
  15155. option. This option makes a difference only for tangling. It has no
  15156. effect when exporting since code blocks for execution have to be
  15157. expanded anyway.
  15158. @anchor{Functions}
  15159. @subheading Functions
  15160. @table @asis
  15161. @item @code{org-babel-tangle}
  15162. @findex org-babel-tangle
  15163. @kindex C-c C-v t
  15164. Tangle the current file. Bound to @kbd{C-c C-v t}.
  15165. With prefix argument only tangle the current code block.
  15166. @item @code{org-babel-tangle-file}
  15167. @findex org-babel-tangle-file
  15168. @kindex C-c C-v f
  15169. Choose a file to tangle. Bound to @kbd{C-c C-v f}.
  15170. @end table
  15171. @anchor{Hooks (1)}
  15172. @subheading Hooks
  15173. @table @asis
  15174. @item @code{org-babel-post-tangle-hook}
  15175. @vindex org-babel-post-tangle-hook
  15176. This hook is run from within code files tangled by
  15177. @code{org-babel-tangle}, making it suitable for post-processing,
  15178. compilation, and evaluation of code in the tangled files.
  15179. @end table
  15180. @anchor{Jumping between code and Org}
  15181. @subheading Jumping between code and Org
  15182. @findex org-babel-tangle-jump-to-org
  15183. Debuggers normally link errors and messages back to the source code.
  15184. But for tangled files, we want to link back to the Org file, not to
  15185. the tangled source file. To make this extra jump, Org uses
  15186. @code{org-babel-tangle-jump-to-org} function with two additional source
  15187. code block header arguments:
  15188. @enumerate
  15189. @item
  15190. Set @samp{padline} to true---this is the default setting.
  15191. @item
  15192. Set @samp{comments} to @samp{link}, which makes Org insert links to the Org
  15193. file.
  15194. @end enumerate
  15195. @node Languages
  15196. @section Languages
  15197. @cindex babel, languages
  15198. @cindex source code, languages
  15199. @cindex code block, languages
  15200. Code blocks in the following languages are supported.
  15201. @multitable {aaaaaaaaaa} {aaaaaaaaaa} {aaaaaaaaaaaaaa} {aaaaaaaaaa}
  15202. @headitem Language
  15203. @tab Identifier
  15204. @tab Language
  15205. @tab Identifier
  15206. @item Asymptote
  15207. @tab asymptote
  15208. @tab Awk
  15209. @tab awk
  15210. @item C
  15211. @tab C
  15212. @tab C++
  15213. @tab C++
  15214. @item Clojure
  15215. @tab clojure
  15216. @tab CSS
  15217. @tab css
  15218. @item D
  15219. @tab d
  15220. @tab ditaa
  15221. @tab ditaa
  15222. @item Graphviz
  15223. @tab dot
  15224. @tab Emacs Calc
  15225. @tab calc
  15226. @item Emacs Lisp
  15227. @tab emacs-lisp
  15228. @tab Fortran
  15229. @tab fortran
  15230. @item Gnuplot
  15231. @tab gnuplot
  15232. @tab Haskell
  15233. @tab haskell
  15234. @item Java
  15235. @tab java
  15236. @tab Javascript
  15237. @tab js
  15238. @item @LaTeX{}
  15239. @tab latex
  15240. @tab Ledger
  15241. @tab ledger
  15242. @item Lisp
  15243. @tab lisp
  15244. @tab Lilypond
  15245. @tab lilypond
  15246. @item Lua
  15247. @tab lua
  15248. @tab MATLAB
  15249. @tab matlab
  15250. @item Mscgen
  15251. @tab mscgen
  15252. @tab Objective Caml
  15253. @tab ocaml
  15254. @item Octave
  15255. @tab octave
  15256. @tab Org mode
  15257. @tab org
  15258. @item Oz
  15259. @tab oz
  15260. @tab Perl
  15261. @tab perl
  15262. @item Plantuml
  15263. @tab plantuml
  15264. @tab Processing.js
  15265. @tab processing
  15266. @item Python
  15267. @tab python
  15268. @tab R
  15269. @tab R
  15270. @item Ruby
  15271. @tab ruby
  15272. @tab Sass
  15273. @tab sass
  15274. @item Scheme
  15275. @tab scheme
  15276. @tab GNU Screen
  15277. @tab screen
  15278. @item Sed
  15279. @tab sed
  15280. @tab shell
  15281. @tab sh
  15282. @item SQL
  15283. @tab sql
  15284. @tab SQLite
  15285. @tab sqlite
  15286. @item Vala
  15287. @tab vala
  15288. @tab
  15289. @tab
  15290. @end multitable
  15291. Additional documentation for some languages is at
  15292. @uref{https://orgmode.org/worg/org-contrib/babel/languages.html}.
  15293. @vindex org-babel-load-languages
  15294. By default, only Emacs Lisp is enabled for evaluation. To enable or
  15295. disable other languages, customize the @code{org-babel-load-languages}
  15296. variable either through the Emacs customization interface, or by
  15297. adding code to the init file as shown next.
  15298. In this example, evaluation is disabled for Emacs Lisp, and enabled
  15299. for R.
  15300. @lisp
  15301. (org-babel-do-load-languages
  15302. 'org-babel-load-languages
  15303. '((emacs-lisp . nil)
  15304. (R . t)))
  15305. @end lisp
  15306. Note that this is not the only way to enable a language. Org also
  15307. enables languages when loaded with @code{require} statement. For example,
  15308. the following enables execution of Clojure code blocks:
  15309. @lisp
  15310. (require 'ob-clojure)
  15311. @end lisp
  15312. @node Editing Source Code
  15313. @section Editing Source Code
  15314. @cindex code block, editing
  15315. @cindex source code, editing
  15316. @kindex C-c '
  15317. Use @kbd{C-c '} to edit the current code block. It opens a new
  15318. major-mode edit buffer containing the body of the source code block,
  15319. ready for any edits. Use @kbd{C-c '} again to close the buffer
  15320. and return to the Org buffer.
  15321. @kindex C-x C-s
  15322. @vindex org-edit-src-auto-save-idle-delay
  15323. @cindex auto-save, in code block editing
  15324. @kbd{C-x C-s} saves the buffer and updates the contents of the
  15325. Org buffer. Set @code{org-edit-src-auto-save-idle-delay} to save the base
  15326. buffer after a certain idle delay time. Set
  15327. @code{org-edit-src-turn-on-auto-save} to auto-save this buffer into
  15328. a separate file using Auto-save mode.
  15329. While editing the source code in the major mode, the Org Src minor
  15330. mode remains active. It provides these customization variables as
  15331. described below. For even more variables, look in the customization
  15332. group @code{org-edit-structure}.
  15333. @table @asis
  15334. @item @code{org-src-lang-modes}
  15335. @vindex org-src-lang-modes
  15336. If an Emacs major-mode named @code{<LANG>-mode} exists, where
  15337. @var{<LANG>} is the language identifier from code block's
  15338. header line, then the edit buffer uses that major mode. Use this
  15339. variable to arbitrarily map language identifiers to major modes.
  15340. @item @code{org-src-window-setup}
  15341. @vindex org-src-window-setup
  15342. For specifying Emacs window arrangement when the new edit buffer
  15343. is created.
  15344. @item @code{org-src-preserve-indentation}
  15345. @cindex indentation, in code blocks
  15346. @vindex org-src-preserve-indentation
  15347. Default is @code{nil}. Source code is indented. This indentation
  15348. applies during export or tangling, and depending on the context,
  15349. may alter leading spaces and tabs. When non-@code{nil}, source code
  15350. is aligned with the leftmost column. No lines are modified
  15351. during export or tangling, which is very useful for white-space
  15352. sensitive languages, such as Python.
  15353. @item @code{org-src-ask-before-returning-to-edit-buffer}
  15354. @vindex org-src-ask-before-returning-to-edit-buffer
  15355. When @code{nil}, Org returns to the edit buffer without further
  15356. prompts. The default prompts for a confirmation.
  15357. @end table
  15358. @vindex org-src-fontify-natively
  15359. @vindex org-src-block-faces
  15360. Set @code{org-src-fontify-natively} to non-@code{nil} to turn on native code
  15361. fontification in the @emph{Org} buffer. Fontification of code blocks can
  15362. give visual separation of text and code on the display page. To
  15363. further customize the appearance of @code{org-block} for specific
  15364. languages, customize @code{org-src-block-faces}. The following example
  15365. shades the background of regular blocks, and colors source blocks only
  15366. for Python and Emacs Lisp languages.
  15367. @lisp
  15368. (require 'color)
  15369. (set-face-attribute 'org-block nil :background
  15370. (color-darken-name
  15371. (face-attribute 'default :background) 3))
  15372. (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
  15373. ("python" (:background "#E5FFB8"))))
  15374. @end lisp
  15375. @node Noweb Reference Syntax
  15376. @section Noweb Reference Syntax
  15377. @cindex code block, Noweb reference
  15378. @cindex syntax, Noweb
  15379. @cindex source code, Noweb reference
  15380. Org supports named blocks in Noweb@footnote{For Noweb literate programming details, see
  15381. @uref{http://www.cs.tufts.edu/~nr/noweb/}.} style syntax:
  15382. @example
  15383. <<CODE-BLOCK-ID>>
  15384. @end example
  15385. Org can replace the construct with the source code, or the results of
  15386. evaluation, of the code block identified as @var{CODE-BLOCK-ID}.
  15387. @cindex @samp{noweb}, header argument
  15388. The @samp{noweb} header argument controls expansion of Noweb syntax
  15389. references. Expansions occur when source code blocks are evaluated,
  15390. tangled, or exported.
  15391. @table @asis
  15392. @item @samp{no}
  15393. Default. No expansion of Noweb syntax references in the body of
  15394. the code when evaluating, tangling, or exporting.
  15395. @item @samp{yes}
  15396. Expansion of Noweb syntax references in the body of the code
  15397. block when evaluating, tangling, or exporting.
  15398. @item @samp{tangle}
  15399. Expansion of Noweb syntax references in the body of the code
  15400. block when tangling. No expansion when evaluating or exporting.
  15401. @item @samp{no-export}
  15402. Expansion of Noweb syntax references in the body of the code
  15403. block when evaluating or tangling. No expansion when exporting.
  15404. @item @samp{strip-export}
  15405. Expansion of Noweb syntax references in the body of the code
  15406. block when expanding prior to evaluating or tangling. Removes
  15407. Noweb syntax references when exporting.
  15408. @item @samp{eval}
  15409. Expansion of Noweb syntax references in the body of the code
  15410. block only before evaluating.
  15411. @end table
  15412. In the following example,
  15413. @example
  15414. #+NAME: initialization
  15415. #+BEGIN_SRC emacs-lisp
  15416. (setq sentence "Never a foot too far, even.")
  15417. #+END_SRC
  15418. #+BEGIN_SRC emacs-lisp :noweb yes
  15419. <<initialization>>
  15420. (reverse sentence)
  15421. #+END_SRC
  15422. @end example
  15423. @noindent
  15424. the second code block is expanded as
  15425. @example
  15426. #+BEGIN_SRC emacs-lisp :noweb yes
  15427. (setq sentence "Never a foot too far, even.")
  15428. (reverse sentence)
  15429. #+END_SRC
  15430. @end example
  15431. Noweb insertions honor prefix characters that appear before the Noweb
  15432. syntax reference. This behavior is illustrated in the following
  15433. example. Because the @samp{<<example>>} Noweb reference appears behind the
  15434. SQL comment syntax, each line of the expanded Noweb reference is
  15435. commented. With:
  15436. @example
  15437. #+NAME: example
  15438. #+BEGIN_SRC text
  15439. this is the
  15440. multi-line body of example
  15441. #+END_SRC
  15442. @end example
  15443. @noindent
  15444. this code block:
  15445. @example
  15446. #+BEGIN_SRC sql :noweb yes
  15447. ---<<example>>
  15448. #+END_SRC
  15449. @end example
  15450. @noindent
  15451. expands to:
  15452. @example
  15453. #+BEGIN_SRC sql :noweb yes
  15454. ---this is the
  15455. ---multi-line body of example
  15456. #+END_SRC
  15457. @end example
  15458. Since this change does not affect Noweb replacement text without
  15459. newlines in them, inline Noweb references are acceptable.
  15460. This feature can also be used for management of indentation in
  15461. exported code snippets. With:
  15462. @example
  15463. #+NAME: if-true
  15464. #+BEGIN_SRC python :exports none
  15465. print('do things when true')
  15466. #+end_src
  15467. #+name: if-false
  15468. #+begin_src python :exports none
  15469. print('do things when false')
  15470. #+end_src
  15471. @end example
  15472. @noindent
  15473. this code block:
  15474. @example
  15475. #+begin_src python :noweb yes :results output
  15476. if true:
  15477. <<if-true>>
  15478. else:
  15479. <<if-false>>
  15480. #+end_src
  15481. @end example
  15482. @noindent
  15483. expands to:
  15484. @example
  15485. if true:
  15486. print('do things when true')
  15487. else:
  15488. print('do things when false')
  15489. @end example
  15490. @cindex @samp{noweb-ref}, header argument
  15491. When expanding Noweb style references, Org concatenates code blocks by
  15492. matching the reference name to either the code block name or, if none
  15493. is found, to the @samp{noweb-ref} header argument.
  15494. For simple concatenation, set this @samp{noweb-ref} header argument at the
  15495. sub-tree or file level. In the example Org file shown next, the body
  15496. of the source code in each block is extracted for concatenation to
  15497. a pure code file when tangled.
  15498. @example
  15499. #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
  15500. <<fullest-disk>>
  15501. #+END_SRC
  15502. * the mount point of the fullest disk
  15503. :PROPERTIES:
  15504. :header-args: :noweb-ref fullest-disk
  15505. :END:
  15506. ** query all mounted disks
  15507. #+BEGIN_SRC sh
  15508. df \
  15509. #+END_SRC
  15510. ** strip the header row
  15511. #+BEGIN_SRC sh
  15512. |sed '1d' \
  15513. #+END_SRC
  15514. ** output mount point of fullest disk
  15515. #+BEGIN_SRC sh
  15516. |awk '@{if (u < +$5) @{u = +$5; m = $6@}@} END @{print m@}'
  15517. #+END_SRC
  15518. @end example
  15519. @cindex @samp{noweb-sep}, header argument
  15520. By default a newline separates each noweb reference concatenation. To
  15521. change this newline separator, edit the @samp{noweb-sep} header argument.
  15522. Eventually, Org can include the results of a code block rather than
  15523. its body. To that effect, append parentheses, possibly including
  15524. arguments, to the code block name, as shown below.
  15525. @example
  15526. <<code-block-name(optional arguments)>>
  15527. @end example
  15528. Note that when using the above approach to a code block's results, the
  15529. code block name set by @samp{NAME} keyword is required; the reference set
  15530. by @samp{noweb-ref} does not work in that case.
  15531. Here is an example that demonstrates how the exported content changes
  15532. when Noweb style references are used with parentheses versus without.
  15533. With:
  15534. @example
  15535. #+NAME: some-code
  15536. #+BEGIN_SRC python :var num=0 :results output :exports none
  15537. print(num*10)
  15538. #+END_SRC
  15539. @end example
  15540. @noindent
  15541. this code block:
  15542. @example
  15543. #+BEGIN_SRC text :noweb yes
  15544. <<some-code>>
  15545. #+END_SRC
  15546. @end example
  15547. @noindent
  15548. expands to:
  15549. @example
  15550. print(num*10)
  15551. @end example
  15552. Below, a similar Noweb style reference is used, but with parentheses,
  15553. while setting a variable @samp{num} to 10:
  15554. @example
  15555. #+BEGIN_SRC text :noweb yes
  15556. <<some-code(num=10)>>
  15557. #+END_SRC
  15558. @end example
  15559. @noindent
  15560. Note that now the expansion contains the results of the code block
  15561. @samp{some-code}, not the code block itself:
  15562. @example
  15563. 100
  15564. @end example
  15565. @node Library of Babel
  15566. @section Library of Babel
  15567. @cindex babel, library of
  15568. @cindex source code, library
  15569. @cindex code block, library
  15570. The ``Library of Babel'' is a collection of code blocks. Like
  15571. a function library, these code blocks can be called from other Org
  15572. files. A collection of useful code blocks is available on @uref{https://orgmode.org/worg/library-of-babel.html, Worg}. For
  15573. remote code block evaluation syntax, see @ref{Evaluating Code Blocks}.
  15574. @kindex C-c C-v i
  15575. @findex org-babel-lob-ingest
  15576. For any user to add code to the library, first save the code in
  15577. regular code blocks of an Org file, and then load the Org file with
  15578. @code{org-babel-lob-ingest}, which is bound to @kbd{C-c C-v i}.
  15579. @node Key bindings and Useful Functions
  15580. @section Key bindings and Useful Functions
  15581. @cindex code block, key bindings
  15582. Many common Org mode key sequences are re-bound depending on
  15583. the context.
  15584. Active key bindings in code blocks:
  15585. @kindex C-c C-c
  15586. @findex org-babel-execute-src-block
  15587. @kindex C-c C-o
  15588. @findex org-babel-open-src-block-result
  15589. @kindex M-UP
  15590. @findex org-babel-load-in-session
  15591. @kindex M-DOWN
  15592. @findex org-babel-pop-to-session
  15593. @multitable @columnfractions 0.2 0.55
  15594. @headitem Key binding
  15595. @tab Function
  15596. @item @kbd{C-c C-c}
  15597. @tab @code{org-babel-execute-src-block}
  15598. @item @kbd{C-c C-o}
  15599. @tab @code{org-babel-open-src-block-result}
  15600. @item @kbd{M-@key{UP}}
  15601. @tab @code{org-babel-load-in-session}
  15602. @item @kbd{M-@key{DOWN}}
  15603. @tab @code{org-babel-pop-to-session}
  15604. @end multitable
  15605. Active key bindings in Org mode buffer:
  15606. @kindex C-c C-v p
  15607. @kindex C-c C-v C-p
  15608. @kindex C-c C-v n
  15609. @kindex C-c C-v C-n
  15610. @kindex C-c C-v e
  15611. @kindex C-c C-v C-e
  15612. @kindex C-c C-v o
  15613. @kindex C-c C-v C-o
  15614. @kindex C-c C-v v
  15615. @kindex C-c C-v C-v
  15616. @kindex C-c C-v u
  15617. @kindex C-c C-v C-u
  15618. @kindex C-c C-v g
  15619. @kindex C-c C-v C-g
  15620. @kindex C-c C-v r
  15621. @kindex C-c C-v C-r
  15622. @kindex C-c C-v b
  15623. @kindex C-c C-v C-b
  15624. @kindex C-c C-v s
  15625. @kindex C-c C-v C-s
  15626. @kindex C-c C-v d
  15627. @kindex C-c C-v C-d
  15628. @kindex C-c C-v t
  15629. @kindex C-c C-v C-t
  15630. @kindex C-c C-v f
  15631. @kindex C-c C-v C-f
  15632. @kindex C-c C-v c
  15633. @kindex C-c C-v C-c
  15634. @kindex C-c C-v j
  15635. @kindex C-c C-v C-j
  15636. @kindex C-c C-v l
  15637. @kindex C-c C-v C-l
  15638. @kindex C-c C-v i
  15639. @kindex C-c C-v C-i
  15640. @kindex C-c C-v I
  15641. @kindex C-c C-v C-I
  15642. @kindex C-c C-v z
  15643. @kindex C-c C-v C-z
  15644. @kindex C-c C-v a
  15645. @kindex C-c C-v C-a
  15646. @kindex C-c C-v h
  15647. @kindex C-c C-v C-h
  15648. @kindex C-c C-v x
  15649. @kindex C-c C-v C-x
  15650. @findex org-babel-previous-src-block
  15651. @findex org-babel-next-src-block
  15652. @findex org-babel-execute-maybe
  15653. @findex org-babel-open-src-block-result
  15654. @findex org-babel-expand-src-block
  15655. @findex org-babel-goto-src-block-head
  15656. @findex org-babel-goto-named-src-block
  15657. @findex org-babel-goto-named-result
  15658. @findex org-babel-execute-buffer
  15659. @findex org-babel-execute-subtree
  15660. @findex org-babel-demarcate-block
  15661. @findex org-babel-tangle
  15662. @findex org-babel-tangle-file
  15663. @findex org-babel-check-src-block
  15664. @findex org-babel-insert-header-arg
  15665. @findex org-babel-load-in-session
  15666. @findex org-babel-lob-ingest
  15667. @findex org-babel-view-src-block-info
  15668. @findex org-babel-switch-to-session-with-code
  15669. @findex org-babel-sha1-hash
  15670. @findex org-babel-describe-bindings
  15671. @findex org-babel-do-key-sequence-in-edit-buffer
  15672. @multitable @columnfractions 0.45 0.55
  15673. @headitem Key binding
  15674. @tab Function
  15675. @item @kbd{C-c C-v p} or @kbd{C-c C-v C-p}
  15676. @tab @code{org-babel-previous-src-block}
  15677. @item @kbd{C-c C-v n} or @kbd{C-c C-v C-n}
  15678. @tab @code{org-babel-next-src-block}
  15679. @item @kbd{C-c C-v e} or @kbd{C-c C-v C-e}
  15680. @tab @code{org-babel-execute-maybe}
  15681. @item @kbd{C-c C-v o} or @kbd{C-c C-v C-o}
  15682. @tab @code{org-babel-open-src-block-result}
  15683. @item @kbd{C-c C-v v} or @kbd{C-c C-v C-v}
  15684. @tab @code{org-babel-expand-src-block}
  15685. @item @kbd{C-c C-v u} or @kbd{C-c C-v C-u}
  15686. @tab @code{org-babel-goto-src-block-head}
  15687. @item @kbd{C-c C-v g} or @kbd{C-c C-v C-g}
  15688. @tab @code{org-babel-goto-named-src-block}
  15689. @item @kbd{C-c C-v r} or @kbd{C-c C-v C-r}
  15690. @tab @code{org-babel-goto-named-result}
  15691. @item @kbd{C-c C-v b} or @kbd{C-c C-v C-b}
  15692. @tab @code{org-babel-execute-buffer}
  15693. @item @kbd{C-c C-v s} or @kbd{C-c C-v C-s}
  15694. @tab @code{org-babel-execute-subtree}
  15695. @item @kbd{C-c C-v d} or @kbd{C-c C-v C-d}
  15696. @tab @code{org-babel-demarcate-block}
  15697. @item @kbd{C-c C-v t} or @kbd{C-c C-v C-t}
  15698. @tab @code{org-babel-tangle}
  15699. @item @kbd{C-c C-v f} or @kbd{C-c C-v C-f}
  15700. @tab @code{org-babel-tangle-file}
  15701. @item @kbd{C-c C-v c} or @kbd{C-c C-v C-c}
  15702. @tab @code{org-babel-check-src-block}
  15703. @item @kbd{C-c C-v j} or @kbd{C-c C-v C-j}
  15704. @tab @code{org-babel-insert-header-arg}
  15705. @item @kbd{C-c C-v l} or @kbd{C-c C-v C-l}
  15706. @tab @code{org-babel-load-in-session}
  15707. @item @kbd{C-c C-v i} or @kbd{C-c C-v C-i}
  15708. @tab @code{org-babel-lob-ingest}
  15709. @item @kbd{C-c C-v I} or @kbd{C-c C-v C-I}
  15710. @tab @code{org-babel-view-src-block-info}
  15711. @item @kbd{C-c C-v z} or @kbd{C-c C-v C-z}
  15712. @tab @code{org-babel-switch-to-session-with-code}
  15713. @item @kbd{C-c C-v a} or @kbd{C-c C-v C-a}
  15714. @tab @code{org-babel-sha1-hash}
  15715. @item @kbd{C-c C-v h} or @kbd{C-c C-v C-h}
  15716. @tab @code{org-babel-describe-bindings}
  15717. @item @kbd{C-c C-v x} or @kbd{C-c C-v C-x}
  15718. @tab @code{org-babel-do-key-sequence-in-edit-buffer}
  15719. @end multitable
  15720. @node Batch Execution
  15721. @section Batch Execution
  15722. @cindex code block, batch execution
  15723. @cindex source code, batch execution
  15724. Org mode features, including working with source code facilities can
  15725. be invoked from the command line. This enables building shell scripts
  15726. for batch processing, running automated system tasks, and expanding
  15727. Org mode's usefulness.
  15728. The sample script shows batch processing of multiple files using
  15729. @code{org-babel-tangle}.
  15730. @example
  15731. #!/bin/sh
  15732. # Tangle files with Org mode
  15733. #
  15734. emacs -Q --batch --eval "
  15735. (progn
  15736. (require 'ob-tangle)
  15737. (dolist (file command-line-args-left)
  15738. (with-current-buffer (find-file-noselect file)
  15739. (org-babel-tangle))))
  15740. " "$@@"
  15741. @end example
  15742. @node Miscellaneous
  15743. @chapter Miscellaneous
  15744. @menu
  15745. * Completion:: M-@key{TAB} guesses completions.
  15746. * Structure Templates:: Quick insertion of structural elements.
  15747. * Speed Keys:: Electric commands at the beginning of a headline.
  15748. * Code Evaluation Security:: Org files evaluate in-line code.
  15749. * Customization:: Adapting Org to your taste.
  15750. * In-buffer Settings:: Overview of keywords.
  15751. * The Very Busy @kbd{C-c C-c} Key:: When in doubt, press @kbd{C-c C-c}.
  15752. * Clean View:: Getting rid of leading stars in the outline.
  15753. * TTY Keys:: Using Org on a tty.
  15754. * Interaction:: With other Emacs packages.
  15755. * Org Crypt:: Encrypting Org files.
  15756. @end menu
  15757. @node Completion
  15758. @section Completion
  15759. @cindex completion, of @TeX{} symbols
  15760. @cindex completion, of TODO keywords
  15761. @cindex completion, of dictionary words
  15762. @cindex completion, of option keywords
  15763. @cindex completion, of tags
  15764. @cindex completion, of property keys
  15765. @cindex completion, of link abbreviations
  15766. @cindex @TeX{} symbol completion
  15767. @cindex TODO keywords completion
  15768. @cindex dictionary word completion
  15769. @cindex option keyword completion
  15770. @cindex tag completion
  15771. @cindex link abbreviations, completion of
  15772. Org has in-buffer completions. Unlike minibuffer completions, which
  15773. are useful for quick command interactions, Org's in-buffer completions
  15774. are more suitable for content creation in Org documents. Type one or
  15775. more letters and invoke the hot key to complete the text in-place.
  15776. Depending on the context and the keys, Org offers different types of
  15777. completions. No minibuffer is involved. Such mode-specific hot keys
  15778. have become an integral part of Emacs and Org provides several
  15779. shortcuts.
  15780. @table @asis
  15781. @item @kbd{M-@key{TAB}}
  15782. @kindex M-TAB
  15783. Complete word at point.
  15784. @itemize
  15785. @item
  15786. At the beginning of a headline, complete TODO keywords.
  15787. @item
  15788. After @samp{\}, complete @TeX{} symbols supported by the exporter.
  15789. @item
  15790. After @samp{*}, complete headlines in the current buffer so that
  15791. they can be used in search links like:
  15792. @example
  15793. [[*find this headline]]
  15794. @end example
  15795. @item
  15796. After @samp{:} in a headline, complete tags. Org deduces the list
  15797. of tags from the @samp{TAGS} in-buffer option (see @ref{Setting Tags}),
  15798. the variable @code{org-tag-alist}, or from all tags used in the
  15799. current buffer.
  15800. @item
  15801. After @samp{:} and not in a headline, complete property keys. The
  15802. list of keys is constructed dynamically from all keys used in
  15803. the current buffer.
  15804. @item
  15805. After @samp{[}, complete link abbreviations (see @ref{Link Abbreviations}).
  15806. @item
  15807. After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
  15808. file-specific @samp{OPTIONS}. After option keyword is complete,
  15809. pressing @kbd{M-@key{TAB}} again inserts example settings for
  15810. this keyword.
  15811. @item
  15812. After @samp{STARTUP} keyword, complete startup items.
  15813. @item
  15814. When point is anywhere else, complete dictionary words using
  15815. Ispell.
  15816. @end itemize
  15817. @end table
  15818. @node Structure Templates
  15819. @section Structure Templates
  15820. @cindex template insertion
  15821. @cindex insertion, of templates
  15822. With just a few keystrokes, it is possible to insert empty structural
  15823. blocks, such as @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}, or to wrap existing
  15824. text in such a block.
  15825. @table @asis
  15826. @item @kbd{C-c C-x w} (@code{org-insert-structure-template})
  15827. Prompt for a type of block structure, and insert the block at
  15828. point. If the region is active, it is wrapped in the block.
  15829. First prompts the user for a key, which is used to look up
  15830. a structure type from the values below. If the key is
  15831. @kbd{@key{TAB}}, the user is prompted to enter a type.
  15832. @end table
  15833. @vindex org-structure-template-alist
  15834. Available structure types are defined in
  15835. @code{org-structure-template-alist}, see the docstring for adding or
  15836. changing values.
  15837. @cindex Tempo
  15838. @cindex template expansion
  15839. @cindex insertion, of templates
  15840. @vindex org-tempo-keywords-alist
  15841. @vindex org-structure-template-alist
  15842. Org Tempo expands snippets to structures defined in
  15843. @code{org-structure-template-alist} and @code{org-tempo-keywords-alist}. For
  15844. example, @kbd{< s @key{TAB}} creates a code block. Enable it by
  15845. customizing @code{org-modules} or add @code{(require 'org-tempo)} to your Emacs
  15846. init file@footnote{For more information, please refer to the commentary section
  15847. in @samp{org-tempo.el}.}.
  15848. @multitable @columnfractions 0.1 0.9
  15849. @item @kbd{a}
  15850. @tab @samp{#+BEGIN_EXPORT ascii} @dots{} @samp{#+END_EXPORT}
  15851. @item @kbd{c}
  15852. @tab @samp{#+BEGIN_CENTER} @dots{} @samp{#+END_CENTER}
  15853. @item @kbd{C}
  15854. @tab @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT}
  15855. @item @kbd{e}
  15856. @tab @samp{#+BEGIN_EXAMPLE} @dots{} @samp{#+END_EXAMPLE}
  15857. @item @kbd{h}
  15858. @tab @samp{#+BEGIN_EXPORT html} @dots{} @samp{#+END_EXPORT}
  15859. @item @kbd{l}
  15860. @tab @samp{#+BEGIN_EXPORT latex} @dots{} @samp{#+END_EXPORT}
  15861. @item @kbd{q}
  15862. @tab @samp{#+BEGIN_QUOTE} @dots{} @samp{#+END_QUOTE}
  15863. @item @kbd{s}
  15864. @tab @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}
  15865. @item @kbd{v}
  15866. @tab @samp{#+BEGIN_VERSE} @dots{} @samp{#+END_VERSE}
  15867. @end multitable
  15868. @node Speed Keys
  15869. @section Speed Keys
  15870. @cindex speed keys
  15871. Single keystrokes can execute custom commands in an Org file when the
  15872. cursor is on a headline. Without the extra burden of a meta or
  15873. modifier key, Speed Keys can speed navigation or execute custom
  15874. commands. Besides faster navigation, Speed Keys may come in handy on
  15875. small mobile devices that do not have full keyboards. Speed Keys may
  15876. also work on TTY devices known for their problems when entering Emacs
  15877. key chords.
  15878. @vindex org-use-speed-commands
  15879. By default, Org has Speed Keys disabled. To activate Speed Keys, set
  15880. the variable @code{org-use-speed-commands} to a non-@code{nil} value. To
  15881. trigger a Speed Key, the cursor must be at the beginning of an Org
  15882. headline, before any of the stars.
  15883. @vindex org-speed-commands-user
  15884. @findex org-speed-command-help
  15885. Org comes with a pre-defined list of Speed Keys. To add or modify
  15886. Speed Keys, customize the variable, @code{org-speed-commands-user}. For
  15887. more details, see the variable's docstring. With Speed Keys
  15888. activated, @kbd{M-x org-speed-command-help}, or @kbd{?} when
  15889. cursor is at the beginning of an Org headline, shows currently active
  15890. Speed Keys, including the user-defined ones.
  15891. @node Code Evaluation Security
  15892. @section Code Evaluation and Security Issues
  15893. Unlike plain text, running code comes with risk. Each @samp{src} code
  15894. block, in terms of risk, is equivalent to an executable file. Org
  15895. therefore puts a few confirmation prompts by default. This is to
  15896. alert the casual user from accidentally running untrusted code.
  15897. For users who do not run code blocks or write code regularly, Org's
  15898. default settings should suffice. However, some users may want to
  15899. tweak the prompts for fewer interruptions. To weigh the risks of
  15900. automatic execution of code blocks, here are some details about code
  15901. evaluation.
  15902. Org evaluates code in the following circumstances:
  15903. @table @asis
  15904. @item @emph{Source code blocks}
  15905. Org evaluates @samp{src} code blocks in an Org file during export.
  15906. Org also evaluates a @samp{src} code block with the @kbd{C-c C-c}
  15907. key chord. Users exporting or running code blocks must load
  15908. files only from trusted sources. Be wary of customizing
  15909. variables that remove or alter default security measures.
  15910. @defopt org-confirm-babel-evaluate
  15911. When @code{t}, Org prompts the user for confirmation before executing
  15912. each code block. When @code{nil}, Org executes code blocks without
  15913. prompting the user for confirmation. When this option is set to
  15914. a custom function, Org invokes the function with these two
  15915. arguments: the source code language and the body of the code
  15916. block. The custom function must return either a @code{t} or @code{nil},
  15917. which determines if the user is prompted. Each source code
  15918. language can be handled separately through this function
  15919. argument.
  15920. @end defopt
  15921. For example, here is how to execute ditaa code blocks without
  15922. prompting:
  15923. @lisp
  15924. (defun my-org-confirm-babel-evaluate (lang body)
  15925. (not (string= lang "ditaa"))) ;don't ask for ditaa
  15926. (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
  15927. @end lisp
  15928. @item @emph{Following @samp{shell} and @samp{elisp} links}
  15929. Org has two link types that can directly evaluate code (see
  15930. @ref{External Links}). Because such code is not visible, these links
  15931. have a potential risk. Org therefore prompts the user when it
  15932. encounters such links. The customization variables are:
  15933. @defopt org-confirm-shell-link-function
  15934. Function that prompts the user before executing a shell link.
  15935. @end defopt
  15936. @defopt org-confirm-elisp-link-function
  15937. Function that prompts the user before executing an Emacs Lisp link.
  15938. @end defopt
  15939. @item @emph{Formulas in tables}
  15940. Formulas in tables (see @ref{The spreadsheet}) are code that is
  15941. evaluated either by the Calc interpreter, or by the Emacs Lisp
  15942. interpreter.
  15943. @end table
  15944. @node Customization
  15945. @section Customization
  15946. @cindex customization
  15947. @cindex options, for customization
  15948. @cindex variables, for customization
  15949. Org has more than 500 variables for customization. They can be
  15950. accessed through the usual @kbd{M-x org-customize} command. Or
  15951. through the Org menu: Org @arrow{} Customization @arrow{} Browse Org Group.
  15952. Org also has per-file settings for some variables (see @ref{In-buffer Settings}).
  15953. @node In-buffer Settings
  15954. @section Summary of In-Buffer Settings
  15955. @cindex in-buffer settings
  15956. @cindex special keywords
  15957. In-buffer settings start with @samp{#+}, followed by a keyword, a colon,
  15958. and then a word for each setting. Org accepts multiple settings on
  15959. the same line. Org also accepts multiple lines for a keyword. This
  15960. manual describes these settings throughout. A summary follows here.
  15961. @cindex refresh set-up
  15962. @kbd{C-c C-c} activates any changes to the in-buffer settings.
  15963. Closing and reopening the Org file in Emacs also activates the
  15964. changes.
  15965. @table @asis
  15966. @item @samp{#+ARCHIVE: %s_done}
  15967. @cindex @samp{ARCHIVE}, keyword
  15968. @vindex org-archive-location
  15969. Sets the archive location of the agenda file. The corresponding
  15970. variable is @code{org-archive-location}.
  15971. @item @samp{#+CATEGORY}
  15972. @cindex @samp{CATEGORY}, keyword
  15973. Sets the category of the agenda file, which applies to the entire
  15974. document.
  15975. @item @samp{#+COLUMNS: %25ITEM ...}
  15976. @cindex @samp{COLUMNS}, property
  15977. Set the default format for columns view. This format applies
  15978. when columns view is invoked in locations where no @samp{COLUMNS}
  15979. property applies.
  15980. @item @samp{#+CONSTANTS: name1=value1 ...}
  15981. @cindex @samp{CONSTANTS}, keyword
  15982. @vindex org-table-formula-constants
  15983. @vindex org-table-formula
  15984. Set file-local values for constants that table formulas can use.
  15985. This line sets the local variable
  15986. @code{org-table-formula-constants-local}. The global version of this
  15987. variable is @code{org-table-formula-constants}.
  15988. @item @samp{#+FILETAGS: :tag1:tag2:tag3:}
  15989. @cindex @samp{FILETAGS}, keyword
  15990. Set tags that all entries in the file inherit from, including the
  15991. top-level entries.
  15992. @item @samp{#+LINK: linkword replace}
  15993. @cindex @samp{LINK}, keyword
  15994. @vindex org-link-abbrev-alist
  15995. Each line specifies one abbreviation for one link. Use multiple
  15996. @samp{LINK} keywords for more, see @ref{Link Abbreviations}. The
  15997. corresponding variable is @code{org-link-abbrev-alist}.
  15998. @item @samp{#+PRIORITIES: highest lowest default}
  15999. @cindex @samp{PRIORITIES}, keyword
  16000. @vindex org-highest-priority
  16001. @vindex org-lowest-priority
  16002. @vindex org-default-priority
  16003. This line sets the limits and the default for the priorities.
  16004. All three must be either letters A--Z or numbers 0--9. The
  16005. highest priority must have a lower ASCII number than the lowest
  16006. priority.
  16007. @item @samp{#+PROPERTY: Property_Name Value}
  16008. @cindex @samp{PROPERTY}, keyword
  16009. This line sets a default inheritance value for entries in the
  16010. current buffer, most useful for specifying the allowed values of
  16011. a property.
  16012. @item @samp{#+SETUPFILE: file}
  16013. @cindex @samp{SETUPFILE}, keyword
  16014. The setup file or a URL pointing to such file is for additional
  16015. in-buffer settings. Org loads this file and parses it for any
  16016. settings in it only when Org opens the main file. If URL is
  16017. specified, the contents are downloaded and stored in a temporary
  16018. file cache. @kbd{C-c C-c} on the settings line parses and
  16019. loads the file, and also resets the temporary file cache. Org
  16020. also parses and loads the document during normal exporting
  16021. process. Org parses the contents of this document as if it was
  16022. included in the buffer. It can be another Org file. To visit
  16023. the file---not a URL---use @kbd{C-c '} while the cursor is
  16024. on the line with the file name.
  16025. @item @samp{#+STARTUP:}
  16026. @cindex @samp{STARTUP}, keyword
  16027. Startup options Org uses when first visiting a file.
  16028. @vindex org-startup-folded
  16029. The first set of options deals with the initial visibility of the
  16030. outline tree. The corresponding variable for global default
  16031. settings is @code{org-startup-folded} with a default value of @code{t},
  16032. which is the same as @code{overview}.
  16033. @table @asis
  16034. @item @samp{overview}
  16035. Top-level headlines only.
  16036. @item @samp{content}
  16037. All headlines.
  16038. @item @samp{showall}
  16039. No folding on any entry.
  16040. @item @samp{showeverything}
  16041. Show even drawer contents.
  16042. @end table
  16043. @vindex org-startup-indented
  16044. Dynamic virtual indentation is controlled by the variable
  16045. @code{org-startup-indented}.@footnote{Note that @code{org-indent-mode} also sets the @code{wrap-prefix}
  16046. property, such that @code{visual-line-mode} (or purely setting @code{word-wrap})
  16047. wraps long lines (including headlines) correctly indented.}
  16048. @table @asis
  16049. @item @samp{indent}
  16050. Start with @code{org-indent-mode} turned on.
  16051. @item @samp{noindent}
  16052. Start with @code{org-indent-mode} turned off.
  16053. @end table
  16054. @vindex org-startup-align-all-tables
  16055. Aligns tables consistently upon visiting a file. The corresponding
  16056. variable is @code{org-startup-align-all-tables} with @code{nil} as default
  16057. value.
  16058. @table @asis
  16059. @item @samp{align}
  16060. Align all tables.
  16061. @item @samp{noalign}
  16062. Do not align tables on startup.
  16063. @end table
  16064. @vindex org-startup-shrink-all-tables
  16065. Shrink table columns with a width cookie. The corresponding
  16066. variable is @code{org-startup-shrink-all-tables} with @code{nil} as default
  16067. value.
  16068. @vindex org-startup-with-inline-images
  16069. When visiting a file, inline images can be automatically displayed.
  16070. The corresponding variable is @code{org-startup-with-inline-images},
  16071. with a default value @code{nil} to avoid delays when visiting a file.
  16072. @table @asis
  16073. @item @samp{inlineimages}
  16074. Show inline images.
  16075. @item @samp{noinlineimages}
  16076. Do not show inline images on startup.
  16077. @end table
  16078. @vindex org-log-done
  16079. @vindex org-log-note-clock-out
  16080. @vindex org-log-repeat
  16081. Logging the closing and reopening of TODO items and clock
  16082. intervals can be configured using these options (see variables
  16083. @code{org-log-done}, @code{org-log-note-clock-out}, and @code{org-log-repeat}).
  16084. @table @asis
  16085. @item @samp{logdone}
  16086. Record a timestamp when an item is marked DONE.
  16087. @item @samp{lognotedone}
  16088. Record timestamp and a note when DONE.
  16089. @item @samp{nologdone}
  16090. Do not record when items are marked DONE.
  16091. @item @samp{logrepeat}
  16092. Record a time when reinstating a repeating item.
  16093. @item @samp{lognoterepeat}
  16094. Record a note when reinstating a repeating item.
  16095. @item @samp{nologrepeat}
  16096. Do not record when reinstating repeating item.
  16097. @item @samp{lognoteclock-out}
  16098. Record a note when clocking out.
  16099. @item @samp{nolognoteclock-out}
  16100. Do not record a note when clocking out.
  16101. @item @samp{logreschedule}
  16102. Record a timestamp when scheduling time changes.
  16103. @item @samp{lognotereschedule}
  16104. Record a note when scheduling time changes.
  16105. @item @samp{nologreschedule}
  16106. Do not record when a scheduling date changes.
  16107. @item @samp{logredeadline}
  16108. Record a timestamp when deadline changes.
  16109. @item @samp{lognoteredeadline}
  16110. Record a note when deadline changes.
  16111. @item @samp{nologredeadline}
  16112. Do not record when a deadline date changes.
  16113. @item @samp{logrefile}
  16114. Record a timestamp when refiling.
  16115. @item @samp{lognoterefile}
  16116. Record a note when refiling.
  16117. @item @samp{nologrefile}
  16118. Do not record when refiling.
  16119. @end table
  16120. @vindex org-hide-leading-stars
  16121. @vindex org-odd-levels-only
  16122. Here are the options for hiding leading stars in outline headings,
  16123. and for indenting outlines. The corresponding variables are
  16124. @code{org-hide-leading-stars} and @code{org-odd-levels-only}, both with
  16125. a default setting @code{nil} (meaning @samp{showstars} and @samp{oddeven}).
  16126. @table @asis
  16127. @item @samp{hidestars}
  16128. Make all but one of the stars starting a headline invisible.
  16129. @item @samp{showstars}
  16130. Show all stars starting a headline.
  16131. @item @samp{indent}
  16132. Virtual indentation according to outline level.
  16133. @item @samp{noindent}
  16134. No virtual indentation according to outline level.
  16135. @item @samp{odd}
  16136. Allow only odd outline levels (1, 3, @dots{}).
  16137. @item @samp{oddeven}
  16138. Allow all outline levels.
  16139. @end table
  16140. @vindex org-put-time-stamp-overlays
  16141. @vindex org-time-stamp-overlay-formats
  16142. To turn on custom format overlays over timestamps (variables
  16143. @code{org-put-time-stamp-overlays} and @code{org-time-stamp-overlay-formats}),
  16144. use:
  16145. @table @asis
  16146. @item @samp{customtime}
  16147. Overlay custom time format.
  16148. @end table
  16149. @vindex constants-unit-system
  16150. The following options influence the table spreadsheet (variable
  16151. @code{constants-unit-system}).
  16152. @table @asis
  16153. @item @samp{constcgs}
  16154. @samp{constants.el} should use the c-g-s unit system.
  16155. @item @samp{constSI}
  16156. @samp{constants.el} should use the SI unit system.
  16157. @end table
  16158. @vindex org-footnote-define-inline
  16159. @vindex org-footnote-auto-label
  16160. @vindex org-footnote-auto-adjust
  16161. To influence footnote settings, use the following keywords. The
  16162. corresponding variables are @code{org-footnote-define-inline},
  16163. @code{org-footnote-auto-label}, and @code{org-footnote-auto-adjust}.
  16164. @table @asis
  16165. @item @samp{fninline}
  16166. Define footnotes inline.
  16167. @item @samp{fnnoinline}
  16168. Define footnotes in separate section.
  16169. @item @samp{fnlocal}
  16170. Define footnotes near first reference, but not inline.
  16171. @item @samp{fnprompt}
  16172. Prompt for footnote labels.
  16173. @item @samp{fnauto}
  16174. Create @samp{[fn:1]}-like labels automatically (default).
  16175. @item @samp{fnconfirm}
  16176. Offer automatic label for editing or confirmation.
  16177. @item @samp{fnadjust}
  16178. Automatically renumber and sort footnotes.
  16179. @item @samp{nofnadjust}
  16180. Do not renumber and sort automatically.
  16181. @end table
  16182. @vindex org-hide-block-startup
  16183. To hide blocks on startup, use these keywords. The corresponding
  16184. variable is @code{org-hide-block-startup}.
  16185. @table @asis
  16186. @item @samp{hideblocks}
  16187. Hide all begin/end blocks on startup.
  16188. @item @samp{nohideblocks}
  16189. Do not hide blocks on startup.
  16190. @end table
  16191. @vindex org-pretty-entities
  16192. The display of entities as UTF-8 characters is governed by the
  16193. variable @code{org-pretty-entities} and the keywords
  16194. @table @asis
  16195. @item @samp{entitiespretty}
  16196. Show entities as UTF-8 characters where possible.
  16197. @item @samp{entitiesplain}
  16198. Leave entities plain.
  16199. @end table
  16200. @item @samp{#+TAGS: TAG1(c1) TAG2(c2)}
  16201. @cindex @samp{TAGS}, keyword
  16202. @vindex org-tag-alist
  16203. These lines (several such lines are allowed) specify the valid
  16204. tags in this file, and (potentially) the corresponding @emph{fast tag
  16205. selection} keys. The corresponding variable is @code{org-tag-alist}.
  16206. @item @samp{#+TODO:}
  16207. @itemx @samp{#+SEQ_TODO:}
  16208. @itemx @samp{#+TYP_TODO:}
  16209. @cindex @samp{SEQ_TODO}, keyword
  16210. @cindex @samp{TODO}, keyword
  16211. @cindex @samp{TYP_TODO}, keyword
  16212. @vindex org-todo-keywords
  16213. These lines set the TODO keywords and their interpretation in the
  16214. current file. The corresponding variable is @code{org-todo-keywords}.
  16215. @end table
  16216. @node The Very Busy @kbd{C-c C-c} Key
  16217. @section The Very Busy @kbd{C-c C-c} Key
  16218. @kindex C-c C-c
  16219. @cindex @kbd{C-c C-c}, overview
  16220. The @kbd{C-c C-c} key in Org serves many purposes depending on
  16221. the context. It is probably the most over-worked, multi-purpose key
  16222. combination in Org. Its uses are well documented throughout this
  16223. manual, but here is a consolidated list for easy reference.
  16224. @itemize
  16225. @item
  16226. If any highlights shown in the buffer from the creation of a sparse
  16227. tree, or from clock display, remove such highlights.
  16228. @item
  16229. If the cursor is in one of the special @samp{KEYWORD} lines, scan the
  16230. buffer for these lines and update the information. Also reset the
  16231. Org file cache used to temporary store the contents of URLs used as
  16232. values for keywords like @samp{SETUPFILE}.
  16233. @item
  16234. If the cursor is inside a table, realign the table. The table
  16235. realigns even if automatic table editor is turned off.
  16236. @item
  16237. If the cursor is on a @samp{TBLFM} keyword, re-apply the formulas to the
  16238. entire table.
  16239. @item
  16240. If the current buffer is a capture buffer, close the note and file
  16241. it. With a prefix argument, also jump to the target location after
  16242. saving the note.
  16243. @item
  16244. If the cursor is on a @samp{<<<target>>>}, update radio targets and
  16245. corresponding links in this buffer.
  16246. @item
  16247. If the cursor is on a property line or at the start or end of
  16248. a property drawer, offer property commands.
  16249. @item
  16250. If the cursor is at a footnote reference, go to the corresponding
  16251. definition, and @emph{vice versa}.
  16252. @item
  16253. If the cursor is on a statistics cookie, update it.
  16254. @item
  16255. If the cursor is in a plain list item with a checkbox, toggle the
  16256. status of the checkbox.
  16257. @item
  16258. If the cursor is on a numbered item in a plain list, renumber the
  16259. ordered list.
  16260. @item
  16261. If the cursor is on the @samp{#+BEGIN} line of a dynamic block, the block
  16262. is updated.
  16263. @item
  16264. If the cursor is at a timestamp, fix the day name in the timestamp.
  16265. @end itemize
  16266. @node Clean View
  16267. @section A Cleaner Outline View
  16268. @cindex hiding leading stars
  16269. @cindex dynamic indentation
  16270. @cindex odd-levels-only outlines
  16271. @cindex clean outline view
  16272. Org's default outline with stars and no indents can become too
  16273. cluttered for short documents. For @emph{book-like} long documents, the
  16274. effect is not as noticeable. Org provides an alternate stars and
  16275. indentation scheme, as shown on the right in the following table. It
  16276. uses only one star and indents text to line with the heading:
  16277. @example
  16278. * Top level headline | * Top level headline
  16279. ** Second level | * Second level
  16280. *** Third level | * Third level
  16281. some text | some text
  16282. *** Third level | * Third level
  16283. more text | more text
  16284. * Another top level headline | * Another top level headline
  16285. @end example
  16286. @noindent
  16287. @cindex Indent mode
  16288. @findex org-indent-mode
  16289. To turn this mode on, use the minor mode, @code{org-indent-mode}. Text
  16290. lines that are not headlines are prefixed with spaces to vertically
  16291. align with the headline text@footnote{The @code{org-indent-mode} also sets the @code{wrap-prefix} correctly
  16292. for indenting and wrapping long lines of headlines or text. This
  16293. minor mode handles @code{visual-line-mode} and directly applied settings
  16294. through @code{word-wrap}.}.
  16295. @vindex org-indent-indentation-per-level
  16296. To make more horizontal space, the headlines are shifted by two stars.
  16297. This can be configured by the @code{org-indent-indentation-per-level}
  16298. variable. Only one star on each headline is visible, the rest are
  16299. masked with the same font color as the background.
  16300. Note that turning on @code{org-indent-mode} sets @code{org-hide-leading-stars}
  16301. to @code{t} and @code{org-adapt-indentation} to @code{nil}.
  16302. @vindex org-startup-indented
  16303. To globally turn on @code{org-indent-mode} for all files, customize the
  16304. variable @code{org-startup-indented}.
  16305. To turn on indenting for individual files, use @samp{STARTUP} keyword as
  16306. follows:
  16307. @example
  16308. #+STARTUP: indent
  16309. @end example
  16310. Indent on startup makes Org use hard spaces to align text with
  16311. headings as shown in examples below.
  16312. @table @asis
  16313. @item @emph{Indentation of text below headlines}
  16314. Indent text to align with the headline.
  16315. @example
  16316. *** Third level
  16317. more text, now indented
  16318. @end example
  16319. @vindex org-adapt-indentation
  16320. Org supports this with paragraph filling, line wrapping, and
  16321. structure editing, preserving or adapting the indentation as
  16322. appropriate@footnote{Also see the variable @code{org-adapt-indentation}.}.
  16323. @item @emph{Hiding leading stars}
  16324. @vindex org-hide-leading-stars
  16325. Org can make leading stars invisible. For global preference,
  16326. configure the variable @code{org-hide-leading-stars}. For per-file
  16327. preference, use these file @samp{STARTUP} options:
  16328. @example
  16329. #+STARTUP: hidestars
  16330. #+STARTUP: showstars
  16331. @end example
  16332. With stars hidden, the tree is shown as:
  16333. @example
  16334. * Top level headline
  16335. * Second level
  16336. * Third level
  16337. ...
  16338. @end example
  16339. @noindent
  16340. @vindex org-hide, face
  16341. Because Org makes the font color the same as the background color
  16342. to hide to stars, sometimes @code{org-hide} face may need tweaking to
  16343. get the effect right. For some black and white combinations,
  16344. @code{grey90} on a white background might mask the stars better.
  16345. @item @emph{Odd levels}
  16346. @vindex org-odd-levels-only
  16347. Using stars for only odd levels, 1, 3, 5, @dots{}, can also clean up
  16348. the clutter. This removes two stars from each level@footnote{Because @samp{LEVEL=2} has 3 stars, @samp{LEVEL=3} has 4 stars, and so
  16349. on.}.
  16350. For Org to properly handle this cleaner structure during edits
  16351. and exports, configure the variable @code{org-odd-levels-only}. To
  16352. set this per-file, use either one of the following lines:
  16353. @example
  16354. #+STARTUP: odd
  16355. #+STARTUP: oddeven
  16356. @end example
  16357. To switch between single and double stars layouts, use @kbd{M-x org-convert-to-odd-levels} and @kbd{M-x org-convert-to-oddeven-levels}.
  16358. @end table
  16359. @node TTY Keys
  16360. @section Using Org on a TTY
  16361. @cindex tty key bindings
  16362. Org provides alternative key bindings for TTY and modern mobile
  16363. devices that cannot handle cursor keys and complex modifier key
  16364. chords. Some of these workarounds may be more cumbersome than
  16365. necessary. Users should look into customizing these further based on
  16366. their usage needs. For example, the normal @kbd{S-<cursor>} for
  16367. editing timestamp might be better with @kbd{C-c .} chord.
  16368. @multitable @columnfractions 0.2 0.28 0.15 0.21
  16369. @headitem Default
  16370. @tab Alternative 1
  16371. @tab Speed key
  16372. @tab Alternative 2
  16373. @item @kbd{S-@key{TAB}}
  16374. @tab @kbd{C-u @key{TAB}}
  16375. @tab @kbd{C}
  16376. @tab
  16377. @item @kbd{M-@key{LEFT}}
  16378. @tab @kbd{C-c C-x l}
  16379. @tab @kbd{l}
  16380. @tab @kbd{Esc @key{LEFT}}
  16381. @item @kbd{M-S-@key{LEFT}}
  16382. @tab @kbd{C-c C-x L}
  16383. @tab @kbd{L}
  16384. @tab
  16385. @item @kbd{M-@key{RIGHT}}
  16386. @tab @kbd{C-c C-x r}
  16387. @tab @kbd{r}
  16388. @tab @kbd{Esc @key{RIGHT}}
  16389. @item @kbd{M-S-@key{RIGHT}}
  16390. @tab @kbd{C-c C-x R}
  16391. @tab @kbd{R}
  16392. @tab
  16393. @item @kbd{M-@key{UP}}
  16394. @tab @kbd{C-c C-x u}
  16395. @tab
  16396. @tab @kbd{Esc @key{UP}}
  16397. @item @kbd{M-S-@key{UP}}
  16398. @tab @kbd{C-c C-x U}
  16399. @tab @kbd{U}
  16400. @tab
  16401. @item @kbd{M-@key{DOWN}}
  16402. @tab @kbd{C-c C-x d}
  16403. @tab
  16404. @tab @kbd{Esc @key{DOWN}}
  16405. @item @kbd{M-S-@key{DOWN}}
  16406. @tab @kbd{C-c C-x D}
  16407. @tab @kbd{D}
  16408. @tab
  16409. @item @kbd{S-@key{RET}}
  16410. @tab @kbd{C-c C-x c}
  16411. @tab
  16412. @tab
  16413. @item @kbd{M-@key{RET}}
  16414. @tab @kbd{C-c C-x m}
  16415. @tab
  16416. @tab @kbd{Esc @key{RET}}
  16417. @item @kbd{M-S-@key{RET}}
  16418. @tab @kbd{C-c C-x M}
  16419. @tab
  16420. @tab
  16421. @item @kbd{S-@key{LEFT}}
  16422. @tab @kbd{C-c @key{LEFT}}
  16423. @tab
  16424. @tab
  16425. @item @kbd{S-@key{RIGHT}}
  16426. @tab @kbd{C-c @key{RIGHT}}
  16427. @tab
  16428. @tab
  16429. @item @kbd{S-@key{UP}}
  16430. @tab @kbd{C-c @key{UP}}
  16431. @tab
  16432. @tab
  16433. @item @kbd{S-@key{DOWN}}
  16434. @tab @kbd{C-c @key{DOWN}}
  16435. @tab
  16436. @tab
  16437. @item @kbd{C-S-@key{LEFT}}
  16438. @tab @kbd{C-c C-x @key{LEFT}}
  16439. @tab
  16440. @tab
  16441. @item @kbd{C-S-@key{RIGHT}}
  16442. @tab @kbd{C-c C-x @key{RIGHT}}
  16443. @tab
  16444. @tab
  16445. @end multitable
  16446. @node Interaction
  16447. @section Interaction with Other Packages
  16448. @cindex packages, interaction with other
  16449. Org's compatibility and the level of interaction with other Emacs
  16450. packages are documented here.
  16451. @menu
  16452. * Cooperation:: Packages Org cooperates with.
  16453. * Conflicts:: Packages that lead to conflicts.
  16454. @end menu
  16455. @node Cooperation
  16456. @subsection Packages that Org cooperates with
  16457. @table @asis
  16458. @item @samp{calc.el} by Dave Gillespie
  16459. @cindex @file{calc.el}
  16460. Org uses the Calc package for implementing spreadsheet
  16461. functionality in its tables (see @ref{The spreadsheet}). Org also
  16462. uses Calc for embedded calculations. See @ref{Embedded Mode,GNU Emacs Calc Manual,,calc,}.
  16463. @item @samp{constants.el} by Carsten Dominik
  16464. @cindex @file{constants.el}
  16465. @vindex org-table-formula-constants
  16466. Org can use names for constants in formulas in tables. Org can
  16467. also use calculation suffixes for units, such as @samp{M} for @samp{Mega}.
  16468. For a standard collection of such constants, install the
  16469. @samp{constants} package. Install version 2.0 of this package,
  16470. available at @uref{http://www.astro.uva.nl/~dominik/Tools}. Org checks
  16471. if the function @code{constants-get} has been autoloaded.
  16472. Installation instructions are in the file @samp{constants.el}.
  16473. @item @samp{cdlatex.el} by Carsten Dominik
  16474. @cindex @file{cdlatex.el}
  16475. Org mode can make use of the CD@LaTeX{} package to efficiently enter
  16476. @LaTeX{} fragments into Org files. See @ref{CD@LaTeX{} mode}.
  16477. @item @samp{imenu.el} by Ake Stenhoff and Lars Lindberg
  16478. @cindex @file{imenu.el}
  16479. Imenu creates dynamic menus based on an index of items in a file.
  16480. Org mode supports Imenu menus. Enable it with a mode hook as
  16481. follows:
  16482. @lisp
  16483. (add-hook 'org-mode-hook
  16484. (lambda () (imenu-add-to-menubar "Imenu")))
  16485. @end lisp
  16486. @vindex org-imenu-depth
  16487. By default the index is two levels deep---you can modify the
  16488. depth using the option @code{org-imenu-depth}.
  16489. @item @samp{speedbar.el} by Eric M. Ludlam
  16490. @cindex @file{speedbar.el}
  16491. Speedbar package creates a special Emacs frame for displaying
  16492. files and index items in files. Org mode supports Speedbar;
  16493. users can drill into Org files directly from the Speedbar. The
  16494. @kbd{<} in the Speedbar frame tweaks the agenda commands to
  16495. that file or to a subtree.
  16496. @item @samp{table.el} by Takaaki Ota
  16497. @cindex table editor, @file{table.el}
  16498. @cindex @file{table.el}
  16499. Complex ASCII tables with automatic line wrapping, column- and
  16500. row-spanning, and alignment can be created using the Emacs table
  16501. package by Takaaki Ota. Org mode recognizes such tables and
  16502. exports them properly. @kbd{C-c '} to edit these tables in
  16503. a special buffer, much like Org's code blocks. Because of
  16504. interference with other Org mode functionality, Takaaki Ota
  16505. tables cannot be edited directly in the Org buffer.
  16506. @table @asis
  16507. @item @kbd{C-c '} (@code{org-edit-special})
  16508. @kindex C-c '
  16509. @findex org-edit-special
  16510. Edit a @samp{table.el} table. Works when the cursor is in
  16511. a @samp{table.el} table.
  16512. @item @kbd{C-c ~​} (@code{org-table-create-with-table.el})
  16513. @kindex C-c ~
  16514. @findex org-table-create-with-table.el
  16515. Insert a @samp{table.el} table. If there is already a table at
  16516. point, this command converts it between the @samp{table.el}
  16517. format and the Org mode format. See the documentation
  16518. string of the command @code{org-convert-table} for the
  16519. restrictions under which this is possible.
  16520. @end table
  16521. @end table
  16522. @node Conflicts
  16523. @subsection Packages that conflict with Org mode
  16524. @cindex shift-selection-mode
  16525. @vindex org-support-shift-select
  16526. In Emacs, @code{shift-selection-mode} combines cursor motions with shift
  16527. key to enlarge regions. Emacs sets this mode by default. This
  16528. conflicts with Org's use of @kbd{S-<cursor>} commands to change
  16529. timestamps, TODO keywords, priorities, and item bullet types, etc.
  16530. Since @kbd{S-<cursor>} commands outside of specific contexts do
  16531. not do anything, Org offers the variable @code{org-support-shift-select}
  16532. for customization. Org mode accommodates shift selection by (i)
  16533. making it available outside of the special contexts where special
  16534. commands apply, and (ii) extending an existing active region even if
  16535. the cursor moves across a special context.
  16536. @table @asis
  16537. @item @samp{cua.el} by Kim. F. Storm
  16538. @cindex @file{cua.el}
  16539. @vindex org-replace-disputed-keys
  16540. Org key bindings conflict with @kbd{S-<cursor>} keys used by
  16541. CUA mode. For Org to relinquish these bindings to CUA mode,
  16542. configure the variable @code{org-replace-disputed-keys}. When set,
  16543. Org moves the following key bindings in Org files, and in the
  16544. agenda buffer---but not during date selection.
  16545. @multitable @columnfractions 0.4 0.4
  16546. @item @kbd{S-@key{UP}} @result{} @kbd{M-p}
  16547. @tab @kbd{S-@key{DOWN}} @result{} @kbd{M-n}
  16548. @item @kbd{S-@key{LEFT}} @result{} @kbd{M--}
  16549. @tab @kbd{S-@key{RIGHT}} @result{} @kbd{M-+}
  16550. @item @kbd{C-S-@key{LEFT}} @result{} @kbd{M-S--}
  16551. @tab @kbd{C-S-@key{RIGHT}} @result{} @kbd{M-S-+}
  16552. @end multitable
  16553. @vindex org-disputed-keys
  16554. Yes, these are unfortunately more difficult to remember. If you
  16555. want to have other replacement keys, look at the variable
  16556. @code{org-disputed-keys}.
  16557. @item @samp{ecomplete.el} by Lars Magne Ingebrigtsen
  16558. @cindex @file{ecomplete.el}
  16559. Ecomplete provides ``electric'' address completion in address
  16560. header lines in message buffers. Sadly Orgtbl mode cuts
  16561. Ecomplete's power supply: no completion happens when Orgtbl mode
  16562. is enabled in message buffers while entering text in address
  16563. header lines. If one wants to use ecomplete one should @emph{not}
  16564. follow the advice to automagically turn on Orgtbl mode in message
  16565. buffers (see @ref{Orgtbl Mode}), but instead---after
  16566. filling in the message headers---turn on Orgtbl mode manually
  16567. when needed in the messages body.
  16568. @item @samp{filladapt.el} by Kyle Jones
  16569. @cindex @file{filladapt.el}
  16570. Org mode tries to do the right thing when filling paragraphs,
  16571. list items and other elements. Many users reported problems
  16572. using both @samp{filladapt.el} and Org mode, so a safe thing to do is
  16573. to disable filladapt like this:
  16574. @lisp
  16575. (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
  16576. @end lisp
  16577. @item @samp{viper.el} by Michael Kifer
  16578. @cindex @file{viper.el}
  16579. @kindex C-c /
  16580. Viper uses @kbd{C-c /} and therefore makes this key not
  16581. access the corresponding Org mode command @code{org-sparse-tree}. You
  16582. need to find another key for this command, or override the key in
  16583. @code{viper-vi-global-user-map} with
  16584. @lisp
  16585. (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
  16586. @end lisp
  16587. @item @samp{windmove.el} by Hovav Shacham
  16588. @cindex @file{windmove.el}
  16589. This package also uses the @kbd{S-<cursor>} keys, so
  16590. everything written in the paragraph above about CUA mode also
  16591. applies here. If you want to make the windmove function active
  16592. in locations where Org mode does not have special functionality
  16593. on @kbd{S-<cursor>}, add this to your configuration:
  16594. @lisp
  16595. ;; Make windmove work in Org mode:
  16596. (add-hook 'org-shiftup-final-hook 'windmove-up)
  16597. (add-hook 'org-shiftleft-final-hook 'windmove-left)
  16598. (add-hook 'org-shiftdown-final-hook 'windmove-down)
  16599. (add-hook 'org-shiftright-final-hook 'windmove-right)
  16600. @end lisp
  16601. @item @samp{yasnippet.el}
  16602. @cindex @file{yasnippet.el}
  16603. The way Org mode binds the @kbd{@key{TAB}} key (binding to @code{[tab]}
  16604. instead of @code{"\t"}) overrules YASnippet's access to this key. The
  16605. following code fixed this problem:
  16606. @lisp
  16607. (add-hook 'org-mode-hook
  16608. (lambda ()
  16609. (setq-local yas/trigger-key [tab])
  16610. (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
  16611. @end lisp
  16612. The latest version of YASnippet does not play well with Org mode.
  16613. If the above code does not fix the conflict, start by defining
  16614. the following function:
  16615. @lisp
  16616. (defun yas/org-very-safe-expand ()
  16617. (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
  16618. @end lisp
  16619. Then, tell Org mode to use that function:
  16620. @lisp
  16621. (add-hook 'org-mode-hook
  16622. (lambda ()
  16623. (make-variable-buffer-local 'yas/trigger-key)
  16624. (setq yas/trigger-key [tab])
  16625. (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
  16626. (define-key yas/keymap [tab] 'yas/next-field)))
  16627. @end lisp
  16628. @end table
  16629. @node Org Crypt
  16630. @section Org Crypt
  16631. Org Crypt encrypts the text of an entry, but not the headline, or
  16632. properties. Behind the scene, it uses the Emacs EasyPG library to
  16633. encrypt and decrypt files.
  16634. @vindex org-crypt-tag-matcher
  16635. Any text below a headline that has a @samp{crypt} tag is automatically
  16636. encrypted when the file is saved. To use a different tag, customize
  16637. the @code{org-crypt-tag-matcher} setting.
  16638. Here is a suggestion for Org Crypt settings in Emacs init file:
  16639. @lisp
  16640. (require 'org-crypt)
  16641. (org-crypt-use-before-save-magic)
  16642. (setq org-tags-exclude-from-inheritance '("crypt"))
  16643. (setq org-crypt-key nil)
  16644. ;; GPG key to use for encryption
  16645. ;; Either the Key ID or set to nil to use symmetric encryption.
  16646. (setq auto-save-default nil)
  16647. ;; Auto-saving does not cooperate with org-crypt.el: so you need to
  16648. ;; turn it off if you plan to use org-crypt.el quite often. Otherwise,
  16649. ;; you'll get an (annoying) message each time you start Org.
  16650. ;; To turn it off only locally, you can insert this:
  16651. ;;
  16652. ;; # -*- buffer-auto-save-file-name: nil; -*-
  16653. @end lisp
  16654. Excluding the @samp{crypt} tag from inheritance prevents already encrypted
  16655. text from being encrypted again.
  16656. @node Hacking
  16657. @appendix Hacking
  16658. @cindex hacking
  16659. This appendix describes some ways a user can extend the functionality
  16660. of Org.
  16661. @menu
  16662. * Hooks: Hooks (2). How to reach into Org's internals.
  16663. * Add-on Packages:: Available extensions.
  16664. * Adding Hyperlink Types:: New custom link types.
  16665. * Adding Export Back-ends:: How to write new export back-ends.
  16666. * Tables in Arbitrary Syntax:: Orgtbl for LaTeX and other programs.
  16667. * Dynamic Blocks:: Automatically filled blocks.
  16668. * Special Agenda Views:: Customized views.
  16669. * Speeding Up Your Agendas:: Tips on how to speed up your agendas.
  16670. * Extracting Agenda Information:: Post-processing agenda information.
  16671. * Using the Property API:: Writing programs that use entry properties.
  16672. * Using the Mapping API:: Mapping over all or selected entries.
  16673. @end menu
  16674. @node Hooks (2)
  16675. @appendixsec Hooks
  16676. @cindex hooks
  16677. Org has a large number of hook variables for adding functionality.
  16678. This appendix illustrates using a few. A complete list of hooks with
  16679. documentation is maintained by the Worg project at
  16680. @uref{https://orgmode.org/worg/doc.html#hooks}.
  16681. @node Add-on Packages
  16682. @appendixsec Add-on Packages
  16683. @cindex add-on packages
  16684. Various authors wrote a large number of add-on packages for Org.
  16685. These packages are not part of Emacs, but they are distributed as
  16686. contributed packages with the separate release available at
  16687. @uref{https://orgmode.org}. See the @samp{contrib/README} file in the source code
  16688. directory for a list of contributed files. Worg page with more
  16689. information is at: @uref{https://orgmode.org/worg/org-contrib/}.
  16690. @node Adding Hyperlink Types
  16691. @appendixsec Adding Hyperlink Types
  16692. @cindex hyperlinks, adding new types
  16693. Org has many built-in hyperlink types (see @ref{Hyperlinks}), and an
  16694. interface for adding new link types. The following example shows the
  16695. process of adding Org links to Unix man pages, which look like this
  16696. @example
  16697. [[man:printf][The printf manual]]
  16698. @end example
  16699. @noindent
  16700. The following @samp{org-man.el} file implements it
  16701. @lisp
  16702. ;;; org-man.el - Support for links to man pages in Org mode
  16703. (require 'org)
  16704. (org-link-set-parameters "man"
  16705. :follow org-man-command
  16706. :export #'org-man-export
  16707. :store #'org-man-store-link)
  16708. (defcustom org-man-command 'man
  16709. "The Emacs command to be used to display a man page."
  16710. :group 'org-link
  16711. :type '(choice (const man) (const woman)))
  16712. (defun org-man-store-link ()
  16713. "Store a link to a man page."
  16714. (when (memq major-mode '(Man-mode woman-mode))
  16715. ;; This is a man page, we do make this link.
  16716. (let* ((page (org-man-get-page-name))
  16717. (link (concat "man:" page))
  16718. (description (format "Man page for %s" page)))
  16719. (org-store-link-props
  16720. :type "man"
  16721. :link link
  16722. :description description))))
  16723. (defun org-man-get-page-name ()
  16724. "Extract the page name from the buffer name."
  16725. ;; This works for both `Man-mode' and `woman-mode'.
  16726. (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  16727. (match-string 1 (buffer-name))
  16728. (error "Cannot create link to this man page")))
  16729. (defun org-man-export (link description format)
  16730. "Export a man page link from Org files."
  16731. (let ((path (format "http://man.he.net/?topic=%s&section=all" link))
  16732. (desc (or description link)))
  16733. (pcase format
  16734. (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
  16735. (`latex (format "\\href@{%s@}@{%s@}" path desc))
  16736. (`texinfo (format "@@uref@{%s,%s@}" path desc))
  16737. (`ascii (format "%s (%s)" desc path))
  16738. (t path))))
  16739. (provide 'org-man)
  16740. ;;; org-man.el ends here
  16741. @end lisp
  16742. @noindent
  16743. To activate links to man pages in Org, enter this in the Emacs init
  16744. file:
  16745. @lisp
  16746. (require 'org-man)
  16747. @end lisp
  16748. @noindent
  16749. A review of @samp{org-man.el}:
  16750. @enumerate
  16751. @item
  16752. First, @code{(require 'org)} ensures @samp{org.el} is loaded.
  16753. @item
  16754. @findex org-link-set-parameters
  16755. @vindex org-link-parameters
  16756. Then @code{org-link-set-parameters} defines a new link type with @samp{man}
  16757. prefix and associates functions for following, exporting and
  16758. storing such links. See the variable @code{org-link-parameters} for
  16759. a complete list of possible associations.
  16760. @item
  16761. The rest of the file implements necessary variables and functions.
  16762. For example, @code{org-man-store-link} is responsible for storing a link
  16763. when @code{org-store-link} (see @ref{Handling Links}) is called from a buffer
  16764. displaying a man page. It first checks if the @code{major-mode} is
  16765. appropriate. If check fails, the function returns @code{nil}, which
  16766. means it isn't responsible for creating a link to the current
  16767. buffer. Otherwise the function makes a link string by combining
  16768. the @samp{man:} prefix with the man topic. It also provides a default
  16769. description. The function @code{org-insert-link} can insert it back
  16770. into an Org buffer later on.
  16771. @end enumerate
  16772. @node Adding Export Back-ends
  16773. @appendixsec Adding Export Back-ends
  16774. @cindex Export, writing back-ends
  16775. Org's export engine makes it easy for writing new back-ends. The
  16776. framework on which the engine was built makes it easy to derive new
  16777. back-ends from existing ones.
  16778. @findex org-export-define-backend
  16779. @findex org-export-define-derived-backend
  16780. The two main entry points to the export engine are:
  16781. @code{org-export-define-backend} and @code{org-export-define-derived-backend}.
  16782. To grok these functions, see @samp{ox-latex.el} for an example of defining
  16783. a new back-end from scratch, and @samp{ox-beamer.el} for an example of
  16784. deriving from an existing engine.
  16785. For creating a new back-end from scratch, first set its name as
  16786. a symbol in an alist consisting of elements and export functions. To
  16787. make the back-end visible to the export dispatcher, set @code{:menu-entry}
  16788. keyword. For export options specific to this back-end, set the
  16789. @code{:options-alist}.
  16790. For creating a new back-end from an existing one, set
  16791. @code{:translate-alist} to an alist of export functions. This alist
  16792. replaces the parent back-end functions.
  16793. For complete documentation, see @uref{https://orgmode.org/worg/dev/org-export-reference.html, the Org Export Reference on Worg}.
  16794. @node Tables in Arbitrary Syntax
  16795. @appendixsec Tables in Arbitrary Syntax
  16796. @cindex tables, in other modes
  16797. @cindex lists, in other modes
  16798. @cindex Orgtbl mode
  16799. Due to Org's success in handling tables with Orgtbl, a frequently
  16800. requested feature is the use of Org's table functions in other modes,
  16801. e.g., @LaTeX{}. This would be hard to do in a general way without
  16802. complicated customization nightmares. Moreover, that would take Org
  16803. away from its simplicity roots that Orgtbl has proven. There is,
  16804. however, an alternate approach to accomplishing the same.
  16805. This approach involves implementing a custom @emph{translate} function that
  16806. operates on a native Org @emph{source table} to produce a table in another
  16807. format. This strategy would keep the excellently working Orgtbl
  16808. simple and isolate complications, if any, confined to the translate
  16809. function. To add more alien table formats, we just add more translate
  16810. functions. Also the burden of developing custom translate functions
  16811. for new table formats is in the hands of those who know those formats
  16812. best.
  16813. @menu
  16814. * Radio tables:: Sending and receiving radio tables.
  16815. * A @LaTeX{} example:: Step by step, almost a tutorial.
  16816. * Translator functions:: Copy and modify.
  16817. @end menu
  16818. @node Radio tables
  16819. @appendixsubsec Radio tables
  16820. @cindex radio tables
  16821. Radio tables are target locations for translated tables that are not near
  16822. their source. Org finds the target location and inserts the translated
  16823. table.
  16824. The key to finding the target location is the magic words @samp{BEGIN/END
  16825. RECEIVE ORGTBL}. They have to appear as comments in the current mode.
  16826. If the mode is C, then:
  16827. @example
  16828. /* BEGIN RECEIVE ORGTBL table_name */
  16829. /* END RECEIVE ORGTBL table_name */
  16830. @end example
  16831. @noindent
  16832. At the location of source, Org needs a special line to direct Orgtbl
  16833. to translate and to find the target for inserting the translated
  16834. table. For example:
  16835. @cindex @samp{ORGTBL}, keyword
  16836. @example
  16837. #+ORGTBL: SEND table_name translation_function arguments ...
  16838. @end example
  16839. @noindent
  16840. @samp{table_name} is the table's reference name, which is also used in the
  16841. receiver lines, and the @samp{translation_function} is the Lisp function
  16842. that translates. This line, in addition, may also contain alternating
  16843. key and value arguments at the end. The translation function gets
  16844. these values as a property list. A few standard parameters are
  16845. already recognized and acted upon before the translation function is
  16846. called:
  16847. @table @asis
  16848. @item @samp{:skip N}
  16849. Skip the first N lines of the table. Hlines do count; include
  16850. them if they are to be skipped.
  16851. @item @samp{:skipcols (n1 n2 ...)}
  16852. List of columns to be skipped. First Org automatically discards
  16853. columns with calculation marks and then sends the table to the
  16854. translator function, which then skips columns as specified in
  16855. @samp{skipcols}.
  16856. @end table
  16857. @noindent
  16858. To keep the source table intact in the buffer without being disturbed
  16859. when the source file is compiled or otherwise being worked on, use one
  16860. of these strategies:
  16861. @itemize
  16862. @item
  16863. Place the table in a block comment. For example, in C mode you
  16864. could wrap the table between @samp{/*} and @samp{*/} lines.
  16865. @item
  16866. Put the table after an ``end'' statement. For example @code{\bye} in @TeX{}
  16867. and @code{\end@{document@}} in @LaTeX{}.
  16868. @item
  16869. Comment and un-comment each line of the table during edits. The
  16870. @kbd{M-x orgtbl-toggle-comment} command makes toggling easy.
  16871. @end itemize
  16872. @node A @LaTeX{} example
  16873. @appendixsubsec A @LaTeX{} example of radio tables
  16874. @cindex @LaTeX{}, and Orgtbl mode
  16875. To wrap a source table in @LaTeX{}, use the @samp{comment} environment
  16876. provided by @samp{comment.sty}@footnote{@uref{https://ctan.org/tex-archive/macros/latex/contrib/comment?lang=en}}. To activate it, put
  16877. @code{\usepackage@{comment@}} in the document header. Orgtbl mode inserts
  16878. a radio table skeleton@footnote{Because @samp{LEVEL=2} has 3 stars, @samp{LEVEL=3} has 4 stars, and so
  16879. on.} with the command @kbd{M-x orgtbl-insert-radio-table}, which prompts for a table name. For
  16880. example, if @samp{salesfigures} is the name, the template inserts:
  16881. @example
  16882. % BEGIN RECEIVE ORGTBL salesfigures
  16883. % END RECEIVE ORGTBL salesfigures
  16884. \begin@{comment@}
  16885. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  16886. | | |
  16887. \end@{comment@}
  16888. @end example
  16889. @vindex LaTeX-verbatim-environments
  16890. @noindent
  16891. The line @samp{#+ORGTBL: SEND} tells Orgtbl mode to use the function
  16892. @code{orgtbl-to-latex} to convert the table to @LaTeX{} format, then insert
  16893. the table at the target (receive) location named @samp{salesfigures}. Now
  16894. the table is ready for data entry. It can even use spreadsheet
  16895. features@footnote{If the @samp{TBLFM} keyword contains an odd number of dollar
  16896. characters, this may cause problems with Font Lock in @LaTeX{} mode. As
  16897. shown in the example you can fix this by adding an extra line inside
  16898. the @samp{comment} environment that is used to balance the dollar
  16899. expressions. If you are using AUC@TeX{} with the font-latex library,
  16900. a much better solution is to add the @samp{comment} environment to the
  16901. variable @code{LaTeX-verbatim-environments}.}:
  16902. @example
  16903. % BEGIN RECEIVE ORGTBL salesfigures
  16904. % END RECEIVE ORGTBL salesfigures
  16905. \begin@{comment@}
  16906. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  16907. | Month | Days | Nr sold | per day |
  16908. |-------+------+---------+---------|
  16909. | Jan | 23 | 55 | 2.4 |
  16910. | Feb | 21 | 16 | 0.8 |
  16911. | March | 22 | 278 | 12.6 |
  16912. #+TBLFM: $4=$3/$2;%.1f
  16913. % $ (optional extra dollar to keep Font Lock happy, see footnote)
  16914. \end@{comment@}
  16915. @end example
  16916. @noindent
  16917. After editing, @kbd{C-c C-c} inserts the translated table at the
  16918. target location, between the two marker lines.
  16919. For hand-made custom tables, note that the translator needs to skip
  16920. the first two lines of the source table. Also the command has to
  16921. @emph{splice} out the target table without the header and footer.
  16922. @example
  16923. \begin@{tabular@}@{lrrr@}
  16924. Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
  16925. % BEGIN RECEIVE ORGTBL salesfigures
  16926. % END RECEIVE ORGTBL salesfigures
  16927. \end@{tabular@}
  16928. %
  16929. \begin@{comment@}
  16930. #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  16931. | Month | Days | Nr sold | per day |
  16932. |-------+------+---------+---------|
  16933. | Jan | 23 | 55 | 2.4 |
  16934. | Feb | 21 | 16 | 0.8 |
  16935. | March | 22 | 278 | 12.6 |
  16936. #+TBLFM: $4=$3/$2;%.1f
  16937. \end@{comment@}
  16938. @end example
  16939. The @LaTeX{} translator function @code{orgtbl-to-latex} is already part of
  16940. Orgtbl mode and uses a @samp{tabular} environment to typeset the table and
  16941. marks horizontal lines with @code{\hline}. For additional parameters to
  16942. control output, see @ref{Translator functions}:
  16943. @table @asis
  16944. @item @code{:splice nil/t}
  16945. When non-@code{nil}, return only table body lines; not wrapped in
  16946. tabular environment. Default is @code{nil}.
  16947. @item @code{:fmt FMT}
  16948. Format to warp each field. It should contain @samp{%s} for the
  16949. original field value. For example, to wrap each field value in
  16950. dollar symbol, you could use @samp{:fmt "$%s$"}. Format can also wrap
  16951. a property list with column numbers and formats, for example
  16952. @samp{:fmt (2 "$%s$" 4 "%s\\%%")}. In place of a string, a function
  16953. of one argument can be used; the function must return a formatted
  16954. string.
  16955. @item @code{:efmt EFMT}
  16956. Format numbers as exponentials. The spec should have @samp{%s} twice
  16957. for inserting mantissa and exponent, for example
  16958. @samp{"%s\\times10^@{%s@}"}. This may also be a property list with
  16959. column numbers and formats, for example @samp{:efmt (2
  16960. "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
  16961. @var{EFMT} has been applied to a value, @var{FMT}---see
  16962. above---is also be applied. Functions with two arguments can be
  16963. supplied instead of strings. By default, no special formatting
  16964. is applied.
  16965. @end table
  16966. @node Translator functions
  16967. @appendixsubsec Translator functions
  16968. @cindex HTML, and Orgtbl mode
  16969. @cindex translator function
  16970. @findex orgtbl-to-csv
  16971. @findex orgtbl-to-tsv
  16972. @findex orgtbl-to-latex
  16973. @findex orgtbl-to-html
  16974. @findex orgtbl-to-texinfo
  16975. @findex orgtbl-to-unicode
  16976. @findex orgtbl-to-orgtbl
  16977. @findex orgtbl-to-generic
  16978. Orgtbl mode has built-in translator functions: @code{orgtbl-to-csv}
  16979. (comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values),
  16980. @code{orgtbl-to-latex}, @code{orgtbl-to-html}, @code{orgtbl-to-texinfo},
  16981. @code{orgtbl-to-unicode} and @code{orgtbl-to-orgtbl}. They use the generic
  16982. translator, @code{orgtbl-to-generic}, which delegates translations to
  16983. various export back-ends.
  16984. Properties passed to the function through the @samp{ORGTBL SEND} line take
  16985. precedence over properties defined inside the function. For example,
  16986. this overrides the default @LaTeX{} line endings, @code{\\}, with @code{\\[2mm]}:
  16987. @example
  16988. #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  16989. @end example
  16990. For a new language translator, define a converter function. It can be
  16991. a generic function, such as shown in this example. It marks
  16992. a beginning and ending of a table with @samp{!BTBL!} and @samp{!ETBL!};
  16993. a beginning and ending of lines with @samp{!BL!} and @samp{!EL!}; and uses a TAB
  16994. for a field separator:
  16995. @lisp
  16996. (defun orgtbl-to-language (table params)
  16997. "Convert the orgtbl-mode TABLE to language."
  16998. (orgtbl-to-generic
  16999. table
  17000. (org-combine-plists
  17001. '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")
  17002. params)))
  17003. @end lisp
  17004. @noindent
  17005. The documentation for the @code{orgtbl-to-generic} function shows
  17006. a complete list of parameters, each of which can be passed through to
  17007. @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function using
  17008. that generic function.
  17009. For complicated translations the generic translator function could be
  17010. replaced by a custom translator function. Such a custom function must
  17011. take two arguments and return a single string containing the formatted
  17012. table. The first argument is the table whose lines are a list of
  17013. fields or the symbol @code{hline}. The second argument is the property
  17014. list consisting of parameters specified in the @samp{#+ORGTBL: SEND} line.
  17015. Please share your translator functions by posting them to the Org
  17016. users mailing list, at @email{emacs-orgmode@@gnu.org}.
  17017. @node Dynamic Blocks
  17018. @appendixsec Dynamic Blocks
  17019. @cindex dynamic blocks
  17020. Org supports @emph{dynamic blocks} in Org documents. They are inserted
  17021. with begin and end markers like any other code block, but the contents
  17022. are updated automatically by a user function. For example, @kbd{C-c C-x C-r} inserts a dynamic table that updates the work time (see
  17023. @ref{Clocking Work Time}).
  17024. Dynamic blocks can have names and function parameters. The syntax is
  17025. similar to source code block specifications:
  17026. @example
  17027. #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  17028. ...
  17029. #+END:
  17030. @end example
  17031. These commands update dynamic blocks:
  17032. @table @asis
  17033. @item @kbd{C-c C-x C-u} (@code{org-dblock-update})
  17034. @kindex C-c C-x C-u
  17035. @findex org-dblock-update
  17036. Update dynamic block at point.
  17037. @item @kbd{C-u C-c C-x C-u}
  17038. @kindex C-u C-c C-x C-u
  17039. Update all dynamic blocks in the current file.
  17040. @end table
  17041. Before updating a dynamic block, Org removes content between the
  17042. @samp{BEGIN} and @samp{END} markers. Org then reads the parameters on the
  17043. @samp{BEGIN} line for passing to the writer function. If the function
  17044. expects to access the removed content, then Org expects an extra
  17045. parameter, @samp{:content}, on the @samp{BEGIN} line.
  17046. The syntax for naming a writer function with a dynamic block labelled
  17047. @samp{myblock} is: @code{org-dblock-write:myblock}. Parameters come from the
  17048. @samp{BEGIN} line.
  17049. The following is an example of a dynamic block and a block writer function
  17050. that updates the time when the function was last run:
  17051. @example
  17052. #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  17053. ...
  17054. #+END:
  17055. @end example
  17056. @noindent
  17057. The dynamic block's writer function:
  17058. @lisp
  17059. (defun org-dblock-write:block-update-time (params)
  17060. (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  17061. (insert "Last block update at: "
  17062. (format-time-string fmt))))
  17063. @end lisp
  17064. To keep dynamic blocks up-to-date in an Org file, use the function,
  17065. @code{org-update-all-dblocks} in hook, such as @code{before-save-hook}. The
  17066. @code{org-update-all-dblocks} function does not run if the file is not in
  17067. Org mode.
  17068. @findex org-narrow-to-block
  17069. Dynamic blocks, like any other block, can be narrowed with
  17070. @code{org-narrow-to-block}.
  17071. @node Special Agenda Views
  17072. @appendixsec Special Agenda Views
  17073. @cindex agenda views, user-defined
  17074. @vindex org-agenda-skip-function
  17075. @vindex org-agenda-skip-function-global
  17076. Org provides a special hook to further limit items in agenda views:
  17077. @code{agenda}, @code{agenda*}@footnote{The @code{agenda*} view is the same as @code{agenda} except that it
  17078. only considers @emph{appointments}, i.e., scheduled and deadline items that
  17079. have a time specification @samp{[h]h:mm} in their time-stamps.}, @code{todo}, @code{alltodo}, @code{tags}, @code{tags-todo},
  17080. @code{tags-tree}. Specify a custom function that tests inclusion of every
  17081. matched item in the view. This function can also skip as much as is
  17082. needed.
  17083. For a global condition applicable to agenda views, use the
  17084. @code{org-agenda-skip-function-global} variable. Org uses a global
  17085. condition with @code{org-agenda-skip-function} for custom searching.
  17086. This example defines a function for a custom view showing TODO items
  17087. with @samp{waiting} status. Manually this is a multi-step search process,
  17088. but with a custom view, this can be automated as follows:
  17089. The custom function searches the subtree for the @samp{waiting} tag and
  17090. returns @code{nil} on match. Otherwise it gives the location from where
  17091. the search continues.
  17092. @lisp
  17093. (defun my-skip-unless-waiting ()
  17094. "Skip trees that are not waiting"
  17095. (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  17096. (if (re-search-forward ":waiting:" subtree-end t)
  17097. nil ; tag found, do not skip
  17098. subtree-end))) ; tag not found, continue after end of subtree
  17099. @end lisp
  17100. To use this custom function in a custom agenda command:
  17101. @lisp
  17102. (org-add-agenda-custom-command
  17103. '("b" todo "PROJECT"
  17104. ((org-agenda-skip-function 'my-skip-unless-waiting)
  17105. (org-agenda-overriding-header "Projects waiting for something: "))))
  17106. @end lisp
  17107. @vindex org-agenda-overriding-header
  17108. Note that this also binds @code{org-agenda-overriding-header} to a more
  17109. meaningful string suitable for the agenda view.
  17110. @vindex org-odd-levels-only
  17111. @vindex org-agenda-skip-function
  17112. Search for entries with a limit set on levels for the custom search.
  17113. This is a general approach to creating custom searches in Org. To
  17114. include all levels, use @samp{LEVEL>0}@footnote{Note that, for @code{org-odd-levels-only}, a level number
  17115. corresponds to order in the hierarchy, not to the number of stars.}. Then to selectively pick
  17116. the matched entries, use @code{org-agenda-skip-function}, which also
  17117. accepts Lisp forms, such as @code{org-agenda-skip-entry-if} and
  17118. @code{org-agenda-skip-subtree-if}. For example:
  17119. @table @asis
  17120. @item @code{(org-agenda-skip-entry-if 'scheduled)}
  17121. Skip current entry if it has been scheduled.
  17122. @item @code{(org-agenda-skip-entry-if 'notscheduled)}
  17123. Skip current entry if it has not been scheduled.
  17124. @item @code{(org-agenda-skip-entry-if 'deadline)}
  17125. Skip current entry if it has a deadline.
  17126. @item @code{(org-agenda-skip-entry-if 'scheduled 'deadline)}
  17127. Skip current entry if it has a deadline, or if it is scheduled.
  17128. @item @code{(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))}
  17129. Skip current entry if the TODO keyword is TODO or WAITING.
  17130. @item @code{(org-agenda-skip-entry-if 'todo 'done)}
  17131. Skip current entry if the TODO keyword marks a DONE state.
  17132. @item @code{(org-agenda-skip-entry-if 'timestamp)}
  17133. Skip current entry if it has any timestamp, may also be deadline
  17134. or scheduled.
  17135. @item @code{(org-agenda-skip-entry-if 'regexp "regular expression")}
  17136. Skip current entry if the regular expression matches in the
  17137. entry.
  17138. @item @code{(org-agenda-skip-entry-if 'notregexp "regular expression")}
  17139. Skip current entry unless the regular expression matches.
  17140. @item @code{(org-agenda-skip-subtree-if 'regexp "regular expression")}
  17141. Same as above, but check and skip the entire subtree.
  17142. @end table
  17143. The following is an example of a search for @samp{waiting} without the
  17144. special function:
  17145. @lisp
  17146. (org-add-agenda-custom-command
  17147. '("b" todo "PROJECT"
  17148. ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  17149. 'regexp ":waiting:"))
  17150. (org-agenda-overriding-header "Projects waiting for something: "))))
  17151. @end lisp
  17152. @node Speeding Up Your Agendas
  17153. @appendixsec Speeding Up Your Agendas
  17154. @cindex agenda views, optimization
  17155. Some agenda commands slow down when the Org files grow in size or
  17156. number. Here are tips to speed up:
  17157. @itemize
  17158. @item
  17159. Reduce the number of Org agenda files to avoid slowdowns due to hard drive
  17160. accesses.
  17161. @item
  17162. Reduce the number of DONE and archived headlines so agenda
  17163. operations that skip over these can finish faster.
  17164. @item
  17165. Do not dim blocked tasks:
  17166. @vindex org-agenda-dim-blocked-tasks
  17167. @lisp
  17168. (setq org-agenda-dim-blocked-tasks nil)
  17169. @end lisp
  17170. @item
  17171. Stop preparing agenda buffers on startup:
  17172. @vindex org-startup-folded
  17173. @vindex org-agenda-inhibit-startup
  17174. @lisp
  17175. (setq org-agenda-inhibit-startup nil)
  17176. @end lisp
  17177. @item
  17178. Disable tag inheritance for agendas:
  17179. @vindex org-agenda-show-inherited-tags
  17180. @vindex org-agenda-use-tag-inheritance
  17181. @lisp
  17182. (setq org-agenda-use-tag-inheritance nil)
  17183. @end lisp
  17184. @end itemize
  17185. These options can be applied to selected agenda views. For more
  17186. details about generation of agenda views, see the docstrings for the
  17187. relevant variables, and this @uref{https://orgmode.org/worg/agenda-optimization.html, dedicated Worg page} for agenda
  17188. optimization.
  17189. @node Extracting Agenda Information
  17190. @appendixsec Extracting Agenda Information
  17191. @cindex agenda, pipe
  17192. @cindex scripts, for agenda processing
  17193. Org provides commands to access agendas through Emacs batch mode.
  17194. Through this command-line interface, agendas are automated for further
  17195. processing or printing.
  17196. @vindex org-agenda-custom-commands
  17197. @findex org-batch-agenda
  17198. @code{org-batch-agenda} creates an agenda view in ASCII and outputs to
  17199. standard output. This command takes one string parameter. When
  17200. string consists of a single character, Org uses it as a key to
  17201. @code{org-agenda-custom-commands}. These are the same ones available
  17202. through the agenda dispatcher (see @ref{Agenda Dispatcher}).
  17203. This example command line directly prints the TODO list to the printer:
  17204. @example
  17205. emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  17206. @end example
  17207. When the string parameter length is two or more characters, Org
  17208. matches it with tags/TODO strings. For example, this example command
  17209. line prints items tagged with @samp{shop}, but excludes items tagged with
  17210. @samp{NewYork}:
  17211. @example
  17212. emacs -batch -l ~/.emacs \
  17213. -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  17214. @end example
  17215. @noindent
  17216. An example showing on-the-fly parameter modifications:
  17217. @example
  17218. emacs -batch -l ~/.emacs \
  17219. -eval '(org-batch-agenda "a" \
  17220. org-agenda-span (quote month) \
  17221. org-agenda-include-diary nil \
  17222. org-agenda-files (quote ("~/org/project.org")))' \
  17223. | lpr
  17224. @end example
  17225. @noindent
  17226. which produces an agenda for the next 30 days from just the
  17227. @samp{~/org/projects.org} file.
  17228. @findex org-batch-agenda-csv
  17229. For structured processing of agenda output, use @code{org-batch-agenda-csv}
  17230. with the following fields:
  17231. @table @asis
  17232. @item category
  17233. The category of the item
  17234. @item head
  17235. The headline, without TODO keyword, TAGS and PRIORITY
  17236. @item type
  17237. The type of the agenda entry, can be
  17238. @multitable {aaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  17239. @item @code{todo}
  17240. @tab selected in TODO match
  17241. @item @code{tagsmatch}
  17242. @tab selected in tags match
  17243. @item @code{diary}
  17244. @tab imported from diary
  17245. @item @code{deadline}
  17246. @tab a deadline
  17247. @item @code{scheduled}
  17248. @tab scheduled
  17249. @item @code{timestamp}
  17250. @tab appointment, selected by timestamp
  17251. @item @code{closed}
  17252. @tab entry was closed on date
  17253. @item @code{upcoming-deadline}
  17254. @tab warning about nearing deadline
  17255. @item @code{past-scheduled}
  17256. @tab forwarded scheduled item
  17257. @item @code{block}
  17258. @tab entry has date block including date
  17259. @end multitable
  17260. @item todo
  17261. The TODO keyword, if any
  17262. @item tags
  17263. All tags including inherited ones, separated by colons
  17264. @item date
  17265. The relevant date, like @samp{2007-2-14}
  17266. @item time
  17267. The time, like @samp{15:00-16:50}
  17268. @item extra
  17269. String with extra planning info
  17270. @item priority-l
  17271. The priority letter if any was given
  17272. @item priority-n
  17273. The computed numerical priority
  17274. @end table
  17275. @noindent
  17276. If the selection of the agenda item was based on a timestamp,
  17277. including those items with @samp{DEADLINE} and @samp{SCHEDULED} keywords, then
  17278. Org includes date and time in the output.
  17279. If the selection of the agenda item was based on a timestamp (or
  17280. deadline/scheduled), then Org includes date and time in the output.
  17281. Here is an example of a post-processing script in Perl. It takes the
  17282. CSV output from Emacs and prints with a checkbox:
  17283. @example
  17284. #!/usr/bin/perl
  17285. # define the Emacs command to run
  17286. $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  17287. # run it and capture the output
  17288. $agenda = qx@{$cmd 2>/dev/null@};
  17289. # loop over all lines
  17290. foreach $line (split(/\n/,$agenda)) @{
  17291. # get the individual values
  17292. ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  17293. $priority_l,$priority_n) = split(/,/,$line);
  17294. # process and print
  17295. print "[ ] $head\n";
  17296. @}
  17297. @end example
  17298. @node Using the Property API
  17299. @appendixsec Using the Property API
  17300. @cindex API, for properties
  17301. @cindex properties, API
  17302. Here is a description of the functions that can be used to work with
  17303. properties.
  17304. @defun org-entry-properties &optional pom which
  17305. Get all properties of the entry at point-or-marker @var{POM}.
  17306. This includes the TODO keyword, the tags, time strings for deadline,
  17307. scheduled, and clocking, and any additional properties defined in the
  17308. entry. The return value is an alist. Keys may occur multiple times
  17309. if the property key was used several times. @var{POM} may also
  17310. be @code{nil}, in which case the current entry is used. If
  17311. @var{WHICH} is @code{nil} or @code{all}, get all properties. If
  17312. @var{WHICH} is @code{special} or @code{standard}, only get that subclass.
  17313. @end defun
  17314. @vindex org-use-property-inheritance
  17315. @findex org-insert-property-drawer
  17316. @defun org-entry-get pom property &optional inherit
  17317. Get value of @var{PROPERTY} for entry at point-or-marker
  17318. @var{POM}. By default, this only looks at properties defined
  17319. locally in the entry. If @var{INHERIT} is non-@code{nil} and the
  17320. entry does not have the property, then also check higher levels of the
  17321. hierarchy. If @var{INHERIT} is the symbol @code{selective}, use
  17322. inheritance if and only if the setting of
  17323. @code{org-use-property-inheritance} selects @var{PROPERTY} for
  17324. inheritance.
  17325. @end defun
  17326. @defun org-entry-delete pom property
  17327. Delete the property @var{PROPERTY} from entry at point-or-marker
  17328. @var{POM}.
  17329. @end defun
  17330. @defun org-entry-put pom property value
  17331. Set @var{PROPERTY} to @var{VALUES} for entry at
  17332. point-or-marker POM.
  17333. @end defun
  17334. @defun org-buffer-property-keys &optional include-specials
  17335. Get all property keys in the current buffer.
  17336. @end defun
  17337. @defun org-insert-property-drawer
  17338. Insert a property drawer for the current entry. Also
  17339. @end defun
  17340. @defun org-entry-put-multivalued-property pom property &rest values
  17341. Set @var{PROPERTY} at point-or-marker @var{POM} to
  17342. @var{VALUES}. @var{VALUES} should be a list of strings.
  17343. They are concatenated, with spaces as separators.
  17344. @end defun
  17345. @defun org-entry-get-multivalued-property pom property
  17346. Treat the value of the property @var{PROPERTY} as
  17347. a whitespace-separated list of values and return the values as a list
  17348. of strings.
  17349. @end defun
  17350. @defun org-entry-add-to-multivalued-property pom property value
  17351. Treat the value of the property @var{PROPERTY} as
  17352. a whitespace-separated list of values and make sure that
  17353. @var{VALUE} is in this list.
  17354. @end defun
  17355. @defun org-entry-remove-from-multivalued-property pom property value
  17356. Treat the value of the property @var{PROPERTY} as
  17357. a whitespace-separated list of values and make sure that
  17358. @var{VALUE} is @emph{not} in this list.
  17359. @end defun
  17360. @defun org-entry-member-in-multivalued-property pom property value
  17361. Treat the value of the property @var{PROPERTY} as
  17362. a whitespace-separated list of values and check if @var{VALUE} is
  17363. in this list.
  17364. @end defun
  17365. @defopt org-property-allowed-value-functions
  17366. Hook for functions supplying allowed values for a specific property.
  17367. The functions must take a single argument, the name of the property,
  17368. and return a flat list of allowed values. If @samp{:ETC} is one of the
  17369. values, use the values as completion help, but allow also other values
  17370. to be entered. The functions must return @code{nil} if they are not
  17371. responsible for this property.
  17372. @end defopt
  17373. @node Using the Mapping API
  17374. @appendixsec Using the Mapping API
  17375. @cindex API, for mapping
  17376. @cindex mapping entries, API
  17377. Org has sophisticated mapping capabilities to find all entries
  17378. satisfying certain criteria. Internally, this functionality is used
  17379. to produce agenda views, but there is also an API that can be used to
  17380. execute arbitrary functions for each or selected entries. The main
  17381. entry point for this API is:
  17382. @defun org-map-entries func &optional match scope &rest skip
  17383. Call @{@{@{(var(FUNC))@}@}@} at each headline selected by @var{MATCH}
  17384. in @var{SCOPE}.
  17385. @var{FUNC} is a function or a Lisp form. With the cursor
  17386. positioned at the beginning of the headline, call the function without
  17387. arguments. Org returns an alist of return values of calls to the
  17388. function.
  17389. To avoid preserving point, Org wraps the call to @var{FUNC} in
  17390. save-excursion form. After evaluation, Org moves the cursor to the
  17391. end of the line that was just processed. Search continues from that
  17392. point forward. This may not always work as expected under some
  17393. conditions, such as if the current sub-tree was removed by a previous
  17394. archiving operation. In such rare circumstances, Org skips the next
  17395. entry entirely when it should not. To stop Org from such skips, make
  17396. @var{FUNC} set the variable @code{org-map-continue-from} to a specific
  17397. buffer position.
  17398. @var{MATCH} is a tags/property/TODO match. Org iterates only
  17399. matched headlines. Org iterates over all headlines when
  17400. @var{MATCH} is @code{nil} or @code{t}.
  17401. @var{SCOPE} determines the scope of this command. It can be any
  17402. of:
  17403. @table @asis
  17404. @item @code{nil}
  17405. The current buffer, respecting the restriction, if any.
  17406. @item @code{tree}
  17407. The subtree started with the entry at point.
  17408. @item @code{region}
  17409. The entries within the active region, if any.
  17410. @item @code{file}
  17411. The current buffer, without restriction.
  17412. @item @code{file-with-archives}
  17413. The current buffer, and any archives associated with it.
  17414. @item @code{agenda}
  17415. All agenda files.
  17416. @item @code{agenda-with-archives}
  17417. All agenda files with any archive files associated with them.
  17418. @item @code{(file1 file2 ...)}
  17419. If this is a list, all files in the list are scanned.
  17420. @end table
  17421. @noindent
  17422. The remaining arguments are treated as settings for the scanner's
  17423. skipping facilities. Valid arguments are:
  17424. @table @asis
  17425. @item @code{archive}
  17426. Skip trees with the archive tag.
  17427. @item @code{comment}
  17428. Skip trees with the COMMENT keyword.
  17429. @item function or Lisp form
  17430. @vindex org-agenda-skip-function
  17431. Used as value for @code{org-agenda-skip-function}, so whenever the
  17432. function returns @code{t}, @var{FUNC} is called for that entry
  17433. and search continues from the point where the function leaves it.
  17434. @end table
  17435. @end defun
  17436. The mapping routine can call any arbitrary function, even functions
  17437. that change meta data or query the property API (see @ref{Using the Property API}). Here are some handy functions:
  17438. @defun org-todo &optional arg
  17439. Change the TODO state of the entry. See the docstring of the
  17440. functions for the many possible values for the argument
  17441. @var{ARG}.
  17442. @end defun
  17443. @defun org-priority &optional action
  17444. Change the priority of the entry. See the docstring of this function
  17445. for the possible values for @var{ACTION}.
  17446. @end defun
  17447. @defun org-toggle-tag tag &optional onoff
  17448. Toggle the tag @var{TAG} in the current entry. Setting
  17449. @var{ONOFF} to either @code{on} or @code{off} does not toggle tag, but
  17450. ensure that it is either on or off.
  17451. @end defun
  17452. @defun org-promote
  17453. Promote the current entry.
  17454. @end defun
  17455. @defun org-demote
  17456. Demote the current entry.
  17457. @end defun
  17458. This example turns all entries tagged with @samp{TOMORROW} into TODO
  17459. entries with keyword @samp{UPCOMING}. Org ignores entries in comment trees
  17460. and archive trees.
  17461. @lisp
  17462. (org-map-entries '(org-todo "UPCOMING")
  17463. "+TOMORROW" 'file 'archive 'comment)
  17464. @end lisp
  17465. The following example counts the number of entries with TODO keyword
  17466. @samp{WAITING}, in all agenda files.
  17467. @lisp
  17468. (length (org-map-entries t "/+WAITING" 'agenda))
  17469. @end lisp
  17470. @node MobileOrg
  17471. @appendix MobileOrg
  17472. @cindex iPhone
  17473. @cindex smartphone
  17474. @cindex android
  17475. @cindex MobileOrg
  17476. MobileOrg is a companion mobile app that runs on iOS and Android
  17477. devices. MobileOrg enables offline-views and capture support for an
  17478. Org mode system that is rooted on a ``real'' computer. MobileOrg can
  17479. record changes to existing entries.
  17480. The @uref{https://github.com/MobileOrg/, iOS implementation} for the @emph{iPhone/iPod Touch/iPad} series of
  17481. devices, was started by Richard Moreland and is now in the hands of
  17482. Sean Escriva. Android users should check out @uref{http://wiki.github.com/matburt/mobileorg-android/, MobileOrg Android} by
  17483. Matt Jones. Though the two implementations are not identical, they
  17484. offer similar features.
  17485. This appendix describes Org's support for agenda view formats
  17486. compatible with MobileOrg. It also describes synchronizing changes,
  17487. such as to notes, between MobileOrg and the computer.
  17488. To change tags and TODO states in MobileOrg, first customize the
  17489. variables @code{org-todo-keywords} and @code{org-tag-alist}. These should cover
  17490. all the important tags and TODO keywords, even if Org files use only
  17491. some of them. Though MobileOrg has in-buffer settings, it understands
  17492. TODO states @emph{sets} (see @ref{Per-file keywords}) and
  17493. @emph{mutually exclusive} tags (see @ref{Setting Tags}) only for those set in
  17494. these variables.
  17495. @menu
  17496. * Setting Up the Staging Area:: For the mobile device.
  17497. * Pushing to MobileOrg:: Uploading Org files and agendas.
  17498. * Pulling from MobileOrg:: Integrating captured and flagged items.
  17499. @end menu
  17500. @node Setting Up the Staging Area
  17501. @appendixsec Setting Up the Staging Area
  17502. MobileOrg needs access to a file directory on a server to interact
  17503. with Emacs. With a public server, consider encrypting the files.
  17504. MobileOrg version 1.5 supports encryption for the iPhone. Org also
  17505. requires @samp{openssl} installed on the local computer. To turn on
  17506. encryption, set the same password in MobileOrg and in Emacs. Set the
  17507. password in the variable @code{org-mobile-use-encryption}@footnote{If Emacs is configured for safe storing of passwords, then
  17508. configure the variable, @code{org-mobile-encryption-password}; please read
  17509. the docstring of that variable.}. Note
  17510. that even after MobileOrg encrypts the file contents, the file name
  17511. remains visible on the file systems of the local computer, the server,
  17512. and the mobile device.
  17513. For a server to host files, consider options like @uref{http://dropbox.com, Dropbox.com}
  17514. account@footnote{An alternative is to use a WebDAV server. MobileOrg
  17515. documentation has details of WebDAV server configuration. Additional
  17516. help is at this @uref{https://orgmode.org/worg/org-faq.html#mobileorg_webdav, FAQ entry}.}. On first connection, MobileOrg creates a directory
  17517. @samp{MobileOrg} on Dropbox. Pass its location to Emacs through an
  17518. initialisation file variable as follows:
  17519. @lisp
  17520. (setq org-mobile-directory "~/Dropbox/MobileOrg")
  17521. @end lisp
  17522. Org copies files to the above directory for MobileOrg. Org also uses
  17523. the same directory for sharing notes between Org and MobileOrg.
  17524. @node Pushing to MobileOrg
  17525. @appendixsec Pushing to MobileOrg
  17526. @vindex org-mobile-files
  17527. @vindex org-directory
  17528. Org pushes files listed in @code{org-mobile-files} to
  17529. @code{org-mobile-directory}. Files include agenda files (as listed in
  17530. @code{org-agenda-files}). Customize @code{org-mobile-files} to add other files.
  17531. File names are staged with paths relative to @code{org-directory}, so all
  17532. files should be inside this directory@footnote{Symbolic links in @code{org-directory} need to have the same name
  17533. as their targets.}.
  17534. Push creates a special Org file @samp{agendas.org} with custom agenda views
  17535. defined by the user@footnote{While creating the agendas, Org mode forces ID properties on
  17536. all referenced entries, so that these entries can be uniquely
  17537. identified if MobileOrg flags them for further action. To avoid
  17538. setting properties configure the variable
  17539. @code{org-mobile-force-id-on-agenda-items} to @code{nil}. Org mode then relies
  17540. on outline paths, assuming they are unique.}.
  17541. Finally, Org writes the file @samp{index.org}, containing links to other
  17542. files. MobileOrg reads this file first from the server to determine
  17543. what other files to download for agendas. For faster downloads,
  17544. MobileOrg only reads files whose checksums@footnote{Checksums are stored automatically in the file
  17545. @samp{checksums.dat}.} have changed.
  17546. @node Pulling from MobileOrg
  17547. @appendixsec Pulling from MobileOrg
  17548. When MobileOrg synchronizes with the server, it pulls the Org files
  17549. for viewing. It then appends to the file @samp{mobileorg.org} on the
  17550. server the captured entries, pointers to flagged and changed entries.
  17551. Org integrates its data in an inbox file format.
  17552. @enumerate
  17553. @item
  17554. @vindex org-mobile-inbox-for-pull
  17555. Org moves all entries found in @samp{mobileorg.org}@footnote{The file will be empty after this operation.} and appends
  17556. them to the file pointed to by the variable
  17557. @code{org-mobile-inbox-for-pull}. Each captured entry and each editing
  17558. event is a top-level entry in the inbox file.
  17559. @item
  17560. After moving the entries, Org attempts changes to MobileOrg. Some
  17561. changes are applied directly and without user interaction.
  17562. Examples include changes to tags, TODO state, headline and body
  17563. text. Entries for further action are tagged as @samp{FLAGGED}. Org
  17564. marks entries with problems with an error message in the inbox.
  17565. They have to be resolved manually.
  17566. @item
  17567. Org generates an agenda view for flagged entries for user
  17568. intervention to clean up. For notes stored in flagged entries,
  17569. MobileOrg displays them in the echo area when the cursor is on the
  17570. corresponding agenda item.
  17571. @table @asis
  17572. @item @kbd{?}
  17573. @kindex ?
  17574. Pressing @kbd{?} displays the entire flagged note in
  17575. another window. Org also pushes it to the kill ring. To
  17576. store flagged note as a normal note, use @kbd{? z C-y C-c C-c}. Pressing@kbd{?} twice does these things: first
  17577. it removes the @samp{FLAGGED} tag; second, it removes the flagged
  17578. note from the property drawer; third, it signals that manual
  17579. editing of the flagged entry is now finished.
  17580. @end table
  17581. @end enumerate
  17582. @kindex ? @r{(Agenda dispatcher)}
  17583. From the agenda dispatcher, @kbd{?} returns to the view to finish
  17584. processing flagged entries. Note that these entries may not be the
  17585. most recent since MobileOrg searches files that were last pulled. To
  17586. get an updated agenda view with changes since the last pull, pull
  17587. again.
  17588. @node History and Acknowledgments
  17589. @appendix History and Acknowledgments
  17590. @anchor{From Carsten}
  17591. @appendixsec From Carsten
  17592. Org was born in 2003, out of frustration over the user interface of
  17593. the Emacs Outline mode. I was trying to organize my notes and
  17594. projects, and using Emacs seemed to be the natural way to go.
  17595. However, having to remember eleven different commands with two or
  17596. three keys per command, only to hide and show parts of the outline
  17597. tree, that seemed entirely unacceptable to me. Also, when using
  17598. outlines to take notes, I constantly wanted to restructure the tree,
  17599. organizing it parallel to my thoughts and plans. @emph{Visibility cycling}
  17600. and @emph{structure editing} were originally implemented in the package
  17601. @samp{outline-magic.el}, but quickly moved to the more general @samp{org.el}.
  17602. As this environment became comfortable for project planning, the next
  17603. step was adding @emph{TODO entries}, basic @emph{timestamps}, and @emph{table
  17604. support}. These areas highlighted the two main goals that Org still
  17605. has today: to be a new, outline-based, plain text mode with innovative
  17606. and intuitive editing features, and to incorporate project planning
  17607. functionality directly into a notes file.
  17608. Since the first release, literally thousands of emails to me or to the
  17609. @email{emacs-orgmode@@gnu.org, mailing list} have provided a constant stream of bug reports, feedback,
  17610. new ideas, and sometimes patches and add-on code. Many thanks to
  17611. everyone who has helped to improve this package. I am trying to keep
  17612. here a list of the people who had significant influence in shaping one
  17613. or more aspects of Org. The list may not be complete, if I have
  17614. forgotten someone, please accept my apologies and let me know.
  17615. Before I get to this list, a few special mentions are in order:
  17616. @table @asis
  17617. @item Bastien Guerry
  17618. Bastien has written a large number of extensions to Org (most of
  17619. them integrated into the core by now), including the @LaTeX{}
  17620. exporter and the plain list parser. His support during the early
  17621. days was central to the success of this project. Bastien also
  17622. invented Worg, helped establishing the Web presence of Org, and
  17623. sponsored hosting costs for the orgmode.org website. Bastien
  17624. stepped in as maintainer of Org between 2011 and 2013, at a time
  17625. when I desperately needed a break.
  17626. @item Eric Schulte and Dan Davison
  17627. Eric and Dan are jointly responsible for the Org Babel system,
  17628. which turns Org into a multi-language environment for evaluating
  17629. code and doing literate programming and reproducible research.
  17630. This has become one of Org's killer features that define what Org
  17631. is today.
  17632. @item John Wiegley
  17633. John has contributed a number of great ideas and patches directly
  17634. to Org, including the attachment system (@samp{org-attach.el}),
  17635. integration with Apple Mail (@samp{org-mac-message.el}), hierarchical
  17636. dependencies of TODO items, habit tracking (@samp{org-habits.el}), and
  17637. encryption (@samp{org-crypt.el}). Also, the capture system is really
  17638. an extended copy of his great @samp{remember.el}.
  17639. @item Sebastian Rose
  17640. Without Sebastian, the HTML/XHTML publishing of Org would be the
  17641. pitiful work of an ignorant amateur. Sebastian has pushed this
  17642. part of Org onto a much higher level. He also wrote
  17643. @samp{org-info.js}, a Java script for displaying webpages derived from
  17644. Org using an Info-like or a folding interface with single-key
  17645. navigation.
  17646. @end table
  17647. @noindent
  17648. See below for the full list of contributions! Again, please let me
  17649. know what I am missing here!
  17650. @anchor{From Bastien}
  17651. @appendixsec From Bastien
  17652. I (Bastien) have been maintaining Org between 2011 and 2013. This
  17653. appendix would not be complete without adding a few more
  17654. acknowledgments and thanks.
  17655. I am first grateful to Carsten for his trust while handing me over the
  17656. maintainership of Org. His unremitting support is what really helped
  17657. me getting more confident over time, with both the community and the
  17658. code.
  17659. When I took over maintainership, I knew I would have to make Org more
  17660. collaborative than ever, as I would have to rely on people that are
  17661. more knowledgeable than I am on many parts of the code. Here is
  17662. a list of the persons I could rely on, they should really be
  17663. considered co-maintainers, either of the code or the community:
  17664. @table @asis
  17665. @item Eric Schulte
  17666. Eric is maintaining the Babel parts of Org. His reactivity here
  17667. kept me away from worrying about possible bugs here and let me
  17668. focus on other parts.
  17669. @item Nicolas Goaziou
  17670. Nicolas is maintaining the consistency of the deepest parts of
  17671. Org. His work on @samp{org-element.el} and @samp{ox.el} has been
  17672. outstanding, and it opened the doors for many new ideas and
  17673. features. He rewrote many of the old exporters to use the new
  17674. export engine, and helped with documenting this major change.
  17675. More importantly (if that's possible), he has been more than
  17676. reliable during all the work done for Org 8.0, and always very
  17677. reactive on the mailing list.
  17678. @item Achim Gratz
  17679. Achim rewrote the building process of Org, turning some @emph{ad hoc}
  17680. tools into a flexible and conceptually clean process. He
  17681. patiently coped with the many hiccups that such a change can
  17682. create for users.
  17683. @item Nick Dokos
  17684. The Org mode mailing list would not be such a nice place without
  17685. Nick, who patiently helped users so many times. It is impossible
  17686. to overestimate such a great help, and the list would not be so
  17687. active without him.
  17688. @end table
  17689. I received support from so many users that it is clearly impossible to
  17690. be fair when shortlisting a few of them, but Org's history would not
  17691. be complete if the ones above were not mentioned in this manual.
  17692. @anchor{List of Contributions}
  17693. @appendixsec List of Contributions
  17694. @itemize
  17695. @item
  17696. Russel Adams came up with the idea for drawers.
  17697. @item
  17698. Thomas Baumann wrote @samp{org-bbdb.el} and @samp{org-mhe.el}.
  17699. @item
  17700. Christophe Bataillon created the great unicorn logo that we use on
  17701. the Org mode website.
  17702. @item
  17703. Alex Bochannek provided a patch for rounding timestamps.
  17704. @item
  17705. Jan Böcker wrote @samp{org-docview.el}.
  17706. @item
  17707. Brad Bozarth showed how to pull RSS feed data into Org files.
  17708. @item
  17709. Tom Breton wrote @samp{org-choose.el}.
  17710. @item
  17711. Charles Cave's suggestion sparked the implementation of templates
  17712. for Remember, which are now templates for capture.
  17713. @item
  17714. Pavel Chalmoviansky influenced the agenda treatment of items with
  17715. specified time.
  17716. @item
  17717. Gregory Chernov patched support for Lisp forms into table
  17718. calculations and improved XEmacs compatibility, in particular by
  17719. porting @samp{nouline.el} to XEmacs.
  17720. @item
  17721. Sacha Chua suggested copying some linking code from Planner.
  17722. @item
  17723. Baoqiu Cui contributed the DocBook exporter.
  17724. @item
  17725. Eddward DeVilla proposed and tested checkbox statistics. He also
  17726. came up with the idea of properties, and that there should be an API
  17727. for them.
  17728. @item
  17729. Nick Dokos tracked down several nasty bugs.
  17730. @item
  17731. Kees Dullemond used to edit projects lists directly in HTML and so
  17732. inspired some of the early development, including HTML export. He
  17733. also asked for a way to narrow wide table columns.
  17734. @item
  17735. Thomas S. Dye contributed documentation on Worg and helped
  17736. integrating the Org Babel documentation into the manual.
  17737. @item
  17738. Christian Egli converted the documentation into Texinfo format,
  17739. inspired the agenda, patched CSS formatting into the HTML exporter,
  17740. and wrote @samp{org-taskjuggler.el}.
  17741. @item
  17742. David Emery provided a patch for custom CSS support in exported HTML
  17743. agendas.
  17744. @item
  17745. Nic Ferrier contributed mailcap and XOXO support.
  17746. @item
  17747. Miguel A. Figueroa-Villanueva implemented hierarchical checkboxes.
  17748. @item
  17749. John Foerch figured out how to make incremental search show context
  17750. around a match in a hidden outline tree.
  17751. @item
  17752. Raimar Finken wrote @samp{org-git-line.el}.
  17753. @item
  17754. Mikael Fornius works as a mailing list moderator.
  17755. @item
  17756. Austin Frank works as a mailing list moderator.
  17757. @item
  17758. Eric Fraga drove the development of Beamer export with ideas and
  17759. testing.
  17760. @item
  17761. Barry Gidden did proofreading the manual in preparation for the book
  17762. publication through Network Theory Ltd.
  17763. @item
  17764. Niels Giesen had the idea to automatically archive DONE trees.
  17765. @item
  17766. Nicolas Goaziou rewrote much of the plain list code.
  17767. @item
  17768. Kai Grossjohann pointed out key-binding conflicts with other
  17769. packages.
  17770. @item
  17771. Brian Gough of Network Theory Ltd publishes the Org mode manual as
  17772. a book.
  17773. @item
  17774. Bernt Hansen has driven much of the support for auto-repeating
  17775. tasks, task state change logging, and the clocktable. His clear
  17776. explanations have been critical when we started to adopt the Git
  17777. version control system.
  17778. @item
  17779. Manuel Hermenegildo has contributed various ideas, small fixes and
  17780. patches.
  17781. @item
  17782. Phil Jackson wrote @samp{org-irc.el}.
  17783. @item
  17784. Scott Jaderholm proposed footnotes, control over whitespace between
  17785. folded entries, and column view for properties.
  17786. @item
  17787. Matt Jones wrote MobileOrg Android.
  17788. @item
  17789. Tokuya Kameshima wrote @samp{org-wl.el} and @samp{org-mew.el}.
  17790. @item
  17791. Shidai Liu (``Leo'') asked for embedded @LaTeX{} and tested it. He also
  17792. provided frequent feedback and some patches.
  17793. @item
  17794. Matt Lundin has proposed last-row references for table formulas and
  17795. named invisible anchors. He has also worked a lot on the FAQ.
  17796. @item
  17797. David Maus wrote @samp{org-atom.el}, maintains the issues file for Org,
  17798. and is a prolific contributor on the mailing list with competent
  17799. replies, small fixes and patches.
  17800. @item
  17801. Jason F. McBrayer suggested agenda export to CSV format.
  17802. @item
  17803. Max Mikhanosha came up with the idea of refiling.
  17804. @item
  17805. Dmitri Minaev sent a patch to set priority limits on a per-file
  17806. basis.
  17807. @item
  17808. Stefan Monnier provided a patch to keep the Emacs Lisp compiler
  17809. happy.
  17810. @item
  17811. Richard Moreland wrote MobileOrg for the iPhone.
  17812. @item
  17813. Rick Moynihan proposed allowing multiple TODO sequences in a file
  17814. and being able to quickly restrict the agenda to a subtree.
  17815. @item
  17816. Todd Neal provided patches for links to Info files and Elisp forms.
  17817. @item
  17818. Greg Newman refreshed the unicorn logo into its current form.
  17819. @item
  17820. Tim O'Callaghan suggested in-file links, search options for general
  17821. file links, and tags.
  17822. @item
  17823. Osamu Okano wrote @samp{orgcard2ref.pl}, a Perl program to create a text
  17824. version of the reference card.
  17825. @item
  17826. Takeshi Okano translated the manual and David O'Toole's tutorial
  17827. into Japanese.
  17828. @item
  17829. Oliver Oppitz suggested multi-state TODO items.
  17830. @item
  17831. Scott Otterson sparked the introduction of descriptive text for
  17832. links, among other things.
  17833. @item
  17834. Pete Phillips helped during the development of the TAGS feature,
  17835. and provided frequent feedback.
  17836. @item
  17837. Martin Pohlack provided the code snippet to bundle character
  17838. insertion into bundles of 20 for undo.
  17839. @item
  17840. T.V. Raman reported bugs and suggested improvements.
  17841. @item
  17842. Matthias Rempe (Oelde) provided ideas, Windows support, and quality
  17843. control.
  17844. @item
  17845. Paul Rivier provided the basic implementation of named footnotes.
  17846. He also acted as mailing list moderator for some time.
  17847. @item
  17848. Kevin Rogers contributed code to access VM files on remote hosts.
  17849. @item
  17850. Frank Ruell solved the mystery of the @samp{keymapp nil} bug, a conflict
  17851. with @samp{allout.el}.
  17852. @item
  17853. Jason Riedy generalized the send-receive mechanism for Orgtbl
  17854. tables with extensive patches.
  17855. @item
  17856. Philip Rooke created the Org reference card, provided lots of
  17857. feedback, developed and applied standards to the Org documentation.
  17858. @item
  17859. Christian Schlauer proposed angular brackets around links, among
  17860. other things.
  17861. @item
  17862. Paul Sexton wrote @samp{org-ctags.el}.
  17863. @item
  17864. Tom Shannon's @samp{organizer-mode.el} inspired linking to VM/BBDB/Gnus.
  17865. @item
  17866. Ilya Shlyakhter proposed the Archive Sibling, line numbering in
  17867. literal examples, and remote highlighting for referenced code lines.
  17868. @item
  17869. Stathis Sideris wrote the @samp{ditaa.jar} ASCII to PNG converter that is
  17870. now packaged into Org's @samp{contrib/} directory.
  17871. @item
  17872. Daniel Sinder came up with the idea of internal archiving by locking
  17873. subtrees.
  17874. @item
  17875. Dale Smith proposed link abbreviations.
  17876. @item
  17877. James TD Smith has contributed a large number of patches for
  17878. useful tweaks and features.
  17879. @item
  17880. Adam Spiers asked for global linking commands, inspired the link
  17881. extension system, added support for Mairix, and proposed the mapping
  17882. API.
  17883. @item
  17884. Ulf Stegemann created the table to translate special symbols to
  17885. HTML, @LaTeX{}, UTF-8, Latin-1 and ASCII.
  17886. @item
  17887. Andy Stewart contributed code to @samp{org-w3m.el}, to copy
  17888. HTML content with links transformation to Org syntax.
  17889. @item
  17890. David O'Toole wrote @samp{org-publish.el} and drafted the
  17891. manual chapter about publishing.
  17892. @item
  17893. Jambunathan K. contributed the ODT exporter.
  17894. @item
  17895. Sebastien Vauban reported many issues with @LaTeX{} and Beamer export
  17896. and enabled source code highlighting in Gnus.
  17897. @item
  17898. Stefan Vollmar organized a video-recorded talk at the
  17899. Max-Planck-Institute for Neurology. He also inspired the creation
  17900. of a concept index for HTML export.
  17901. @item
  17902. Jürgen Vollmer contributed code generating the table of contents in
  17903. HTML output.
  17904. @item
  17905. Samuel Wales has provided important feedback and bug reports.
  17906. @item
  17907. Chris Wallace provided a patch implementing the @samp{QUOTE} block.
  17908. @item
  17909. David Wainberg suggested archiving, and improvements to the
  17910. linking system.
  17911. @item
  17912. Carsten Wimmer suggested some changes and helped fix a bug in
  17913. linking to Gnus.
  17914. @item
  17915. Roland Winkler requested additional key bindings to make Org work on
  17916. a TTY.
  17917. @item
  17918. Piotr Zielinski wrote @samp{org-mouse.el}, proposed agenda
  17919. blocks and contributed various ideas and code snippets.
  17920. @item
  17921. Marco Wahl wrote @samp{org-eww.el}.
  17922. @end itemize
  17923. @node GNU Free Documentation License
  17924. @appendix GNU Free Documentation License
  17925. @include doclicense.texi
  17926. @node Main Index
  17927. @chapter Main Index
  17928. @printindex cp
  17929. @node Key Index
  17930. @chapter Key Index
  17931. @printindex ky
  17932. @node Command and Function Index
  17933. @chapter Command and Function Index
  17934. @printindex fn
  17935. @node Variable Index
  17936. @chapter Variable Index
  17937. This is not a complete index of variables and faces, only the ones
  17938. that are mentioned in the manual. For a more complete list, use
  17939. @kbd{M-x org-customize} and then click yourself through the tree.
  17940. @printindex vr
  17941. @bye