org.texi 763 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784
  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. To record a timestamp without a note for TODO keywords configured with
  3885. @samp{@@}, just type @kbd{C-c C-c} to enter a blank note when prompted.
  3886. @vindex org-log-done
  3887. noindent
  3888. you not only define global TODO keywords and fast access keys, but
  3889. also request that a time is recorded when the entry is set to @samp{DONE},
  3890. and that a note is recorded when switching to @samp{WAIT} or
  3891. @samp{CANCELED}@footnote{It is possible that Org mode records two timestamps when you
  3892. are using both @code{org-log-done} and state change logging. However, it
  3893. never prompts for two notes: if you have configured both, the state
  3894. change recording note takes precedence and cancel the closing note.}. The setting for @samp{WAIT} is even more special: the
  3895. @samp{!} after the slash means that in addition to the note taken when
  3896. entering the state, a timestamp should be recorded when @emph{leaving} the
  3897. @samp{WAIT} state, if and only if the @emph{target} state does not configure
  3898. logging for entering it. So it has no effect when switching from
  3899. @samp{WAIT} to @samp{DONE}, because @samp{DONE} is configured to record a timestamp
  3900. only. But when switching from @samp{WAIT} back to @samp{TODO}, the @samp{/!} in the
  3901. @samp{WAIT} setting now triggers a timestamp even though @samp{TODO} has no
  3902. logging configured.
  3903. You can use the exact same syntax for setting logging preferences local
  3904. to a buffer:
  3905. @example
  3906. #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
  3907. @end example
  3908. @cindex @samp{LOGGING}, property
  3909. In order to define logging settings that are local to a subtree or
  3910. a single item, define a @samp{LOGGING} property in this entry. Any
  3911. non-empty @samp{LOGGING} property resets all logging settings to @code{nil}.
  3912. You may then turn on logging for this specific tree using @samp{STARTUP}
  3913. keywords like @samp{lognotedone} or @samp{logrepeat}, as well as adding state
  3914. specific settings like @samp{TODO(!)}. For example:
  3915. @example
  3916. * TODO Log each state with only a time
  3917. :PROPERTIES:
  3918. :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
  3919. :END:
  3920. * TODO Only log when switching to WAIT, and when repeating
  3921. :PROPERTIES:
  3922. :LOGGING: WAIT(@@) logrepeat
  3923. :END:
  3924. * TODO No logging at all
  3925. :PROPERTIES:
  3926. :LOGGING: nil
  3927. :END:
  3928. @end example
  3929. @node Tracking your habits
  3930. @subsection Tracking your habits
  3931. @cindex habits
  3932. @cindex STYLE, property
  3933. Org has the ability to track the consistency of a special category of
  3934. TODO, called ``habits.'' A habit has the following properties:
  3935. @enumerate
  3936. @item
  3937. You have enabled the @code{habits} module by customizing the variable
  3938. @code{org-modules}.
  3939. @item
  3940. The habit is a TODO item, with a TODO keyword representing an open
  3941. state.
  3942. @item
  3943. The property @samp{STYLE} is set to the value @samp{habit}.
  3944. @item
  3945. The TODO has a scheduled date, usually with a @samp{.+} style repeat
  3946. interval. A @samp{++} style may be appropriate for habits with time
  3947. constraints, e.g., must be done on weekends, or a @samp{+} style for an
  3948. unusual habit that can have a backlog, e.g., weekly reports.
  3949. @item
  3950. The TODO may also have minimum and maximum ranges specified by
  3951. using the syntax @samp{.+2d/3d}, which says that you want to do the task
  3952. at least every three days, but at most every two days.
  3953. @item
  3954. You must also have state logging for the DONE state enabled (see
  3955. @ref{Tracking TODO state changes}), in order for historical data to be
  3956. represented in the consistency graph. If it is not enabled it is
  3957. not an error, but the consistency graphs are largely meaningless.
  3958. @end enumerate
  3959. To give you an idea of what the above rules look like in action, here's an
  3960. actual habit with some history:
  3961. @example
  3962. ** TODO Shave
  3963. SCHEDULED: <2009-10-17 Sat .+2d/4d>
  3964. :PROPERTIES:
  3965. :STYLE: habit
  3966. :LAST_REPEAT: [2009-10-19 Mon 00:36]
  3967. :END:
  3968. - State "DONE" from "TODO" [2009-10-15 Thu]
  3969. - State "DONE" from "TODO" [2009-10-12 Mon]
  3970. - State "DONE" from "TODO" [2009-10-10 Sat]
  3971. - State "DONE" from "TODO" [2009-10-04 Sun]
  3972. - State "DONE" from "TODO" [2009-10-02 Fri]
  3973. - State "DONE" from "TODO" [2009-09-29 Tue]
  3974. - State "DONE" from "TODO" [2009-09-25 Fri]
  3975. - State "DONE" from "TODO" [2009-09-19 Sat]
  3976. - State "DONE" from "TODO" [2009-09-16 Wed]
  3977. - State "DONE" from "TODO" [2009-09-12 Sat]
  3978. @end example
  3979. What this habit says is: I want to shave at most every 2 days---given
  3980. by the @samp{SCHEDULED} date and repeat interval---and at least every
  3981. 4 days. If today is the 15th, then the habit first appears in the
  3982. agenda on Oct 17, after the minimum of 2 days has elapsed, and will
  3983. appear overdue on Oct 19, after four days have elapsed.
  3984. What's really useful about habits is that they are displayed along
  3985. with a consistency graph, to show how consistent you've been at
  3986. getting that task done in the past. This graph shows every day that
  3987. the task was done over the past three weeks, with colors for each day.
  3988. The colors used are:
  3989. @table @asis
  3990. @item Blue
  3991. If the task was not to be done yet on that day.
  3992. @item Green
  3993. If the task could have been done on that day.
  3994. @item Yellow
  3995. If the task was going to be overdue the next day.
  3996. @item Red
  3997. If the task was overdue on that day.
  3998. @end table
  3999. In addition to coloring each day, the day is also marked with an
  4000. asterisk if the task was actually done that day, and an exclamation
  4001. mark to show where the current day falls in the graph.
  4002. There are several configuration variables that can be used to change
  4003. the way habits are displayed in the agenda.
  4004. @table @asis
  4005. @item @code{org-habit-graph-column}
  4006. @vindex org-habit-graph-column
  4007. The buffer column at which the consistency graph should be drawn.
  4008. This overwrites any text in that column, so it is a good idea to
  4009. keep your habits' titles brief and to the point.
  4010. @item @code{org-habit-preceding-days}
  4011. @vindex org-habit-preceding-days
  4012. The amount of history, in days before today, to appear in
  4013. consistency graphs.
  4014. @item @code{org-habit-following-days}
  4015. @vindex org-habit-following-days
  4016. The number of days after today that appear in consistency graphs.
  4017. @item @code{org-habit-show-habits-only-for-today}
  4018. @vindex org-habit-show-habits-only-for-today
  4019. If non-@code{nil}, only show habits in today's agenda view. This is
  4020. set to true by default.
  4021. @end table
  4022. Lastly, pressing @kbd{K} in the agenda buffer causes habits to
  4023. temporarily be disabled and do not appear at all. Press @kbd{K}
  4024. again to bring them back. They are also subject to tag filtering, if
  4025. you have habits which should only be done in certain contexts, for
  4026. example.
  4027. @node Priorities
  4028. @section Priorities
  4029. @cindex priorities
  4030. @cindex priority cookie
  4031. If you use Org mode extensively, you may end up with enough TODO items
  4032. that it starts to make sense to prioritize them. Prioritizing can be
  4033. done by placing a @emph{priority cookie} into the headline of a TODO item,
  4034. like this
  4035. @example
  4036. *** TODO [#A] Write letter to Sam Fortune
  4037. @end example
  4038. @vindex org-priority-faces
  4039. @noindent
  4040. By default, Org mode supports three priorities: @samp{A}, @samp{B}, and @samp{C}.
  4041. @samp{A} is the highest priority. An entry without a cookie is treated
  4042. just like priority @samp{B}. Priorities make a difference only for sorting
  4043. in the agenda (see @ref{Weekly/daily agenda}); outside the agenda, they
  4044. have no inherent meaning to Org mode. The cookies can be highlighted
  4045. with special faces by customizing the variable @code{org-priority-faces}.
  4046. Priorities can be attached to any outline node; they do not need to be
  4047. TODO items.
  4048. @table @asis
  4049. @item @kbd{C-c ,} (@code{org-priority})
  4050. @kindex C-c ,
  4051. @findex org-priority
  4052. Set the priority of the current headline. The command prompts
  4053. for a priority character @samp{A}, @samp{B} or @samp{C}. When you press
  4054. @kbd{@key{SPC}} instead, the priority cookie is removed from the
  4055. headline. The priorities can also be changed ``remotely'' from the
  4056. timeline and agenda buffer with the @kbd{,} command (see
  4057. @ref{Agenda Commands}).
  4058. @item @kbd{S-@key{UP}} (@code{org-priority-up})
  4059. @itemx @kbd{S-@key{DOWN}} (@code{org-priority-down})
  4060. @kindex S-UP
  4061. @kindex S-DOWN
  4062. @findex org-priority-up
  4063. @findex org-priority-down
  4064. @vindex org-priority-start-cycle-with-default
  4065. Increase/decrease priority of current headline@footnote{See also the option @code{org-priority-start-cycle-with-default}.}. Note that
  4066. these keys are also used to modify timestamps (see @ref{Creating Timestamps}). See also @ref{Conflicts}, for
  4067. a discussion of the interaction with @code{shift-selection-mode}.
  4068. @end table
  4069. @vindex org-highest-priority
  4070. @vindex org-lowest-priority
  4071. @vindex org-default-priority
  4072. You can change the range of allowed priorities by setting the
  4073. variables @code{org-highest-priority}, @code{org-lowest-priority}, and
  4074. @code{org-default-priority}. For an individual buffer, you may set these
  4075. values (highest, lowest, default) like this (please make sure that the
  4076. highest priority is earlier in the alphabet than the lowest priority):
  4077. @cindex @samp{PRIORITIES}, keyword
  4078. @example
  4079. #+PRIORITIES: A C B
  4080. @end example
  4081. @node Breaking Down Tasks
  4082. @section Breaking Down Tasks into Subtasks
  4083. @cindex tasks, breaking down
  4084. @cindex statistics, for TODO items
  4085. @vindex org-agenda-todo-list-sublevels
  4086. It is often advisable to break down large tasks into smaller,
  4087. manageable subtasks. You can do this by creating an outline tree
  4088. below a TODO item, with detailed subtasks on the tree@footnote{To keep subtasks out of the global TODO list, see the
  4089. @code{org-agenda-todo-list-sublevels}.}. To keep
  4090. the overview over the fraction of subtasks that are already completed,
  4091. insert either @samp{[/]} or @samp{[%]} anywhere in the headline. These cookies
  4092. are updated each time the TODO status of a child changes, or when
  4093. pressing @kbd{C-c C-c} on the cookie. For example:
  4094. @example
  4095. * Organize Party [33%]
  4096. ** TODO Call people [1/2]
  4097. *** TODO Peter
  4098. *** DONE Sarah
  4099. ** TODO Buy food
  4100. ** DONE Talk to neighbor
  4101. @end example
  4102. @cindex @samp{COOKIE_DATA}, property
  4103. If a heading has both checkboxes and TODO children below it, the
  4104. meaning of the statistics cookie become ambiguous. Set the property
  4105. @samp{COOKIE_DATA} to either @samp{checkbox} or @samp{todo} to resolve this issue.
  4106. @vindex org-hierarchical-todo-statistics
  4107. If you would like to have the statistics cookie count any TODO entries
  4108. in the subtree (not just direct children), configure the variable
  4109. @code{org-hierarchical-todo-statistics}. To do this for a single subtree,
  4110. include the word @samp{recursive} into the value of the @samp{COOKIE_DATA}
  4111. property.
  4112. @example
  4113. * Parent capturing statistics [2/20]
  4114. :PROPERTIES:
  4115. :COOKIE_DATA: todo recursive
  4116. :END:
  4117. @end example
  4118. If you would like a TODO entry to automatically change to DONE when
  4119. all children are done, you can use the following setup:
  4120. @lisp
  4121. (defun org-summary-todo (n-done n-not-done)
  4122. "Switch entry to DONE when all subentries are done, to TODO otherwise."
  4123. (let (org-log-done org-log-states) ; turn off logging
  4124. (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
  4125. (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
  4126. @end lisp
  4127. Another possibility is the use of checkboxes to identify (a hierarchy
  4128. of) a large number of subtasks (see @ref{Checkboxes}).
  4129. @node Checkboxes
  4130. @section Checkboxes
  4131. @cindex checkboxes
  4132. @vindex org-list-automatic-rules
  4133. Every item in a plain list@footnote{With the exception of description lists. But you can allow it
  4134. by modifying @code{org-list-automatic-rules} accordingly.} (see @ref{Plain Lists}) can be made into
  4135. a checkbox by starting it with the string @samp{[ ]}. This feature is
  4136. similar to TODO items (see @ref{TODO Items}), but is more lightweight.
  4137. Checkboxes are not included into the global TODO list, so they are
  4138. often great to split a task into a number of simple steps. Or you can
  4139. 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
  4140. @samp{org-mouse.el}).
  4141. Here is an example of a checkbox list.
  4142. @example
  4143. * TODO Organize party [2/4]
  4144. - [-] call people [1/3]
  4145. - [ ] Peter
  4146. - [X] Sarah
  4147. - [ ] Sam
  4148. - [X] order food
  4149. - [ ] think about what music to play
  4150. - [X] talk to the neighbors
  4151. @end example
  4152. Checkboxes work hierarchically, so if a checkbox item has children
  4153. that are checkboxes, toggling one of the children checkboxes makes the
  4154. parent checkbox reflect if none, some, or all of the children are
  4155. checked.
  4156. @cindex statistics, for checkboxes
  4157. @cindex checkbox statistics
  4158. @cindex @samp{COOKIE_DATA}, property
  4159. @vindex org-hierarchical-checkbox-statistics
  4160. The @samp{[2/4]} and @samp{[1/3]} in the first and second line are cookies
  4161. indicating how many checkboxes present in this entry have been checked
  4162. off, and the total number of checkboxes present. This can give you an
  4163. idea on how many checkboxes remain, even without opening a folded
  4164. entry. The cookies can be placed into a headline or into (the first
  4165. line of) a plain list item. Each cookie covers checkboxes of direct
  4166. children structurally below the headline/item on which the cookie
  4167. appears@footnote{Set the variable @code{org-hierarchical-checkbox-statistics} if you
  4168. want such cookies to count all checkboxes below the cookie, not just
  4169. those belonging to direct children.}. You have to insert the cookie yourself by typing
  4170. either @samp{[/]} or @samp{[%]}. With @samp{[/]} you get an @samp{n out of m} result, as
  4171. in the examples above. With @samp{[%]} you get information about the
  4172. percentage of checkboxes checked (in the above example, this would be
  4173. @samp{[50%]} and @samp{[33%]}, respectively). In a headline, a cookie can count
  4174. either checkboxes below the heading or TODO states of children, and it
  4175. displays whatever was changed last. Set the property @samp{COOKIE_DATA} to
  4176. either @samp{checkbox} or @samp{todo} to resolve this issue.
  4177. @cindex blocking, of checkboxes
  4178. @cindex checkbox blocking
  4179. @cindex @samp{ORDERED}, property
  4180. If the current outline node has an @samp{ORDERED} property, checkboxes must
  4181. be checked off in sequence, and an error is thrown if you try to check
  4182. off a box while there are unchecked boxes above it.
  4183. @noindent
  4184. The following commands work with checkboxes:
  4185. @table @asis
  4186. @item @kbd{C-c C-c} (@code{org-toggle-checkbox})
  4187. @kindex C-c C-c
  4188. @findex org-toggle-checkbox
  4189. Toggle checkbox status or---with prefix argument---checkbox
  4190. presence at point. With a single prefix argument, add an empty
  4191. checkbox or remove the current one@footnote{@kbd{C-u C-c C-c} on the @emph{first} item of a list with no
  4192. checkbox adds checkboxes to the rest of the list.}. With a double prefix
  4193. argument, set it to @samp{[-]}, which is considered to be an
  4194. intermediate state.
  4195. @item @kbd{C-c C-x C-b} (@code{org-toggle-checkbox})
  4196. @kindex C-c C-x C-b
  4197. Toggle checkbox status or---with prefix argument---checkbox
  4198. presence at point. With double prefix argument, set it to @samp{[-]},
  4199. which is considered to be an intermediate state.
  4200. @itemize
  4201. @item
  4202. If there is an active region, toggle the first checkbox in the
  4203. region and set all remaining boxes to the same status as the
  4204. first. With a prefix argument, add or remove the checkbox for
  4205. all items in the region.
  4206. @item
  4207. If the cursor is in a headline, toggle checkboxes in the region
  4208. between this headline and the next---so @emph{not} the entire
  4209. subtree.
  4210. @item
  4211. If there is no active region, just toggle the checkbox at
  4212. point.
  4213. @end itemize
  4214. @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading})
  4215. @kindex M-S-RET
  4216. @findex org-insert-todo-heading
  4217. Insert a new item with a checkbox. This works only if the cursor
  4218. is already in a plain list item (see @ref{Plain Lists}).
  4219. @item @kbd{C-c C-x o} (@code{org-toggle-ordered-property})
  4220. @kindex C-c C-x o
  4221. @findex org-toggle-ordered-property
  4222. @vindex org-track-ordered-property-with-tag
  4223. Toggle the @samp{ORDERED} property of the entry, to toggle if
  4224. checkboxes must be checked off in sequence. A property is used
  4225. for this behavior because this should be local to the current
  4226. entry, not inherited like a tag. However, if you would like to
  4227. @emph{track} the value of this property with a tag for better
  4228. visibility, customize @code{org-track-ordered-property-with-tag}.
  4229. @item @kbd{C-c #} (@code{org-update-statistics-cookies})
  4230. @kindex C-c #
  4231. @findex org-update-statistics-cookies
  4232. Update the statistics cookie in the current outline entry. When
  4233. called with a @kbd{C-u} prefix, update the entire file.
  4234. Checkbox statistic cookies are updated automatically if you
  4235. toggle checkboxes with @kbd{C-c C-c} and make new ones with
  4236. @kbd{M-S-@key{RET}}. TODO statistics cookies update when changing
  4237. TODO states. If you delete boxes/entries or add/change them by
  4238. hand, use this command to get things back into sync.
  4239. @end table
  4240. @node Tags
  4241. @chapter Tags
  4242. @cindex tags
  4243. @cindex headline tagging
  4244. @cindex matching, tags
  4245. @cindex sparse tree, tag based
  4246. An excellent way to implement labels and contexts for
  4247. cross-correlating information is to assign @emph{tags} to headlines. Org
  4248. mode has extensive support for tags.
  4249. @vindex org-tag-faces
  4250. Every headline can contain a list of tags; they occur at the end of
  4251. the headline. Tags are normal words containing letters, numbers, @samp{_},
  4252. and @samp{@@}. Tags must be preceded and followed by a single colon, e.g.,
  4253. @samp{:work:}. Several tags can be specified, as in @samp{:work:urgent:}. Tags
  4254. by default are in bold face with the same color as the headline. You
  4255. may specify special faces for specific tags using the variable
  4256. @code{org-tag-faces}, in much the same way as you can for TODO keywords
  4257. (see @ref{Faces for TODO keywords}).
  4258. @menu
  4259. * Tag Inheritance:: Tags use the tree structure of an outline.
  4260. * Setting Tags:: How to assign tags to a headline.
  4261. * Tag Hierarchy:: Create a hierarchy of tags.
  4262. * Tag Searches:: Searching for combinations of tags.
  4263. @end menu
  4264. @node Tag Inheritance
  4265. @section Tag Inheritance
  4266. @cindex tag inheritance
  4267. @cindex inheritance, of tags
  4268. @cindex sublevels, inclusion into tags match
  4269. @emph{Tags} make use of the hierarchical structure of outline trees. If
  4270. a heading has a certain tag, all subheadings inherit the tag as well.
  4271. For example, in the list
  4272. @example
  4273. * Meeting with the French group :work:
  4274. ** Summary by Frank :boss:notes:
  4275. *** TODO Prepare slides for him :action:
  4276. @end example
  4277. @noindent
  4278. the final heading has the tags @samp{work}, @samp{boss}, @samp{notes}, and @samp{action}
  4279. even though the final heading is not explicitly marked with those
  4280. tags. You can also set tags that all entries in a file should inherit
  4281. just as if these tags were defined in a hypothetical level zero that
  4282. 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.}
  4283. @cindex @samp{FILETAGS}, keyword
  4284. @example
  4285. #+FILETAGS: :Peter:Boss:Secret:
  4286. @end example
  4287. @vindex org-use-tag-inheritance
  4288. @vindex org-tags-exclude-from-inheritance
  4289. @noindent
  4290. To limit tag inheritance to specific tags, or to turn it off entirely,
  4291. use the variables @code{org-use-tag-inheritance} and
  4292. @code{org-tags-exclude-from-inheritance}.
  4293. @vindex org-tags-match-list-sublevels
  4294. When a headline matches during a tags search while tag inheritance is
  4295. turned on, all the sublevels in the same tree---for a simple match
  4296. form---match as well@footnote{This is only true if the search does not involve more complex
  4297. tests including properties (see @ref{Property Searches}).}. The list of matches may then become
  4298. very long. If you only want to see the first tags match in a subtree,
  4299. configure the variable @code{org-tags-match-list-sublevels} (not
  4300. recommended).
  4301. @vindex org-agenda-use-tag-inheritance
  4302. Tag inheritance is relevant when the agenda search tries to match
  4303. a tag, either in the @code{tags} or @code{tags-todo} agenda types. In other
  4304. agenda types, @code{org-use-tag-inheritance} has no effect. Still, you may
  4305. want to have your tags correctly set in the agenda, so that tag
  4306. filtering works fine, with inherited tags. Set
  4307. @code{org-agenda-use-tag-inheritance} to control this: the default value
  4308. includes all agenda types, but setting this to @code{nil} can really speed
  4309. up agenda generation.
  4310. @node Setting Tags
  4311. @section Setting Tags
  4312. @cindex setting tags
  4313. @cindex tags, setting
  4314. @kindex M-TAB
  4315. Tags can simply be typed into the buffer at the end of a headline.
  4316. After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
  4317. also a special command for inserting tags:
  4318. @table @asis
  4319. @item @kbd{C-c C-q} (@code{org-set-tags-command})
  4320. @kindex C-c C-q
  4321. @findex org-set-tags-command
  4322. @cindex completion, of tags
  4323. @vindex org-tags-column
  4324. Enter new tags for the current headline. Org mode either offers
  4325. completion or a special single-key interface for setting tags,
  4326. see below. After pressing @kbd{@key{RET}}, the tags are inserted
  4327. and aligned to @code{org-tags-column}. When called with
  4328. a @kbd{C-u} prefix, all tags in the current buffer are
  4329. aligned to that column, just to make things look nice. Tags are
  4330. automatically realigned after promotion, demotion, and TODO state
  4331. changes (see @ref{TODO Basics}).
  4332. @item @kbd{C-c C-c} (@code{org-set-tags-command})
  4333. @kindex C-c C-c
  4334. When the cursor is in a headline, this does the same as
  4335. @kbd{C-c C-q}.
  4336. @end table
  4337. @vindex org-tag-alist
  4338. Org supports tag insertion based on a @emph{list of tags}. By default this
  4339. list is constructed dynamically, containing all tags currently used in
  4340. the buffer. You may also globally specify a hard list of tags with
  4341. the variable @code{org-tag-alist}. Finally you can set the default tags
  4342. for a given file with lines like
  4343. @cindex @samp{TAGS}, keyword
  4344. @example
  4345. #+TAGS: @@work @@home @@tennisclub
  4346. #+TAGS: laptop car pc sailboat
  4347. @end example
  4348. If you have globally defined your preferred set of tags using the
  4349. variable @code{org-tag-alist}, but would like to use a dynamic tag list in
  4350. a specific file, add an empty @samp{TAGS} keyword to that file:
  4351. @example
  4352. #+TAGS:
  4353. @end example
  4354. @vindex org-tag-persistent-alist
  4355. If you have a preferred set of tags that you would like to use in
  4356. every file, in addition to those defined on a per-file basis by @samp{TAGS}
  4357. keyword, then you may specify a list of tags with the variable
  4358. @code{org-tag-persistent-alist}. You may turn this off on a per-file basis
  4359. by adding a @samp{STARTUP} keyword to that file:
  4360. @example
  4361. #+STARTUP: noptag
  4362. @end example
  4363. By default Org mode uses the standard minibuffer completion facilities
  4364. for entering tags. However, it also implements another, quicker, tag
  4365. selection method called @emph{fast tag selection}. This allows you to
  4366. select and deselect tags with just a single key press. For this to
  4367. work well you should assign unique letters to most of your commonly
  4368. used tags. You can do this globally by configuring the variable
  4369. @code{org-tag-alist} in your Emacs init file. For example, you may find
  4370. the need to tag many items in different files with @samp{@@home}. In this
  4371. case you can set something like:
  4372. @lisp
  4373. (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
  4374. @end lisp
  4375. @noindent
  4376. If the tag is only relevant to the file you are working on, then you
  4377. can instead set the @samp{TAGS} keyword as:
  4378. @example
  4379. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
  4380. @end example
  4381. @noindent
  4382. The tags interface shows the available tags in a splash window. If
  4383. you want to start a new line after a specific tag, insert @samp{\n} into
  4384. the tag list
  4385. @example
  4386. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) \n laptop(l) pc(p)
  4387. @end example
  4388. @noindent
  4389. or write them in two lines:
  4390. @example
  4391. #+TAGS: @@work(w) @@home(h) @@tennisclub(t)
  4392. #+TAGS: laptop(l) pc(p)
  4393. @end example
  4394. @noindent
  4395. You can also group together tags that are mutually exclusive by using
  4396. braces, as in:
  4397. @example
  4398. #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
  4399. @end example
  4400. @noindent
  4401. you indicate that at most one of @samp{@@work}, @samp{@@home}, and @samp{@@tennisclub}
  4402. should be selected. Multiple such groups are allowed.
  4403. @noindent
  4404. Do not forget to press @kbd{C-c C-c} with the cursor in one of
  4405. these lines to activate any changes.
  4406. @noindent
  4407. To set these mutually exclusive groups in the variable
  4408. @code{org-tags-alist}, you must use the dummy tags @code{:startgroup} and
  4409. @code{:endgroup} instead of the braces. Similarly, you can use @code{:newline}
  4410. to indicate a line break. The previous example would be set globally
  4411. by the following configuration:
  4412. @lisp
  4413. (setq org-tag-alist '((:startgroup . nil)
  4414. ("@@work" . ?w) ("@@home" . ?h)
  4415. ("@@tennisclub" . ?t)
  4416. (:endgroup . nil)
  4417. ("laptop" . ?l) ("pc" . ?p)))
  4418. @end lisp
  4419. If at least one tag has a selection key then pressing @kbd{C-c C-c} automatically presents you with a special interface, listing
  4420. inherited tags, the tags of the current headline, and a list of all
  4421. valid tags with corresponding keys@footnote{Keys are automatically assigned to tags that have no
  4422. configured keys.}.
  4423. Pressing keys assigned to tags adds or removes them from the list of
  4424. tags in the current line. Selecting a tag in a group of mutually
  4425. exclusive tags turns off any other tag from that group.
  4426. In this interface, you can also use the following special keys:
  4427. @table @asis
  4428. @item @kbd{@key{TAB}}
  4429. @kindex TAB
  4430. Enter a tag in the minibuffer, even if the tag is not in the
  4431. predefined list. You can complete on all tags present in the
  4432. buffer. You can also add several tags: just separate them with
  4433. a comma.
  4434. @item @kbd{@key{SPC}}
  4435. @kindex SPC
  4436. Clear all tags for this line.
  4437. @item @kbd{@key{RET}}
  4438. @kindex RET
  4439. Accept the modified set.
  4440. @item @kbd{C-g}
  4441. @kindex C-g
  4442. Abort without installing changes.
  4443. @item @kbd{q}
  4444. @kindex q
  4445. If @kbd{q} is not assigned to a tag, it aborts like
  4446. @kbd{C-g}.
  4447. @item @kbd{!}
  4448. @kindex !
  4449. Turn off groups of mutually exclusive tags. Use this to (as an
  4450. exception) assign several tags from such a group.
  4451. @item @kbd{C-c}
  4452. @kindex C-c C-c
  4453. Toggle auto-exit after the next change (see below). If you are
  4454. using expert mode, the first @kbd{C-c} displays the
  4455. selection window.
  4456. @end table
  4457. @noindent
  4458. This method lets you assign tags to a headline with very few keys.
  4459. With the above setup, you could clear the current tags and set
  4460. @samp{@@home}, @samp{laptop} and @samp{pc} tags with just the following keys:
  4461. @kbd{C-c C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to @samp{@@work}
  4462. would be done with @kbd{C-c C-c w @key{RET}} or alternatively with
  4463. @kbd{C-c C-c C-c w}. Adding the non-predefined tag @samp{Sarah} could
  4464. be done with @kbd{C-c C-c @key{TAB} S a r a h @key{RET}}.
  4465. @vindex org-fast-tag-selection-single-key
  4466. If you find that most of the time you need only a single key press to
  4467. modify your list of tags, set the variable
  4468. @code{org-fast-tag-selection-single-key}. Then you no longer have to press
  4469. @kbd{@key{RET}} to exit fast tag selection---it exits after the first
  4470. change. If you then occasionally need more keys, press @kbd{C-c}
  4471. to turn off auto-exit for the current tag selection process (in
  4472. effect: start selection with @kbd{C-c C-c C-c} instead of
  4473. @kbd{C-c C-c}). If you set the variable to the value @code{expert},
  4474. the special window is not even shown for single-key tag selection, it
  4475. comes up only when you press an extra @kbd{C-c}.
  4476. @node Tag Hierarchy
  4477. @section Tag Hierarchy
  4478. @cindex group tags
  4479. @cindex tags, groups
  4480. @cindex tags hierarchy
  4481. Tags can be defined in hierarchies. A tag can be defined as a @emph{group
  4482. tag} for a set of other tags. The group tag can be seen as the
  4483. ``broader term'' for its set of tags. Defining multiple group tags and
  4484. nesting them creates a tag hierarchy.
  4485. One use-case is to create a taxonomy of terms (tags) that can be used
  4486. to classify nodes in a document or set of documents.
  4487. When you search for a group tag, it return matches for all members in
  4488. the group and its subgroups. In an agenda view, filtering by a group
  4489. tag displays or hide headlines tagged with at least one of the members
  4490. of the group or any of its subgroups. This makes tag searches and
  4491. filters even more flexible.
  4492. You can set group tags by using brackets and inserting a colon between
  4493. the group tag and its related tags---beware that all whitespaces are
  4494. mandatory so that Org can parse this line correctly:
  4495. @example
  4496. #+TAGS: [ GTD : Control Persp ]
  4497. @end example
  4498. In this example, @samp{GTD} is the group tag and it is related to two other
  4499. tags: @samp{Control}, @samp{Persp}. Defining @samp{Control} and @samp{Persp} as group
  4500. tags creates an hierarchy of tags:
  4501. @example
  4502. #+TAGS: [ Control : Context Task ]
  4503. #+TAGS: [ Persp : Vision Goal AOF Project ]
  4504. @end example
  4505. That can conceptually be seen as a hierarchy of tags:
  4506. @itemize
  4507. @item
  4508. @samp{GTD}
  4509. @itemize
  4510. @item
  4511. @samp{Persp}
  4512. @itemize
  4513. @item
  4514. @samp{Vision}
  4515. @item
  4516. @samp{Goal}
  4517. @item
  4518. @samp{AOF}
  4519. @item
  4520. @samp{Project}
  4521. @end itemize
  4522. @item
  4523. @samp{Control}
  4524. @itemize
  4525. @item
  4526. @samp{Context}
  4527. @item
  4528. @samp{Task}
  4529. @end itemize
  4530. @end itemize
  4531. @end itemize
  4532. You can use the @code{:startgrouptag}, @code{:grouptags} and @code{:endgrouptag}
  4533. keyword directly when setting @code{org-tag-alist} directly:
  4534. @lisp
  4535. (setq org-tag-alist '((:startgrouptag)
  4536. ("GTD")
  4537. (:grouptags)
  4538. ("Control")
  4539. ("Persp")
  4540. (:endgrouptag)
  4541. (:startgrouptag)
  4542. ("Control")
  4543. (:grouptags)
  4544. ("Context")
  4545. ("Task")
  4546. (:endgrouptag)))
  4547. @end lisp
  4548. The tags in a group can be mutually exclusive if using the same group
  4549. syntax as is used for grouping mutually exclusive tags together; using
  4550. curly brackets.
  4551. @example
  4552. #+TAGS: @{ Context : @@Home @@Work @@Call @}
  4553. @end example
  4554. When setting @code{org-tag-alist} you can use @code{:startgroup} and @code{:endgroup}
  4555. instead of @code{:startgrouptag} and @code{:endgrouptag} to make the tags
  4556. mutually exclusive.
  4557. Furthermore, the members of a group tag can also be regular
  4558. expressions, creating the possibility of a more dynamic and rule-based
  4559. tag structure. The regular expressions in the group must be specified
  4560. within curly brackets. Here is an expanded example:
  4561. @example
  4562. #+TAGS: [ Vision : @{V@@.+@} ]
  4563. #+TAGS: [ Goal : @{G@@.+@} ]
  4564. #+TAGS: [ AOF : @{AOF@@.+@} ]
  4565. #+TAGS: [ Project : @{P@@.+@} ]
  4566. @end example
  4567. Searching for the tag @samp{Project} now lists all tags also including
  4568. regular expression matches for @samp{P@@.+}, and similarly for tag searches
  4569. on @samp{Vision}, @samp{Goal} and @samp{AOF}. For example, this would work well for
  4570. a project tagged with a common project-identifier,
  4571. e.g. @samp{P@@2014_OrgTags}.
  4572. @kindex C-c C-x q
  4573. @findex org-toggle-tags-groups
  4574. @vindex org-group-tags
  4575. If you want to ignore group tags temporarily, toggle group tags
  4576. support with @code{org-toggle-tags-groups}, bound to @kbd{C-c C-x q}.
  4577. If you want to disable tag groups completely, set @code{org-group-tags} to
  4578. @code{nil}.
  4579. @node Tag Searches
  4580. @section Tag Searches
  4581. @cindex tag searches
  4582. @cindex searching for tags
  4583. Once a system of tags has been set up, it can be used to collect
  4584. related information into special lists.
  4585. @table @asis
  4586. @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree})
  4587. @kindex C-c / m
  4588. @kindex C-c \
  4589. @findex org-match-sparse-tree
  4590. Create a sparse tree with all headlines matching a tags search.
  4591. With a @kbd{C-u} prefix argument, ignore headlines that are
  4592. not a TODO line.
  4593. @item @kbd{C-c a m} (@code{org-tags-view})
  4594. @kindex C-c a m
  4595. @findex org-tags-view
  4596. Create a global list of tag matches from all agenda files. See
  4597. @ref{Matching tags and properties}.
  4598. @item @kbd{C-c a M} (@code{org-tags-view})
  4599. @kindex C-c a M
  4600. @vindex org-tags-match-list-sublevels
  4601. Create a global list of tag matches from all agenda files, but
  4602. check only TODO items and force checking subitems (see the option
  4603. @code{org-tags-match-list-sublevels}).
  4604. @end table
  4605. These commands all prompt for a match string which allows basic
  4606. Boolean logic like @samp{+boss+urgent-project1}, to find entries with tags
  4607. @samp{boss} and @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find
  4608. entries which are tagged, like @samp{Kathy} or @samp{Sally}. The full syntax of
  4609. the search string is rich and allows also matching against TODO
  4610. keywords, entry levels and properties. For a complete description
  4611. with many examples, see @ref{Matching tags and properties}.
  4612. @node Properties and Columns
  4613. @chapter Properties and Columns
  4614. @cindex properties
  4615. A property is a key-value pair associated with an entry. Properties
  4616. can be set so they are associated with a single entry, with every
  4617. entry in a tree, or with every entry in an Org file.
  4618. There are two main applications for properties in Org mode. First,
  4619. properties are like tags, but with a value. Imagine maintaining
  4620. a file where you document bugs and plan releases for a piece of
  4621. software. Instead of using tags like @samp{release_1}, @samp{release_2}, you
  4622. can use a property, say @samp{Release}, that in different subtrees has
  4623. different values, such as @samp{1.0} or @samp{2.0}. Second, you can use
  4624. properties to implement (very basic) database capabilities in an Org
  4625. buffer. Imagine keeping track of your music CDs, where properties
  4626. could be things such as the album, artist, date of release, number of
  4627. tracks, and so on.
  4628. Properties can be conveniently edited and viewed in column view (see
  4629. @ref{Column View}).
  4630. @menu
  4631. * Property Syntax:: How properties are spelled out.
  4632. * Special Properties:: Access to other Org mode features.
  4633. * Property Searches:: Matching property values.
  4634. * Property Inheritance:: Passing values down a tree.
  4635. * Column View:: Tabular viewing and editing.
  4636. @end menu
  4637. @node Property Syntax
  4638. @section Property Syntax
  4639. @cindex property syntax
  4640. @cindex drawer, for properties
  4641. Properties are key--value pairs. When they are associated with
  4642. a single entry or with a tree they need to be inserted into a special
  4643. drawer (see @ref{Drawers}) with the name @samp{PROPERTIES}, which has to be
  4644. located right below a headline, and its planning line (see @ref{Deadlines and Scheduling}) when applicable. Each property is specified on
  4645. a single line, with the key---surrounded by colons---first, and the
  4646. value after it. Keys are case-insensitive. Here is an example:
  4647. @example
  4648. * CD collection
  4649. ** Classic
  4650. *** Goldberg Variations
  4651. :PROPERTIES:
  4652. :Title: Goldberg Variations
  4653. :Composer: J.S. Bach
  4654. :Artist: Glen Gould
  4655. :Publisher: Deutsche Grammophon
  4656. :NDisks: 1
  4657. :END:
  4658. @end example
  4659. Depending on the value of @code{org-use-property-inheritance}, a property
  4660. set this way is associated either with a single entry, or with the
  4661. sub-tree defined by the entry, see @ref{Property Inheritance}.
  4662. You may define the allowed values for a particular property @samp{Xyz} by
  4663. setting a property @samp{Xyz_ALL}. This special property is @emph{inherited},
  4664. so if you set it in a level 1 entry, it applies to the entire tree.
  4665. When allowed values are defined, setting the corresponding property
  4666. becomes easier and is less prone to typing errors. For the example
  4667. with the CD collection, we can pre-define publishers and the number of
  4668. disks in a box like this:
  4669. @example
  4670. * CD collection
  4671. :PROPERTIES:
  4672. :NDisks_ALL: 1 2 3 4
  4673. :Publisher_ALL: "Deutsche Grammophon" Philips EMI
  4674. :END:
  4675. @end example
  4676. If you want to set properties that can be inherited by any entry in
  4677. a file, use a line like:
  4678. @cindex @samp{_ALL} suffix, in properties
  4679. @cindex @samp{PROPERTY}, keyword
  4680. @example
  4681. #+PROPERTY: NDisks_ALL 1 2 3 4
  4682. @end example
  4683. @cindex @samp{+} suffix, in properties
  4684. If you want to add to the value of an existing property, append a @samp{+}
  4685. to the property name. The following results in the property @samp{var}
  4686. having the value @samp{foo=1 bar=2}.
  4687. @example
  4688. #+PROPERTY: var foo=1
  4689. #+PROPERTY: var+ bar=2
  4690. @end example
  4691. It is also possible to add to the values of inherited properties. The
  4692. following results in the @samp{Genres} property having the value @samp{Classic
  4693. Baroque} under the @samp{Goldberg Variations} subtree.
  4694. @example
  4695. * CD collection
  4696. ** Classic
  4697. :PROPERTIES:
  4698. :Genres: Classic
  4699. :END:
  4700. *** Goldberg Variations
  4701. :PROPERTIES:
  4702. :Title: Goldberg Variations
  4703. :Composer: J.S. Bach
  4704. :Artist: Glen Gould
  4705. :Publisher: Deutsche Grammophon
  4706. :NDisks: 1
  4707. :Genres+: Baroque
  4708. :END:
  4709. @end example
  4710. Note that a property can only have one entry per drawer.
  4711. @vindex org-global-properties
  4712. Property values set with the global variable @code{org-global-properties}
  4713. can be inherited by all entries in all Org files.
  4714. @noindent
  4715. The following commands help to work with properties:
  4716. @table @asis
  4717. @item @kbd{M-@key{TAB}} (@code{pcomplete})
  4718. @kindex M-TAB
  4719. @findex pcomplete
  4720. After an initial colon in a line, complete property keys. All
  4721. keys used in the current file are offered as possible
  4722. completions.
  4723. @item @kbd{C-c C-x p} (@code{org-set-property})
  4724. @kindex C-c C-x p
  4725. @findex org-set-property
  4726. Set a property. This prompts for a property name and a value.
  4727. If necessary, the property drawer is created as well.
  4728. @item @kbd{C-u M-x org-insert-drawer}
  4729. @findex org-insert-drawer
  4730. Insert a property drawer into the current entry. The drawer is
  4731. inserted early in the entry, but after the lines with planning
  4732. information like deadlines.
  4733. @item @kbd{C-c C-c} (@code{org-property-action})
  4734. @kindex C-c C-c
  4735. @findex org-property-action
  4736. With the cursor in a property drawer, this executes property
  4737. commands.
  4738. @item @kbd{C-c C-c s} (@code{org-set-property})
  4739. @kindex C-c C-c s
  4740. @findex org-set-property
  4741. Set a property in the current entry. Both the property and the value
  4742. can be inserted using completion.
  4743. @item @kbd{S-@key{RIGHT}} (@code{org-property-next-allowed-values})
  4744. @itemx @kbd{S-@key{LEFT}} (@code{org-property-previous-allowed-value})
  4745. @kindex S-RIGHT
  4746. @kindex S-LEFT
  4747. Switch property at point to the next/previous allowed value.
  4748. @item @kbd{C-c C-c d} (@code{org-delete-property})
  4749. @kindex C-c C-c d
  4750. @findex org-delete-property
  4751. Remove a property from the current entry.
  4752. @item @kbd{C-c C-c D} (@code{org-delete-property-globally})
  4753. @kindex C-c C-c D
  4754. @findex org-delete-property-globally
  4755. Globally remove a property, from all entries in the current file.
  4756. @item @kbd{C-c C-c c} (@code{org-compute-property-at-point})
  4757. @kindex C-c C-c c
  4758. @findex org-compute-property-at-point
  4759. Compute the property at point, using the operator and scope from
  4760. the nearest column format definition.
  4761. @end table
  4762. @node Special Properties
  4763. @section Special Properties
  4764. @cindex properties, special
  4765. Special properties provide an alternative access method to Org mode
  4766. features, like the TODO state or the priority of an entry, discussed
  4767. in the previous chapters. This interface exists so that you can
  4768. include these states in a column view (see @ref{Column View}), or to use
  4769. them in queries. The following property names are special and should
  4770. not be used as keys in the properties drawer:
  4771. @cindex @samp{ALLTAGS}, special property
  4772. @cindex @samp{BLOCKED}, special property
  4773. @cindex @samp{CLOCKSUM}, special property
  4774. @cindex @samp{CLOCKSUM_T}, special property
  4775. @cindex @samp{CLOSED}, special property
  4776. @cindex @samp{DEADLINE}, special property
  4777. @cindex @samp{FILE}, special property
  4778. @cindex @samp{ITEM}, special property
  4779. @cindex @samp{PRIORITY}, special property
  4780. @cindex @samp{SCHEDULED}, special property
  4781. @cindex @samp{TAGS}, special property
  4782. @cindex @samp{TIMESTAMP}, special property
  4783. @cindex @samp{TIMESTAMP_IA}, special property
  4784. @cindex @samp{TODO}, special property
  4785. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  4786. @item @samp{ALLTAGS}
  4787. @tab All tags, including inherited ones.
  4788. @item @samp{BLOCKED}
  4789. @tab @code{t} if task is currently blocked by children or siblings.
  4790. @item @samp{CATEGORY}
  4791. @tab The category of an entry.
  4792. @item @samp{CLOCKSUM}
  4793. @tab The sum of CLOCK intervals in the subtree. @code{org-clock-sum}
  4794. @item
  4795. @tab must be run first to compute the values in the current buffer.
  4796. @item @samp{CLOCKSUM_T}
  4797. @tab The sum of CLOCK intervals in the subtree for today.
  4798. @item
  4799. @tab @code{org-clock-sum-today} must be run first to compute the
  4800. @item
  4801. @tab values in the current buffer.
  4802. @item @samp{CLOSED}
  4803. @tab When was this entry closed?
  4804. @item @samp{DEADLINE}
  4805. @tab The deadline time string, without the angular brackets.
  4806. @item @samp{FILE}
  4807. @tab The filename the entry is located in.
  4808. @item @samp{ITEM}
  4809. @tab The headline of the entry.
  4810. @item @samp{PRIORITY}
  4811. @tab The priority of the entry, a string with a single letter.
  4812. @item @samp{SCHEDULED}
  4813. @tab The scheduling timestamp, without the angular brackets.
  4814. @item @samp{TAGS}
  4815. @tab The tags defined directly in the headline.
  4816. @item @samp{TIMESTAMP}
  4817. @tab The first keyword-less timestamp in the entry.
  4818. @item @samp{TIMESTAMP_IA}
  4819. @tab The first inactive timestamp in the entry.
  4820. @item @samp{TODO}
  4821. @tab The TODO keyword of the entry.
  4822. @end multitable
  4823. @node Property Searches
  4824. @section Property Searches
  4825. @cindex properties, searching
  4826. @cindex searching, of properties
  4827. To create sparse trees and special lists with selection based on
  4828. properties, the same commands are used as for tag searches (see @ref{Tag Searches}).
  4829. @table @asis
  4830. @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree})
  4831. @kindex C-c / m
  4832. @kindex C-c \
  4833. @findex org-match-sparse-tree
  4834. Create a sparse tree with all matching entries. With
  4835. a @kbd{C-u} prefix argument, ignore headlines that are not
  4836. a TODO line.
  4837. @item @kbd{C-c a m}, @code{org-tags-view}
  4838. @kindex C-c a m
  4839. Create a global list of tag/property matches from all agenda
  4840. files.
  4841. @item @kbd{C-c a M} (@code{org-tags-view})
  4842. @kindex C-c a M
  4843. @findex org-tags-view
  4844. @vindex org-tags-match-list-sublevels
  4845. Create a global list of tag matches from all agenda files, but
  4846. check only TODO items and force checking of subitems (see the
  4847. option @code{org-tags-match-list-sublevels}).
  4848. @end table
  4849. The syntax for the search string is described in @ref{Matching tags and properties}.
  4850. There is also a special command for creating sparse trees based on a
  4851. single property:
  4852. @table @asis
  4853. @item @kbd{C-c / p}
  4854. @kindex C-c / p
  4855. Create a sparse tree based on the value of a property. This
  4856. first prompts for the name of a property, and then for a value.
  4857. A sparse tree is created with all entries that define this
  4858. property with the given value. If you enclose the value in curly
  4859. braces, it is interpreted as a regular expression and matched
  4860. against the property values.
  4861. @end table
  4862. @node Property Inheritance
  4863. @section Property Inheritance
  4864. @cindex properties, inheritance
  4865. @cindex inheritance, of properties
  4866. @vindex org-use-property-inheritance
  4867. The outline structure of Org documents lends itself to an inheritance
  4868. model of properties: if the parent in a tree has a certain property,
  4869. the children can inherit this property. Org mode does not turn this
  4870. on by default, because it can slow down property searches
  4871. significantly and is often not needed. However, if you find
  4872. inheritance useful, you can turn it on by setting the variable
  4873. @code{org-use-property-inheritance}. It may be set to @code{t} to make all
  4874. properties inherited from the parent, to a list of properties that
  4875. should be inherited, or to a regular expression that matches inherited
  4876. properties. If a property has the value @code{nil}, this is interpreted as
  4877. an explicit un-define of the property, so that inheritance search
  4878. stops at this value and returns @code{nil}.
  4879. Org mode has a few properties for which inheritance is hard-coded, at
  4880. least for the special applications for which they are used:
  4881. @table @asis
  4882. @item @code{COLUMNS}
  4883. @cindex @samp{COLUMNS}, property
  4884. The @samp{COLUMNS} property defines the format of column view (see
  4885. @ref{Column View}). It is inherited in the sense that the level where
  4886. a @samp{COLUMNS} property is defined is used as the starting point for
  4887. a column view table, independently of the location in the subtree
  4888. from where columns view is turned on.
  4889. @item @code{CATEGORY}
  4890. @cindex @samp{CATEGORY}, property
  4891. For agenda view, a category set through a @samp{CATEGORY} property
  4892. applies to the entire subtree.
  4893. @item @code{ARCHIVE}
  4894. @cindex @samp{ARCHIVE}, property
  4895. For archiving, the @samp{ARCHIVE} property may define the archive
  4896. location for the entire subtree (see @ref{Moving subtrees}).
  4897. @item @code{LOGGING}
  4898. @cindex @samp{LOGGING}, property
  4899. The @samp{LOGGING} property may define logging settings for an entry
  4900. or a subtree (see @ref{Tracking TODO state changes}).
  4901. @end table
  4902. @node Column View
  4903. @section Column View
  4904. A great way to view and edit properties in an outline tree is @emph{column
  4905. view}. In column view, each outline node is turned into a table row.
  4906. Columns in this table provide access to properties of the entries.
  4907. Org mode implements columns by overlaying a tabular structure over the
  4908. headline of each item. While the headlines have been turned into
  4909. a table row, you can still change the visibility of the outline tree.
  4910. For example, you get a compact table by switching to ``contents''
  4911. view---@kbd{S-@key{TAB}} @kbd{S-@key{TAB}}, or simply @kbd{c}
  4912. while column view is active---but you can still open, read, and edit
  4913. the entry below each headline. Or, you can switch to column view
  4914. after executing a sparse tree command and in this way get a table only
  4915. for the selected items. Column view also works in agenda buffers (see
  4916. @ref{Agenda Views}) where queries have collected selected items, possibly
  4917. from a number of files.
  4918. @menu
  4919. * Defining columns:: The COLUMNS format property.
  4920. * Using column view:: How to create and use column view.
  4921. * Capturing column view:: A dynamic block for column view.
  4922. @end menu
  4923. @node Defining columns
  4924. @subsection Defining columns
  4925. @cindex column view, for properties
  4926. @cindex properties, column view
  4927. Setting up a column view first requires defining the columns. This is
  4928. done by defining a column format line.
  4929. @menu
  4930. * Scope of column definitions:: Where defined, where valid?
  4931. * Column attributes:: Appearance and content of a column.
  4932. @end menu
  4933. @node Scope of column definitions
  4934. @subsubsection Scope of column definitions
  4935. To define a column format for an entire file, use a line like:
  4936. @cindex @samp{COLUMNS}, keyword
  4937. @example
  4938. #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  4939. @end example
  4940. To specify a format that only applies to a specific tree, add
  4941. a @samp{COLUMNS} property to the top node of that tree, for example:
  4942. @example
  4943. ** Top node for columns view
  4944. :PROPERTIES:
  4945. :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  4946. :END:
  4947. @end example
  4948. If a @samp{COLUMNS} property is present in an entry, it defines columns for
  4949. the entry itself, and for the entire subtree below it. Since the
  4950. column definition is part of the hierarchical structure of the
  4951. document, you can define columns on level 1 that are general enough
  4952. for all sublevels, and more specific columns further down, when you
  4953. edit a deeper part of the tree.
  4954. @node Column attributes
  4955. @subsubsection Column attributes
  4956. A column definition sets the attributes of a column. The general
  4957. definition looks like this:
  4958. @example
  4959. %[WIDTH]PROPERTY[(TITLE)][@{SUMMARY-TYPE@}]
  4960. @end example
  4961. @noindent
  4962. Except for the percent sign and the property name, all items are
  4963. optional. The individual parts have the following meaning:
  4964. @table @asis
  4965. @item @var{WIDTH}
  4966. An integer specifying the width of the column in characters. If
  4967. omitted, the width is determined automatically.
  4968. @item @var{PROPERTY}
  4969. The property that should be edited in this column. Special
  4970. properties representing meta data are allowed here as well (see
  4971. @ref{Special Properties}).
  4972. @item @var{TITLE}
  4973. The header text for the column. If omitted, the property name is
  4974. used.
  4975. @item @var{SUMMARY-TYPE}
  4976. The summary type. If specified, the column values for parent
  4977. nodes are computed from the children@footnote{If more than one summary type applies to the same property,
  4978. the parent values are computed according to the first of them.}.
  4979. Supported summary types are:
  4980. @multitable {aaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  4981. @item @samp{+}
  4982. @tab Sum numbers in this column.
  4983. @item @samp{+;%.1f}
  4984. @tab Like @samp{+}, but format result with @samp{%.1f}.
  4985. @item @samp{$}
  4986. @tab Currency, short for @samp{+;%.2f}.
  4987. @item @samp{min}
  4988. @tab Smallest number in column.
  4989. @item @samp{max}
  4990. @tab Largest number.
  4991. @item @samp{mean}
  4992. @tab Arithmetic mean of numbers.
  4993. @item @samp{X}
  4994. @tab Checkbox status, @samp{[X]} if all children are @samp{[X]}.
  4995. @item @samp{X/}
  4996. @tab Checkbox status, @samp{[n/m]}.
  4997. @item @samp{X%}
  4998. @tab Checkbox status, @samp{[n%]}.
  4999. @item @samp{:}
  5000. @tab Sum times, HH:MM, plain numbers are hours.
  5001. @item @samp{:min}
  5002. @tab Smallest time value in column.
  5003. @item @samp{:max}
  5004. @tab Largest time value.
  5005. @item @samp{:mean}
  5006. @tab Arithmetic mean of time values.
  5007. @item @samp{@@min}
  5008. @tab Minimum age@footnote{An age is defined as a duration, using effort modifiers
  5009. defined in @code{org-effort-durations}, e.g., @samp{3d 1h}. If any value in the
  5010. column is as such, the summary is also an effort duration.} (in days/hours/mins/seconds).
  5011. @item @samp{@@max}
  5012. @tab Maximum age (in days/hours/mins/seconds).
  5013. @item @samp{@@mean}
  5014. @tab Arithmetic mean of ages (in days/hours/mins/seconds).
  5015. @item @samp{est+}
  5016. @tab Add low-high estimates.
  5017. @end multitable
  5018. @noindent
  5019. @vindex org-columns-summary-types
  5020. You can also define custom summary types by setting
  5021. @code{org-columns-summary-types}.
  5022. @end table
  5023. The @samp{est+} summary type requires further explanation. It is used for
  5024. combining estimates, expressed as low-high ranges. For example,
  5025. instead of estimating a particular task will take 5 days, you might
  5026. estimate it as 5--6 days if you're fairly confident you know how much
  5027. work is required, or 1--10 days if you do not really know what needs
  5028. to be done. Both ranges average at 5.5 days, but the first represents
  5029. a more predictable delivery.
  5030. When combining a set of such estimates, simply adding the lows and
  5031. highs produces an unrealistically wide result. Instead, @samp{est+} adds
  5032. the statistical mean and variance of the sub-tasks, generating a final
  5033. estimate from the sum. For example, suppose you had ten tasks, each
  5034. of which was estimated at 0.5 to 2 days of work. Straight addition
  5035. produces an estimate of 5 to 20 days, representing what to expect if
  5036. everything goes either extremely well or extremely poorly. In
  5037. contrast, @samp{est+} estimates the full job more realistically, at 10--15
  5038. days.
  5039. Here is an example for a complete columns definition, along with
  5040. allowed values@footnote{Please note that the @samp{COLUMNS} definition must be on a single
  5041. line; it is wrapped here only because of formatting constraints.}.
  5042. @example
  5043. :COLUMNS: %25ITEM %9Approved(Approved?)@{X@} %Owner %11Status \
  5044. %10Time_Estimate@{:@} %CLOCKSUM %CLOCKSUM_T
  5045. :Owner_ALL: Tammy Mark Karl Lisa Don
  5046. :Status_ALL: "In progress" "Not started yet" "Finished" ""
  5047. :Approved_ALL: "[ ]" "[X]"
  5048. @end example
  5049. @noindent
  5050. The first column, @samp{%25ITEM}, means the first 25 characters of the item
  5051. itself, i.e., of the headline. You probably always should start the
  5052. column definition with the @samp{ITEM} specifier. The other specifiers
  5053. create columns @samp{Owner} with a list of names as allowed values, for
  5054. @samp{Status} with four different possible values, and for a checkbox field
  5055. @samp{Approved}. When no width is given after the @samp{%} character, the
  5056. column is exactly as wide as it needs to be in order to fully display
  5057. all values. The @samp{Approved} column does have a modified title
  5058. (@samp{Approved?}, with a question mark). Summaries are created for the
  5059. @samp{Time_Estimate} column by adding time duration expressions like HH:MM,
  5060. and for the @samp{Approved} column, by providing an @samp{[X]} status if all
  5061. children have been checked. The @samp{CLOCKSUM} and @samp{CLOCKSUM_T} columns
  5062. are special, they lists the sums of CLOCK intervals in the subtree,
  5063. either for all clocks or just for today.
  5064. @node Using column view
  5065. @subsection Using column view
  5066. @anchor{Turning column view on or off}
  5067. @subsubheading Turning column view on or off
  5068. @table @asis
  5069. @item @kbd{C-c C-x C-c} (@code{org-columns})
  5070. @kindex C-c C-x C-c
  5071. @vindex org-columns
  5072. @vindex org-columns-default-format
  5073. Turn on column view. If the cursor is before the first headline
  5074. in the file, column view is turned on for the entire file, using
  5075. the @samp{#+COLUMNS} definition. If the cursor is somewhere inside
  5076. the outline, this command searches the hierarchy, up from point,
  5077. for a @samp{COLUMNS} property that defines a format. When one is
  5078. found, the column view table is established for the tree starting
  5079. at the entry that contains the @samp{COLUMNS} property. If no such
  5080. property is found, the format is taken from the @samp{#+COLUMNS} line
  5081. or from the variable @code{org-columns-default-format}, and column
  5082. view is established for the current entry and its subtree.
  5083. @item @kbd{r} or @kbd{g} (@code{org-columns-redo})
  5084. @kindex r
  5085. @kindex g
  5086. @findex org-columns-redo
  5087. Recreate the column view, to include recent changes made in the
  5088. buffer.
  5089. @item @kbd{q} (@code{org-columns-quit})
  5090. @kindex q
  5091. @findex org-columns-quit
  5092. Exit column view.
  5093. @end table
  5094. @anchor{Editing values}
  5095. @subsubheading Editing values
  5096. @table @asis
  5097. @item @kbd{@key{LEFT}}, @kbd{@key{RIGHT}}, @kbd{@key{UP}}, @kbd{@key{DOWN}}
  5098. Move through the column view from field to field.
  5099. @item @kbd{1..9,0}
  5100. @kindex 1..9,0
  5101. Directly select the Nth allowed value, @kbd{0} selects the
  5102. 10th value.
  5103. @item @kbd{n} or @kbd{S-@key{RIGHT}} (@code{org-columns-next-allowed-value})
  5104. @itemx @kbd{p} or @kbd{S-@key{LEFT}} (@code{org-columns-previous-allowed-value})
  5105. @kindex n
  5106. @kindex S-RIGHT
  5107. @kindex p
  5108. @kindex S-LEFT
  5109. @findex org-columns-next-allowed-value
  5110. @findex org-columns-previous-allowed-value
  5111. Switch to the next/previous allowed value of the field. For
  5112. this, you have to have specified allowed values for a property.
  5113. @item @kbd{e} (@code{org-columns-edit-value})
  5114. @kindex e
  5115. @findex org-columns-edit-value
  5116. Edit the property at point. For the special properties, this
  5117. invokes the same interface that you normally use to change that
  5118. property. For example, the tag completion or fast selection
  5119. interface pops up when editing a @samp{TAGS} property.
  5120. @item @kbd{C-c C-c} (@code{org-columns-set-tags-or-toggle})
  5121. @kindex C-c C-c
  5122. @findex org-columns-set-tags-or-toggle
  5123. When there is a checkbox at point, toggle it.
  5124. @item @kbd{v} (@code{org-columns-show-value})
  5125. @kindex v
  5126. @findex org-columns-show-value
  5127. View the full value of this property. This is useful if the
  5128. width of the column is smaller than that of the value.
  5129. @item @kbd{a} (@code{org-columns-edit-allowed})
  5130. @kindex a
  5131. @findex org-columns-edit-allowed
  5132. Edit the list of allowed values for this property. If the list
  5133. is found in the hierarchy, the modified values is stored there.
  5134. If no list is found, the new value is stored in the first entry
  5135. that is part of the current column view.
  5136. @end table
  5137. @anchor{Modifying column view on-the-fly}
  5138. @subsubheading Modifying column view on-the-fly:
  5139. @table @asis
  5140. @item @kbd{<} (@code{org-columns-narrow})
  5141. @itemx @kbd{>} (@code{org-columns-widen})
  5142. @kindex <
  5143. @kindex >
  5144. @findex org-columns-narrow
  5145. @findex org-columns-widen
  5146. Make the column narrower/wider by one character.
  5147. @item @kbd{S-M-@key{RIGHT}} (@code{org-columns-new})
  5148. @kindex S-M-RIGHT
  5149. @findex org-columns-new
  5150. Insert a new column, to the left of the current column.
  5151. @item @kbd{S-M-@key{LEFT}} (@code{org-columns-delete})
  5152. @kindex S-M-LEFT
  5153. @findex org-columns-delete
  5154. Delete the current column.
  5155. @end table
  5156. @node Capturing column view
  5157. @subsection Capturing column view
  5158. Since column view is just an overlay over a buffer, it cannot be
  5159. exported or printed directly. If you want to capture a column view,
  5160. use a @samp{columnview} dynamic block (see @ref{Dynamic Blocks}). The frame of
  5161. this block looks like this:
  5162. @cindex @samp{BEGIN columnview}
  5163. @example
  5164. * The column view
  5165. #+BEGIN: columnview :hlines 1 :id "label"
  5166. #+END:
  5167. @end example
  5168. @noindent
  5169. This dynamic block has the following parameters:
  5170. @table @asis
  5171. @item @samp{:id}
  5172. This is the most important parameter. Column view is a feature
  5173. that is often localized to a certain (sub)tree, and the capture
  5174. block might be at a different location in the file. To identify
  5175. the tree whose view to capture, you can use four values:
  5176. @table @asis
  5177. @item @samp{local}
  5178. Use the tree in which the capture block is located.
  5179. @item @samp{global}
  5180. Make a global view, including all headings in the file.
  5181. @item @samp{file:FILENAME}
  5182. Run column view at the top of the @var{FILENAME} file
  5183. @item @samp{LABEL}
  5184. @cindex @samp{ID}, property
  5185. Call column view in the tree that has an @samp{ID} property with
  5186. the value @var{LABEL}. You can use @kbd{M-x org-id-copy} to create a globally unique ID for the
  5187. current entry and copy it to the kill-ring.
  5188. @end table
  5189. @item @samp{:hlines}
  5190. When @code{t}, insert an hline after every line. When a number N,
  5191. insert an hline before each headline with level @code{<= N}.
  5192. @item @samp{:vlines}
  5193. When non-@code{nil}, force column groups to get vertical lines.
  5194. @item @samp{:maxlevel}
  5195. When set to a number, do not capture entries below this level.
  5196. @item @samp{:skip-empty-rows}
  5197. When non-@code{nil}, skip rows where the only non-empty specifier of
  5198. the column view is @samp{ITEM}.
  5199. @item @samp{:indent}
  5200. When non-@code{nil}, indent each @samp{ITEM} field according to its level.
  5201. @end table
  5202. @noindent
  5203. The following commands insert or update the dynamic block:
  5204. @table @asis
  5205. @item @kbd{C-c C-x i} (@code{org-insert-columns-dblock})
  5206. @kindex C-c C-x i
  5207. @findex org-insert-columns-dblock
  5208. Insert a dynamic block capturing a column view. Prompt for the
  5209. scope or ID of the view.
  5210. @item @kbd{C-c C-c} @kbd{C-c C-x C-u} (@code{org-dblock-update})
  5211. @kindex C-c C-c
  5212. @kindex C-c C-x C-u
  5213. @findex org-dblock-update
  5214. Update dynamic block at point. The cursor needs to be in the
  5215. @samp{#+BEGIN} line of the dynamic block.
  5216. @item @kbd{C-u C-c C-x C-u} (@code{org-update-all-dblocks})
  5217. @kindex C-u C-c C-x C-u
  5218. Update all dynamic blocks (see @ref{Dynamic Blocks}). This is useful
  5219. if you have several clock table blocks, column-capturing blocks
  5220. or other dynamic blocks in a buffer.
  5221. @end table
  5222. You can add formulas to the column view table and you may add plotting
  5223. instructions in front of the table---these survive an update of the
  5224. block. If there is a @samp{TBLFM} keyword after the table, the table is
  5225. recalculated automatically after an update.
  5226. An alternative way to capture and process property values into a table
  5227. is provided by Eric Schulte's @samp{org-collector.el} which is
  5228. a contributed package@footnote{Contributed packages are not part of Emacs, but are
  5229. distributed with the main distribution of Org---visit
  5230. @uref{https://orgmode.org}.}. It provides a general API to collect
  5231. properties from entries in a certain scope, and arbitrary Lisp
  5232. expressions to process these values before inserting them into a table
  5233. or a dynamic block.
  5234. @node Dates and Times
  5235. @chapter Dates and Times
  5236. @cindex dates
  5237. @cindex times
  5238. @cindex timestamp
  5239. @cindex date stamp
  5240. To assist project planning, TODO items can be labeled with a date
  5241. and/or a time. The specially formatted string carrying the date and
  5242. time information is called a @emph{timestamp} in Org mode. This may be
  5243. a little confusing because timestamp is often used as indicating when
  5244. something was created or last changed. However, in Org mode this term
  5245. is used in a much wider sense.
  5246. @menu
  5247. * Timestamps:: Assigning a time to a tree entry.
  5248. * Creating Timestamps:: Commands to insert timestamps.
  5249. * Deadlines and Scheduling:: Planning your work.
  5250. * Clocking Work Time:: Tracking how long you spend on a task.
  5251. * Effort Estimates:: Planning work effort in advance.
  5252. * Timers:: Notes with a running timer.
  5253. @end menu
  5254. @node Timestamps
  5255. @section Timestamps, Deadlines and Scheduling
  5256. @cindex timestamps
  5257. @cindex ranges, time
  5258. @cindex date stamps
  5259. @cindex deadlines
  5260. @cindex scheduling
  5261. A timestamp is a specification of a date (possibly with a time or
  5262. a range of times) in a special format, either @samp{<2003-09-16 Tue>} or
  5263. @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
  5264. date/time format. To use an alternative format, see @ref{Custom time format}. The day name is optional when you type the date yourself.
  5265. However, any date inserted or modified by Org adds that day name, for
  5266. reading convenience.}.
  5267. A timestamp can appear anywhere in the headline or body of an Org tree
  5268. entry. Its presence causes entries to be shown on specific dates in
  5269. the agenda (see @ref{Weekly/daily agenda}). We distinguish:
  5270. @table @asis
  5271. @item Plain timestamp; Event; Appointment
  5272. @cindex timestamp
  5273. @cindex appointment
  5274. A simple timestamp just assigns a date/time to an item. This is
  5275. just like writing down an appointment or event in a paper agenda.
  5276. In the timeline and agenda displays, the headline of an entry
  5277. associated with a plain timestamp is shown exactly on that date.
  5278. @example
  5279. * Meet Peter at the movies
  5280. <2006-11-01 Wed 19:15>
  5281. * Discussion on climate change
  5282. <2006-11-02 Thu 20:00-22:00>
  5283. @end example
  5284. @item Timestamp with repeater interval
  5285. @cindex timestamp, with repeater interval
  5286. A timestamp may contain a @emph{repeater interval}, indicating that it
  5287. applies not only on the given date, but again and again after
  5288. a certain interval of N days (d), weeks (w), months (m), or years
  5289. (y). The following shows up in the agenda every Wednesday:
  5290. @example
  5291. * Pick up Sam at school
  5292. <2007-05-16 Wed 12:30 +1w>
  5293. @end example
  5294. @item Diary-style sexp entries
  5295. @cindex diary style timestamps
  5296. @cindex sexp timestamps
  5297. For more complex date specifications, Org mode supports using the
  5298. special sexp diary entries implemented in the Emacs
  5299. calendar/diary package@footnote{When working with the standard diary sexp functions, you need
  5300. to be very careful with the order of the arguments. That order
  5301. depends evilly on the variable @code{calendar-date-style}. For example, to
  5302. specify a date December 12, 2005, the call might look like
  5303. @samp{(diary-date 12 1 2005)} or @samp{(diary-date 1 12 2005)} or @samp{(diary-date
  5304. 2005 12 1)}, depending on the settings. This has been the source of
  5305. much confusion. Org mode users can resort to special versions of
  5306. these functions like @code{org-date} or @code{org-anniversary}. These work just
  5307. like the corresponding @code{diary-} functions, but with stable ISO order
  5308. of arguments (year, month, day) wherever applicable, independent of
  5309. the value of @code{calendar-date-style}.}. For example, with optional time:
  5310. @example
  5311. * 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
  5312. <%%(org-float t 4 2)>
  5313. @end example
  5314. @item Time/Date range
  5315. @cindex timerange
  5316. @cindex date range
  5317. Two timestamps connected by @samp{--} denote a range. The headline is
  5318. shown on the first and last day of the range, and on any dates
  5319. that are displayed and fall in the range. Here is an example:
  5320. @example
  5321. ** Meeting in Amsterdam
  5322. <2004-08-23 Mon>--<2004-08-26 Thu>
  5323. @end example
  5324. @item Inactive timestamp
  5325. @cindex timestamp, inactive
  5326. @cindex inactive timestamp
  5327. Just like a plain timestamp, but with square brackets instead of
  5328. angular ones. These timestamps are inactive in the sense that
  5329. they do @emph{not} trigger an entry to show up in the agenda.
  5330. @example
  5331. * Gillian comes late for the fifth time
  5332. [2006-11-01 Wed]
  5333. @end example
  5334. @end table
  5335. @node Creating Timestamps
  5336. @section Creating Timestamps
  5337. For Org mode to recognize timestamps, they need to be in the specific
  5338. format. All commands listed below produce timestamps in the correct
  5339. format.
  5340. @table @asis
  5341. @item @kbd{C-c .} (@code{org-time-stamp})
  5342. @kindex C-c .
  5343. @findex org-time-stamp
  5344. Prompt for a date and insert a corresponding timestamp. When the
  5345. cursor is at an existing timestamp in the buffer, the command is
  5346. used to modify this timestamp instead of inserting a new one.
  5347. When this command is used twice in succession, a time range is
  5348. inserted.
  5349. @kindex C-u C-c .
  5350. @vindex org-time-stamp-rounding-minutes
  5351. When called with a prefix argument, use the alternative format
  5352. which contains date and time. The default time can be rounded to
  5353. multiples of 5 minutes. See the option
  5354. @code{org-time-stamp-rounding-minutes}.
  5355. @kindex C-u C-u C-c .
  5356. With two prefix arguments, insert an active timestamp with the
  5357. current time without prompting.
  5358. @item @kbd{C-c !} (@code{org-time-stamp-inactive})
  5359. @kindex C-c !
  5360. @kindex C-u C-c !
  5361. @kindex C-u C-u C-c !
  5362. @findex org-time-stamp-inactive
  5363. Like @kbd{C-c .}, but insert an inactive timestamp that does
  5364. not cause an agenda entry.
  5365. @item @kbd{C-c C-c}
  5366. @kindex C-c C-c
  5367. Normalize timestamp, insert or fix day name if missing or wrong.
  5368. @item @kbd{C-c <} (@code{org-date-from-calendar})
  5369. @kindex C-c <
  5370. @findex org-date-from-calendar
  5371. Insert a timestamp corresponding to the cursor date in the
  5372. calendar.
  5373. @item @kbd{C-c >} (@code{org-goto-calendar})
  5374. @kindex C-c >
  5375. @findex org-goto-calendar
  5376. Access the Emacs calendar for the current date. If there is
  5377. a timestamp in the current line, go to the corresponding date
  5378. instead.
  5379. @item @kbd{C-c C-o} (@code{org-open-at-point})
  5380. @kindex C-c C-o
  5381. @findex org-open-at-point
  5382. Access the agenda for the date given by the timestamp or -range
  5383. at point (see @ref{Weekly/daily agenda}).
  5384. @item @kbd{S-@key{LEFT}} (@code{org-timestamp-down-day})
  5385. @itemx @kbd{S-@key{RIGHT}} (@code{org-timestamp-up-day})
  5386. @kindex S-LEFT
  5387. @kindex S-RIGHT
  5388. @findex org-timestamp-down-day
  5389. @findex org-timestamp-up-day
  5390. Change date at cursor by one day. These key bindings conflict
  5391. with shift-selection and related modes (see @ref{Conflicts}).
  5392. @item @kbd{S-@key{UP}} (@code{org-timestamp-up})
  5393. @itemx @kbd{S-@key{DOWN}} (@code{org-timestamp-down})
  5394. @kindex S-UP
  5395. @kindex S-DOWN
  5396. Change the item under the cursor in a timestamp. The cursor can
  5397. be on a year, month, day, hour or minute. When the timestamp
  5398. contains a time range like @samp{15:30-16:30}, modifying the first
  5399. time also shifts the second, shifting the time block with
  5400. constant length. To change the length, modify the second time.
  5401. Note that if the cursor is in a headline and not at a timestamp,
  5402. these same keys modify the priority of an item. (see
  5403. @ref{Priorities}). The key bindings also conflict with
  5404. shift-selection and related modes (see @ref{Conflicts}).
  5405. @item @kbd{C-c C-y} (@code{org-evaluate-time-range})
  5406. @kindex C-c C-y
  5407. @findex org-evaluate-time-range
  5408. @cindex evaluate time range
  5409. Evaluate a time range by computing the difference between start
  5410. and end. With a prefix argument, insert result after the time
  5411. range (in a table: into the following column).
  5412. @end table
  5413. @menu
  5414. * The date/time prompt:: How Org mode helps you enter dates and times.
  5415. * Custom time format:: Making dates look different.
  5416. @end menu
  5417. @node The date/time prompt
  5418. @subsection The date/time prompt
  5419. @cindex date, reading in minibuffer
  5420. @cindex time, reading in minibuffer
  5421. @vindex org-read-date-prefer-future
  5422. When Org mode prompts for a date/time, the default is shown in default
  5423. date/time format, and the prompt therefore seems to ask for a specific
  5424. format. But it in fact accepts date/time information in a variety of
  5425. formats. Generally, the information should start at the beginning of
  5426. the string. Org mode finds whatever information is in there and
  5427. derives anything you have not specified from the @emph{default date and
  5428. time}. The default is usually the current date and time, but when
  5429. modifying an existing timestamp, or when entering the second stamp of
  5430. a range, it is taken from the stamp in the buffer. When filling in
  5431. information, Org mode assumes that most of the time you want to enter
  5432. a date in the future: if you omit the month/year and the given
  5433. day/month is @emph{before} today, it assumes that you mean a future
  5434. date@footnote{See the variable @code{org-read-date-prefer-future}. You may set
  5435. that variable to the symbol @code{time} to even make a time before now
  5436. shift the date to tomorrow.}. If the date has been automatically shifted into the
  5437. future, the time prompt shows this with @samp{(=>F)}.
  5438. For example, let's assume that today is @strong{June 13, 2006}. Here is how
  5439. various inputs are interpreted, the items filled in by Org mode are in
  5440. @strong{bold}.
  5441. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  5442. @item @samp{3-2-5}
  5443. @tab @result{} 2003-02-05
  5444. @item @samp{2/5/3}
  5445. @tab @result{} 2003-02-05
  5446. @item @samp{14}
  5447. @tab @result{} @strong{2006}-@strong{06}-14
  5448. @item @samp{12}
  5449. @tab @result{} @strong{2006}-@strong{07}-12
  5450. @item @samp{2/5}
  5451. @tab @result{} @strong{2007}-02-05
  5452. @item @samp{Fri}
  5453. @tab @result{} nearest Friday (default date or later)
  5454. @item @samp{sep 15}
  5455. @tab @result{} @strong{2006}-09-15
  5456. @item @samp{feb 15}
  5457. @tab @result{} @strong{2007}-02-15
  5458. @item @samp{sep 12 9}
  5459. @tab @result{} 2009-09-12
  5460. @item @samp{12:45}
  5461. @tab @result{} @strong{2006}-@strong{06}-@strong{13} 12:45
  5462. @item @samp{22 sept 0:34}
  5463. @tab @result{} @strong{2006}-09-22 0:34
  5464. @item @samp{w4}
  5465. @tab @result{} ISO week for of the current year @strong{2006}
  5466. @item @samp{2012 w4 fri}
  5467. @tab @result{} Friday of ISO week 4 in 2012
  5468. @item @samp{2012-w04-5}
  5469. @tab @result{} Same as above
  5470. @end multitable
  5471. Furthermore you can specify a relative date by giving, as the @emph{first}
  5472. thing in the input: a plus/minus sign, a number and a letter---@samp{d},
  5473. @samp{w}, @samp{m} or @samp{y}---to indicate change in days, weeks, months, or
  5474. years. With a single plus or minus, the date is always relative to
  5475. today. With a double plus or minus, it is relative to the default
  5476. date. If instead of a single letter, you use the abbreviation of day
  5477. name, the date is the Nth such day, e.g.:
  5478. @multitable {aaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  5479. @item @samp{+0}
  5480. @tab @result{} today
  5481. @item @samp{.}
  5482. @tab @result{} today
  5483. @item @samp{+4d}
  5484. @tab @result{} four days from today
  5485. @item @samp{+4}
  5486. @tab @result{} same as +4d
  5487. @item @samp{+2w}
  5488. @tab @result{} two weeks from today
  5489. @item @samp{++5}
  5490. @tab @result{} five days from default date
  5491. @item @samp{+2tue}
  5492. @tab @result{} second Tuesday from now
  5493. @end multitable
  5494. @vindex parse-time-months
  5495. @vindex parse-time-weekdays
  5496. The function understands English month and weekday abbreviations. If
  5497. you want to use un-abbreviated names and/or other languages, configure
  5498. the variables @code{parse-time-months} and @code{parse-time-weekdays}.
  5499. @vindex org-read-date-force-compatible-dates
  5500. Not all dates can be represented in a given Emacs implementation. By
  5501. default Org mode forces dates into the compatibility range 1970--2037
  5502. which works on all Emacs implementations. If you want to use dates
  5503. outside of this range, read the docstring of the variable
  5504. @code{org-read-date-force-compatible-dates}.
  5505. You can specify a time range by giving start and end times or by
  5506. giving a start time and a duration (in HH:MM format). Use one or two
  5507. dash(es) as the separator in the former case and use @samp{+} as the
  5508. separator in the latter case, e.g.:
  5509. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaa}
  5510. @item @samp{11am-1:15pm}
  5511. @tab @result{} 11:00-13:15
  5512. @item @samp{11am--1:15pm}
  5513. @tab @result{} same as above
  5514. @item @samp{11am+2:15}
  5515. @tab @result{} same as above
  5516. @end multitable
  5517. @cindex calendar, for selecting date
  5518. @vindex org-popup-calendar-for-date-prompt
  5519. Parallel to the minibuffer prompt, a calendar is popped up@footnote{If you do not need/want the calendar, configure the variable
  5520. @code{org-popup-calendar-for-date-prompt}.}.
  5521. When you exit the date prompt, either by clicking on a date in the
  5522. calendar, or by pressing @kbd{@key{RET}}, the date selected in the
  5523. calendar is combined with the information entered at the prompt. You
  5524. can control the calendar fully from the minibuffer:
  5525. @kindex <
  5526. @kindex >
  5527. @kindex M-v
  5528. @kindex C-v
  5529. @kindex mouse-1
  5530. @kindex S-RIGHT
  5531. @kindex S-LEFT
  5532. @kindex S-DOWN
  5533. @kindex S-UP
  5534. @kindex M-S-RIGHT
  5535. @kindex M-S-LEFT
  5536. @kindex RET
  5537. @multitable @columnfractions 0.25 0.55
  5538. @item @kbd{@key{RET}}
  5539. @tab Choose date at cursor in calendar.
  5540. @item @kbd{mouse-1}
  5541. @tab Select date by clicking on it.
  5542. @item @kbd{S-@key{RIGHT}}
  5543. @tab One day forward.
  5544. @item @kbd{S-@key{LEFT}}
  5545. @tab One day backward.
  5546. @item @kbd{S-@key{DOWN}}
  5547. @tab One week forward.
  5548. @item @kbd{S-@key{UP}}
  5549. @tab One week backward.
  5550. @item @kbd{M-S-@key{RIGHT}}
  5551. @tab One month forward.
  5552. @item @kbd{M-S-@key{LEFT}}
  5553. @tab One month backward.
  5554. @item @kbd{>}
  5555. @tab Scroll calendar forward by one month.
  5556. @item @kbd{<}
  5557. @tab Scroll calendar backward by one month.
  5558. @item @kbd{M-v}
  5559. @tab Scroll calendar forward by 3 months.
  5560. @item @kbd{C-v}
  5561. @tab Scroll calendar backward by 3 months.
  5562. @end multitable
  5563. @vindex org-read-date-display-live
  5564. The actions of the date/time prompt may seem complex, but I assure you
  5565. they will grow on you, and you will start getting annoyed by pretty
  5566. much any other way of entering a date/time out there. To help you
  5567. understand what is going on, the current interpretation of your input
  5568. is displayed live in the minibuffer@footnote{If you find this distracting, turn off the display with
  5569. @code{org-read-date-display-live}.}.
  5570. @node Custom time format
  5571. @subsection Custom time format
  5572. @cindex custom date/time format
  5573. @cindex time format, custom
  5574. @cindex date format, custom
  5575. @vindex org-display-custom-times
  5576. @vindex org-time-stamp-custom-formats
  5577. Org mode uses the standard ISO notation for dates and times as it is
  5578. defined in ISO 8601. If you cannot get used to this and require
  5579. another representation of date and time to keep you happy, you can get
  5580. it by customizing the variables @code{org-display-custom-times} and
  5581. @code{org-time-stamp-custom-formats}.
  5582. @table @asis
  5583. @item @kbd{C-c C-x C-t} (@code{org-toggle-time-stamp-overlays})
  5584. @kindex C-c C-x C-t
  5585. @findex org-toggle-time-stamp-overlays
  5586. Toggle the display of custom formats for dates and times.
  5587. @end table
  5588. @noindent
  5589. Org mode needs the default format for scanning, so the custom
  5590. date/time format does not @emph{replace} the default format. Instead, it
  5591. is put @emph{over} the default format using text properties. This has the
  5592. following consequences:
  5593. @itemize
  5594. @item
  5595. You cannot place the cursor onto a timestamp anymore, only before or
  5596. after.
  5597. @item
  5598. The @kbd{S-@key{UP}} and @kbd{S-@key{DOWN}} keys can no longer be used
  5599. to adjust each component of a timestamp. If the cursor is at the
  5600. beginning of the stamp, @kbd{S-@key{UP}} and @kbd{S-@key{DOWN}} change
  5601. the stamp by one day, just like @kbd{S-@key{LEFT}}
  5602. @kbd{S-@key{RIGHT}}. At the end of the stamp, change the time by one
  5603. minute.
  5604. @item
  5605. If the timestamp contains a range of clock times or a repeater,
  5606. these are not overlaid, but remain in the buffer as they were.
  5607. @item
  5608. When you delete a timestamp character-by-character, it only
  5609. disappears from the buffer after @emph{all} (invisible) characters
  5610. belonging to the ISO timestamp have been removed.
  5611. @item
  5612. If the custom timestamp format is longer than the default and you
  5613. are using dates in tables, table alignment will be messed up. If
  5614. the custom format is shorter, things do work as expected.
  5615. @end itemize
  5616. @node Deadlines and Scheduling
  5617. @section Deadlines and Scheduling
  5618. A timestamp may be preceded by special keywords to facilitate
  5619. planning. Both the timestamp and the keyword have to be positioned
  5620. immediately after the task they refer to.
  5621. @table @asis
  5622. @item @samp{DEADLINE}
  5623. @cindex @samp{DEADLINE}
  5624. Meaning: the task (most likely a TODO item, though not
  5625. necessarily) is supposed to be finished on that date.
  5626. @vindex org-deadline-warning-days
  5627. On the deadline date, the task is listed in the agenda. In
  5628. addition, the agenda for @emph{today} carries a warning about the
  5629. approaching or missed deadline, starting
  5630. @code{org-deadline-warning-days} before the due date, and continuing
  5631. until the entry is marked DONE. An example:
  5632. @example
  5633. *** TODO write article about the Earth for the Guide
  5634. DEADLINE: <2004-02-29 Sun>
  5635. The editor in charge is [[bbdb:Ford Prefect]]
  5636. @end example
  5637. @vindex org-agenda-skip-deadline-prewarning-if-scheduled
  5638. You can specify a different lead time for warnings for a specific
  5639. deadlines using the following syntax. Here is an example with
  5640. a warning period of 5 days @samp{DEADLINE: <2004-02-29 Sun -5d>}.
  5641. This warning is deactivated if the task gets scheduled and you
  5642. set @code{org-agenda-skip-deadline-prewarning-if-scheduled} to @code{t}.
  5643. @item @samp{SCHEDULED}
  5644. @cindex @samp{SCHEDULED}
  5645. Meaning: you are planning to start working on that task on the
  5646. given date.
  5647. @vindex org-agenda-skip-scheduled-if-done
  5648. The headline is listed under the given date@footnote{It will still be listed on that date after it has been marked
  5649. DONE. If you do not like this, set the variable
  5650. @code{org-agenda-skip-scheduled-if-done}.}. In addition,
  5651. a reminder that the scheduled date has passed is present in the
  5652. compilation for @emph{today}, until the entry is marked DONE, i.e.,
  5653. the task is automatically forwarded until completed.
  5654. @example
  5655. *** TODO Call Trillian for a date on New Years Eve.
  5656. SCHEDULED: <2004-12-25 Sat>
  5657. @end example
  5658. @vindex org-scheduled-delay-days
  5659. @vindex org-agenda-skip-scheduled-delay-if-deadline
  5660. If you want to @emph{delay} the display of this task in the agenda,
  5661. use @samp{SCHEDULED: <2004-12-25 Sat -2d>}: the task is still
  5662. scheduled on the 25th but will appear two days later. In case
  5663. the task contains a repeater, the delay is considered to affect
  5664. all occurrences; if you want the delay to only affect the first
  5665. scheduled occurrence of the task, use @samp{--2d} instead. See
  5666. @code{org-scheduled-delay-days} and
  5667. @code{org-agenda-skip-scheduled-delay-if-deadline} for details on how
  5668. to control this globally or per agenda.
  5669. @noindent
  5670. @strong{Important:} Scheduling an item in Org mode should @emph{not} be
  5671. understood in the same way that we understand @emph{scheduling
  5672. a meeting}. Setting a date for a meeting is just a simple
  5673. appointment, you should mark this entry with a simple plain
  5674. timestamp, to get this item shown on the date where it applies.
  5675. This is a frequent misunderstanding by Org users. In Org mode,
  5676. @emph{scheduling} means setting a date when you want to start working
  5677. on an action item.
  5678. @end table
  5679. You may use timestamps with repeaters in scheduling and deadline
  5680. entries. Org mode issues early and late warnings based on the
  5681. assumption that the timestamp represents the @emph{nearest instance} of the
  5682. repeater. However, the use of diary S-exp entries like
  5683. @example
  5684. <%%(org-float t 42)>
  5685. @end example
  5686. @noindent
  5687. in scheduling and deadline timestamps is limited. Org mode does not
  5688. know enough about the internals of each S-exp function to issue early
  5689. and late warnings. However, it shows the item on each day where the
  5690. S-exp entry matches.
  5691. @menu
  5692. * Inserting deadline/schedule:: Planning items.
  5693. * Repeated tasks:: Items that show up again and again.
  5694. @end menu
  5695. @node Inserting deadline/schedule
  5696. @subsection Inserting deadlines or schedules
  5697. The following commands allow you to quickly insert a deadline or to
  5698. schedule an item:@footnote{The @samp{SCHEDULED} and @samp{DEADLINE} dates are inserted on the line
  5699. right below the headline. Do not put any text between this line and
  5700. the headline.}
  5701. @table @asis
  5702. @item @kbd{C-c C-d} (@code{org-deadline})
  5703. @kindex C-c C-d
  5704. @findex org-deadline
  5705. @vindex org-log-redeadline
  5706. Insert @samp{DEADLINE} keyword along with a stamp. The insertion
  5707. happens in the line directly following the headline. Remove any
  5708. @samp{CLOSED} timestamp . When called with a prefix argument, also
  5709. remove any existing deadline from the entry. Depending on the
  5710. variable @code{org-log-redeadline}, take a note when changing an
  5711. existing deadline@footnote{Note the corresponding @samp{STARTUP} options @samp{logredeadline},
  5712. @samp{lognoteredeadline}, and @samp{nologredeadline}.}.
  5713. @item @kbd{C-c C-s} (@code{org-schedule})
  5714. @kindex C-c C-s
  5715. @findex org-schedule
  5716. @vindex org-log-reschedule
  5717. Insert @samp{SCHEDULED} keyword along with a stamp. The insertion
  5718. happens in the line directly following the headline. Remove any
  5719. @samp{CLOSED} timestamp. When called with a prefix argument, also
  5720. remove the scheduling date from the entry. Depending on the
  5721. variable @code{org-log-reschedule}, take a note when changing an
  5722. existing scheduling time@footnote{Note the corresponding @samp{STARTUP} options @samp{logreschedule},
  5723. @samp{lognotereschedule}, and @samp{nologreschedule}.}.
  5724. @item @kbd{C-c C-x C-k} (@code{org-mark-entry-for-agenda-action})
  5725. @kindex C-c C-x C-k
  5726. @kindex k a
  5727. @kindex k s
  5728. @findex org-mark-entry-for-agenda-action
  5729. Mark the current entry for agenda action. After you have marked
  5730. the entry like this, you can open the agenda or the calendar to
  5731. find an appropriate date. With the cursor on the selected date,
  5732. press @kbd{k s} or @kbd{k d} to schedule the marked
  5733. item.
  5734. @item @kbd{C-c / d} (@code{org-check-deadlines})
  5735. @kindex C-c / d
  5736. @findex org-check-deadlines
  5737. @cindex sparse tree, for deadlines
  5738. @vindex org-deadline-warning-days
  5739. Create a sparse tree with all deadlines that are either past-due,
  5740. or which will become due within @code{org-deadline-warning-days}.
  5741. With @kbd{C-u} prefix, show all deadlines in the file. With
  5742. a numeric prefix, check that many days. For example, @kbd{C-1 C-c / d} shows all deadlines due tomorrow.
  5743. @item @kbd{C-c / b}, @code{org-check-before-date}
  5744. @kindex C-c / b
  5745. @findex org-check-before-date
  5746. Sparse tree for deadlines and scheduled items before a given
  5747. date.
  5748. @item @kbd{C-c / a}, @code{org-check-after-date}
  5749. @kindex C-c / a
  5750. @findex org-check-after-date
  5751. Sparse tree for deadlines and scheduled items after a given date.
  5752. @end table
  5753. Note that @code{org-schedule} and @code{org-deadline} supports setting the date
  5754. by indicating a relative time e.g., @samp{+1d} sets the date to the next
  5755. day after today, and @samp{--1w} sets the date to the previous week before
  5756. any current timestamp.
  5757. @node Repeated tasks
  5758. @subsection Repeated tasks
  5759. @cindex tasks, repeated
  5760. @cindex repeated tasks
  5761. Some tasks need to be repeated again and again. Org mode helps to
  5762. organize such tasks using a so-called repeater in a @samp{DEADLINE},
  5763. @samp{SCHEDULED}, or plain timestamp. In the following example:
  5764. @example
  5765. ** TODO Pay the rent
  5766. DEADLINE: <2005-10-01 Sat +1m>
  5767. @end example
  5768. noindent
  5769. the @samp{+1m} is a repeater; the intended interpretation is that the task
  5770. has a deadline on @samp{<2005-10-01>} and repeats itself every (one) month
  5771. starting from that time. You can use yearly, monthly, weekly, daily
  5772. and hourly repeat cookies by using the @code{y/w/m/d/h} letters. If you
  5773. need both a repeater and a special warning period in a deadline entry,
  5774. the repeater should come first and the warning period last: @samp{DEADLINE:
  5775. <2005-10-01 Sat +1m -3d>}.
  5776. @vindex org-todo-repeat-to-state
  5777. Deadlines and scheduled items produce entries in the agenda when they
  5778. are over-due, so it is important to be able to mark such an entry as
  5779. completed once you have done so. When you mark a @samp{DEADLINE} or
  5780. a @samp{SCHEDULED} with the TODO keyword @samp{DONE}, it no longer produces
  5781. entries in the agenda. The problem with this is, however, is that
  5782. then also the @emph{next} instance of the repeated entry will not be
  5783. active. Org mode deals with this in the following way: when you try
  5784. to mark such an entry DONE, using @kbd{C-c C-t}, it shifts the
  5785. base date of the repeating timestamp by the repeater interval, and
  5786. immediately sets the entry state back to TODO@footnote{In fact, the target state is taken from, in this sequence, the
  5787. @samp{REPEAT_TO_STATE} property, the variable @code{org-todo-repeat-to-state} if
  5788. it is a string, the previous TODO state if @code{org-todo-repeat-to-state}
  5789. is @code{t}, or the first state of the TODO state sequence.}. In the example
  5790. above, setting the state to DONE would actually switch the date like
  5791. this:
  5792. @example
  5793. ** TODO Pay the rent
  5794. DEADLINE: <2005-11-01 Tue +1m>
  5795. @end example
  5796. To mark a task with a repeater as DONE, use @kbd{C-- 1 C-c C-t},
  5797. i.e., @code{org-todo} with a numeric prefix argument of @samp{-1}.
  5798. @vindex org-log-repeat
  5799. A timestamp@footnote{You can change this using the option @code{org-log-repeat}, or the
  5800. @samp{STARTUP} options @samp{logrepeat}, @samp{lognoterepeat}, and @samp{nologrepeat}.
  5801. With @samp{lognoterepeat}, you will also be prompted for a note.} is added under the deadline, to keep a record that
  5802. you actually acted on the previous instance of this deadline.
  5803. As a consequence of shifting the base date, this entry is no longer
  5804. visible in the agenda when checking past dates, but all future
  5805. instances will be visible.
  5806. With the @samp{+1m} cookie, the date shift is always exactly one month. So
  5807. if you have not paid the rent for three months, marking this entry
  5808. DONE still keeps it as an overdue deadline. Depending on the task,
  5809. this may not be the best way to handle it. For example, if you forgot
  5810. to call your father for 3 weeks, it does not make sense to call him
  5811. 3 times in a single day to make up for it. Finally, there are tasks
  5812. like changing batteries which should always repeat a certain time
  5813. @emph{after} the last time you did it. For these tasks, Org mode has
  5814. special repeaters @samp{++} and @samp{.+}. For example:
  5815. @example
  5816. ** TODO Call Father
  5817. DEADLINE: <2008-02-10 Sun ++1w>
  5818. Marking this DONE shifts the date by at least one week, but also
  5819. by as many weeks as it takes to get this date into the future.
  5820. However, it stays on a Sunday, even if you called and marked it
  5821. done on Saturday.
  5822. ** TODO Empty kitchen trash
  5823. DEADLINE: <2008-02-08 Fri 20:00 ++1d>
  5824. Marking this DONE shifts the date by at least one day, and also
  5825. by as many days as it takes to get the timestamp into the future.
  5826. Since there is a time in the timestamp, the next deadline in the
  5827. future will be on today's date if you complete the task before
  5828. 20:00.
  5829. ** TODO Check the batteries in the smoke detectors
  5830. DEADLINE: <2005-11-01 Tue .+1m>
  5831. Marking this DONE will shift the date to one month after today.
  5832. @end example
  5833. @vindex org-agenda-skip-scheduled-if-deadline-is-shown
  5834. You may have both scheduling and deadline information for a specific
  5835. task. If the repeater is set for the scheduling information only, you
  5836. probably want the repeater to be ignored after the deadline. If so,
  5837. set the variable @code{org-agenda-skip-scheduled-if-deadline-is-shown} to
  5838. @code{repeated-after-deadline}. However, any scheduling information
  5839. without a repeater is no longer relevant once the task is done, and
  5840. thus, removed upon repeating the task. If you want both scheduling
  5841. and deadline information to repeat after the same interval, set the
  5842. same repeater for both timestamps.
  5843. An alternative to using a repeater is to create a number of copies of
  5844. a task subtree, with dates shifted in each copy. The command
  5845. @kbd{C-c C-x c} was created for this purpose; it is described in
  5846. @ref{Structure Editing}.
  5847. @node Clocking Work Time
  5848. @section Clocking Work Time
  5849. @cindex clocking time
  5850. @cindex time clocking
  5851. Org mode allows you to clock the time you spend on specific tasks in
  5852. a project. When you start working on an item, you can start the
  5853. clock. When you stop working on that task, or when you mark the task
  5854. done, the clock is stopped and the corresponding time interval is
  5855. recorded. It also computes the total time spent on each
  5856. subtree@footnote{Clocking only works if all headings are indented with less
  5857. than 30 stars. This is a hard-coded limitation of @code{lmax} in
  5858. @code{org-clock-sum}.} of a project. And it remembers a history or tasks
  5859. recently clocked, to that you can jump quickly between a number of
  5860. tasks absorbing your time.
  5861. To save the clock history across Emacs sessions, use:
  5862. @lisp
  5863. (setq org-clock-persist 'history)
  5864. (org-clock-persistence-insinuate)
  5865. @end lisp
  5866. @vindex org-clock-persist
  5867. When you clock into a new task after resuming Emacs, the incomplete
  5868. clock@footnote{To resume the clock under the assumption that you have worked
  5869. on this task while outside Emacs, use @code{(setq org-clock-persist t)}.} is retrieved (see @ref{Resolving idle time (1)}) and you are
  5870. prompted about what to do with it.
  5871. @menu
  5872. * Clocking commands:: Starting and stopping a clock.
  5873. * The clock table:: Detailed reports.
  5874. * Resolving idle time:: Resolving time when you've been idle.
  5875. @end menu
  5876. @node Clocking commands
  5877. @subsection Clocking commands
  5878. @table @asis
  5879. @item @kbd{C-c C-x C-i} (@code{org-clock-in})
  5880. @kindex C-c C-x C-i
  5881. @findex org-clock-in
  5882. @vindex org-clock-into-drawer
  5883. @vindex org-clock-continuously
  5884. @cindex @samp{LOG_INTO_DRAWER}, property
  5885. Start the clock on the current item (clock-in). This inserts the
  5886. CLOCK keyword together with a timestamp. If this is not the
  5887. first clocking of this item, the multiple CLOCK lines are wrapped
  5888. into a @samp{LOGBOOK} drawer (see also the variable
  5889. @code{org-clock-into-drawer}). You can also overrule the setting of
  5890. this variable for a subtree by setting a @samp{CLOCK_INTO_DRAWER} or
  5891. @samp{LOG_INTO_DRAWER} property. When called with a @kbd{C-u}
  5892. prefix argument, select the task from a list of recently clocked
  5893. tasks. With two @kbd{C-u C-u} prefixes, clock into the task
  5894. at point and mark it as the default task; the default task is
  5895. always be available with letter @kbd{d} when selecting
  5896. a clocking task. With three @kbd{C-u C-u C-u} prefixes,
  5897. force continuous clocking by starting the clock when the last
  5898. clock stopped.
  5899. @cindex @samp{CLOCK_MODELINE_TOTAL}, property
  5900. @cindex @samp{LAST_REPEAT}, property
  5901. @vindex org-clock-modeline-total
  5902. @vindex org-clock-in-prepare-hook
  5903. While the clock is running, Org shows the current clocking time
  5904. in the mode line, along with the title of the task. The clock
  5905. time shown is all time ever clocked for this task and its
  5906. children. If the task has an effort estimate (see @ref{Effort Estimates}), the mode line displays the current clocking time
  5907. against it@footnote{To add an effort estimate ``on the fly'', hook a function doing
  5908. 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
  5909. task@footnote{The last reset of the task is recorded by the @samp{LAST_REPEAT}
  5910. property.}. You can exercise more control over show time with
  5911. the @samp{CLOCK_MODELINE_TOTAL} property. It may have the values
  5912. @samp{current} to show only the current clocking instance, @samp{today} to
  5913. show all time clocked on this tasks today---see also the
  5914. variable @code{org-extend-today-until}, @code{all} to include all time, or
  5915. @code{auto} which is the default@footnote{See also the variable @code{org-clock-modeline-total}.}. Clicking with
  5916. @kbd{mouse-1} onto the mode line entry pops up a menu with
  5917. clocking options.
  5918. @item @kbd{C-c C-x C-o} (@code{org-clock-out})
  5919. @kindex C-c C-x C-o
  5920. @findex org-clock-out
  5921. @vindex org-log-note-clock-out
  5922. Stop the clock (clock-out). This inserts another timestamp at
  5923. the same location where the clock was last started. It also
  5924. directly computes the resulting time in inserts it after the time
  5925. range as @samp{=>HH:MM}. See the variable @code{org-log-note-clock-out}
  5926. for the possibility to record an additional note together with
  5927. the clock-out timestamp@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP:
  5928. lognoteclock-out}.}.
  5929. @item @kbd{C-c C-x C-x} (@code{org-clock-in-last})
  5930. @kindex C-c C-x C-x
  5931. @findex org-clock-in-last
  5932. @vindex org-clock-continuously
  5933. Re-clock the last clocked task. With one @kbd{C-u} prefix
  5934. argument, select the task from the clock history. With two
  5935. @kbd{C-u} prefixes, force continuous clocking by starting
  5936. the clock when the last clock stopped.
  5937. @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate})
  5938. @kindex C-c C-x C-e
  5939. @findex org-clock-modify-effort-estimate
  5940. Update the effort estimate for the current clock task.
  5941. @item @kbd{C-c C-c} or @kbd{C-c C-y} (@code{org-evaluate-time-range})
  5942. @kindex C-c C-c
  5943. @kindex C-c C-y
  5944. @findex org-evaluate-time-range
  5945. Recompute the time interval after changing one of the timestamps.
  5946. This is only necessary if you edit the timestamps directly. If
  5947. you change them with @kbd{S-<cursor>} keys, the update is
  5948. automatic.
  5949. @item @kbd{C-S-@key{UP}} (@code{org-clock-timestamps-up})
  5950. @itemx @kbd{C-S-@key{DOWN}} (@code{org-clock-timestamps-down})
  5951. @kindex C-S-UP
  5952. @findex org-clock-timestamps-up
  5953. @kindex C-S-DOWN
  5954. @findex org-clock-timestamps-down
  5955. On CLOCK log lines, increase/decrease both timestamps so that the
  5956. clock duration keeps the same value.
  5957. @item @kbd{S-M-@key{UP}} (@code{org-timestamp-up})
  5958. @itemx @kbd{S-M-@key{DOWN}} (@code{org-timestamp-down})
  5959. @kindex S-M-UP
  5960. @findex org-clock-timestamp-up
  5961. @kindex S-M-DOWN
  5962. @findex org-clock-timestamp-down
  5963. On @samp{CLOCK} log lines, increase/decrease the timestamp at point
  5964. and the one of the previous, or the next, clock timestamp by the
  5965. same duration. For example, if you hit @kbd{S-M-@key{UP}} to
  5966. increase a clocked-out timestamp by five minutes, then the
  5967. clocked-in timestamp of the next clock is increased by five
  5968. minutes.
  5969. @item @kbd{C-c C-t} (@code{org-todo})
  5970. @kindex C-c C-t
  5971. @findex org-todo
  5972. Changing the TODO state of an item to DONE automatically stops
  5973. the clock if it is running in this same item.
  5974. @item @kbd{C-c C-x C-q} (@code{org-clock-cancel})
  5975. @kindex C-c C-x C-q
  5976. @findex org-clock-cancel
  5977. Cancel the current clock. This is useful if a clock was started
  5978. by mistake, or if you ended up working on something else.
  5979. @item @kbd{C-c C-x C-j} (@code{org-clock-goto})
  5980. @kindex C-c C-x C-j
  5981. @findex or-clock-goto
  5982. Jump to the headline of the currently clocked in task. With
  5983. a @kbd{C-u} prefix argument, select the target task from
  5984. a list of recently clocked tasks.
  5985. @item @kbd{C-c C-x C-d} (@code{org-clock-display})
  5986. @kindex C-c C-x C-d
  5987. @findex org-clock-display
  5988. @vindex org-remove-highlights-with-change
  5989. Display time summaries for each subtree in the current buffer.
  5990. This puts overlays at the end of each headline, showing the total
  5991. time recorded under that heading, including the time of any
  5992. subheadings. You can use visibility cycling to study the tree,
  5993. but the overlays disappear when you change the buffer (see
  5994. variable @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
  5995. @end table
  5996. 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
  5997. a day.
  5998. @strong{Important:} note that both @code{org-clock-out} and @code{org-clock-in-last}
  5999. can have a global keybinding and do not modify the window disposition.
  6000. @node The clock table
  6001. @subsection The clock table
  6002. @cindex clocktable, dynamic block
  6003. @cindex report, of clocked time
  6004. Org mode can produce quite complex reports based on the time clocking
  6005. information. Such a report is called a @emph{clock table}, because it is
  6006. formatted as one or several Org tables.
  6007. @table @asis
  6008. @item @kbd{C-c C-x C-r} (@code{org-clock-report})
  6009. @kindex C-c C-x C-r
  6010. @findex org-clock-report
  6011. Insert a dynamic block (see @ref{Dynamic Blocks}) containing a clock
  6012. report as an Org mode table into the current file. When the
  6013. cursor is at an existing clock table, just update it. When
  6014. called with a prefix argument, jump to the first clock report in
  6015. the current document and update it. The clock table includes
  6016. archived trees.
  6017. @item @kbd{C-c C-c} or @kbd{C-c C-x C-u} (@code{org-dblock-update})
  6018. @kindex C-c C-c
  6019. @kindex C-c C-x C-u
  6020. @findex org-dblock-update
  6021. Update dynamic block at point. The cursor needs to be in the
  6022. @samp{BEGIN} line of the dynamic block.
  6023. @item @kbd{C-u C-c C-x C-u}
  6024. @kindex C-u C-c C-x C-u
  6025. Update all dynamic blocks (see @ref{Dynamic Blocks}). This is useful
  6026. if you have several clock table blocks in a buffer.
  6027. @item @kbd{S-@key{LEFT}}
  6028. @itemx @kbd{S-@key{RIGHT}} (@code{org-clocktable-try-shift})
  6029. @kindex S-LEFT
  6030. @kindex S-RIGHT
  6031. @findex org-clocktable-try-shift
  6032. Shift the current @samp{:block} interval and update the table. The
  6033. cursor needs to be in the @samp{#+BEGIN: clocktable} line for this
  6034. command. If @samp{:block} is @samp{today}, it is shifted to @samp{today-1},
  6035. etc.
  6036. @end table
  6037. Here is an example of the frame for a clock table as it is inserted
  6038. into the buffer with the @kbd{C-c C-x C-r} command:
  6039. @cindex @samp{BEGIN clocktable}
  6040. @example
  6041. #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
  6042. #+END: clocktable
  6043. @end example
  6044. @noindent
  6045. @vindex org-clocktable-defaults
  6046. The @samp{#+BEGIN} line and specify a number of options to define the
  6047. scope, structure, and formatting of the report. Defaults for all
  6048. these options can be configured in the variable
  6049. @code{org-clocktable-defaults}.
  6050. @noindent
  6051. First there are options that determine which clock entries are to
  6052. be selected:
  6053. @table @asis
  6054. @item :maxlevel
  6055. Maximum level depth to which times are listed in the table.
  6056. Clocks at deeper levels are summed into the upper level.
  6057. @item :scope
  6058. The scope to consider. This can be any of the following:
  6059. @multitable {aaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  6060. @item @code{nil}
  6061. @tab the current buffer or narrowed region
  6062. @item @code{file}
  6063. @tab the full current buffer
  6064. @item @code{subtree}
  6065. @tab the subtree where the clocktable is located
  6066. @item @code{treeN}
  6067. @tab the surrounding level N tree, for example @samp{tree3}
  6068. @item @code{tree}
  6069. @tab the surrounding level 1 tree
  6070. @item @code{agenda}
  6071. @tab all agenda files
  6072. @item @samp{("file" ...)}
  6073. @tab scan these files
  6074. @item @samp{FUNCTION}
  6075. @tab scan files returned by calling FUNCTION with no argument
  6076. @item @code{file-with-archives}
  6077. @tab current file and its archives
  6078. @item @code{agenda-with-archives}
  6079. @tab all agenda files, including archives
  6080. @end multitable
  6081. @item :block
  6082. The time block to consider. This block is specified either
  6083. absolutely, or relative to the current time and may be any of
  6084. these formats:
  6085. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaa}
  6086. @item @samp{2007-12-31}
  6087. @tab New year eve 2007
  6088. @item @samp{2007-12}
  6089. @tab December 2007
  6090. @item @samp{2007-W50}
  6091. @tab ISO-week 50 in 2007
  6092. @item @samp{2007-Q2}
  6093. @tab 2nd quarter in 2007
  6094. @item @samp{2007}
  6095. @tab the year 2007
  6096. @item @code{today}, @code{yesterday}, @code{today-N}
  6097. @tab a relative day
  6098. @item @code{thisweek}, @code{lastweek}, @code{thisweek-N}
  6099. @tab a relative week
  6100. @item @code{thismonth}, @code{lastmonth}, @code{thismonth-N}
  6101. @tab a relative month
  6102. @item @code{thisyear}, @code{lastyear}, @code{thisyear-N}
  6103. @tab a relative year
  6104. @item @code{untilnow}
  6105. @tab all clocked time ever
  6106. @end multitable
  6107. @vindex org-clock-display-default-range
  6108. When this option is not set, Org falls back to the value in
  6109. @code{org-clock-display-default-range}, which defaults to the current
  6110. year.
  6111. Use @kbd{S-@key{LEFT}} or @kbd{S-@key{RIGHT}} to shift the time
  6112. interval.
  6113. @item :tstart
  6114. A time string specifying when to start considering times.
  6115. Relative times like @samp{"<-2w>"} can also be used. See @ref{Matching tags and properties} for relative time syntax.
  6116. @item :tend
  6117. A time string specifying when to stop considering times.
  6118. Relative times like @samp{"<now>"} can also be used. See @ref{Matching tags and properties} for relative time syntax.
  6119. @item wstart
  6120. The starting day of the week. The default is 1 for Monday.
  6121. @item mstart
  6122. The starting day of the month. The default is 1 for the first.
  6123. @item :step
  6124. Set to @code{week} or @code{day} to split the table into chunks. To use
  6125. this, @code{:block} or @code{:tstart}, @code{:tend} are needed.
  6126. @item :stepskip0
  6127. Do not show steps that have zero time.
  6128. @item :fileskip0
  6129. Do not show table sections from files which did not contribute.
  6130. @item :tags
  6131. A tags match to select entries that should contribute. See
  6132. @ref{Matching tags and properties} for the match syntax.
  6133. @end table
  6134. @findex org-clocktable-write-default
  6135. Then there are options that determine the formatting of the table.
  6136. There options are interpreted by the function
  6137. @code{org-clocktable-write-default}, but you can specify your own function
  6138. using the @samp{:formatter} parameter.
  6139. @table @asis
  6140. @item :emphasize
  6141. When @code{t}, emphasize level one and level two items.
  6142. @item :lang
  6143. Language@footnote{Language terms can be set through the variable
  6144. @code{org-clock-clocktable-language-setup}.} to use for descriptive cells like ``Task''.
  6145. @item :link
  6146. Link the item headlines in the table to their origins.
  6147. @item :narrow
  6148. An integer to limit the width of the headline column in the Org
  6149. table. If you write it like @samp{50!}, then the headline is also
  6150. shortened in export.
  6151. @item :indent
  6152. Indent each headline field according to its level.
  6153. @item :tcolumns
  6154. Number of columns to be used for times. If this is smaller than
  6155. @samp{:maxlevel}, lower levels are lumped into one column.
  6156. @item :level
  6157. Should a level number column be included?
  6158. @item :sort
  6159. A cons cell containing the column to sort and a sorting type.
  6160. E.g., @samp{:sort (1 . ?a)} sorts the first column alphabetically.
  6161. @item :compact
  6162. Abbreviation for @samp{:level nil :indent t :narrow 40! :tcolumns 1}.
  6163. All are overwritten except if there is an explicit @samp{:narrow}.
  6164. @item :timestamp
  6165. A timestamp for the entry, when available. Look for SCHEDULED,
  6166. DEADLINE, TIMESTAMP and TIMESTAMP_IA special properties (see
  6167. @ref{Special Properties}), in this order.
  6168. @item :properties
  6169. List of properties shown in the table. Each property gets its
  6170. own column.
  6171. @item :inherit-props
  6172. When this flag is non-@code{nil}, the values for @samp{:properties} are
  6173. inherited.
  6174. @item :formula
  6175. Content of a @samp{TBLFM} keyword to be added and evaluated. As
  6176. a special case, @samp{:formula %} adds a column with % time. If you
  6177. do not specify a formula here, any existing formula below the
  6178. clock table survives updates and is evaluated.
  6179. @item :formatter
  6180. A function to format clock data and insert it into the buffer.
  6181. @end table
  6182. To get a clock summary of the current level 1 tree, for the current
  6183. day, you could write:
  6184. @example
  6185. #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
  6186. #+END: clocktable
  6187. @end example
  6188. @noindent
  6189. To use a specific time range you could write@footnote{Note that all parameters must be specified in a single
  6190. line---the line is broken here only to fit it into the manual.}
  6191. @example
  6192. #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
  6193. :tend "<2006-08-10 Thu 12:00>"
  6194. #+END: clocktable
  6195. @end example
  6196. A range starting a week ago and ending right now could be written as
  6197. @example
  6198. #+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
  6199. #+END: clocktable
  6200. @end example
  6201. A summary of the current subtree with % times would be:
  6202. @example
  6203. #+BEGIN: clocktable :scope subtree :link t :formula %
  6204. #+END: clocktable
  6205. @end example
  6206. A horizontally compact representation of everything clocked during
  6207. last week would be:
  6208. @example
  6209. #+BEGIN: clocktable :scope agenda :block lastweek :compact t
  6210. #+END: clocktable
  6211. @end example
  6212. @node Resolving idle time
  6213. @subsection Resolving idle time and continuous clocking
  6214. @anchor{Resolving idle time (1)}
  6215. @subsubheading Resolving idle time
  6216. @cindex resolve idle time
  6217. @cindex idle, resolve, dangling
  6218. If you clock in on a work item, and then walk away from your
  6219. computer---perhaps to take a phone call---you often need to
  6220. ``resolve'' the time you were away by either subtracting it from the
  6221. current clock, or applying it to another one.
  6222. @vindex org-clock-idle-time
  6223. @vindex org-clock-x11idle-program-name
  6224. By customizing the variable @code{org-clock-idle-time} to some integer,
  6225. such as 10 or 15, Emacs can alert you when you get back to your
  6226. computer after being idle for that many minutes@footnote{On computers using macOS, idleness is based on actual user
  6227. idleness, not just Emacs' idle time. For X11, you can install
  6228. a utility program @samp{x11idle.c}, available in the @samp{contrib/scripts/}
  6229. directory of the Org Git distribution, or install the xprintidle
  6230. package and set it to the variable @code{org-clock-x11idle-program-name} if
  6231. you are running Debian, to get the same general treatment of idleness.
  6232. On other systems, idle time refers to Emacs idle time only.}, and ask what
  6233. you want to do with the idle time. There will be a question waiting
  6234. for you when you get back, indicating how much idle time has passed
  6235. constantly updated with the current amount, as well as a set of
  6236. choices to correct the discrepancy:
  6237. @table @asis
  6238. @item @kbd{k}
  6239. @kindex k
  6240. To keep some or all of the minutes and stay clocked in, press
  6241. @kbd{k}. Org asks how many of the minutes to keep. Press
  6242. @kbd{@key{RET}} to keep them all, effectively changing nothing, or
  6243. enter a number to keep that many minutes.
  6244. @item @kbd{K}
  6245. @kindex K
  6246. If you use the shift key and press @kbd{K}, it keeps however
  6247. many minutes you request and then immediately clock out of that
  6248. task. If you keep all of the minutes, this is the same as just
  6249. clocking out of the current task.
  6250. @item @kbd{s}
  6251. @kindex s
  6252. To keep none of the minutes, use @kbd{s} to subtract all the
  6253. away time from the clock, and then check back in from the moment
  6254. you returned.
  6255. @item @kbd{S}
  6256. @kindex S
  6257. To keep none of the minutes and just clock out at the start of
  6258. the away time, use the shift key and press @kbd{S}.
  6259. Remember that using shift always leave you clocked out, no matter
  6260. which option you choose.
  6261. @item @kbd{C}
  6262. @kindex C
  6263. To cancel the clock altogether, use @kbd{C}. Note that if
  6264. instead of canceling you subtract the away time, and the
  6265. resulting clock amount is less than a minute, the clock is still
  6266. canceled rather than cluttering up the log with an empty entry.
  6267. @end table
  6268. What if you subtracted those away minutes from the current clock, and
  6269. now want to apply them to a new clock? Simply clock in to any task
  6270. immediately after the subtraction. Org will notice that you have
  6271. subtracted time ``on the books'', so to speak, and will ask if you want
  6272. to apply those minutes to the next task you clock in on.
  6273. There is one other instance when this clock resolution magic occurs.
  6274. Say you were clocked in and hacking away, and suddenly your cat chased
  6275. a mouse who scared a hamster that crashed into your UPS's power
  6276. button! You suddenly lose all your buffers, but thanks to auto-save
  6277. you still have your recent Org mode changes, including your last clock
  6278. in.
  6279. If you restart Emacs and clock into any task, Org will notice that you
  6280. have a dangling clock which was never clocked out from your last
  6281. session. Using that clock's starting time as the beginning of the
  6282. unaccounted-for period, Org will ask how you want to resolve that
  6283. time. The logic and behavior is identical to dealing with away time
  6284. due to idleness; it is just happening due to a recovery event rather
  6285. than a set amount of idle time.
  6286. You can also check all the files visited by your Org agenda for
  6287. dangling clocks at any time using @kbd{M-x org-resolve-clocks @key{RET}} (or @kbd{C-c C-x C-z}).
  6288. @anchor{Continuous clocking}
  6289. @subsubheading Continuous clocking
  6290. @cindex continuous clocking
  6291. @vindex org-clock-continuously
  6292. You may want to start clocking from the time when you clocked out the
  6293. previous task. To enable this systematically, set
  6294. @code{org-clock-continuously} to non-@code{nil}. Each time you clock in, Org
  6295. retrieves the clock-out time of the last clocked entry for this
  6296. session, and start the new clock from there.
  6297. If you only want this from time to time, use three universal prefix
  6298. arguments with @code{org-clock-in} and two @kbd{C-u C-u} with
  6299. @code{org-clock-in-last}.
  6300. @node Effort Estimates
  6301. @section Effort Estimates
  6302. @cindex effort estimates
  6303. @cindex @samp{EFFORT}, property
  6304. @vindex org-effort-property
  6305. If you want to plan your work in a very detailed way, or if you need
  6306. to produce offers with quotations of the estimated work effort, you
  6307. may want to assign effort estimates to entries. If you are also
  6308. clocking your work, you may later want to compare the planned effort
  6309. with the actual working time, a great way to improve planning
  6310. estimates. Effort estimates are stored in a special property
  6311. @samp{EFFORT}. You can set the effort for an entry with the following
  6312. commands:
  6313. @table @asis
  6314. @item @kbd{C-c C-x e} (@code{org-set-effort})
  6315. @kindex C-c C-x e
  6316. @findex org-set-effort
  6317. Set the effort estimate for the current entry. With a prefix
  6318. argument, set it to the next allowed value---see below. This
  6319. command is also accessible from the agenda with the @kbd{e}
  6320. key.
  6321. @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate})
  6322. @kindex C-c C-x C-e
  6323. @findex org-clock-modify-effort-estimate
  6324. Modify the effort estimate of the item currently being clocked.
  6325. @end table
  6326. Clearly the best way to work with effort estimates is through column
  6327. view (see @ref{Column View}). You should start by setting up discrete
  6328. values for effort estimates, and a @samp{COLUMNS} format that displays
  6329. these values together with clock sums---if you want to clock your
  6330. time. For a specific buffer you can use:
  6331. @example
  6332. #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
  6333. #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
  6334. @end example
  6335. noindent
  6336. @vindex org-global-properties
  6337. @vindex org-columns-default-format
  6338. or, even better, you can set up these values globally by customizing
  6339. the variables @code{org-global-properties} and
  6340. @code{org-columns-default-format}. In particular if you want to use this
  6341. setup also in the agenda, a global setup may be advised.
  6342. The way to assign estimates to individual items is then to switch to
  6343. column mode, and to use @kbd{S-@key{RIGHT}} and @kbd{S-@key{LEFT}} to
  6344. change the value. The values you enter are immediately summed up in
  6345. the hierarchy. In the column next to it, any clocked time is
  6346. displayed.
  6347. @vindex org-agenda-columns-add-appointments-to-effort-sum
  6348. If you switch to column view in the daily/weekly agenda, the effort
  6349. column summarizes the estimated work effort for each day@footnote{Please note the pitfalls of summing hierarchical data in
  6350. a flat list (@ref{Agenda Column View}).}, and
  6351. you can use this to find space in your schedule. To get an overview
  6352. of the entire part of the day that is committed, you can set the
  6353. option @code{org-agenda-columns-add-appointments-to-effort-sum}. The
  6354. appointments on a day that take place over a specified time interval
  6355. are then also added to the load estimate of the day.
  6356. Effort estimates can be used in secondary agenda filtering that is
  6357. triggered with the @kbd{/} key in the agenda (see @ref{Agenda Commands}). If you have these estimates defined consistently,
  6358. two or three key presses narrow down the list to stuff that fits into
  6359. an available time slot.
  6360. @node Timers
  6361. @section Taking Notes with a Relative Timer
  6362. @cindex relative timer
  6363. @cindex countdown timer
  6364. Org provides two types of timers. There is a relative timer that
  6365. counts up, which can be useful when taking notes during, for example,
  6366. a meeting or a video viewing. There is also a countdown timer.
  6367. The relative and countdown are started with separate commands.
  6368. @table @asis
  6369. @item @kbd{C-c C-x 0} (@code{org-timer-start})
  6370. @kindex C-c C-x 0
  6371. @findex org-timer-start
  6372. Start or reset the relative timer. By default, the timer is set
  6373. to 0. When called with a @kbd{C-u} prefix, prompt the user
  6374. for a starting offset. If there is a timer string at point, this
  6375. is taken as the default, providing a convenient way to restart
  6376. taking notes after a break in the process. When called with
  6377. a double prefix argument @kbd{C-u C-u}, change all timer
  6378. strings in the active region by a certain amount. This can be
  6379. used to fix timer strings if the timer was not started at exactly
  6380. the right moment.
  6381. @item @kbd{C-c C-x ;} (@code{org-timer-set-timer})
  6382. @kindex C-c C-x ;
  6383. @findex org-timer-set-timer
  6384. @vindex org-timer-default-timer
  6385. Start a countdown timer. The user is prompted for a duration.
  6386. @code{org-timer-default-timer} sets the default countdown value.
  6387. Giving a numeric prefix argument overrides this default value.
  6388. This command is available as @kbd{;} in agenda buffers.
  6389. @end table
  6390. Once started, relative and countdown timers are controlled with the
  6391. same commands.
  6392. @table @asis
  6393. @item @kbd{C-c C-x .} (@code{org-timer})
  6394. @kindex C-c C-x .
  6395. @findex org-timer
  6396. Insert a relative time into the buffer. The first time you use
  6397. this, the timer starts. Using a prefix argument restarts it.
  6398. @item @kbd{C-c C-x -} (@code{org-timer-item})
  6399. @kindex C-c C-x -
  6400. @findex org-timer-item
  6401. Insert a description list item with the current relative time.
  6402. With a prefix argument, first reset the timer to 0.
  6403. @item @kbd{M-@key{RET}} (@code{org-insert-heading})
  6404. @kindex M-RET
  6405. @findex org-insert-heading
  6406. Once the timer list is started, you can also use
  6407. @kbd{M-@key{RET}} to insert new timer items.
  6408. @item @kbd{C-c C-x ,} (@code{org-timer-pause-or-continue})
  6409. @kindex C-c C-x ,
  6410. @findex org-timer-pause-or-continue
  6411. Pause the timer, or continue it if it is already paused.
  6412. @item @kbd{C-c C-x _} (@code{org-timer-stop})
  6413. @kindex C-c C-x _
  6414. @findex org-timer-stop
  6415. Stop the timer. After this, you can only start a new timer, not
  6416. continue the old one. This command also removes the timer from
  6417. the mode line.
  6418. @end table
  6419. @node Capture Refile Archive
  6420. @chapter Capture, Refile, Archive
  6421. @cindex capture
  6422. An important part of any organization system is the ability to quickly
  6423. capture new ideas and tasks, and to associate reference material with
  6424. them. Org does this using a process called @emph{capture}. It also can
  6425. store files related to a task (@emph{attachments}) in a special directory.
  6426. Once in the system, tasks and projects need to be moved around.
  6427. Moving completed project trees to an archive file keeps the system
  6428. compact and fast.
  6429. @menu
  6430. * Capture:: Capturing new stuff.
  6431. * Attachments:: Add files to tasks.
  6432. * RSS Feeds:: Getting input from RSS feeds.
  6433. * Protocols:: External access to Emacs and Org.
  6434. * Refile and Copy:: Moving/copying a tree from one place to another.
  6435. * Archiving:: What to do with finished products.
  6436. @end menu
  6437. @node Capture
  6438. @section Capture
  6439. @cindex capture
  6440. Capture lets you quickly store notes with little interruption of your
  6441. work flow. Org's method for capturing new items is heavily inspired
  6442. by John Wiegley's excellent Remember package.
  6443. @menu
  6444. * Setting up capture:: Where notes will be stored.
  6445. * Using capture:: Commands to invoke and terminate capture.
  6446. * Capture templates:: Define the outline of different note types.
  6447. @end menu
  6448. @node Setting up capture
  6449. @subsection Setting up capture
  6450. The following customization sets a default target file for notes.
  6451. @vindex org-default-notes-file
  6452. @lisp
  6453. (setq org-default-notes-file (concat org-directory "/notes.org"))
  6454. @end lisp
  6455. You may also define a global key for capturing new material (see
  6456. @ref{Activation}).
  6457. @node Using capture
  6458. @subsection Using capture
  6459. @table @asis
  6460. @item @kbd{M-x org-capture} (@code{org-capture})
  6461. @findex org-capture
  6462. @cindex date tree
  6463. Display the capture templates menu. If you have templates
  6464. defined (see @ref{Capture templates}), it offers these templates for
  6465. selection or use a new Org outline node as the default template.
  6466. It inserts the template into the target file and switch to an
  6467. indirect buffer narrowed to this new node. You may then insert
  6468. the information you want.
  6469. @item @kbd{C-c C-c} (@code{org-capture-finalize})
  6470. @kindex C-c C-c @r{(Capture buffer)}
  6471. @findex org-capture-finalize
  6472. Once you have finished entering information into the capture
  6473. buffer, @kbd{C-c C-c} returns you to the window
  6474. configuration before the capture process, so that you can resume
  6475. your work without further distraction. When called with a prefix
  6476. argument, finalize and then jump to the captured item.
  6477. @item @kbd{C-c C-w} (@code{org-capture-refile})
  6478. @kindex C-c C-w @r{(Capture buffer)}
  6479. @findex org-capture-refile
  6480. Finalize the capture process by refiling the note to a different
  6481. place (see @ref{Refile and Copy}). Please realize that this is
  6482. a normal refiling command that will be executed---so the cursor
  6483. position at the moment you run this command is important. If you
  6484. have inserted a tree with a parent and children, first move the
  6485. cursor back to the parent. Any prefix argument given to this
  6486. command is passed on to the @code{org-refile} command.
  6487. @item @kbd{C-c C-k} (@code{org-capture-kill})
  6488. @kindex C-c C-k @r{(Capture buffer)}
  6489. @findex org-capture-kill
  6490. Abort the capture process and return to the previous state.
  6491. @end table
  6492. @kindex k c @r{(Agenda)}
  6493. You can also call @code{org-capture} in a special way from the agenda,
  6494. using the @kbd{k c} key combination. With this access, any
  6495. timestamps inserted by the selected capture template defaults to the
  6496. cursor date in the agenda, rather than to the current date.
  6497. To find the locations of the last stored capture, use @code{org-capture}
  6498. with prefix commands:
  6499. @table @asis
  6500. @item @kbd{C-u M-x org-capture}
  6501. Visit the target location of a capture template. You get to
  6502. select the template in the usual way.
  6503. @item @kbd{C-u C-u M-x org-capture}
  6504. Visit the last stored capture item in its buffer.
  6505. @end table
  6506. @vindex org-capture-bookmark
  6507. @vindex org-capture-last-stored
  6508. You can also jump to the bookmark @code{org-capture-last-stored}, which is
  6509. automatically created unless you set @code{org-capture-bookmark} to @code{nil}.
  6510. To insert the capture at point in an Org buffer, call @code{org-capture}
  6511. with a @code{C-0} prefix argument.
  6512. @node Capture templates
  6513. @subsection Capture templates
  6514. @cindex templates, for Capture
  6515. You can use templates for different types of capture items, and for
  6516. different target locations. The easiest way to create such templates
  6517. is through the customize interface.
  6518. @table @asis
  6519. @item @kbd{C}
  6520. @kindex C @r{(Capture menu}
  6521. @vindex org-capture-templates
  6522. Customize the variable @code{org-capture-templates}.
  6523. @end table
  6524. Before we give the formal description of template definitions, let's
  6525. look at an example. Say you would like to use one template to create
  6526. general TODO entries, and you want to put these entries under the
  6527. heading @samp{Tasks} in your file @samp{~/org/gtd.org}. Also, a date tree in
  6528. the file @samp{journal.org} should capture journal entries. A possible
  6529. configuration would look like:
  6530. @lisp
  6531. (setq org-capture-templates
  6532. '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
  6533. "* TODO %?\n %i\n %a")
  6534. ("j" "Journal" entry (file+datetree "~/org/journal.org")
  6535. "* %?\nEntered on %U\n %i\n %a")))
  6536. @end lisp
  6537. @noindent
  6538. If you then press @kbd{t} from the capture menu, Org will prepare
  6539. the template for you like this:
  6540. @example
  6541. * TODO
  6542. [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
  6543. @end example
  6544. @noindent
  6545. During expansion of the template, @code{%a} has been replaced by a link to
  6546. the location from where you called the capture command. This can be
  6547. extremely useful for deriving tasks from emails, for example. You
  6548. fill in the task definition, press @kbd{C-c C-c} and Org returns
  6549. you to the same place where you started the capture process.
  6550. To define special keys to capture to a particular template without
  6551. going through the interactive template selection, you can create your
  6552. key binding like this:
  6553. @lisp
  6554. (define-key global-map "\C-cx"
  6555. (lambda () (interactive) (org-capture nil "x")))
  6556. @end lisp
  6557. @menu
  6558. * Template elements:: What is needed for a complete template entry.
  6559. * Template expansion:: Filling in information about time and context.
  6560. * Templates in contexts:: Only show a template in a specific context.
  6561. @end menu
  6562. @node Template elements
  6563. @subsubsection Template elements
  6564. Now lets look at the elements of a template definition. Each entry in
  6565. @code{org-capture-templates} is a list with the following items:
  6566. @table @asis
  6567. @item keys
  6568. The keys that selects the template, as a string, characters only,
  6569. for example @samp{"a"}, for a template to be selected with a single
  6570. key, or @samp{"bt"} for selection with two keys. When using several
  6571. keys, keys using the same prefix key must be sequential in the
  6572. list and preceded by a 2-element entry explaining the prefix key,
  6573. for example:
  6574. @lisp
  6575. ("b" "Templates for marking stuff to buy")
  6576. @end lisp
  6577. @noindent
  6578. If you do not define a template for the @kbd{C} key, this
  6579. key opens the Customize buffer for this complex variable.
  6580. @item description
  6581. A short string describing the template, shown during selection.
  6582. @item type
  6583. The type of entry, a symbol. Valid values are:
  6584. @table @asis
  6585. @item @code{entry}
  6586. An Org mode node, with a headline. Will be filed as the child
  6587. of the target entry or as a top-level entry. The target file
  6588. should be an Org file.
  6589. @item @code{item}
  6590. A plain list item, placed in the first plain list at the
  6591. target location. Again the target file should be an Org
  6592. file.
  6593. @item @code{checkitem}
  6594. A checkbox item. This only differs from the plain list item
  6595. by the default template.
  6596. @item @code{table-line}
  6597. A new line in the first table at the target location. Where
  6598. exactly the line will be inserted depends on the properties
  6599. @code{:prepend} and @code{:table-line-pos} (see below).
  6600. @item @code{plain}
  6601. Text to be inserted as it is.
  6602. @end table
  6603. @item target
  6604. @vindex org-default-notes-file
  6605. @vindex org-directory
  6606. Specification of where the captured item should be placed. In
  6607. Org files, targets usually define a node. Entries will become
  6608. children of this node. Other types will be added to the table or
  6609. list in the body of this node. Most target specifications
  6610. contain a file name. If that file name is the empty string, it
  6611. defaults to @code{org-default-notes-file}. A file can also be given
  6612. as a variable or as a function called with no argument. When an
  6613. absolute path is not specified for a target, it is taken as
  6614. relative to @code{org-directory}.
  6615. Valid values are:
  6616. @table @asis
  6617. @item @samp{(file "path/to/file")}
  6618. Text will be placed at the beginning or end of that file.
  6619. @item @samp{(id "id of existing org entry")}
  6620. Filing as child of this entry, or in the body of the entry.
  6621. @item @samp{(file+headline "filename" "node headline")}
  6622. Fast configuration if the target heading is unique in the file.
  6623. @item @samp{(file+olp "filename" "Level 1 heading" "Level 2" ...)}
  6624. For non-unique headings, the full path is safer.
  6625. @item @samp{(file+regexp "filename" "regexp to find location")}
  6626. Use a regular expression to position the cursor.
  6627. @item @samp{(file+olp+datetree "filename" [ "Level 1 heading" ...])}
  6628. This target@footnote{Org used to offer four different targets for date/week tree
  6629. capture. Now, Org automatically translates these to use
  6630. @code{file+olp+datetree}, applying the @code{:time-prompt} and @code{:tree-type}
  6631. properties. Please rewrite your date/week-tree targets using
  6632. @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
  6633. level, months or ISO weeks as sublevels and then dates on the lowest
  6634. level. Tags are allowed in the tree structure.} for
  6635. today's date. If the optional outline path is given, the tree
  6636. will be built under the node it is pointing to, instead of at
  6637. top level. Check out the @code{:time-prompt} and @code{:tree-type}
  6638. properties below for additional options.
  6639. @item @code{(file+function "filename" function-finding-location)}
  6640. A function to find the right location in the file.
  6641. @item @code{(clock)}
  6642. File to the entry that is currently being clocked.
  6643. @item @code{(function function-finding-location)}
  6644. Most general way: write your own function which both visits the
  6645. file and moves point to the right location.
  6646. @end table
  6647. @item template
  6648. The template for creating the capture item. If you leave this
  6649. empty, an appropriate default template will be used. Otherwise
  6650. this is a string with escape codes, which will be replaced
  6651. depending on time and context of the capture call. The string
  6652. with escapes may be loaded from a template file, using the
  6653. special syntax @samp{(file "template filename")}. See below for more
  6654. details.
  6655. @item properties
  6656. The rest of the entry is a property list of additional options.
  6657. Recognized properties are:
  6658. @table @asis
  6659. @item @code{:prepend}
  6660. Normally new captured information will be appended at the
  6661. target location (last child, last table line, last list item,
  6662. @dots{}). Setting this property changes that.
  6663. @item @code{:immediate-finish}
  6664. When set, do not offer to edit the information, just file it
  6665. away immediately. This makes sense if the template only needs
  6666. information that can be added automatically.
  6667. @item @code{:empty-lines}
  6668. Set this to the number of lines to insert before and after the
  6669. new item. Default 0, and the only other common value is 1.
  6670. @item @code{:clock-in}
  6671. Start the clock in this item.
  6672. @item @code{:clock-keep}
  6673. Keep the clock running when filing the captured entry.
  6674. @item @code{:clock-resume}
  6675. If starting the capture interrupted a clock, restart that clock
  6676. when finished with the capture. Note that @code{:clock-keep} has
  6677. precedence over @code{:clock-resume}. When setting both to
  6678. non-@code{nil}, the current clock will run and the previous one will
  6679. not be resumed.
  6680. @item @code{:time-prompt}
  6681. Prompt for a date/time to be used for date/week trees and when
  6682. filling the template. Without this property, capture uses the
  6683. current date and time. Even if this property has not been set,
  6684. you can force the same behavior by calling @code{org-capture} with
  6685. a @kbd{C-1} prefix argument.
  6686. @item @code{:tree-type}
  6687. When @code{week}, make a week tree instead of the month tree, i.e.,
  6688. place the headings for each day under a heading with the
  6689. current ISO week.
  6690. @item @code{:unnarrowed}
  6691. Do not narrow the target buffer, simply show the full buffer. Default
  6692. is to narrow it so that you only see the new material.
  6693. @item @code{:table-line-pos}
  6694. Specification of the location in the table where the new line
  6695. should be inserted. It should be a string like @samp{II-3} meaning
  6696. that the new line should become the third line before the
  6697. second horizontal separator line.
  6698. @item @code{:kill-buffer}
  6699. If the target file was not yet visited when capture was invoked, kill
  6700. the buffer again after capture is completed.
  6701. @end table
  6702. @end table
  6703. @node Template expansion
  6704. @subsubsection Template expansion
  6705. In the template itself, special ``%-escapes''@footnote{If you need one of these sequences literally, escape the @samp{%}
  6706. with a backslash.} allow dynamic
  6707. insertion of content. The templates are expanded in the order given
  6708. here:
  6709. @table @asis
  6710. @item @code{%[FILE]}
  6711. Insert the contents of the file given by @var{FILE}.
  6712. @item @code{%(SEXP)}
  6713. Evaluate Elisp SEXP and replace with the result. The
  6714. @var{SEXP} must return a string.
  6715. @item @code{%<FORMAT>}
  6716. The result of format-time-string on the @var{FORMAT}
  6717. specification.
  6718. @item @code{%t}
  6719. Timestamp, date only.
  6720. @item @code{%T}
  6721. Timestamp, with date and time.
  6722. @item @code{%u}, @code{%U}
  6723. Like @code{%t}, @code{%T} above, but inactive timestamps.
  6724. @item @code{%i}
  6725. Initial content, the region when capture is called while the
  6726. region is active. The entire text will be indented like @code{%i}
  6727. itself.
  6728. @item @code{%a}
  6729. Annotation, normally the link created with @code{org-store-link}.
  6730. @item @code{%A}
  6731. Like @code{%a}, but prompt for the description part.
  6732. @item @code{%l}
  6733. Like @code{%a}, but only insert the literal link.
  6734. @item @code{%c}
  6735. Current kill ring head.
  6736. @item @code{%x}
  6737. Content of the X clipboard.
  6738. @item @code{%k}
  6739. Title of the currently clocked task.
  6740. @item @code{%K}
  6741. Link to the currently clocked task.
  6742. @item @code{%n}
  6743. User name (taken from @code{user-full-name}).
  6744. @item @code{%f}
  6745. File visited by current buffer when org-capture was called.
  6746. @item @code{%F}
  6747. Full path of the file or directory visited by current buffer.
  6748. @item @code{%:keyword}
  6749. Specific information for certain link types, see below.
  6750. @item @code{%^g}
  6751. Prompt for tags, with completion on tags in target file.
  6752. @item @code{%^G}
  6753. Prompt for tags, with completion all tags in all agenda files.
  6754. @item @code{%^t}
  6755. Like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}. You may
  6756. define a prompt like @code{%^@{Birthday@}t}.
  6757. @item @code{%^C}
  6758. Interactive selection of which kill or clip to use.
  6759. @item @code{%^L}
  6760. Like @code{%^C}, but insert as link.
  6761. @item @code{%^@{PROP@}p}
  6762. Prompt the user for a value for property PROP.
  6763. @item @code{%^@{PROMPT@}}
  6764. Prompt the user for a string and replace this sequence with it.
  6765. You may specify a default value and a completion table with
  6766. @code{%^@{prompt|default|completion2|completion3...@}}. The arrow keys
  6767. access a prompt-specific history.
  6768. @item @code{%\n}
  6769. Insert the text entered at the Nth @code{%^@{PROMPT@}}, where N is
  6770. a number, starting from 1.
  6771. @item @code{%?}
  6772. After completing the template, position cursor here.
  6773. @end table
  6774. @noindent
  6775. @vindex org-store-link-props
  6776. 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
  6777. accessed in capture templates in a similar way.}:
  6778. @vindex org-from-is-user-regexp
  6779. @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  6780. @headitem Link type
  6781. @tab Available keywords
  6782. @item bbdb
  6783. @tab @code{%:name}, @code{%:company}
  6784. @item irc
  6785. @tab @code{%:server}, @code{%:port}, @code{%:nick}
  6786. @item mh, rmail
  6787. @tab @code{%:type}, @code{%:subject}, @code{%:message-id}
  6788. @item
  6789. @tab @code{%:from}, @code{%:fromname}, @code{%:fromaddress}
  6790. @item
  6791. @tab @code{%:to}, @code{%:toname}, @code{%:toaddress}
  6792. @item
  6793. @tab @code{%:date} (message date header field)
  6794. @item
  6795. @tab @code{%:date-timestamp} (date as active timestamp)
  6796. @item
  6797. @tab @code{%:date-timestamp-inactive} (date as inactive timestamp)
  6798. @item
  6799. @tab @code{%:fromto} (either ``to NAME'' or ``from NAME'')@footnote{This is always the other, not the user. See the variable
  6800. @code{org-from-is-user-regexp}.}
  6801. @item gnus
  6802. @tab @code{%:group}, for messages also all email fields
  6803. @item w3, w3m
  6804. @tab @code{%:url}
  6805. @item info
  6806. @tab @code{%:file}, @code{%:node}
  6807. @item calendar
  6808. @tab @code{%:date}
  6809. @item org-protocol
  6810. @tab @code{%:link}, @code{%:description}, @code{%:annotation}
  6811. @end multitable
  6812. @node Templates in contexts
  6813. @subsubsection Templates in contexts
  6814. @vindex org-capture-templates-contexts
  6815. To control whether a capture template should be accessible from
  6816. a specific context, you can customize
  6817. @code{org-capture-templates-contexts}. Let's say, for example, that you
  6818. have a capture template ``p'' for storing Gnus emails containing
  6819. patches. Then you would configure this option like this:
  6820. @lisp
  6821. (setq org-capture-templates-contexts
  6822. '(("p" (in-mode . "message-mode"))))
  6823. @end lisp
  6824. You can also tell that the command key @kbd{p} should refer to
  6825. another template. In that case, add this command key like this:
  6826. @lisp
  6827. (setq org-capture-templates-contexts
  6828. '(("p" "q" (in-mode . "message-mode"))))
  6829. @end lisp
  6830. See the docstring of the variable for more information.
  6831. @node Attachments
  6832. @section Attachments
  6833. @cindex attachments
  6834. @vindex org-attach-directory
  6835. It is often useful to associate reference material with an outline
  6836. node/task. Small chunks of plain text can simply be stored in the
  6837. subtree of a project. Hyperlinks (see @ref{Hyperlinks}) can establish
  6838. associations with files that live elsewhere on your computer or in the
  6839. cloud, like emails or source code files belonging to a project.
  6840. Another method is @emph{attachments}, which are files located in
  6841. a directory belonging to an outline node. Org uses directories named
  6842. by the unique ID of each entry. These directories are located in the
  6843. @code{data} directory which lives in the same directory where your Org file
  6844. lives@footnote{If you move entries or Org files from one directory to
  6845. another, you may want to configure @code{org-attach-directory} to contain
  6846. an absolute path.}. If you initialize this directory with @samp{git init}, Org
  6847. automatically commits changes when it sees them. The attachment
  6848. system has been contributed to Org by John Wiegley.
  6849. In cases where it seems better to do so, you can attach a directory of
  6850. your choice to an entry. You can also make children inherit the
  6851. attachment directory from a parent, so that an entire subtree uses the
  6852. same attached directory.
  6853. @noindent
  6854. The following commands deal with attachments:
  6855. @table @asis
  6856. @item @kbd{C-c C-a} (@code{org-attach})
  6857. @kindex C-c C-a
  6858. @findex org-attach
  6859. The dispatcher for commands related to the attachment system.
  6860. After these keys, a list of commands is displayed and you must
  6861. press an additional key to select a command:
  6862. @table @asis
  6863. @item @kbd{a} (@code{org-attach-attach})
  6864. @kindex C-c C-a a
  6865. @findex org-attach-attach
  6866. @vindex org-attach-method
  6867. Select a file and move it into the task's attachment
  6868. directory. The file is copied, moved, or linked, depending
  6869. on @code{org-attach-method}. Note that hard links are not
  6870. supported on all systems.
  6871. @item @kbd{c}/@kbd{m}/@kbd{l}
  6872. @kindex C-c C-a c
  6873. @kindex C-c C-a m
  6874. @kindex C-c C-a l
  6875. Attach a file using the copy/move/link method. Note that
  6876. hard links are not supported on all systems.
  6877. @item @kbd{n} (@code{org-attach-new})
  6878. @kindex C-c C-a n
  6879. @findex org-attach-new
  6880. Create a new attachment as an Emacs buffer.
  6881. @item @kbd{z} (@code{org-attach-sync})
  6882. @kindex C-c C-a z
  6883. @findex org-attach-sync
  6884. Synchronize the current task with its attachment directory, in case
  6885. you added attachments yourself.
  6886. @item @kbd{o} (@code{org-attach-open})
  6887. @kindex C-c C-a o
  6888. @findex org-attach-open
  6889. @vindex org-file-apps
  6890. Open current task's attachment. If there is more than one,
  6891. prompt for a file name first. Opening follows the rules set
  6892. by @code{org-file-apps}. For more details, see the information
  6893. on following hyperlinks (see @ref{Handling Links}).
  6894. @item @kbd{O} (@code{org-attach-open-in-emacs})
  6895. @kindex C-c C-a O
  6896. @findex org-attach-open-in-emacs
  6897. Also open the attachment, but force opening the file in
  6898. Emacs.
  6899. @item @kbd{f} (@code{org-attach-reveal})
  6900. @kindex C-c C-a f
  6901. @findex org-attach-reveal
  6902. Open the current task's attachment directory.
  6903. @item @kbd{F} (@code{org-attach-reveal-in-emacs})
  6904. @kindex C-c C-a F
  6905. @findex org-attach-reveal-in-emacs
  6906. Also open the directory, but force using Dired in Emacs.
  6907. @item @kbd{d} (@code{org-attach-delete-one})
  6908. @kindex C-c C-a d
  6909. Select and delete a single attachment.
  6910. @item @kbd{D} (@code{org-attach-delete-all})
  6911. @kindex C-c C-a D
  6912. Delete all of a task's attachments. A safer way is to open
  6913. the directory in Dired and delete from there.
  6914. @item @kbd{s} (@code{org-attach-set-directory})
  6915. @kindex C-c C-a s
  6916. @cindex @samp{ATTACH_DIR}, property
  6917. Set a specific directory as the entry's attachment
  6918. directory. This works by putting the directory path into
  6919. the @samp{ATTACH_DIR} property.
  6920. @item @kbd{i} (@code{org-attach-set-inherit})
  6921. @kindex C-c C-a i
  6922. @cindex @samp{ATTACH_DIR_INHERIT}, property
  6923. Set the @samp{ATTACH_DIR_INHERIT} property, so that children use
  6924. the same directory for attachments as the parent does.
  6925. @end table
  6926. @end table
  6927. @cindex attach from Dired
  6928. @findex org-attach-dired-to-subtree
  6929. It is possible to attach files to a subtree from a Dired buffer. To
  6930. use this feature, have one window in Dired mode containing the file(s)
  6931. to be attached and another window with point in the subtree that shall
  6932. get the attachments. In the Dired window, with point on a file,
  6933. @kbd{M-x org-attach-dired-to-subtree} attaches the file to the
  6934. subtree using the attachment method set by variable
  6935. @code{org-attach-method}. When files are marked in the Dired window then
  6936. all marked files get attached.
  6937. Add the following lines to the Emacs init file to have @kbd{C-c C-x a} attach files in Dired buffers.
  6938. @lisp
  6939. (add-hook 'dired-mode-hook
  6940. (lambda ()
  6941. (define-key dired-mode-map
  6942. (kbd "C-c C-x a")
  6943. #'org-attach-dired-to-subtree))))
  6944. @end lisp
  6945. The following code shows how to bind the previous command with
  6946. a specific attachment method.
  6947. @lisp
  6948. (add-hook 'dired-mode-hook
  6949. (lambda ()
  6950. (define-key dired-mode-map (kbd "C-c C-x c")
  6951. (lambda ()
  6952. (interactive)
  6953. (let ((org-attach-method 'cp))
  6954. (call-interactively #'org-attach-dired-to-subtree))))))
  6955. @end lisp
  6956. @node RSS Feeds
  6957. @section RSS Feeds
  6958. @cindex RSS feeds
  6959. @cindex Atom feeds
  6960. Org can add and change entries based on information found in RSS feeds
  6961. and Atom feeds. You could use this to make a task out of each new
  6962. podcast in a podcast feed. Or you could use a phone-based
  6963. note-creating service on the web to import tasks into Org. To access
  6964. feeds, configure the variable @code{org-feed-alist}. The docstring of this
  6965. variable has detailed information. With the following
  6966. @lisp
  6967. (setq org-feed-alist
  6968. '(("Slashdot"
  6969. "http://rss.slashdot.org/Slashdot/slashdot"
  6970. "~/txt/org/feeds.org" "Slashdot Entries")))
  6971. @end lisp
  6972. @noindent
  6973. new items from the feed provided by @samp{rss.slashdot.org} result in new
  6974. entries in the file @samp{~/org/feeds.org} under the heading @samp{Slashdot
  6975. Entries}, whenever the following command is used:
  6976. @table @asis
  6977. @item @kbd{C-c C-x g} (@code{org-feed-update-all})
  6978. @kindex C-c C-x g
  6979. Collect items from the feeds configured in @code{org-feed-alist} and
  6980. act upon them.
  6981. @item @kbd{C-c C-x G} (@code{org-feed-goto-inbox})
  6982. @kindex C-c C-x G
  6983. Prompt for a feed name and go to the inbox configured for this feed.
  6984. @end table
  6985. Under the same headline, Org creates a drawer @samp{FEEDSTATUS} in which it
  6986. stores information about the status of items in the feed, to avoid
  6987. adding the same item several times.
  6988. For more information, including how to read atom feeds, see
  6989. @samp{org-feed.el} and the docstring of @code{org-feed-alist}.
  6990. @node Protocols
  6991. @section Protocols for External Access
  6992. @cindex protocols, for external access
  6993. Org protocol is a means to trigger custom actions in Emacs from
  6994. external applications. Any application that supports calling external
  6995. programs with an URL as argument may be used with this functionality.
  6996. For example, you can configure bookmarks in your web browser to send
  6997. a link to the current page to Org and create a note from it using
  6998. capture (see @ref{Capture}). You can also create a bookmark that tells
  6999. Emacs to open the local source file of a remote website you are
  7000. browsing.
  7001. @cindex Org protocol, set-up
  7002. @cindex Installing Org protocol
  7003. In order to use Org protocol from an application, you need to register
  7004. @samp{org-protocol://} as a valid scheme-handler. External calls are
  7005. passed to Emacs through the @samp{emacsclient} command, so you also need to
  7006. ensure an Emacs server is running. More precisely, when the
  7007. application calls
  7008. @example
  7009. emacsclient org-protocol://PROTOCOL?key1=val1&key2=val2
  7010. @end example
  7011. @noindent
  7012. Emacs calls the handler associated to @var{PROTOCOL} with
  7013. argument @samp{(:key1 val1 :key2 val2)}.
  7014. @cindex protocol, new protocol
  7015. @cindex defining new protocols
  7016. Org protocol comes with three predefined protocols, detailed in the
  7017. following sections. Configure @code{org-protocol-protocol-alist} to define
  7018. your own.
  7019. @menu
  7020. * @code{store-link} protocol:: Store a link, push URL to kill-ring.
  7021. * @code{capture} protocol:: Fill a buffer with external information.
  7022. * @code{open-source} protocol:: Edit published contents.
  7023. @end menu
  7024. @node @code{store-link} protocol
  7025. @subsection @code{store-link} protocol
  7026. @cindex store-link protocol
  7027. @cindex protocol, store-link
  7028. Using @code{store-link} handler, you can copy links, insertable through
  7029. @kbd{M-x org-insert-link} or yanking thereafter. More precisely,
  7030. the command
  7031. @example
  7032. emacsclient org-protocol://store-link?url=URL&title=TITLE
  7033. @end example
  7034. @noindent
  7035. stores the following link:
  7036. @example
  7037. [[URL][TITLE]]
  7038. @end example
  7039. In addition, @var{URL} is pushed on the kill-ring for yanking.
  7040. You need to encode @var{URL} and @var{TITLE} if they contain
  7041. slashes, and probably quote those for the shell.
  7042. To use this feature from a browser, add a bookmark with an arbitrary
  7043. name, e.g., @samp{Org: store-link} and enter this as @emph{Location}:
  7044. @example
  7045. javascript:location.href='org-protocol://store-link?url='+
  7046. encodeURIComponent(location.href);
  7047. @end example
  7048. @node @code{capture} protocol
  7049. @subsection @code{capture} protocol
  7050. @cindex capture protocol
  7051. @cindex protocol, capture
  7052. Activating ``capture'' handler pops up a @samp{Capture} buffer and fills the
  7053. capture template associated to the @samp{X} key with them.
  7054. @example
  7055. emacsclient org-protocol://capture?template=X?url=URL?title=TITLE?body=BODY
  7056. @end example
  7057. To use this feature, add a bookmark with an arbitrary name, e.g.
  7058. @samp{Org: capture} and enter this as @samp{Location}:
  7059. @example
  7060. javascript:location.href='org-protocol://capture?template=x'+
  7061. '&url='+encodeURIComponent(window.location.href)+
  7062. '&title='+encodeURIComponent(document.title)+
  7063. '&body='+encodeURIComponent(window.getSelection());
  7064. @end example
  7065. @vindex org-protocol-default-template-key
  7066. The result depends on the capture template used, which is set in the
  7067. bookmark itself, as in the example above, or in
  7068. @code{org-protocol-default-template-key}.
  7069. The following template placeholders are available:
  7070. @example
  7071. %:link The URL
  7072. %:description The webpage title
  7073. %:annotation Equivalent to [[%:link][%:description]]
  7074. %i The selected text
  7075. @end example
  7076. @node @code{open-source} protocol
  7077. @subsection @code{open-source} protocol
  7078. @cindex open-source protocol
  7079. @cindex protocol, open-source
  7080. The @code{open-source} handler is designed to help with editing local
  7081. sources when reading a document. To that effect, you can use
  7082. a bookmark with the following location:
  7083. @example
  7084. javascript:location.href='org-protocol://open-source?&url='+
  7085. encodeURIComponent(location.href)
  7086. @end example
  7087. @vindex org-protocol-project-alist
  7088. The variable @code{org-protocol-project-alist} maps URLs to local file
  7089. names, by stripping URL parameters from the end and replacing the
  7090. @code{:base-url} with @code{:working-directory} and @code{:online-suffix} with
  7091. @code{:working-suffix}. For example, assuming you own a local copy of
  7092. @samp{https://orgmode.org/worg/} contents at @samp{/home/user/worg}, you can set
  7093. @code{org-protocol-project-alist} to the following
  7094. @lisp
  7095. (setq org-protocol-project-alist
  7096. '(("Worg"
  7097. :base-url "https://orgmode.org/worg/"
  7098. :working-directory "/home/user/worg/"
  7099. :online-suffix ".html"
  7100. :working-suffix ".org")))
  7101. @end lisp
  7102. @noindent
  7103. If you are now browsing
  7104. @samp{https://orgmode.org/worg/org-contrib/org-protocol.html} and find
  7105. a typo or have an idea about how to enhance the documentation, simply
  7106. click the bookmark and start editing.
  7107. @cindex rewritten URL in open-source protocol
  7108. @cindex protocol, open-source rewritten URL
  7109. However, such mapping may not yield the desired results. Suppose you
  7110. maintain an online store located at @samp{http://example.com/}. The local
  7111. sources reside in @samp{/home/user/example/}. It is common practice to
  7112. serve all products in such a store through one file and rewrite URLs
  7113. that do not match an existing file on the server. That way, a request
  7114. to @samp{http://example.com/print/posters.html} might be rewritten on the
  7115. server to something like
  7116. @samp{http://example.com/shop/products.php/posters.html.php}. The
  7117. @code{open-source} handler probably cannot find a file named
  7118. @samp{/home/user/example/print/posters.html.php} and fails.
  7119. Such an entry in @code{org-protocol-project-alist} may hold an additional
  7120. property @code{:rewrites}. This property is a list of cons cells, each of
  7121. which maps a regular expression to a path relative to the
  7122. @code{:working-directory}.
  7123. Now map the URL to the path @samp{/home/user/example/products.php} by
  7124. adding @code{:rewrites} rules like this:
  7125. @lisp
  7126. (setq org-protocol-project-alist
  7127. '(("example.com"
  7128. :base-url "http://example.com/"
  7129. :working-directory "/home/user/example/"
  7130. :online-suffix ".php"
  7131. :working-suffix ".php"
  7132. :rewrites (("example.com/print/" . "products.php")
  7133. ("example.com/$" . "index.php")))))
  7134. @end lisp
  7135. @noindent
  7136. Since @samp{example.com/$} is used as a regular expression, it maps
  7137. @samp{http://example.com/}, @samp{https://example.com},
  7138. @samp{http://www.example.com/} and similar to
  7139. @samp{/home/user/example/index.php}.
  7140. The @code{:rewrites} rules are searched as a last resort if and only if no
  7141. existing file name is matched.
  7142. @cindex protocol, open-source, set-up mapping
  7143. @cindex mappings in open-source protocol
  7144. @findex org-protocol-create
  7145. @findex org-protocol-create-for-org
  7146. Two functions can help you filling @code{org-protocol-project-alist} with
  7147. valid contents: @code{org-protocol-create} and
  7148. @code{org-protocol-create-for-org}. The latter is of use if you're editing
  7149. an Org file that is part of a publishing project.
  7150. @node Refile and Copy
  7151. @section Refile and Copy
  7152. @cindex refiling notes
  7153. @cindex copying notes
  7154. When reviewing the captured data, you may want to refile or to copy
  7155. some of the entries into a different list, for example into a project.
  7156. Cutting, finding the right location, and then pasting the note is
  7157. cumbersome. To simplify this process, you can use the following
  7158. special command:
  7159. @table @asis
  7160. @item @kbd{C-c M-w} (@code{org-copy})
  7161. @kindex C-c M-w
  7162. @findex org-copy
  7163. Copying works like refiling, except that the original note is not
  7164. deleted.
  7165. @item @kbd{C-c C-w} (@code{org-refile})
  7166. @kindex C-c C-w
  7167. @findex org-refile
  7168. @vindex org-reverse-note-order
  7169. @vindex org-refile-targets
  7170. @vindex org-refile-use-outline-path
  7171. @vindex org-outline-path-complete-in-steps
  7172. @vindex org-refile-allow-creating-parent-nodes
  7173. @vindex org-log-refile
  7174. Refile the entry or region at point. This command offers
  7175. possible locations for refiling the entry and lets you select one
  7176. with completion. The item (or all items in the region) is filed
  7177. below the target heading as a subitem. Depending on
  7178. @code{org-reverse-note-order}, it is either the first or last subitem.
  7179. By default, all level 1 headlines in the current buffer are
  7180. considered to be targets, but you can have more complex
  7181. definitions across a number of files. See the variable
  7182. @code{org-refile-targets} for details. If you would like to select
  7183. a location via a file-path-like completion along the outline
  7184. path, see the variables @code{org-refile-use-outline-path} and
  7185. @code{org-outline-path-complete-in-steps}. If you would like to be
  7186. able to create new nodes as new parents for refiling on the fly,
  7187. check the variable @code{org-refile-allow-creating-parent-nodes}.
  7188. When the variable @code{org-log-refile}@footnote{Note the corresponding @samp{STARTUP} options @samp{logrefile},
  7189. @samp{lognoterefile}, and @samp{nologrefile}.} is set, a timestamp or
  7190. a note is recorded whenever an entry is refiled.
  7191. @item @kbd{C-u C-c C-w}
  7192. @kindex C-u C-c C-w
  7193. Use the refile interface to jump to a heading.
  7194. @item @kbd{C-u C-u C-c C-w} (@code{org-refile-goto-last-stored})
  7195. @kindex C-u C-u C-c C-w
  7196. @findex org-refile-goto-last-stored
  7197. Jump to the location where @code{org-refile} last moved a tree to.
  7198. @item @kbd{C-2 C-c C-w}
  7199. @kindex C-2 C-c C-w
  7200. Refile as the child of the item currently being clocked.
  7201. @item @kbd{C-3 C-c C-w}
  7202. @kindex C-3 C-c C-w
  7203. @vindex org-refile-keep
  7204. Refile and keep the entry in place. Also see @code{org-refile-keep}
  7205. to make this the default behavior, and beware that this may
  7206. result in duplicated @code{ID} properties.
  7207. @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})
  7208. @kindex C-u C-u C-u C-c C-w
  7209. @kindex C-0 C-c C-w
  7210. @findex org-refile-cache-clear
  7211. @vindex org-refile-use-cache
  7212. Clear the target cache. Caching of refile targets can be turned
  7213. on by setting @code{org-refile-use-cache}. To make the command see
  7214. new possible targets, you have to clear the cache with this
  7215. command.
  7216. @end table
  7217. @node Archiving
  7218. @section Archiving
  7219. @cindex archiving
  7220. When a project represented by a (sub)tree is finished, you may want to
  7221. move the tree out of the way and to stop it from contributing to the
  7222. agenda. Archiving is important to keep your working files compact and
  7223. global searches like the construction of agenda views fast.
  7224. @table @asis
  7225. @item @kbd{C-c C-x C-a} (@code{org-archive-subtree-default})
  7226. @kindex C-c C-x C-a
  7227. @findex org-archive-subtree-default
  7228. @vindex org-archive-default-command
  7229. Archive the current entry using the command specified in the
  7230. variable @code{org-archive-default-command}.
  7231. @end table
  7232. @menu
  7233. * Moving subtrees:: Moving a tree to an archive file.
  7234. * Internal archiving:: Switch off a tree but keep it in the file.
  7235. @end menu
  7236. @node Moving subtrees
  7237. @subsection Moving a tree to an archive file
  7238. @cindex external archiving
  7239. The most common archiving action is to move a project tree to another
  7240. file, the archive file.
  7241. @table @asis
  7242. @item @kbd{C-c C-x C-s} or short @kbd{C-c $} (@code{org-archive-subtree})
  7243. @kindex C-c C-x C-s
  7244. @kindex C-c $
  7245. @findex org-archive-subtree
  7246. @vindex org-archive-location
  7247. Archive the subtree starting at the cursor position to the
  7248. location given by @code{org-archive-location}.
  7249. @item @kbd{C-u C-c C-x C-s}
  7250. @kindex C-u C-c C-x C-s
  7251. Check if any direct children of the current headline could be
  7252. moved to the archive. To do this, check each subtree for open
  7253. TODO entries. If none is found, the command offers to move it to
  7254. the archive location. If the cursor is @emph{not} on a headline when
  7255. this command is invoked, check level 1 trees.
  7256. @item @kbd{C-u C-u C-c C-x C-s}
  7257. @kindex C-u C-u C-c C-x C-s
  7258. As above, but check subtree for timestamps instead of TODO
  7259. entries. The command offers to archive the subtree if it @emph{does}
  7260. contain a timestamp, and that timestamp is in the past.
  7261. @end table
  7262. @cindex archive locations
  7263. The default archive location is a file in the same directory as the
  7264. current file, with the name derived by appending @samp{_archive} to the
  7265. current file name. You can also choose what heading to file archived
  7266. items under, with the possibility to add them to a datetree in a file.
  7267. For information and examples on how to specify the file and the
  7268. heading, see the documentation string of the variable
  7269. @code{org-archive-location}.
  7270. There is also an in-buffer option for setting this variable, for
  7271. example:
  7272. @cindex @samp{ARCHIVE}, keyword
  7273. @example
  7274. #+ARCHIVE: %s_done::
  7275. @end example
  7276. @noindent
  7277. @cindex ARCHIVE, property
  7278. If you would like to have a special archive location for a single
  7279. entry or a (sub)tree, give the entry an @samp{ARCHIVE} property with the
  7280. location as the value (see @ref{Properties and Columns}).
  7281. @vindex org-archive-save-context-info
  7282. When a subtree is moved, it receives a number of special properties
  7283. that record context information like the file from where the entry
  7284. came, its outline path the archiving time etc. Configure the variable
  7285. @code{org-archive-save-context-info} to adjust the amount of information
  7286. added.
  7287. @node Internal archiving
  7288. @subsection Internal archiving
  7289. @cindex @samp{ARCHIVE}, tag
  7290. If you want to just switch off---for agenda views---certain subtrees
  7291. without moving them to a different file, you can use the @samp{ARCHIVE}
  7292. tag.
  7293. A headline that is marked with the @samp{ARCHIVE} tag (see @ref{Tags}) stays at
  7294. its location in the outline tree, but behaves in the following way:
  7295. @itemize
  7296. @item
  7297. @vindex org-cycle-open-archived-trees
  7298. It does not open when you attempt to do so with a visibility cycling
  7299. command (see @ref{Visibility Cycling}). You can force cycling archived
  7300. subtrees with @kbd{C-@key{TAB}}, or by setting the option
  7301. @code{org-cycle-open-archived-trees}. Also normal outline commands, like
  7302. @code{outline-show-all}, open archived subtrees.
  7303. @item
  7304. @vindex org-sparse-tree-open-archived-trees
  7305. During sparse tree construction (see @ref{Sparse Trees}), matches in
  7306. archived subtrees are not exposed, unless you configure the option
  7307. @code{org-sparse-tree-open-archived-trees}.
  7308. @item
  7309. @vindex org-agenda-skip-archived-trees
  7310. During agenda view construction (see @ref{Agenda Views}), the content of
  7311. archived trees is ignored unless you configure the option
  7312. @code{org-agenda-skip-archived-trees}, in which case these trees are
  7313. always included. In the agenda you can press @kbd{v a} to get
  7314. archives temporarily included.
  7315. @item
  7316. @vindex org-export-with-archived-trees
  7317. Archived trees are not exported (see @ref{Exporting}), only the headline
  7318. is. Configure the details using the variable
  7319. @code{org-export-with-archived-trees}.
  7320. @item
  7321. @vindex org-columns-skip-archived-trees
  7322. Archived trees are excluded from column view unless the variable
  7323. @code{org-columns-skip-archived-trees} is configured to @code{nil}.
  7324. @end itemize
  7325. The following commands help manage the @samp{ARCHIVE} tag:
  7326. @table @asis
  7327. @item @kbd{C-c C-x a} (@code{org-toggle-archive-tag})
  7328. @kindex C-c C-x a
  7329. @findex org-toggle-archive-tag
  7330. Toggle the archive tag for the current headline. When the tag is
  7331. set, the headline changes to a shadowed face, and the subtree
  7332. below it is hidden.
  7333. @item @kbd{C-u C-c C-x a}
  7334. @kindex C-u C-c C-x a
  7335. Check if any direct children of the current headline should be
  7336. archived. To do this, check each subtree for open TODO entries.
  7337. If none is found, the command offers to set the @samp{ARCHIVE} tag for
  7338. the child. If the cursor is @emph{not} on a headline when this
  7339. command is invoked, check the level 1 trees.
  7340. @item @kbd{C-@key{TAB}}, @code{org-force-cycle-archived}
  7341. @kindex C-TAB
  7342. Cycle a tree even if it is tagged with @samp{ARCHIVE}.
  7343. @item @kbd{C-c C-x A} (@code{org-archive-to-archive-sibling})
  7344. @kindex C-c C-x A
  7345. @findex org-archive-to-archive-sibling
  7346. Move the current entry to the @emph{Archive Sibling}. This is
  7347. a sibling of the entry with the heading @samp{Archive} and the archive
  7348. tag. The entry becomes a child of that sibling and in this way
  7349. retains a lot of its original context, including inherited tags
  7350. and approximate position in the outline.
  7351. @end table
  7352. @node Agenda Views
  7353. @chapter Agenda Views
  7354. @cindex agenda views
  7355. Due to the way Org works, TODO items, time-stamped items, and tagged
  7356. headlines can be scattered throughout a file or even a number of
  7357. files. To get an overview of open action items, or of events that are
  7358. important for a particular date, this information must be collected,
  7359. sorted and displayed in an organized way.
  7360. Org can select items based on various criteria and display them in
  7361. a separate buffer. Seven different view types are provided:
  7362. @itemize
  7363. @item
  7364. an @emph{agenda} that is like a calendar and shows information for
  7365. specific dates,
  7366. @item
  7367. a @emph{TODO list} that covers all unfinished action items,
  7368. @item
  7369. a @emph{match view}, showings headlines based on the tags, properties,
  7370. and TODO state associated with them,
  7371. @item
  7372. a @emph{timeline view} that shows all events in a single Org file, in
  7373. time-sorted view,
  7374. @item
  7375. a @emph{text search view} that shows all entries from multiple files that
  7376. contain specified keywords,
  7377. @item
  7378. a @emph{stuck projects view} showing projects that currently do not move
  7379. along, and
  7380. @item
  7381. @emph{custom views} that are special searches and combinations of
  7382. different views.
  7383. @end itemize
  7384. @noindent
  7385. The extracted information is displayed in a special @emph{agenda buffer}.
  7386. This buffer is read-only, but provides commands to visit the
  7387. corresponding locations in the original Org files, and even to edit
  7388. these files remotely.
  7389. @vindex org-agenda-skip-comment-trees
  7390. @vindex org-agenda-skip-archived-trees
  7391. @cindex commented entries, in agenda views
  7392. @cindex archived entries, in agenda views
  7393. By default, the report ignores commented (see @ref{Comment Lines}) and
  7394. archived (see @ref{Internal archiving}) entries. You can override this by
  7395. setting @code{org-agenda-skip-comment-trees} and
  7396. @code{org-agenda-skip-archived-trees} to @code{nil}.
  7397. @vindex org-agenda-window-setup
  7398. @vindex org-agenda-restore-windows-after-quit
  7399. Two variables control how the agenda buffer is displayed and whether
  7400. the window configuration is restored when the agenda exits:
  7401. @code{org-agenda-window-setup} and @code{org-agenda-restore-windows-after-quit}.
  7402. @menu
  7403. * Agenda Files:: Files being searched for agenda information.
  7404. * Agenda Dispatcher:: Keyboard access to agenda views.
  7405. * Built-in Agenda Views:: What is available out of the box?
  7406. * Presentation and Sorting:: How agenda items are prepared for display.
  7407. * Agenda Commands:: Remote editing of Org trees.
  7408. * Custom Agenda Views:: Defining special searches and views.
  7409. * Exporting Agenda Views:: Writing a view to a file.
  7410. * Agenda Column View:: Using column view for collected entries.
  7411. @end menu
  7412. @node Agenda Files
  7413. @section Agenda Files
  7414. @cindex agenda files
  7415. @cindex files for agenda
  7416. @vindex org-agenda-files
  7417. The information to be shown is normally collected from all @emph{agenda
  7418. 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
  7419. name, then the list of agenda files in maintained in that external
  7420. file.}.
  7421. If a directory is part of this list, all files with the extension
  7422. @samp{.org} in this directory are part of the list.
  7423. Thus, even if you only work with a single Org file, that file should
  7424. be put into the list@footnote{When using the dispatcher, pressing @kbd{<} before
  7425. selecting a command actually limits the command to the current file,
  7426. and ignores @code{org-agenda-files} until the next dispatcher command.}. You can customize @code{org-agenda-files},
  7427. but the easiest way to maintain it is through the following commands
  7428. @table @asis
  7429. @item @kbd{C-c [} (@code{org-agenda-file-to-front})
  7430. @kindex C-c [
  7431. @findex org-agenda-file-to-front
  7432. @cindex files, adding to agenda list
  7433. Add current file to the list of agenda files. The file is added
  7434. to the front of the list. If it was already in the list, it is
  7435. moved to the front. With a prefix argument, file is added/moved
  7436. to the end.
  7437. @item @kbd{C-c ]} (@code{org-remove-file})
  7438. @kindex C-c ]
  7439. @findex org-remove-file
  7440. Remove current file from the list of agenda files.
  7441. @item @kbd{C-'}
  7442. @itemx @kbd{C-,} (@code{org-cycle-agenda-files})
  7443. @kindex C-'
  7444. @kindex C-,
  7445. @findex org-cycle-agenda-files
  7446. @cindex cycling, of agenda files
  7447. Cycle through agenda file list, visiting one file after the other.
  7448. @item @kbd{M-x org-switchb}
  7449. @findex org-switchb
  7450. Command to use an iswitchb-like interface to switch to and
  7451. between Org buffers.
  7452. @end table
  7453. @noindent
  7454. The Org menu contains the current list of files and can be used to
  7455. visit any of them.
  7456. If you would like to focus the agenda temporarily on a file not in
  7457. this list, or on just one file in the list, or even on only a subtree
  7458. in a file, then this can be done in different ways. For a single
  7459. agenda command, you may press @kbd{<} once or several times in
  7460. the dispatcher (see @ref{Agenda Dispatcher}). To restrict the agenda
  7461. scope for an extended period, use the following commands:
  7462. @table @asis
  7463. @item @kbd{C-c C-x <} (@code{org-agenda-set-restriction-lock})
  7464. @kindex C-c C-x <
  7465. @findex org-agenda-set-restriction-lock
  7466. Permanently restrict the agenda to the current subtree. When
  7467. called with a prefix argument, or with the cursor before the
  7468. first headline in a file, set the agenda scope to the entire
  7469. file. This restriction remains in effect until removed with
  7470. @kbd{C-c C-x >}, or by typing either @kbd{<} or
  7471. @kbd{>} in the agenda dispatcher. If there is a window
  7472. displaying an agenda view, the new restriction takes effect
  7473. immediately.
  7474. @item @kbd{C-c C-x >} (@code{org-agenda-remove-restriction-lock})
  7475. @kindex C-c C-x >
  7476. @findex org-agenda-remove-restriction-lock
  7477. Remove the permanent restriction created by @kbd{C-c C-x <}.
  7478. @end table
  7479. @noindent
  7480. When working with @samp{speedbar.el}, you can use the following commands in
  7481. the Speedbar frame:
  7482. @table @asis
  7483. @item @kbd{<} (@code{org-speedbar-set-agenda-restriction})
  7484. @findex org-speedbar-set-agenda-restriction
  7485. Permanently restrict the agenda to the item---either an Org file
  7486. or a subtree in such a file---at the cursor in the Speedbar
  7487. frame. If there is a window displaying an agenda view, the new
  7488. restriction takes effect immediately.
  7489. @item @kbd{>} (@code{org-agenda-remove-restriction-lock})
  7490. @findex org-agenda-remove-restriction-lock
  7491. Lift the restriction.
  7492. @end table
  7493. @node Agenda Dispatcher
  7494. @section The Agenda Dispatcher
  7495. @cindex agenda dispatcher
  7496. @cindex dispatching agenda commands
  7497. The views are created through a dispatcher, accessible with @kbd{M-x org-agenda}, or, better, bound to a global key (see @ref{Activation}).
  7498. It displays a menu from which an additional letter is required to
  7499. execute a command. The dispatcher offers the following default
  7500. commands:
  7501. @table @asis
  7502. @item @kbd{a}
  7503. Create the calendar-like agenda (see @ref{Weekly/daily agenda}).
  7504. @item @kbd{t} or @kbd{T}
  7505. Create a list of all TODO items (see @ref{Global TODO list}).
  7506. @item @kbd{m} or @kbd{M}
  7507. Create a list of headlines matching a given expression (see
  7508. @ref{Matching tags and properties}).
  7509. @item @kbd{s}
  7510. @kindex s @r{(Agenda dispatcher)}
  7511. Create a list of entries selected by a boolean expression of
  7512. keywords and/or regular expressions that must or must not occur
  7513. in the entry.
  7514. @item @kbd{/}
  7515. @kindex / @r{(Agenda dispatcher)}
  7516. @vindex org-agenda-text-search-extra-files
  7517. Search for a regular expression in all agenda files and
  7518. additionally in the files listed in
  7519. @code{org-agenda-text-search-extra-files}. This uses the Emacs
  7520. command @code{multi-occur}. A prefix argument can be used to specify
  7521. the number of context lines for each match, default is
  7522. @enumerate
  7523. @item
  7524. @end enumerate
  7525. @item @kbd{#} or @kbd{!}
  7526. Create a list of stuck projects (see @ref{Stuck projects}).
  7527. @item @kbd{<}
  7528. @kindex < @r{(Agenda dispatcher)}
  7529. Restrict an agenda command to the current buffer@footnote{For backward compatibility, you can also press @kbd{1} to
  7530. restrict to the current buffer.}. After
  7531. pressing @kbd{<}, you still need to press the character
  7532. selecting the command.
  7533. @item @kbd{< <}
  7534. @kindex < < @r{(Agenda dispatcher)}
  7535. If there is an active region, restrict the following agenda
  7536. command to the region. Otherwise, restrict it to the current
  7537. subtree@footnote{For backward compatibility, you can also press @kbd{0} to
  7538. restrict to the current region/subtree.}. After pressing @kbd{< <}, you still need to
  7539. press the character selecting the command.
  7540. @item @kbd{*}
  7541. @kindex * @r{(Agenda dispatcher)}
  7542. @vindex org-agenda-sticky
  7543. @findex org-toggle-sticky-agenda
  7544. Toggle sticky agenda views. By default, Org maintains only
  7545. a single agenda buffer and rebuilds it each time you change the
  7546. view, to make sure everything is always up to date. If you
  7547. switch between views often and the build time bothers you, you
  7548. can turn on sticky agenda buffers (make this the default by
  7549. customizing the variable @code{org-agenda-sticky}). With sticky
  7550. agendas, the dispatcher only switches to the selected view, you
  7551. need to update it by hand with @kbd{r} or @kbd{g}. You
  7552. can toggle sticky agenda view any time with
  7553. @code{org-toggle-sticky-agenda}.
  7554. @end table
  7555. You can also define custom commands that are accessible through the
  7556. dispatcher, just like the default commands. This includes the
  7557. possibility to create extended agenda buffers that contain several
  7558. blocks together, for example the weekly agenda, the global TODO list
  7559. and a number of special tags matches. See @ref{Custom Agenda Views}.
  7560. @node Built-in Agenda Views
  7561. @section The Built-in Agenda Views
  7562. In this section we describe the built-in views.
  7563. @menu
  7564. * Weekly/daily agenda:: The calendar page with current tasks.
  7565. * Global TODO list:: All unfinished action items.
  7566. * Matching tags and properties:: Structured information with fine-tuned search.
  7567. * Search view:: Find entries by searching for text.
  7568. * Stuck projects:: Find projects you need to review.
  7569. @end menu
  7570. @node Weekly/daily agenda
  7571. @subsection Weekly/daily agenda
  7572. @cindex agenda
  7573. @cindex weekly agenda
  7574. @cindex daily agenda
  7575. The purpose of the weekly/daily @emph{agenda} is to act like a page of
  7576. a paper agenda, showing all the tasks for the current week or day.
  7577. @table @asis
  7578. @item @kbd{M-x org-agenda a} (@code{org-agenda-list})
  7579. @kindex a @r{(Agenda dispatcher)}
  7580. @findex org-agenda-list
  7581. @cindex org-agenda, command
  7582. Compile an agenda for the current week from a list of Org files.
  7583. The agenda shows the entries for each day. With a numeric prefix
  7584. argument@footnote{For backward compatibility, the universal prefix argument
  7585. @kbd{C-u} causes all TODO entries to be listed before the agenda.
  7586. This feature is deprecated, use the dedicated TODO list, or a block
  7587. agenda instead (see @ref{Block agenda}).}---like @kbd{C-u 2 1 M-x org-agenda a}---you
  7588. may set the number of days to be displayed.
  7589. @end table
  7590. @vindex org-agenda-span
  7591. @vindex org-agenda-start-day
  7592. @vindex org-agenda-start-on-weekday
  7593. The default number of days displayed in the agenda is set by the
  7594. variable @code{org-agenda-span}. This variable can be set to any number of
  7595. days you want to see by default in the agenda, or to a span name, such
  7596. a @code{day}, @code{week}, @code{month} or @code{year}. For weekly agendas, the default
  7597. is to start on the previous Monday (see
  7598. @code{org-agenda-start-on-weekday}). You can also set the start date using
  7599. a date shift: @code{(setq org-agenda-start-day "+10d")} starts the agenda
  7600. ten days from today in the future.
  7601. Remote editing from the agenda buffer means, for example, that you can
  7602. change the dates of deadlines and appointments from the agenda buffer.
  7603. The commands available in the Agenda buffer are listed in @ref{Agenda Commands}.
  7604. @anchor{Calendar/Diary integration}
  7605. @subsubheading Calendar/Diary integration
  7606. @cindex calendar integration
  7607. @cindex diary integration
  7608. Emacs contains the calendar and diary by Edward M. Reingold. The
  7609. calendar displays a three-month calendar with holidays from different
  7610. countries and cultures. The diary allows you to keep track of
  7611. anniversaries, lunar phases, sunrise/set, recurrent appointments
  7612. (weekly, monthly) and more. In this way, it is quite complementary to
  7613. Org. It can be very useful to combine output from Org with the diary.
  7614. In order to include entries from the Emacs diary into Org mode's
  7615. agenda, you only need to customize the variable
  7616. @lisp
  7617. (setq org-agenda-include-diary t)
  7618. @end lisp
  7619. @noindent
  7620. After that, everything happens automatically. All diary entries
  7621. including holidays, anniversaries, etc., are included in the agenda
  7622. buffer created by Org mode. @kbd{@key{SPC}}, @kbd{@key{TAB}}, and
  7623. @kbd{@key{RET}} can be used from the agenda buffer to jump to the diary
  7624. file in order to edit existing diary entries. The @kbd{i}
  7625. command to insert new entries for the current date works in the agenda
  7626. buffer, as well as the commands @kbd{S}, @kbd{M}, and
  7627. @kbd{C} to display Sunrise/Sunset times, show lunar phases and to
  7628. convert to other calendars, respectively. @kbd{c} can be used to
  7629. switch back and forth between calendar and agenda.
  7630. If you are using the diary only for S-exp entries and holidays, it is
  7631. faster to not use the above setting, but instead to copy or even move
  7632. the entries into an Org file. Org mode evaluates diary-style sexp
  7633. entries, and does it faster because there is no overhead for first
  7634. creating the diary display. Note that the sexp entries must start at
  7635. the left margin, no whitespace is allowed before them, as seen in the
  7636. following segment of an Org file:@footnote{The variable @code{org-anniversary} used in the example is just
  7637. like @code{diary-anniversary}, but the argument order is always according
  7638. to ISO and therefore independent of the value of
  7639. @code{calendar-date-style}.}
  7640. @example
  7641. * Holidays
  7642. :PROPERTIES:
  7643. :CATEGORY: Holiday
  7644. :END:
  7645. %%(org-calendar-holiday) ; special function for holiday names
  7646. * Birthdays
  7647. :PROPERTIES:
  7648. :CATEGORY: Ann
  7649. :END:
  7650. %%(org-anniversary 1956 5 14) Arthur Dent is %d years old
  7651. %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old
  7652. @end example
  7653. @anchor{Anniversaries from BBDB}
  7654. @subsubheading Anniversaries from BBDB
  7655. @cindex BBDB, anniversaries
  7656. @cindex anniversaries, from BBDB
  7657. @findex org-bbdb-anniversaries
  7658. If you are using the Insidious Big Brother Database to store your
  7659. contacts, you very likely prefer to store anniversaries in BBDB rather
  7660. than in a separate Org or diary file. Org supports this and can show
  7661. BBDB anniversaries as part of the agenda. All you need to do is to
  7662. add the following to one of your agenda files:
  7663. @example
  7664. * Anniversaries
  7665. :PROPERTIES:
  7666. :CATEGORY: Anniv
  7667. :END:
  7668. %%(org-bbdb-anniversaries)
  7669. @end example
  7670. You can then go ahead and define anniversaries for a BBDB record.
  7671. Basically, you need to press @kbd{C-o anniversary @key{RET}} with the
  7672. cursor in a BBDB record and then add the date in the format
  7673. @samp{YYYY-MM-DD} or @samp{MM-DD}, followed by a space and the class of the
  7674. anniversary (@samp{birthday}, @samp{wedding}, or a format string). If you omit
  7675. the class, it defaults to @samp{birthday}. Here are a few examples, the
  7676. header for the file @samp{org-bbdb.el} contains more detailed information.
  7677. @example
  7678. 1973-06-22
  7679. 06-22
  7680. 1955-08-02 wedding
  7681. 2008-04-14 %s released version 6.01 of Org mode, %d years ago
  7682. @end example
  7683. After a change to BBDB, or for the first agenda display during an
  7684. Emacs session, the agenda display suffers a short delay as Org updates
  7685. its hash with anniversaries. However, from then on things will be
  7686. very fast, much faster in fact than a long list of
  7687. @samp{%%(diary-anniversary)} entries in an Org or Diary file.
  7688. @findex org-bbdb-anniversaries-future
  7689. If you would like to see upcoming anniversaries with a bit of
  7690. forewarning, you can use the following instead:
  7691. @example
  7692. * Anniversaries
  7693. :PROPERTIES:
  7694. :CATEGORY: Anniv
  7695. :END:
  7696. %%(org-bbdb-anniversaries-future 3)
  7697. @end example
  7698. That will give you three days' warning: on the anniversary date itself
  7699. and the two days prior. The argument is optional: if omitted, it
  7700. defaults to 7.
  7701. @anchor{Appointment reminders}
  7702. @subsubheading Appointment reminders
  7703. @cindex @file{appt.el}
  7704. @cindex appointment reminders
  7705. @cindex appointment
  7706. @cindex reminders
  7707. @cindex APPT_WARNTIME, keyword
  7708. Org can interact with Emacs appointments notification facility. To
  7709. add the appointments of your agenda files, use the command
  7710. @code{org-agenda-to-appt}. This command lets you filter through the list
  7711. of your appointments and add only those belonging to a specific
  7712. category or matching a regular expression. It also reads
  7713. a @samp{APPT_WARNTIME} property which overrides the value of
  7714. @code{appt-message-warning-time} for this appointment. See the docstring
  7715. for details.
  7716. @node Global TODO list
  7717. @subsection The global TODO list
  7718. @cindex global TODO list
  7719. @cindex TODO list, global
  7720. The global TODO list contains all unfinished TODO items formatted and
  7721. collected into a single place.
  7722. @table @asis
  7723. @item @kbd{M-x org-agenda t} (@code{org-todo-list})
  7724. @kindex t @r{(Agenda dispatcher)}
  7725. @findex org-todo-list
  7726. Show the global TODO list. This collects the TODO items from all
  7727. agenda files (see @ref{Agenda Views}) into a single buffer. By
  7728. default, this lists items with a state the is not a DONE state.
  7729. The buffer is in @code{agenda-mode}, so there are commands to examine
  7730. and manipulate the TODO entries directly from that buffer (see
  7731. @ref{Agenda Commands}).
  7732. @item @kbd{M-x org-agenda T} (@code{org-todo-list})
  7733. @kindex T @r{(Agenda dispatcher)}
  7734. @findex org-todo-list
  7735. @cindex TODO keyword matching
  7736. @vindex org-todo-keywords
  7737. Like the above, but allows selection of a specific TODO keyword.
  7738. You can also do this by specifying a prefix argument to
  7739. @kbd{t}. You are prompted for a keyword, and you may also
  7740. specify several keywords by separating them with @samp{|} as the
  7741. boolean OR operator. With a numeric prefix, the Nth keyword in
  7742. @code{org-todo-keywords} is selected.
  7743. @kindex r
  7744. The @kbd{r} key in the agenda buffer regenerates it, and you
  7745. can give a prefix argument to this command to change the selected
  7746. TODO keyword, for example @kbd{3 r}. If you often need
  7747. a search for a specific keyword, define a custom command for it
  7748. (see @ref{Agenda Dispatcher}).
  7749. Matching specific TODO keywords can also be done as part of
  7750. a tags search (see @ref{Tag Searches}).
  7751. @end table
  7752. Remote editing of TODO items means that you can change the state of
  7753. a TODO entry with a single key press. The commands available in the
  7754. TODO list are described in @ref{Agenda Commands}.
  7755. @cindex sublevels, inclusion into TODO list
  7756. Normally the global TODO list simply shows all headlines with TODO
  7757. keywords. This list can become very long. There are two ways to keep
  7758. it more compact:
  7759. @itemize
  7760. @item
  7761. @vindex org-agenda-todo-ignore-scheduled
  7762. @vindex org-agenda-todo-ignore-deadlines
  7763. @vindex org-agenda-todo-ignore-timestamp
  7764. @vindex org-agenda-todo-ignore-with-date
  7765. Some people view a TODO item that has been @emph{scheduled} for execution
  7766. or have a @emph{deadline} (see @ref{Timestamps}) as
  7767. no longer @emph{open}. Configure the variables
  7768. @code{org-agenda-todo-ignore-scheduled},
  7769. @code{org-agenda-todo-ignore-deadlines},
  7770. @code{org-agenda-todo-ignore-timestamp} and/or
  7771. @code{org-agenda-todo-ignore-with-date} to exclude such items from the
  7772. global TODO list.
  7773. @item
  7774. @vindex org-agenda-todo-list-sublevels
  7775. TODO items may have sublevels to break up the task into subtasks.
  7776. In such cases it may be enough to list only the highest level TODO
  7777. headline and omit the sublevels from the global list. Configure the
  7778. variable @code{org-agenda-todo-list-sublevels} to get this behavior.
  7779. @end itemize
  7780. @node Matching tags and properties
  7781. @subsection Matching tags and properties
  7782. @cindex matching, of tags
  7783. @cindex matching, of properties
  7784. @cindex tags view
  7785. @cindex match view
  7786. If headlines in the agenda files are marked with @emph{tags} (see @ref{Tags}),
  7787. or have properties (see @ref{Properties and Columns}), you can select
  7788. headlines based on this metadata and collect them into an agenda
  7789. buffer. The match syntax described here also applies when creating
  7790. sparse trees with @kbd{C-c / m}.
  7791. @table @asis
  7792. @item @kbd{M-x org-agenda m} (@code{org-tags-view})
  7793. @kindex m @r{(Agenda dispatcher)}
  7794. @findex org-tags-view
  7795. Produce a list of all headlines that match a given set of tags.
  7796. The command prompts for a selection criterion, which is a boolean
  7797. logic expression with tags, like @samp{+work+urgent-withboss} or
  7798. @samp{work|home} (see @ref{Tags}). If you often need a specific search,
  7799. define a custom command for it (see @ref{Agenda Dispatcher}).
  7800. @item @kbd{M-x org-agenda M} (@code{org-tags-view})
  7801. @kindex M @r{(Agenda dispatcher)}
  7802. @findex org-tags-view
  7803. @vindex org-tags-match-list-sublevels
  7804. @vindex org-agenda-tags-todo-honor-ignore-options
  7805. Like @kbd{m}, but only select headlines that are also TODO
  7806. items and force checking subitems (see the variable
  7807. @code{org-tags-match-list-sublevels}). To exclude scheduled/deadline
  7808. items, see the variable
  7809. @code{org-agenda-tags-todo-honor-ignore-options}. Matching specific
  7810. TODO keywords together with a tags match is also possible, see
  7811. @ref{Tag Searches}.
  7812. @end table
  7813. The commands available in the tags list are described in @ref{Agenda Commands}.
  7814. @cindex boolean logic, for agenda searches
  7815. A search string can use Boolean operators @samp{&} for AND and @samp{|} for OR.
  7816. @samp{&} binds more strongly than @samp{|}. Parentheses are currently not
  7817. implemented. Each element in the search is either a tag, a regular
  7818. expression matching tags, or an expression like @samp{PROPERTY OPERATOR
  7819. VALUE} with a comparison operator, accessing a property value. Each
  7820. element may be preceded by @samp{-} to select against it, and @samp{+} is
  7821. syntactic sugar for positive selection. The AND operator @samp{&} is
  7822. optional when @samp{+} or @samp{-} is present. Here are some examples, using
  7823. only tags.
  7824. @table @asis
  7825. @item @code{+work-boss}
  7826. Select headlines tagged @samp{work}, but discard those also tagged
  7827. @samp{boss}.
  7828. @item @code{work|laptop}
  7829. Selects lines tagged @samp{work} or @samp{laptop}.
  7830. @item @code{work|laptop+night}
  7831. Like before, but require the @samp{laptop} lines to be tagged
  7832. also @samp{night}.
  7833. @end table
  7834. @cindex regular expressions, with tags search
  7835. Instead of a tag, you may also specify a regular expression enclosed
  7836. in curly braces. For example, @samp{work+@{^boss.*@}} matches headlines that
  7837. contain the tag @samp{:work:} and any tag @emph{starting} with @samp{boss}.
  7838. @cindex group tags, as regular expressions
  7839. Group tags (see @ref{Tag Hierarchy}) are expanded as regular expressions.
  7840. E.g., if @samp{work} is a group tag for the group @samp{:work:lab:conf:}, then
  7841. searching for @samp{work} also searches for @samp{@{\(?:work\|lab\|conf\)@}} and
  7842. searching for @samp{-work} searches for all headlines but those with one of
  7843. the tags in the group (i.e., @samp{-@{\(?:work\|lab\|conf\)@}}).
  7844. @cindex TODO keyword matching, with tags search
  7845. @cindex level, for tags/property match
  7846. @cindex category, for tags/property match
  7847. @vindex org-odd-levels-only
  7848. You may also test for properties (see @ref{Properties and Columns}) at the
  7849. same time as matching tags. The properties may be real properties, or
  7850. special properties that represent other metadata (see @ref{Special Properties}). For example, the property @samp{TODO} represents the TODO
  7851. keyword of the entry. Or, the property @samp{LEVEL} represents the level
  7852. of an entry. So searching @samp{+LEVEL=3+boss-TODO​="DONE"} lists all level
  7853. three headlines that have the tag @samp{boss} and are @emph{not} marked with the
  7854. TODO keyword @samp{DONE}. In buffers with @code{org-odd-levels-only} set,
  7855. @samp{LEVEL} does not count the number of stars, but @samp{LEVEL=2} corresponds
  7856. to 3 stars etc.
  7857. Here are more examples:
  7858. @table @asis
  7859. @item @samp{work+TODO​="WAITING"}
  7860. Select @samp{work}-tagged TODO lines with the specific TODO keyword
  7861. @samp{WAITING}.
  7862. @item @samp{work+TODO​="WAITING"|home+TODO​="WAITING"}
  7863. Waiting tasks both at work and at home.
  7864. @end table
  7865. When matching properties, a number of different operators can be used
  7866. to test the value of a property. Here is a complex example:
  7867. @example
  7868. +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2
  7869. +With=@{Sarah|Denny@}+SCHEDULED>="<2008-10-11>"
  7870. @end example
  7871. @noindent
  7872. The type of comparison depends on how the comparison value is written:
  7873. @itemize
  7874. @item
  7875. If the comparison value is a plain number, a numerical comparison is
  7876. done, and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=}, @samp{>=}, and
  7877. @samp{<>}.
  7878. @item
  7879. If the comparison value is enclosed in double-quotes, a string
  7880. comparison is done, and the same operators are allowed.
  7881. @item
  7882. If the comparison value is enclosed in double-quotes @emph{and} angular
  7883. brackets (like @samp{DEADLINE<​="<2008-12-24 18:30>"}), both values are
  7884. assumed to be date/time specifications in the standard Org way, and
  7885. the comparison is done accordingly. Valid values also include
  7886. @samp{"<now>"} for now (including time), @samp{"<today>"}, and @samp{"<tomorrow>"}
  7887. for these days at 0:00 hours, i.e., without a time specification.
  7888. You can also use strings like @samp{"<+5d>"} or @samp{"<-2m>"} with units @samp{d},
  7889. @samp{w}, @samp{m}, and @samp{y} for day, week, month, and year, respectively.
  7890. @item
  7891. If the comparison value is enclosed in curly braces, a regexp match
  7892. is performed, with @samp{=} meaning that the regexp matches the property
  7893. value, and @samp{<>} meaning that it does not match.
  7894. @end itemize
  7895. So the search string in the example finds entries tagged @samp{work} but
  7896. not @samp{boss}, which also have a priority value @samp{A}, a @samp{Coffee} property
  7897. with the value @samp{unlimited}, an @samp{EFFORT} property that is numerically
  7898. smaller than 2, a @samp{With} property that is matched by the regular
  7899. expression @samp{Sarah|Denny}, and that are scheduled on or after October
  7900. 11, 2008.
  7901. You can configure Org mode to use property inheritance during
  7902. a search, but beware that this can slow down searches considerably.
  7903. See @ref{Property Inheritance}, for details.
  7904. For backward compatibility, and also for typing speed, there is also
  7905. a different way to test TODO states in a search. For this, terminate
  7906. the tags/property part of the search string (which may include several
  7907. terms connected with @samp{|}) with a @samp{/} and then specify a Boolean
  7908. expression just for TODO keywords. The syntax is then similar to that
  7909. for tags, but should be applied with care: for example, a positive
  7910. selection on several TODO keywords cannot meaningfully be combined
  7911. with boolean AND. However, @emph{negative selection} combined with AND can
  7912. be meaningful. To make sure that only lines are checked that actually
  7913. 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
  7914. with @samp{!}. Using @kbd{M-x org-agenda M} or @samp{/!} does not match
  7915. TODO keywords in a DONE state. Examples:
  7916. @table @asis
  7917. @item @samp{work/WAITING}
  7918. Same as @samp{work+TODO​="WAITING"}.
  7919. @item @samp{work/!-WAITING-NEXT}
  7920. Select @samp{work}-tagged TODO lines that are neither @samp{WAITING} nor
  7921. @samp{NEXT}.
  7922. @item @samp{work/!+WAITING|+NEXT}
  7923. Select @samp{work}-tagged TODO lines that are either @samp{WAITING} or
  7924. @samp{NEXT}.
  7925. @end table
  7926. @node Search view
  7927. @subsection Search view
  7928. @cindex search view
  7929. @cindex text search
  7930. @cindex searching, for text
  7931. This agenda view is a general text search facility for Org mode
  7932. entries. It is particularly useful to find notes.
  7933. @table @asis
  7934. @item @kbd{M-x org-agenda s} (@code{org-search-view})
  7935. @kindex s @r{(Agenda dispatcher)}
  7936. @findex org-search-view
  7937. This is a special search that lets you select entries by matching
  7938. a substring or specific words using a boolean logic.
  7939. @end table
  7940. For example, the search string @samp{computer equipment} matches entries
  7941. that contain @samp{computer equipment} as a substring, even if the two
  7942. words are separated by more space or a line break.
  7943. Search view can also search for specific keywords in the entry, using
  7944. Boolean logic. The search string @samp{+computer
  7945. +wifi -ethernet -@{8\.11[bg]@}} matches note entries that contain the
  7946. keywords @samp{computer} and @samp{wifi}, but not the keyword @samp{ethernet}, and
  7947. which are also not matched by the regular expression @samp{8\.11[bg]},
  7948. meaning to exclude both @samp{8.11b} and @samp{8.11g}. The first @samp{+} is
  7949. necessary to turn on boolean search, other @samp{+} characters are
  7950. optional. For more details, see the docstring of the command
  7951. @code{org-search-view}.
  7952. You can incrementally adjust a boolean search with the following keys
  7953. @multitable @columnfractions 0.1 0.6
  7954. @item @kbd{[}
  7955. @tab Add a positive search word
  7956. @item @kbd{]}
  7957. @tab Add a negative search word
  7958. @item @kbd{@{}
  7959. @tab Add a positive regular expression
  7960. @item @kbd{@}}
  7961. @tab Add a negative regular expression
  7962. @end multitable
  7963. @vindex org-agenda-text-search-extra-files
  7964. Note that in addition to the agenda files, this command also searches
  7965. the files listed in @code{org-agenda-text-search-extra-files}.
  7966. @node Stuck projects
  7967. @subsection Stuck projects
  7968. @pindex GTD, Getting Things Done
  7969. If you are following a system like David Allen's GTD to organize your
  7970. work, one of the ``duties'' you have is a regular review to make sure
  7971. that all projects move along. A @emph{stuck} project is a project that has
  7972. no defined next actions, so it never shows up in the TODO lists Org
  7973. mode produces. During the review, you need to identify such projects
  7974. and define next actions for them.
  7975. @table @asis
  7976. @item @kbd{M-x org-agenda #} (@code{org-agenda-list-stuck-projects})
  7977. @kindex # @r{(Agenda dispatcher)}
  7978. @findex org-agenda-list-stuck-projects
  7979. List projects that are stuck.
  7980. @item @kbd{M-x org-agenda !}
  7981. @kindex ! @r{(Agenda dispatcher)}
  7982. @vindex org-stuck-projects
  7983. Customize the variable @code{org-stuck-projects} to define what
  7984. a stuck project is and how to find it.
  7985. @end table
  7986. You almost certainly need to configure this view before it works for
  7987. you. The built-in default assumes that all your projects are level-2
  7988. headlines, and that a project is not stuck if it has at least one
  7989. entry marked with a TODO keyword @samp{TODO} or @samp{NEXT} or @samp{NEXTACTION}.
  7990. Let's assume that you, in your own way of using Org mode, identify
  7991. projects with a tag @samp{:PROJECT:}, and that you use a TODO keyword
  7992. @samp{MAYBE} to indicate a project that should not be considered yet.
  7993. Let's further assume that the TODO keyword @samp{DONE} marks finished
  7994. projects, and that @samp{NEXT} and @samp{TODO} indicate next actions. The tag
  7995. @samp{:@@shop:} indicates shopping and is a next action even without the
  7996. NEXT tag. Finally, if the project contains the special word @samp{IGNORE}
  7997. anywhere, it should not be listed either. In this case you would
  7998. start by identifying eligible projects with a tags/TODO match (see
  7999. @ref{Tag Searches}) @samp{+PROJECT/-MAYBE-DONE}, and then check for @samp{TODO},
  8000. @samp{NEXT}, @samp{@@shop}, and @samp{IGNORE} in the subtree to identify projects that
  8001. are not stuck. The correct customization for this is:
  8002. @lisp
  8003. (setq org-stuck-projects
  8004. '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@shop")
  8005. "\\<IGNORE\\>"))
  8006. @end lisp
  8007. Note that if a project is identified as non-stuck, the subtree of this
  8008. entry is searched for stuck projects.
  8009. @node Presentation and Sorting
  8010. @section Presentation and Sorting
  8011. @cindex presentation, of agenda items
  8012. @vindex org-agenda-prefix-format
  8013. @vindex org-agenda-tags-column
  8014. Before displaying items in an agenda view, Org mode visually prepares
  8015. the items and sorts them. Each item occupies a single line. The line
  8016. starts with a @emph{prefix} that contains the @emph{category} (see @ref{Categories})
  8017. of the item and other important information. You can customize in
  8018. which column tags are displayed through @code{org-agenda-tags-column}. You
  8019. can also customize the prefix using the option
  8020. @code{org-agenda-prefix-format}. This prefix is followed by a cleaned-up
  8021. version of the outline headline associated with the item.
  8022. @menu
  8023. * Categories:: Not all tasks are equal.
  8024. * Time-of-day specifications:: How the agenda knows the time.
  8025. * Sorting of agenda items:: The order of things.
  8026. * Filtering/limiting agenda times:: Dynamically narrow the agenda.
  8027. @end menu
  8028. @node Categories
  8029. @subsection Categories
  8030. @cindex category
  8031. @cindex @samp{CATEGORY}, keyword
  8032. The category is a broad label assigned to each agenda item. By
  8033. default, the category is simply derived from the file name, but you
  8034. can also specify it with a special line in the buffer, like
  8035. this:
  8036. @example
  8037. #+CATEGORY: Thesis
  8038. @end example
  8039. @noindent
  8040. @cindex @samp{CATEGORY}, property
  8041. If you would like to have a special category for a single entry or
  8042. a (sub)tree, give the entry a @samp{CATEGORY} property with the special
  8043. category you want to apply as the value.
  8044. @noindent
  8045. The display in the agenda buffer looks best if the category is not
  8046. longer than 10 characters.
  8047. @noindent
  8048. @vindex org-agenda-category-icon-alist
  8049. You can set up icons for category by customizing the
  8050. @code{org-agenda-category-icon-alist} variable.
  8051. @node Time-of-day specifications
  8052. @subsection Time-of-day specifications
  8053. @cindex time-of-day specification
  8054. Org mode checks each agenda item for a time-of-day specification. The
  8055. time can be part of the timestamp that triggered inclusion into the
  8056. agenda, for example
  8057. @example
  8058. <2005-05-10 Tue 19:00>
  8059. @end example
  8060. @noindent
  8061. Time ranges can be specified with two timestamps:
  8062. @example
  8063. <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
  8064. @end example
  8065. In the headline of the entry itself, a time(range) may also appear as
  8066. plain text (like @samp{12:45} or a @samp{8:30-1pm}). If the agenda integrates
  8067. the Emacs diary (see @ref{Weekly/daily agenda}), time specifications in
  8068. diary entries are recognized as well.
  8069. For agenda display, Org mode extracts the time and displays it in
  8070. a standard 24 hour format as part of the prefix. The example times in
  8071. the previous paragraphs would end up in the agenda like this:
  8072. @example
  8073. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  8074. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  8075. 19:00...... The Vogon reads his poem
  8076. 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
  8077. @end example
  8078. @cindex time grid
  8079. If the agenda is in single-day mode, or for the display of today, the
  8080. timed entries are embedded in a time grid, like
  8081. @example
  8082. 8:00...... ------------------
  8083. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  8084. 10:00...... ------------------
  8085. 12:00...... ------------------
  8086. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  8087. 14:00...... ------------------
  8088. 16:00...... ------------------
  8089. 18:00...... ------------------
  8090. 19:00...... The Vogon reads his poem
  8091. 20:00...... ------------------
  8092. 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
  8093. @end example
  8094. @vindex org-agenda-use-time-grid
  8095. @vindex org-agenda-time-grid
  8096. The time grid can be turned on and off with the variable
  8097. @code{org-agenda-use-time-grid}, and can be configured with
  8098. @code{org-agenda-time-grid}.
  8099. @node Sorting of agenda items
  8100. @subsection Sorting of agenda items
  8101. @cindex sorting, of agenda items
  8102. @cindex priorities, of agenda items
  8103. Before being inserted into a view, the items are sorted. How this is
  8104. done depends on the type of view.
  8105. @itemize
  8106. @item
  8107. @vindex org-agenda-files
  8108. For the daily/weekly agenda, the items for each day are sorted. The
  8109. default order is to first collect all items containing an explicit
  8110. time-of-day specification. These entries are shown at the beginning
  8111. of the list, as a @emph{schedule} for the day. After that, items remain
  8112. grouped in categories, in the sequence given by @code{org-agenda-files}.
  8113. Within each category, items are sorted by priority (see
  8114. @ref{Priorities}), which is composed of the base priority (2000 for
  8115. priority @samp{A}, 1000 for @samp{B}, and 0 for @samp{C}), plus additional
  8116. increments for overdue scheduled or deadline items.
  8117. @item
  8118. For the TODO list, items remain in the order of categories, but
  8119. within each category, sorting takes place according to priority (see
  8120. @ref{Priorities}). The priority used for sorting derives from the
  8121. priority cookie, with additions depending on how close an item is to
  8122. its due or scheduled date.
  8123. @item
  8124. For tags matches, items are not sorted at all, but just appear in
  8125. the sequence in which they are found in the agenda files.
  8126. @end itemize
  8127. @vindex org-agenda-sorting-strategy
  8128. Sorting can be customized using the variable
  8129. @code{org-agenda-sorting-strategy}, and may also include criteria based on
  8130. the estimated effort of an entry (see @ref{Effort Estimates}).
  8131. @node Filtering/limiting agenda times
  8132. @subsection Filtering/limiting agenda times
  8133. Agenda built-in or customized commands are statically defined. Agenda
  8134. filters and limits provide two ways of dynamically narrowing down the
  8135. list of agenda entries: @emph{filters} and @emph{limits}. Filters only act on
  8136. the display of the items, while limits take effect before the list of
  8137. agenda entries is built. Filters are more often used interactively,
  8138. while limits are mostly useful when defined as local variables within
  8139. custom agenda commands.
  8140. @anchor{Filtering in the agenda}
  8141. @subsubheading Filtering in the agenda
  8142. @cindex agenda filtering
  8143. @cindex filtering entries, in agenda
  8144. @cindex tag filtering, in agenda
  8145. @cindex category filtering, in agenda
  8146. @cindex top headline filtering, in agenda
  8147. @cindex effort filtering, in agenda
  8148. @cindex query editing, in agenda
  8149. @table @asis
  8150. @item @kbd{/} (@code{org-agenda-filter-by-tag})
  8151. @findex org-agenda-filter-by-tag
  8152. @vindex org-agenda-tag-filter-preset
  8153. Filter the agenda view with respect to a tag and/or effort
  8154. estimates. The difference between this and a custom agenda
  8155. command is that filtering is very fast, so that you can switch
  8156. quickly between different filters without having to recreate the
  8157. agenda.@footnote{Custom commands can preset a filter by binding the variable
  8158. @code{org-agenda-tag-filter-preset} as an option. This filter is then
  8159. applied to the view and persists as a basic filter through refreshes
  8160. and more secondary filtering. The filter is a global property of the
  8161. entire agenda view---in a block agenda, you should only set this in
  8162. the global options section, not in the section of an individual block.}
  8163. You are prompted for a tag selection letter; @kbd{@key{SPC}} means
  8164. any tag at all. Pressing @kbd{@key{TAB}} at that prompt offers
  8165. completion to select a tag, including any tags that do not have
  8166. a selection character. The command then hides all entries that
  8167. do not contain or inherit this tag. When called with prefix
  8168. argument, remove the entries that @emph{do} have the tag. A second
  8169. @kbd{/} at the prompt turns off the filter and shows any
  8170. hidden entries. Pressing @kbd{+} or @kbd{-} switches
  8171. between filtering and excluding the next tag.
  8172. @vindex org-agenda-auto-exclude-function
  8173. Org also supports automatic, context-aware tag filtering. If the
  8174. variable @code{org-agenda-auto-exclude-function} is set to
  8175. a user-defined function, that function can decide which tags
  8176. should be excluded from the agenda automatically. Once this is
  8177. set, the @kbd{/} command then accepts @kbd{@key{RET}} as
  8178. a sub-option key and runs the auto exclusion logic. For example,
  8179. let's say you use a @samp{Net} tag to identify tasks which need
  8180. network access, an @samp{Errand} tag for errands in town, and a @samp{Call}
  8181. tag for making phone calls. You could auto-exclude these tags
  8182. based on the availability of the Internet, and outside of
  8183. business hours, with something like this:
  8184. @lisp
  8185. (defun org-my-auto-exclude-function (tag)
  8186. (and (cond
  8187. ((string= tag "Net")
  8188. (/= 0 (call-process "/sbin/ping" nil nil nil
  8189. "-c1" "-q" "-t1" "mail.gnu.org")))
  8190. ((or (string= tag "Errand") (string= tag "Call"))
  8191. (let ((hour (nth 2 (decode-time))))
  8192. (or (< hour 8) (> hour 21)))))
  8193. (concat "-" tag)))
  8194. (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
  8195. @end lisp
  8196. @item @kbd{<} (@code{org-agenda-filter-by-category})
  8197. @findex org-agenda-filter-by-category
  8198. Filter the current agenda view with respect to the category of
  8199. the item at point. Pressing @kbd{<} another time removes
  8200. this filter. When called with a prefix argument exclude the
  8201. category of the item at point from the agenda.
  8202. @vindex org-agenda-category-filter-preset
  8203. You can add a filter preset in custom agenda commands through the
  8204. option @code{org-agenda-category-filter-preset}. See @ref{Setting options}.
  8205. @item @kbd{^} (@code{org-agenda-filter-by-top-headline})
  8206. @findex org-agenda-filter-by-top-headline
  8207. Filter the current agenda view and only display the siblings and
  8208. the parent headline of the one at point.
  8209. @item @kbd{=} (@code{org-agenda-filter-by-regexp})
  8210. @findex org-agenda-filter-by-regexp
  8211. Filter the agenda view by a regular expression: only show agenda
  8212. entries matching the regular expression the user entered. When
  8213. called with a prefix argument, it filters @emph{out} entries matching
  8214. the regexp. With two universal prefix arguments, it removes all
  8215. the regexp filters, which can be accumulated.
  8216. @vindex org-agenda-regexp-filter-preset
  8217. You can add a filter preset in custom agenda commands through the
  8218. option @code{org-agenda-regexp-filter-preset}. See @ref{Setting options}.
  8219. @item @kbd{_} (@code{org-agenda-filter-by-effort})
  8220. @findex org-agenda-filter-by-effort
  8221. Filter the agenda view with respect to effort estimates. You
  8222. first need to set up allowed efforts globally, for example
  8223. @lisp
  8224. (setq org-global-properties
  8225. '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
  8226. @end lisp
  8227. @vindex org-sort-agenda-noeffort-is-high
  8228. You can then filter for an effort by first typing an operator,
  8229. one of @kbd{<}, @kbd{>} and @kbd{=}, and then the
  8230. one-digit index of an effort estimate in your array of allowed
  8231. values, where @kbd{0} means the 10th value. The filter then
  8232. restricts to entries with effort smaller-or-equal, equal, or
  8233. larger-or-equal than the selected value. For application of the
  8234. operator, entries without a defined effort are treated according
  8235. to the value of @code{org-sort-agenda-noeffort-is-high}.
  8236. When called with a prefix argument, it removes entries matching
  8237. the condition. With two universal prefix arguments, it clears
  8238. effort filters, which can be accumulated.
  8239. @vindex org-agenda-effort-filter-preset
  8240. You can add a filter preset in custom agenda commands through the
  8241. option @code{org-agenda-effort-filter-preset}. See @ref{Setting options}.
  8242. @item @kbd{|} (@code{org-agenda-filter-remove-all})
  8243. Remove all filters in the current agenda view.
  8244. @end table
  8245. @anchor{Setting limits for the agenda}
  8246. @subsubheading Setting limits for the agenda
  8247. @cindex limits, in agenda
  8248. Here is a list of options that you can set, either globally, or
  8249. locally in your custom agenda views (see @ref{Custom Agenda Views}).
  8250. @table @asis
  8251. @item @code{org-agenda-max-entries}
  8252. @vindex org-agenda-max-entries
  8253. Limit the number of entries.
  8254. @item @code{org-agenda-max-effort}
  8255. @vindex org-agenda-max-effort
  8256. Limit the duration of accumulated efforts (as minutes).
  8257. @item @code{org-agenda-max-todos}
  8258. @vindex org-agenda-max-todos
  8259. Limit the number of entries with TODO keywords.
  8260. @item @code{org-agenda-max-tags}
  8261. @vindex org-agenda-max-tags
  8262. Limit the number of tagged entries.
  8263. @end table
  8264. When set to a positive integer, each option excludes entries from
  8265. other categories: for example, @code{(setq org-agenda-max-effort 100)}
  8266. limits the agenda to 100 minutes of effort and exclude any entry that
  8267. has no effort property. If you want to include entries with no effort
  8268. property, use a negative value for @code{org-agenda-max-effort}. One
  8269. useful setup is to use @code{org-agenda-max-entries} locally in a custom
  8270. command. For example, this custom command displays the next five
  8271. entries with a @samp{NEXT} TODO keyword.
  8272. @lisp
  8273. (setq org-agenda-custom-commands
  8274. '(("n" todo "NEXT"
  8275. ((org-agenda-max-entries 5)))))
  8276. @end lisp
  8277. Once you mark one of these five entry as DONE, rebuilding the agenda
  8278. will again the next five entries again, including the first entry that
  8279. was excluded so far.
  8280. You can also dynamically set temporary limits, which are lost when
  8281. rebuilding the agenda:
  8282. @table @asis
  8283. @item @kbd{~} (@code{org-agenda-limit-interactively})
  8284. @findex org-agenda-limit-interactively
  8285. This prompts for the type of limit to apply and its value.
  8286. @end table
  8287. @node Agenda Commands
  8288. @section Commands in the Agenda Buffer
  8289. @cindex commands, in agenda buffer
  8290. Entries in the agenda buffer are linked back to the Org file or diary
  8291. file where they originate. You are not allowed to edit the agenda
  8292. buffer itself, but commands are provided to show and jump to the
  8293. original entry location, and to edit the Org files ``remotely'' from the
  8294. agenda buffer. In this way, all information is stored only once,
  8295. removing the risk that your agenda and note files may diverge.
  8296. Some commands can be executed with mouse clicks on agenda lines. For
  8297. the other commands, the cursor needs to be in the desired line.
  8298. @anchor{Motion (1)}
  8299. @subheading Motion
  8300. @cindex motion commands in agenda
  8301. @table @asis
  8302. @item @kbd{n} (@code{org-agenda-next-line})
  8303. @kindex n
  8304. @findex org-agenda-next-line
  8305. Next line (same as @kbd{@key{DOWN}} and @kbd{C-n}).
  8306. @item @kbd{p} (@code{org-agenda-previous-line})
  8307. @kindex p
  8308. @findex org-agenda-previous-line
  8309. Previous line (same as @kbd{@key{UP}} and @kbd{C-p}).
  8310. @end table
  8311. @anchor{View/Go to Org file}
  8312. @subheading View/Go to Org file
  8313. @cindex view file commands in agenda
  8314. @table @asis
  8315. @item @kbd{@key{SPC}} or @kbd{mouse-3} (@code{org-agenda-show-and-scroll-up})
  8316. @kindex SPC
  8317. @kindex mouse-3
  8318. @findex org-agenda-show-and-scroll-up
  8319. Display the original location of the item in another window.
  8320. With a prefix argument, make sure that drawers stay folded.
  8321. @item @kbd{L} (@code{org-agenda-recenter})
  8322. @findex org-agenda-recenter
  8323. Display original location and recenter that window.
  8324. @item @kbd{@key{TAB}} or @kbd{mouse-2} (@code{org-agenda-goto})
  8325. @kindex TAB
  8326. @kindex mouse-2
  8327. @findex org-agenda-goto
  8328. Go to the original location of the item in another window.
  8329. @item @kbd{@key{RET}} (@code{org-agenda-switch-to})
  8330. @kindex RET
  8331. @findex org-agenda-switch-to
  8332. Go to the original location of the item and delete other windows.
  8333. @item @kbd{F} (@code{org-agenda-follow-mode})
  8334. @kindex F
  8335. @findex org-agenda-follow-mode
  8336. @vindex org-agenda-start-with-follow-mode
  8337. Toggle Follow mode. In Follow mode, as you move the cursor
  8338. through the agenda buffer, the other window always shows the
  8339. corresponding location in the Org file. The initial setting for
  8340. this mode in new agenda buffers can be set with the variable
  8341. @code{org-agenda-start-with-follow-mode}.
  8342. @item @kbd{C-c C-x b} (@code{org-agenda-tree-to-indirect-buffer})
  8343. @kindex C-c C-x b
  8344. @findex org-agenda-tree-to-indirect-buffer
  8345. Display the entire subtree of the current item in an indirect
  8346. buffer. With a numeric prefix argument N, go up to level N and
  8347. then take that tree. If N is negative, go up that many levels.
  8348. With a @kbd{C-u} prefix, do not remove the previously used
  8349. indirect buffer.
  8350. @item @kbd{C-c C-o} (@code{org-agenda-open-link})
  8351. @kindex C-c C-o
  8352. @findex org-agenda-open-link
  8353. Follow a link in the entry. This offers a selection of any links
  8354. in the text belonging to the referenced Org node. If there is
  8355. only one link, follow it without a selection prompt.
  8356. @end table
  8357. @anchor{Change display}
  8358. @subheading Change display
  8359. @cindex change agenda display
  8360. @cindex display changing, in agenda
  8361. @table @asis
  8362. @item @kbd{A}
  8363. @kindex A
  8364. Interactively select another agenda view and append it to the
  8365. current view.
  8366. @item @kbd{o}
  8367. @kindex o
  8368. Delete other windows.
  8369. @item @kbd{v d} or short @kbd{d} (@code{org-agenda-day-view})
  8370. @kindex v d
  8371. @kindex d
  8372. @findex org-agenda-day-view
  8373. Switch to day view. When switching to day view, this setting
  8374. becomes the default for subsequent agenda refreshes. A numeric
  8375. prefix argument may be used to jump directly to a specific day of
  8376. the year. For example, @kbd{32 d} jumps to February 1st.
  8377. When setting day view, a year may be encoded in the prefix
  8378. argument as well. For example, @kbd{200712 d} jumps to
  8379. January 12, 2007. If such a year specification has only one or
  8380. two digits, it is expanded into one of the 30 next years or the
  8381. last 69 years.
  8382. @item @kbd{v w} or short @kbd{w} (@code{org-agenda-week-view})
  8383. @kindex v w
  8384. @kindex w
  8385. @findex org-agenda-week-view
  8386. Switch to week view. When switching week view, this setting
  8387. becomes the default for subsequent agenda refreshes. A numeric
  8388. prefix argument may be used to jump directly to a specific day of
  8389. the ISO week. For example @kbd{9 w} to ISO week number 9.
  8390. When setting week view, a year may be encoded in the prefix
  8391. argument as well. For example, @kbd{200712 w} jumps to week
  8392. 12 in 2007. If such a year specification has only one or two
  8393. digits, it is expanded into one of the 30 next years or the last
  8394. 69 years.
  8395. @item @kbd{v m} (@code{org-agenda-month-view})
  8396. @kindex v m
  8397. @findex org-agenda-month-view
  8398. Switch to month view. Because month views are slow to create,
  8399. they do not become the default for subsequent agenda refreshes.
  8400. A numeric prefix argument may be used to jump directly to
  8401. a specific day of the month. When setting month view, a year may
  8402. be encoded in the prefix argument as well. For example,
  8403. @kbd{200712 m} jumps to December, 2007. If such a year
  8404. specification has only one or two digits, it is expanded into one
  8405. of the 30 next years or the last 69 years.
  8406. @item @kbd{v y} (@code{org-agenda-year-view})
  8407. @kindex v y
  8408. @findex org-agenda-year-view
  8409. Switch to year view. Because year views are slow to create, they
  8410. do not become the default for subsequent agenda refreshes.
  8411. A numeric prefix argument may be used to jump directly to
  8412. a specific day of the year.
  8413. @item @kbd{v @key{SPC}} (@code{org-agenda-reset-view})
  8414. @kindex v SPC
  8415. @findex org-agenda-reset-view
  8416. @vindex org-agenda-span
  8417. Reset the current view to @code{org-agenda-span}.
  8418. @item @kbd{f} (@code{org-agenda-later})
  8419. @kindex f
  8420. @findex org-agenda-later
  8421. Go forward in time to display the span following the current one.
  8422. For example, if the display covers a week, switch to the
  8423. following week. With a prefix argument, repeat that many times.
  8424. @item @kbd{b} (@code{org-agenda-earlier})
  8425. @kindex b
  8426. @findex org-agenda-earlier
  8427. Go backward in time to display earlier dates.
  8428. @item @kbd{.} (@code{org-agenda-goto-today})
  8429. @kindex .
  8430. @findex org-agenda-goto-today
  8431. Go to today.
  8432. @item @kbd{j} (@code{org-agenda-goto-date})
  8433. @kindex j
  8434. @findex org-agenda-goto-date
  8435. Prompt for a date and go there.
  8436. @item @kbd{J} (@code{org-agenda-clock-goto})
  8437. @kindex J
  8438. @findex org-agenda-clock-goto
  8439. Go to the currently clocked-in task @emph{in the agenda buffer}.
  8440. @item @kbd{D} (@code{org-agenda-toggle-diary})
  8441. @kindex D
  8442. @findex org-agenda-toggle-diary
  8443. Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
  8444. @item @kbd{v l} or @kbd{v L} or short @kbd{l} (@code{org-agenda-log-mode})
  8445. @kindex v l
  8446. @kindex l
  8447. @kindex v L
  8448. @findex org-agenda-log-mode
  8449. @vindex org-log-done
  8450. @vindex org-agenda-log-mode-items
  8451. Toggle Logbook mode. In Logbook mode, entries that were marked
  8452. DONE while logging was on (see the variable @code{org-log-done}) are
  8453. shown in the agenda, as are entries that have been clocked on
  8454. that day. You can configure the entry types that should be
  8455. included in log mode using the variable
  8456. @code{org-agenda-log-mode-items}. When called with a @kbd{C-u}
  8457. prefix, show all possible logbook entries, including state
  8458. 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}.
  8459. @item @kbd{v [} or short @kbd{[} (@code{org-agenda-manipulate-query-add})
  8460. @kindex v [
  8461. @kindex [
  8462. @findex org-agenda-manipulate-query-add
  8463. Include inactive timestamps into the current view. Only for
  8464. weekly/daily agenda and timeline views.
  8465. @item @kbd{v a} (@code{org-agenda-archives-mode})
  8466. @kindex v a
  8467. @findex org-agenda-archives-mode
  8468. Toggle Archives mode. In Archives mode, trees that are archived
  8469. (see @ref{Internal archiving}) are also scanned when producing the
  8470. agenda. To exit archives mode, press @kbd{v a} again.
  8471. @item @kbd{v A}
  8472. @kindex v A
  8473. Toggle Archives mode. Include all archive files as well.
  8474. @item @kbd{v R} or short @kbd{R} (@code{org-agenda-clockreport-mode})
  8475. @kindex v R
  8476. @kindex R
  8477. @findex org-agenda-clockreport-mode
  8478. @vindex org-agenda-start-with-clockreport-mode
  8479. @vindex org-clock-report-include-clocking-task
  8480. Toggle Clockreport mode. In Clockreport mode, the daily/weekly
  8481. agenda always shows a table with the clocked times for the time
  8482. span and file scope covered by the current agenda view. The
  8483. initial setting for this mode in new agenda buffers can be set
  8484. with the variable @code{org-agenda-start-with-clockreport-mode}. By
  8485. using a prefix argument when toggling this mode (i.e., @kbd{C-u R}), the clock table does not show contributions from entries
  8486. that are hidden by agenda filtering@footnote{Only tags filtering is respected here, effort filtering is
  8487. ignored.}. See also the
  8488. variable @code{org-clock-report-include-clocking-task}.
  8489. @item @kbd{v c}
  8490. @kindex v c
  8491. @vindex org-agenda-clock-consistency-checks
  8492. Show overlapping clock entries, clocking gaps, and other clocking
  8493. problems in the current agenda range. You can then visit
  8494. clocking lines and fix them manually. See the variable
  8495. @code{org-agenda-clock-consistency-checks} for information on how to
  8496. customize the definition of what constituted a clocking problem.
  8497. To return to normal agenda display, press @kbd{l} to exit
  8498. Logbook mode.
  8499. @item @kbd{v E} or short @kbd{E} (@code{org-agenda-entry-text-mode})
  8500. @kindex v E
  8501. @kindex E
  8502. @findex org-agenda-entry-text-mode
  8503. @vindex org-agenda-start-with-entry-text-mode
  8504. @vindex org-agenda-entry-text-maxlines
  8505. Toggle entry text mode. In entry text mode, a number of lines
  8506. from the Org outline node referenced by an agenda line are
  8507. displayed below the line. The maximum number of lines is given
  8508. by the variable @code{org-agenda-entry-text-maxlines}. Calling this
  8509. command with a numeric prefix argument temporarily modifies that
  8510. number to the prefix value.
  8511. @item @kbd{G} (@code{org-agenda-toggle-time-grid})
  8512. @kindex G
  8513. @vindex org-agenda-use-time-grid
  8514. @vindex org-agenda-time-grid
  8515. Toggle the time grid on and off. See also the variables
  8516. @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
  8517. @item @kbd{r} (@code{org-agenda-redo})
  8518. @itemx @kbd{g}
  8519. @kindex r
  8520. @kindex g
  8521. @findex org-agenda-redo
  8522. Recreate the agenda buffer, for example to reflect the changes
  8523. after modification of the timestamps of items with
  8524. @kbd{S-@key{LEFT}} and @kbd{S-@key{RIGHT}}. When the
  8525. buffer is the global TODO list, a prefix argument is interpreted
  8526. to create a selective list for a specific TODO keyword.
  8527. @item @kbd{C-x C-s} or short @kbd{s} (@code{org-save-all-org-buffers})
  8528. @kindex C-x C-s
  8529. @findex org-save-all-org-buffers
  8530. @kindex s
  8531. Save all Org buffers in the current Emacs session, and also the
  8532. locations of IDs.
  8533. @item @kbd{C-c C-x C-c} (@code{org-agenda-columns})
  8534. @kindex C-c C-x C-c
  8535. @findex org-agenda-columns
  8536. @vindex org-columns-default-format
  8537. Invoke column view (see @ref{Column View}) in the agenda buffer. The
  8538. column view format is taken from the entry at point, or, if there
  8539. is no entry at point, from the first entry in the agenda view.
  8540. So whatever the format for that entry would be in the original
  8541. buffer (taken from a property, from a @samp{COLUMNS} keyword, or from
  8542. the default variable @code{org-columns-default-format}) is used in the
  8543. agenda.
  8544. @item @kbd{C-c C-x >} (@code{org-agenda-remove-restriction-lock})
  8545. @kindex C-c C-x >
  8546. @findex org-agenda-remove-restriction-lock
  8547. Remove the restriction lock on the agenda, if it is currently
  8548. restricted to a file or subtree (see @ref{Agenda Files}).
  8549. @item @kbd{M-@key{UP}} (@code{org-agenda-drag-line-backward})
  8550. @kindex M-UP
  8551. @findex org-agenda-drag-line-backward
  8552. Drag the line at point backward one line. With a numeric prefix
  8553. argument, drag backward by that many lines.
  8554. Moving agenda lines does not persist after an agenda refresh and
  8555. does not modify the contributing Org files.
  8556. @item @kbd{M-@key{DOWN}} (@code{org-agenda-drag-line-forward})
  8557. @kindex M-DOWN
  8558. @findex org-agenda-drag-line-forward
  8559. Drag the line at point forward one line. With a numeric prefix
  8560. argument, drag forward by that many lines.
  8561. @end table
  8562. @anchor{Remote editing}
  8563. @subheading Remote editing
  8564. @cindex remote editing, from agenda
  8565. @table @asis
  8566. @item @kbd{0--9}
  8567. Digit argument.
  8568. @item @kbd{C-_} (@code{org-agenda-undo})
  8569. @kindex C-_
  8570. @findex org-agenda-undo
  8571. @cindex undoing remote-editing events
  8572. @cindex remote editing, undo
  8573. Undo a change due to a remote editing command. The change is
  8574. undone both in the agenda buffer and in the remote buffer.
  8575. @item @kbd{t} (@code{org-agenda-todo})
  8576. @kindex t
  8577. @findex org-agenda-todo
  8578. Change the TODO state of the item, both in the agenda and in the
  8579. original Org file.
  8580. @item @kbd{C-S-@key{RIGHT}} (@code{org-agenda-todo-nextset})
  8581. @kindex C-S-RIGHT
  8582. @findex org-agenda-todo-nextset
  8583. Switch to the next set of TODO keywords.
  8584. @item @kbd{C-S-@key{LEFT}}, @code{org-agenda-todo-previousset}
  8585. @kindex C-S-LEFT
  8586. Switch to the previous set of TODO keywords.
  8587. @item @kbd{C-k} (@code{org-agenda-kill})
  8588. @kindex C-k
  8589. @findex org-agenda-kill
  8590. @vindex org-agenda-confirm-kill
  8591. Delete the current agenda item along with the entire subtree
  8592. belonging to it in the original Org file. If the text to be
  8593. deleted remotely is longer than one line, the kill needs to be
  8594. confirmed by the user. See variable @code{org-agenda-confirm-kill}.
  8595. @item @kbd{C-c C-w} (@code{org-agenda-refile})
  8596. @kindex C-c C-w
  8597. @findex org-agenda-refile
  8598. Refile the entry at point.
  8599. @item @kbd{C-c C-x C-a} or short @kbd{a} (@code{org-agenda-archive-default-with-confirmation})
  8600. @kindex C-c C-x C-a
  8601. @kindex a
  8602. @findex org-agenda-archive-default-with-confirmation
  8603. @vindex org-archive-default-command
  8604. Archive the subtree corresponding to the entry at point using the
  8605. default archiving command set in @code{org-archive-default-command}.
  8606. When using the @kbd{a} key, confirmation is required.
  8607. @item @kbd{C-c C-x a} (@code{org-agenda-toggle-archive-tag})
  8608. @kindex C-c C-x a
  8609. @findex org-agenda-toggle-archive-tag
  8610. Toggle the archive tag (see @ref{Internal archiving}) for the current
  8611. headline.
  8612. @item @kbd{C-c C-x A} (@code{org-agenda-archive-to-archive-sibling})
  8613. @kindex C-c C-x A
  8614. @findex org-agenda-archive-to-archive-sibling
  8615. Move the subtree corresponding to the current entry to its
  8616. @emph{archive sibling}.
  8617. @item @kbd{C-c C-x C-s} or short @kbd{$} (@code{org-agenda-archive})
  8618. @kindex C-c C-x C-s
  8619. @kindex $
  8620. @findex org-agenda-archive
  8621. Archive the subtree corresponding to the current headline. This
  8622. means the entry is moved to the configured archive location, most
  8623. likely a different file.
  8624. @item @kbd{T} (@code{org-agenda-show-tags})
  8625. @kindex T
  8626. @findex org-agenda-show-tags
  8627. @vindex org-agenda-show-inherited-tags
  8628. Show all tags associated with the current item. This is useful
  8629. if you have turned off @code{org-agenda-show-inherited-tags}, but
  8630. still want to see all tags of a headline occasionally.
  8631. @item @kbd{:} (@code{org-agenda-set-tags})
  8632. @kindex :
  8633. @findex org-agenda-set-tags
  8634. Set tags for the current headline. If there is an active region
  8635. in the agenda, change a tag for all headings in the region.
  8636. @item @kbd{,} (@code{org-agenda-priority})
  8637. @kindex ,
  8638. @findex org-agenda-priority
  8639. Set the priority for the current item. Org mode prompts for the
  8640. priority character. If you reply with @kbd{@key{SPC}}, the
  8641. priority cookie is removed from the entry.
  8642. @item @kbd{P} (@code{org-agenda-show-priority})
  8643. @kindex P
  8644. @findex org-agenda-show-priority
  8645. Display weighted priority of current item.
  8646. @item @kbd{+} or @kbd{S-@key{UP}} (@code{org-agenda-priority-up})
  8647. @kindex +
  8648. @kindex S-UP
  8649. @findex org-agenda-priority-up
  8650. Increase the priority of the current item. The priority is
  8651. changed in the original buffer, but the agenda is not resorted.
  8652. Use the @kbd{r} key for this.
  8653. @item @kbd{-} or @kbd{S-@key{DOWN}} (@code{org-agenda-priority-down})
  8654. @kindex -
  8655. @kindex S-DOWN
  8656. @findex org-agenda-priority-down
  8657. Decrease the priority of the current item.
  8658. @item @kbd{C-c C-z} or short @kbd{z} (@code{org-agenda-add-note})
  8659. @kindex z
  8660. @kindex C-c C-z
  8661. @findex org-agenda-add-note
  8662. @vindex org-log-into-drawer
  8663. Add a note to the entry. This note is recorded, and then filed
  8664. to the same location where state change notes are put. Depending
  8665. on @code{org-log-into-drawer}, this may be inside a drawer.
  8666. @item @kbd{C-c C-a} (@code{org-attach})
  8667. @kindex C-c C-a
  8668. @findex org-attach
  8669. Dispatcher for all command related to attachments.
  8670. @item @kbd{C-c C-s} (@code{org-agenda-schedule})
  8671. @kindex C-c C-s
  8672. @findex org-agenda-schedule
  8673. Schedule this item. With a prefix argument, remove the
  8674. scheduling timestamp
  8675. @item @kbd{C-c C-d} (@code{org-agenda-deadline})
  8676. @kindex C-c C-d
  8677. @findex org-agenda-deadline
  8678. Set a deadline for this item. With a prefix argument, remove the
  8679. deadline.
  8680. @item @kbd{S-@key{RIGHT}} (@code{org-agenda-do-date-later})
  8681. @kindex S-RIGHT
  8682. @findex org-agenda-do-date-later
  8683. Change the timestamp associated with the current line by one day
  8684. into the future. If the date is in the past, the first call to
  8685. this command moves it to today. With a numeric prefix argument,
  8686. 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}
  8687. prefix, change the time by one hour. If you immediately repeat
  8688. the command, it will continue to change hours even without the
  8689. prefix argument. With a double @kbd{C-u C-u} prefix, do the
  8690. same for changing minutes. The stamp is changed in the original
  8691. Org file, but the change is not directly reflected in the agenda
  8692. buffer. Use @kbd{r} or @kbd{g} to update the buffer.
  8693. @item @kbd{S-@key{LEFT}} (@code{org-agenda-do-date-earlier})
  8694. @kindex S-LEFT
  8695. @findex org-agenda-do-date-earlier
  8696. Change the timestamp associated with the current line by one day
  8697. into the past.
  8698. @item @kbd{>} (@code{org-agenda-date-prompt})
  8699. @kindex >
  8700. @findex org-agenda-date-prompt
  8701. Change the timestamp associated with the current line. The key
  8702. @kbd{>} has been chosen, because it is the same as
  8703. @kbd{S-.} on my keyboard.
  8704. @item @kbd{I} (@code{org-agenda-clock-in})
  8705. @kindex I
  8706. @findex org-agenda-clock-in
  8707. Start the clock on the current item. If a clock is running
  8708. already, it is stopped first.
  8709. @item @kbd{O} (@code{org-agenda-clock-out})
  8710. @kindex O
  8711. @findex org-agenda-clock-out
  8712. Stop the previously started clock.
  8713. @item @kbd{X} (@code{org-agenda-clock-cancel})
  8714. @kindex X
  8715. @findex org-agenda-clock-cancel
  8716. Cancel the currently running clock.
  8717. @item @kbd{J} (@code{org-agenda-clock-goto})
  8718. @kindex J
  8719. @findex org-agenda-clock-goto
  8720. Jump to the running clock in another window.
  8721. @item @kbd{k} (@code{org-agenda-capture})
  8722. @kindex k
  8723. @findex org-agenda-capture
  8724. @cindex capturing, from agenda
  8725. @vindex org-capture-use-agenda-date
  8726. Like @code{org-capture}, but use the date at point as the default date
  8727. for the capture template. See @code{org-capture-use-agenda-date} to
  8728. make this the default behavior of @code{org-capture}.
  8729. @end table
  8730. @anchor{Bulk remote editing selected entries}
  8731. @subheading Bulk remote editing selected entries
  8732. @cindex remote editing, bulk, from agenda
  8733. @vindex org-agenda-bulk-custom-functions
  8734. @table @asis
  8735. @item @kbd{m} (@code{org-agenda-bulk-mark})
  8736. @kindex m
  8737. @findex org-agenda-bulk-mark
  8738. Mark the entry at point for bulk action. If there is an active
  8739. region in the agenda, mark the entries in the region. With
  8740. numeric prefix argument, mark that many successive entries.
  8741. @item @kbd{*} (@code{org-agenda-bulk-mark-all})
  8742. @kindex *
  8743. @findex org-agenda-bulk-mark-all
  8744. Mark all visible agenda entries for bulk action.
  8745. @item @kbd{u} (@code{org-agenda-bulk-unmark})
  8746. @kindex u
  8747. @findex org-agenda-bulk-unmark
  8748. Unmark entry for bulk action.
  8749. @item @kbd{U} (@code{org-agenda-bulk-remove-all-marks})
  8750. @kindex U
  8751. @findex org-agenda-bulk-remove-all-marks
  8752. Unmark all marked entries for bulk action.
  8753. @item @kbd{M-m} (@code{org-agenda-bulk-toggle})
  8754. @kindex M-m
  8755. @findex org-agenda-bulk-toggle
  8756. Toggle mark of the entry at point for bulk action.
  8757. @item @kbd{M-*} (@code{org-agenda-bulk-toggle-all})
  8758. @kindex M-*
  8759. @findex org-agenda-bulk-toggle-all
  8760. Mark entries matching a regular expression for bulk action.
  8761. @item @kbd{%} (@code{org-agenda-bulk-mark-regexp})
  8762. @kindex %
  8763. @findex org-agenda-bulk-mark-regexp
  8764. Mark entries matching a regular expression for bulk action.
  8765. @item @kbd{B} (@code{org-agenda-bulk-action})
  8766. @kindex B
  8767. @findex org-agenda-bulk-action
  8768. @vindex org-agenda-bulk-persistent-marks
  8769. Bulk action: act on all marked entries in the agenda. This
  8770. prompts for another key to select the action to be applied. The
  8771. prefix argument to @kbd{B} is passed through to the
  8772. @kbd{s} and @kbd{d} commands, to bulk-remove these
  8773. special timestamps. By default, marks are removed after the
  8774. bulk. If you want them to persist, set
  8775. @code{org-agenda-bulk-persistent-marks} to @code{t} or hit @kbd{p} at
  8776. the prompt.
  8777. @table @asis
  8778. @item @kbd{*}
  8779. Toggle persistent marks.
  8780. @item @kbd{$}
  8781. Archive all selected entries.
  8782. @item @kbd{A}
  8783. Archive entries by moving them to their respective archive
  8784. siblings.
  8785. @item @kbd{t}
  8786. Change TODO state. This prompts for a single TODO keyword and
  8787. changes the state of all selected entries, bypassing blocking
  8788. and suppressing logging notes---but not timestamps.
  8789. @item @kbd{+}
  8790. Add a tag to all selected entries.
  8791. @item @kbd{-}
  8792. Remove a tag from all selected entries.
  8793. @item @kbd{s}
  8794. Schedule all items to a new date. To shift existing schedule
  8795. dates by a fixed number of days, use something starting with
  8796. double plus at the prompt, for example @samp{++8d} or @samp{++2w}.
  8797. @item @kbd{d}
  8798. Set deadline to a specific date.
  8799. @item @kbd{r}
  8800. Prompt for a single refile target and move all entries. The
  8801. entries are no longer in the agenda; refresh (@kbd{g}) to
  8802. bring them back.
  8803. @item @kbd{S}
  8804. Reschedule randomly into the coming N days. N is prompted for.
  8805. With a prefix argument (@kbd{C-u B S}), scatter only
  8806. across weekdays.
  8807. @item @kbd{f}
  8808. @vindex org-agenda-bulk-custom-functions
  8809. Apply a function@footnote{You can also create persistent custom functions through
  8810. @code{org-agenda-bulk-custom-functions}.} to marked entries. For example, the
  8811. function below sets the @samp{CATEGORY} property of the entries to
  8812. @samp{web}.
  8813. @lisp
  8814. (defun set-category ()
  8815. (interactive "P")
  8816. (let ((marker (or (org-get-at-bol 'org-hd-marker)
  8817. (org-agenda-error))))
  8818. (org-with-point-at marker
  8819. (org-back-to-heading t)
  8820. (org-set-property "CATEGORY" "web"))))
  8821. @end lisp
  8822. @end table
  8823. @end table
  8824. @anchor{Calendar commands}
  8825. @subheading Calendar commands
  8826. @cindex calendar commands, from agenda
  8827. @table @asis
  8828. @item @kbd{c} (@code{org-agenda-goto-calendar})
  8829. @kindex c
  8830. @findex org-agenda-goto-calendar
  8831. Open the Emacs calendar and move to the date at the agenda
  8832. cursor.
  8833. @item @kbd{c} (@code{org-calendar-goto-agenda})
  8834. @kindex c
  8835. @findex org-calendar-goto-agenda
  8836. When in the calendar, compute and show the Org agenda for the
  8837. date at the cursor.
  8838. @item @kbd{i} (@code{org-agenda-diary-entry})
  8839. @kindex i
  8840. @findex org-agenda-diary-entry
  8841. @cindex diary entries, creating from agenda
  8842. Insert a new entry into the diary, using the date at the cursor
  8843. and (for block entries) the date at the mark. This adds to the
  8844. Emacs diary file@footnote{This file is parsed for the agenda when
  8845. @code{org-agenda-include-diary} is set.}, in a way similar to the @kbd{i}
  8846. command in the calendar. The diary file pops up in another
  8847. window, where you can add the entry.
  8848. @vindex org-agenda-diary-file
  8849. If you configure @code{org-agenda-diary-file} to point to an Org file,
  8850. Org creates entries in that file instead. Most entries are
  8851. stored in a date-based outline tree that will later make it easy
  8852. to archive appointments from previous months/years. The tree is
  8853. built under an entry with a @samp{DATE_TREE} property, or else with
  8854. years as top-level entries. Emacs prompts you for the entry
  8855. text---if you specify it, the entry is created in
  8856. @code{org-agenda-diary-file} without further interaction. If you
  8857. directly press @kbd{@key{RET}} at the prompt without typing text,
  8858. the target file is shown in another window for you to finish the
  8859. entry there. See also the @kbd{k r} command.
  8860. @item @kbd{M} (@code{org-agenda-phases-of-moon})
  8861. @kindex M
  8862. @findex org-agenda-phases-of-moon
  8863. Show the phases of the moon for the three months around current
  8864. date.
  8865. @item @kbd{S} (@code{org-agenda-sunrise-sunset})
  8866. @kindex S
  8867. @findex org-agenda-sunrise-sunset
  8868. Show sunrise and sunset times. The geographical location must be
  8869. set with calendar variables, see the documentation for the Emacs
  8870. calendar.
  8871. @item @kbd{C} (@code{org-agenda-convert-date})
  8872. @kindex C
  8873. @findex org-agenda-convert-date
  8874. Convert the date at cursor into many other cultural and historic
  8875. calendars.
  8876. @item @kbd{H} (@code{org-agenda-holidays})
  8877. @kindex H
  8878. @findex org-agenda-holidays
  8879. Show holidays for three months around the cursor date.
  8880. @end table
  8881. @anchor{Quit and exit}
  8882. @subheading Quit and exit
  8883. @table @asis
  8884. @item @kbd{q} (@code{org-agenda-quit})
  8885. @kindex q
  8886. @findex org-agenda-quit
  8887. Quit agenda, remove the agenda buffer.
  8888. @item @kbd{x} (@code{org-agenda-exit})
  8889. @kindex x
  8890. @findex org-agenda-exit
  8891. @cindex agenda files, removing buffers
  8892. Exit agenda, remove the agenda buffer and all buffers loaded by
  8893. Emacs for the compilation of the agenda. Buffers created by the
  8894. user to visit Org files are not removed.
  8895. @end table
  8896. @node Custom Agenda Views
  8897. @section Custom Agenda Views
  8898. @cindex custom agenda views
  8899. @cindex agenda views, custom
  8900. Custom agenda commands serve two purposes: to store and quickly access
  8901. frequently used TODO and tags searches, and to create special
  8902. composite agenda buffers. Custom agenda commands are accessible
  8903. through the dispatcher (see @ref{Agenda Dispatcher}), just like the
  8904. default commands.
  8905. @menu
  8906. * Storing searches:: Type once, use often.
  8907. * Block agenda:: All the stuff you need in a single buffer.
  8908. * Setting options:: Changing the rules.
  8909. @end menu
  8910. @node Storing searches
  8911. @subsection Storing searches
  8912. The first application of custom searches is the definition of keyboard
  8913. shortcuts for frequently used searches, either creating an agenda
  8914. buffer, or a sparse tree (the latter covering of course only the
  8915. current buffer).
  8916. @kindex C @r{(Agenda dispatcher)}
  8917. @vindex org-agenda-custom-commands
  8918. @cindex agenda views, main example
  8919. @cindex agenda, as an agenda views
  8920. @cindex agenda*, as an agenda views
  8921. @cindex tags, as an agenda view
  8922. @cindex todo, as an agenda view
  8923. @cindex tags-todo
  8924. @cindex todo-tree
  8925. @cindex occur-tree
  8926. @cindex tags-tree
  8927. Custom commands are configured in the variable
  8928. @code{org-agenda-custom-commands}. You can customize this variable, for
  8929. example by pressing @kbd{C} from the agenda dispatcher (see @ref{Agenda Dispatcher}). You can also directly set it with Emacs Lisp in
  8930. the Emacs init file. The following example contains all valid agenda
  8931. views:
  8932. @lisp
  8933. (setq org-agenda-custom-commands
  8934. '(("x" agenda)
  8935. ("y" agenda*)
  8936. ("w" todo "WAITING")
  8937. ("W" todo-tree "WAITING")
  8938. ("u" tags "+boss-urgent")
  8939. ("v" tags-todo "+boss-urgent")
  8940. ("U" tags-tree "+boss-urgent")
  8941. ("f" occur-tree "\\<FIXME\\>")
  8942. ("h" . "HOME+Name tags searches") ;description for "h" prefix
  8943. ("hl" tags "+home+Lisa")
  8944. ("hp" tags "+home+Peter")
  8945. ("hk" tags "+home+Kim")))
  8946. @end lisp
  8947. @noindent
  8948. The initial string in each entry defines the keys you have to press
  8949. after the dispatcher command in order to access the command. Usually
  8950. this will be just a single character, but if you have many similar
  8951. commands, you can also define two-letter combinations where the first
  8952. character is the same in several combinations and serves as a prefix
  8953. key@footnote{You can provide a description for a prefix key by inserting
  8954. a cons cell with the prefix and the description.}. The second parameter is the search type, followed by the
  8955. string or regular expression to be used for the matching. The example
  8956. above will therefore define:
  8957. @table @asis
  8958. @item @kbd{x}
  8959. as a global search for agenda entries planned@footnote{@emph{Planned} means here that these entries have some planning
  8960. information attached to them, like a time-stamp, a scheduled or
  8961. a deadline string. See @code{org-agenda-entry-types} on how to set what
  8962. planning information is taken into account.} this
  8963. week/day.
  8964. @item @kbd{y}
  8965. as the same search, but only for entries with an hour
  8966. specification like @samp{[h]h:mm}---think of them as appointments.
  8967. @item @kbd{w}
  8968. as a global search for TODO entries with @samp{WAITING} as the TODO
  8969. keyword.
  8970. @item @kbd{W}
  8971. as the same search, but only in the current buffer and displaying
  8972. the results as a sparse tree.
  8973. @item @kbd{u}
  8974. as a global tags search for headlines tagged @samp{boss} but not
  8975. @samp{urgent}.
  8976. @item @kbd{v}
  8977. The same search, but limiting it to headlines that are also TODO
  8978. items.
  8979. @item @kbd{U}
  8980. as the same search, but only in the current buffer and displaying
  8981. the result as a sparse tree.
  8982. @item @kbd{f}
  8983. to create a sparse tree (again, current buffer only) with all
  8984. entries containing the word @samp{FIXME}.
  8985. @item @kbd{h}
  8986. as a prefix command for a @samp{HOME} tags search where you have to
  8987. press an additional key (@kbd{l}, @kbd{p} or
  8988. @kbd{k}) to select a name (Lisa, Peter, or Kim) as
  8989. additional tag to match.
  8990. @end table
  8991. Note that @code{*-tree} agenda views need to be called from an Org buffer
  8992. as they operate on the current buffer only.
  8993. @node Block agenda
  8994. @subsection Block agenda
  8995. @cindex block agenda
  8996. @cindex agenda, with block views
  8997. Another possibility is the construction of agenda views that comprise
  8998. the results of @emph{several} commands, each of which creates a block in
  8999. the agenda buffer. The available commands include @code{agenda} for the
  9000. daily or weekly agenda (as created with @kbd{a}) , @code{alltodo} for
  9001. the global TODO list (as constructed with @kbd{t}), and the
  9002. matching commands discussed above: @code{todo}, @code{tags}, and @code{tags-todo}.
  9003. Here are two examples:
  9004. @lisp
  9005. (setq org-agenda-custom-commands
  9006. '(("h" "Agenda and Home-related tasks"
  9007. ((agenda "")
  9008. (tags-todo "home")
  9009. (tags "garden")))
  9010. ("o" "Agenda and Office-related tasks"
  9011. ((agenda "")
  9012. (tags-todo "work")
  9013. (tags "office")))))
  9014. @end lisp
  9015. @noindent
  9016. This defines @kbd{h} to create a multi-block view for stuff you
  9017. need to attend to at home. The resulting agenda buffer contains your
  9018. agenda for the current week, all TODO items that carry the tag @samp{home},
  9019. and also all lines tagged with @samp{garden}. Finally the command
  9020. @kbd{o} provides a similar view for office tasks.
  9021. @node Setting options
  9022. @subsection Setting options for custom commands
  9023. @cindex options, for custom agenda views
  9024. @vindex org-agenda-custom-commands
  9025. Org mode contains a number of variables regulating agenda construction
  9026. and display. The global variables define the behavior for all agenda
  9027. commands, including the custom commands. However, if you want to
  9028. change some settings just for a single custom view, you can do so.
  9029. Setting options requires inserting a list of variable names and values
  9030. at the right spot in @code{org-agenda-custom-commands}. For example:
  9031. @lisp
  9032. (setq org-agenda-custom-commands
  9033. '(("w" todo "WAITING"
  9034. ((org-agenda-sorting-strategy '(priority-down))
  9035. (org-agenda-prefix-format " Mixed: ")))
  9036. ("U" tags-tree "+boss-urgent"
  9037. ((org-show-context-detail 'minimal)))
  9038. ("N" search ""
  9039. ((org-agenda-files '("~org/notes.org"))
  9040. (org-agenda-text-search-extra-files nil)))))
  9041. @end lisp
  9042. @noindent
  9043. Now the @kbd{w} command sorts the collected entries only by
  9044. priority, and the prefix format is modified to just say @samp{Mixed:}
  9045. instead of giving the category of the entry. The sparse tags tree of
  9046. @kbd{U} now turns out ultra-compact, because neither the headline
  9047. hierarchy above the match, nor the headline following the match are
  9048. shown. The command @kbd{N} does a text search limited to only
  9049. a single file.
  9050. For command sets creating a block agenda, @code{org-agenda-custom-commands}
  9051. has two separate spots for setting options. You can add options that
  9052. should be valid for just a single command in the set, and options that
  9053. should be valid for all commands in the set. The former are just
  9054. added to the command entry; the latter must come after the list of
  9055. command entries. Going back to the block agenda example (see @ref{Block agenda}), let's change the sorting strategy for the @kbd{h}
  9056. commands to @code{priority-down}, but let's sort the results for GARDEN
  9057. tags query in the opposite order, @code{priority-up}. This would look like
  9058. this:
  9059. @lisp
  9060. (setq org-agenda-custom-commands
  9061. '(("h" "Agenda and Home-related tasks"
  9062. ((agenda)
  9063. (tags-todo "home")
  9064. (tags "garden"
  9065. ((org-agenda-sorting-strategy '(priority-up)))))
  9066. ((org-agenda-sorting-strategy '(priority-down))))
  9067. ("o" "Agenda and Office-related tasks"
  9068. ((agenda)
  9069. (tags-todo "work")
  9070. (tags "office")))))
  9071. @end lisp
  9072. As you see, the values and parentheses setting is a little complex.
  9073. When in doubt, use the customize interface to set this variable---it
  9074. fully supports its structure. Just one caveat: when setting options
  9075. in this interface, the @emph{values} are just Lisp expressions. So if the
  9076. value is a string, you need to add the double-quotes around the value
  9077. yourself.
  9078. @vindex org-agenda-custom-commands-contexts
  9079. To control whether an agenda command should be accessible from
  9080. a specific context, you can customize
  9081. @code{org-agenda-custom-commands-contexts}. Let's say for example that you
  9082. have an agenda command @kbd{o} displaying a view that you only
  9083. need when reading emails. Then you would configure this option like
  9084. this:
  9085. @lisp
  9086. (setq org-agenda-custom-commands-contexts
  9087. '(("o" (in-mode . "message-mode"))))
  9088. @end lisp
  9089. You can also tell that the command key @kbd{o} should refer to
  9090. another command key @kbd{r}. In that case, add this command key
  9091. like this:
  9092. @lisp
  9093. (setq org-agenda-custom-commands-contexts
  9094. '(("o" "r" (in-mode . "message-mode"))))
  9095. @end lisp
  9096. See the docstring of the variable for more information.
  9097. @node Exporting Agenda Views
  9098. @section Exporting Agenda Views
  9099. @cindex agenda views, exporting
  9100. If you are away from your computer, it can be very useful to have
  9101. a printed version of some agenda views to carry around. Org mode can
  9102. export custom agenda views as plain text, HTML@footnote{For HTML you need to install Hrvoje Niksic's @samp{htmlize.el}
  9103. from @uref{https://github.com/hniksic/emacs-htmlize, Hrvoje Niksic's repository}.}, Postscript,
  9104. PDF@footnote{To create PDF output, the Ghostscript ps2pdf utility must be
  9105. installed on the system. Selecting a PDF file also creates the
  9106. postscript file.}, and iCalendar files. If you want to do this only
  9107. occasionally, use the following command:
  9108. @table @asis
  9109. @item @kbd{C-x C-w} (@code{org-agenda-write})
  9110. @kindex C-x C-w
  9111. @findex org-agenda-write
  9112. @cindex exporting agenda views
  9113. @cindex agenda views, exporting
  9114. @vindex org-agenda-exporter-settings
  9115. Write the agenda view to a file.
  9116. @end table
  9117. If you need to export certain agenda views frequently, you can
  9118. associate any custom agenda command with a list of output file
  9119. names@footnote{If you want to store standard views like the weekly agenda or
  9120. the global TODO list as well, you need to define custom commands for
  9121. them in order to be able to specify file names.}. Here is an example that first defines custom commands
  9122. for the agenda and the global TODO list, together with a number of
  9123. files to which to export them. Then we define two block agenda
  9124. commands and specify file names for them as well. File names can be
  9125. relative to the current working directory, or absolute.
  9126. @lisp
  9127. (setq org-agenda-custom-commands
  9128. '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  9129. ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  9130. ("h" "Agenda and Home-related tasks"
  9131. ((agenda "")
  9132. (tags-todo "home")
  9133. (tags "garden"))
  9134. nil
  9135. ("~/views/home.html"))
  9136. ("o" "Agenda and Office-related tasks"
  9137. ((agenda)
  9138. (tags-todo "work")
  9139. (tags "office"))
  9140. nil
  9141. ("~/views/office.ps" "~/calendars/office.ics"))))
  9142. @end lisp
  9143. The extension of the file name determines the type of export. If it
  9144. is @samp{.html}, Org mode uses the htmlize package to convert the buffer to
  9145. HTML and save it to this file name. If the extension is @samp{.ps},
  9146. @code{ps-print-buffer-with-faces} is used to produce Postscript output. If
  9147. the extension is @samp{.ics}, iCalendar export is run export over all files
  9148. that were used to construct the agenda, and limit the export to
  9149. entries listed in the agenda. Any other extension produces a plain
  9150. ASCII file.
  9151. The export files are @emph{not} created when you use one of those
  9152. commands interactively because this might use too much overhead.
  9153. Instead, there is a special command to produce @emph{all} specified
  9154. files in one step:
  9155. @table @asis
  9156. @item @kbd{e} (@code{org-store-agenda-views})
  9157. @kindex e @r{(Agenda dispatcher)}
  9158. @findex org-store-agenda-views
  9159. Export all agenda views that have export file names associated
  9160. with them.
  9161. @end table
  9162. You can use the options section of the custom agenda commands to also
  9163. set options for the export commands. For example:
  9164. @lisp
  9165. (setq org-agenda-custom-commands
  9166. '(("X" agenda ""
  9167. ((ps-number-of-columns 2)
  9168. (ps-landscape-mode t)
  9169. (org-agenda-prefix-format " [ ] ")
  9170. (org-agenda-with-colors nil)
  9171. (org-agenda-remove-tags t))
  9172. ("theagenda.ps"))))
  9173. @end lisp
  9174. @noindent
  9175. @vindex org-agenda-exporter-settings
  9176. This command sets two options for the Postscript exporter, to make it
  9177. print in two columns in landscape format---the resulting page can be
  9178. cut in two and then used in a paper agenda. The remaining settings
  9179. modify the agenda prefix to omit category and scheduling information,
  9180. and instead include a checkbox to check off items. We also remove the
  9181. tags to make the lines compact, and we do not want to use colors for
  9182. the black-and-white printer. Settings specified in
  9183. @code{org-agenda-exporter-settings} also apply, e.g.,
  9184. @lisp
  9185. (setq org-agenda-exporter-settings
  9186. '((ps-number-of-columns 2)
  9187. (ps-landscape-mode t)
  9188. (org-agenda-add-entry-text-maxlines 5)
  9189. (htmlize-output-type 'css)))
  9190. @end lisp
  9191. @noindent
  9192. but the settings in @code{org-agenda-custom-commands} take precedence.
  9193. @noindent
  9194. From the command line you may also use:
  9195. @example
  9196. emacs -eval (org-batch-store-agenda-views) -kill
  9197. @end example
  9198. @noindent
  9199. or, if you need to modify some parameters@footnote{Quoting depends on the system you use, please check the FAQ
  9200. for examples.}
  9201. @example
  9202. emacs -eval '(org-batch-store-agenda-views \
  9203. org-agenda-span (quote month) \
  9204. org-agenda-start-day "2007-11-01" \
  9205. org-agenda-include-diary nil \
  9206. org-agenda-files (quote ("~/org/project.org")))' \
  9207. -kill
  9208. @end example
  9209. @noindent
  9210. which creates the agenda views restricted to the file
  9211. @samp{~/org/project.org}, without diary entries and with a 30-day extent.
  9212. You can also extract agenda information in a way that allows further
  9213. processing by other programs. See @ref{Extracting Agenda Information}, for
  9214. more information.
  9215. @node Agenda Column View
  9216. @section Using Column View in the Agenda
  9217. @cindex column view, in agenda
  9218. @cindex agenda, column view
  9219. Column view (see @ref{Column View}) is normally used to view and edit
  9220. properties embedded in the hierarchical structure of an Org file. It
  9221. can be quite useful to use column view also from the agenda, where
  9222. entries are collected by certain criteria.
  9223. @table @asis
  9224. @item @kbd{C-c C-x C-c} (@code{org-agenda-columns})
  9225. @kindex C-c C-x C-c
  9226. @findex org-agenda-columns
  9227. Turn on column view in the agenda.
  9228. @end table
  9229. To understand how to use this properly, it is important to realize
  9230. that the entries in the agenda are no longer in their proper outline
  9231. environment. This causes the following issues:
  9232. @enumerate
  9233. @item
  9234. @vindex org-columns-default-format
  9235. @vindex org-overriding-columns-format
  9236. Org needs to make a decision which columns format to use. Since
  9237. the entries in the agenda are collected from different files, and
  9238. different files may have different columns formats, this is
  9239. a non-trivial problem. Org first checks if the variable
  9240. @code{org-agenda-overriding-columns-format} is currently set, and if so,
  9241. takes the format from there. Otherwise it takes the format
  9242. associated with the first item in the agenda, or, if that item does
  9243. not have a specific format (defined in a property, or in its file),
  9244. it uses @code{org-columns-default-format}.
  9245. @item
  9246. @cindex @samp{CLOCKSUM}, special property
  9247. If any of the columns has a summary type defined (see @ref{Column attributes}), turning on column view in the agenda visits all
  9248. relevant agenda files and make sure that the computations of this
  9249. property are up to date. This is also true for the special
  9250. @samp{CLOCKSUM} property. Org then sums the values displayed in the
  9251. agenda. In the daily/weekly agenda, the sums cover a single day;
  9252. in all other views they cover the entire block.
  9253. It is important to realize that the agenda may show the same entry
  9254. @emph{twice}---for example as scheduled and as a deadline---and it may
  9255. show two entries from the same hierarchy (for example a @emph{parent}
  9256. and its @emph{child}). In these cases, the summation in the agenda
  9257. leads to incorrect results because some values count double.
  9258. @item
  9259. When the column view in the agenda shows the @samp{CLOCKSUM} property,
  9260. that is always the entire clocked time for this item. So even in
  9261. the daily/weekly agenda, the clocksum listed in column view may
  9262. originate from times outside the current view. This has the
  9263. advantage that you can compare these values with a column listing
  9264. the planned total effort for a task---one of the major
  9265. applications for column view in the agenda. If you want
  9266. information about clocked time in the displayed period use clock
  9267. table mode (press @kbd{R} in the agenda).
  9268. @item
  9269. @cindex @samp{CLOCKSUM_T}, special property
  9270. When the column view in the agenda shows the @samp{CLOCKSUM_T} property,
  9271. that is always today's clocked time for this item. So even in the
  9272. weekly agenda, the clocksum listed in column view only originates
  9273. from today. This lets you compare the time you spent on a task for
  9274. today, with the time already spent---via @samp{CLOCKSUM}---and with
  9275. the planned total effort for it.
  9276. @end enumerate
  9277. @node Markup
  9278. @chapter Markup for Rich Export
  9279. When exporting Org documents, the exporter tries to reflect the
  9280. structure of the document as accurately as possible in the back-end.
  9281. Since export targets like HTML and @LaTeX{} allow much richer formatting,
  9282. Org mode has rules on how to prepare text for rich export. This
  9283. section summarizes the markup rules used in an Org mode buffer.
  9284. @menu
  9285. * Paragraphs:: The basic unit of text.
  9286. * Emphasis and Monospace:: Bold, italic, etc.
  9287. * Horizontal Rules:: Make a line.
  9288. * Images and Tables:: Images, tables and caption mechanism.
  9289. * Literal Examples:: Source code examples with special formatting.
  9290. * Special Symbols:: Greek letters and other symbols.
  9291. * Subscripts and Superscripts:: Simple syntax for raising/lowering text.
  9292. * Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents.
  9293. @end menu
  9294. @node Paragraphs
  9295. @section Paragraphs
  9296. @cindex paragraphs, markup rules
  9297. Paragraphs are separated by at least one empty line. If you need to
  9298. enforce a line break within a paragraph, use @code{\\} at the end of
  9299. a line.
  9300. To preserve the line breaks, indentation and blank lines in a region,
  9301. but otherwise use normal formatting, you can use this construct, which
  9302. can also be used to format poetry.
  9303. @cindex @samp{BEGIN_VERSE}
  9304. @cindex verse blocks
  9305. @example
  9306. #+BEGIN_VERSE
  9307. Great clouds overhead
  9308. Tiny black birds rise and fall
  9309. Snow covers Emacs
  9310. ---AlexSchroeder
  9311. #+END_VERSE
  9312. @end example
  9313. When quoting a passage from another document, it is customary to
  9314. format this as a paragraph that is indented on both the left and the
  9315. right margin. You can include quotations in Org documents like this:
  9316. @cindex @samp{BEGIN_QUOTE}
  9317. @cindex quote blocks
  9318. @example
  9319. #+BEGIN_QUOTE
  9320. Everything should be made as simple as possible,
  9321. but not any simpler ---Albert Einstein
  9322. #+END_QUOTE
  9323. @end example
  9324. If you would like to center some text, do it like this:
  9325. @cindex @samp{BEGIN_CENTER}
  9326. @cindex center blocks
  9327. @example
  9328. #+BEGIN_CENTER
  9329. Everything should be made as simple as possible, \\
  9330. but not any simpler
  9331. #+END_CENTER
  9332. @end example
  9333. @node Emphasis and Monospace
  9334. @section Emphasis and Monospace
  9335. @cindex underlined text, markup rules
  9336. @cindex bold text, markup rules
  9337. @cindex italic text, markup rules
  9338. @cindex verbatim text, markup rules
  9339. @cindex code text, markup rules
  9340. @cindex strike-through text, markup rules
  9341. You can make words @samp{*bold*}, @samp{/italic/}, @samp{_underlined_}, @samp{=verbatim=}
  9342. and @samp{~code~}, and, if you must, @samp{+strike-through+}. Text in the code
  9343. and verbatim string is not processed for Org mode specific syntax; it
  9344. is exported verbatim.
  9345. @vindex org-fontify-emphasized-text
  9346. To turn off fontification for marked up text, you can set
  9347. @code{org-fontify-emphasized-text} to @code{nil}. To narrow down the list of
  9348. available markup syntax, you can customize @code{org-emphasis-alist}.
  9349. @node Horizontal Rules
  9350. @section Horizontal Rules
  9351. @cindex horizontal rules, markup rules
  9352. A line consisting of only dashes, and at least 5 of them, is exported
  9353. as a horizontal line.
  9354. @node Images and Tables
  9355. @section Images and Tables
  9356. @cindex tables, markup rules
  9357. @cindex @samp{CAPTION}, keyword
  9358. @cindex @samp{NAME}, keyword
  9359. Both the native Org mode tables (see @ref{Tables}) and tables formatted
  9360. with the @samp{table.el} package are exported properly. For Org mode
  9361. tables, the lines before the first horizontal separator line become
  9362. table header lines. You can use the following lines somewhere before
  9363. the table to assign a caption and a label for cross references, and in
  9364. the text you can refer to the object with @samp{[[tab:basic-data]]} (see
  9365. @ref{Internal Links}):
  9366. @example
  9367. #+CAPTION: This is the caption for the next table (or link)
  9368. #+NAME: tab:basic-data
  9369. | ... | ... |
  9370. |-----+-----|
  9371. @end example
  9372. Optionally, the caption can take the form:
  9373. @example
  9374. #+CAPTION[Caption for list of tables]: Caption for table.
  9375. @end example
  9376. @cindex inlined images, markup rules
  9377. Some back-ends allow you to directly include images into the exported
  9378. document. Org does this, if a link to an image file does not have
  9379. a description part, for example @samp{[[./img/a.jpg]]}. If you wish to define
  9380. a caption for the image and maybe a label for internal cross
  9381. references, make sure that the link is on a line by itself and precede
  9382. it with @samp{CAPTION} and @samp{NAME} keywords as follows:
  9383. @example
  9384. #+CAPTION: This is the caption for the next figure link (or table)
  9385. #+NAME: fig:SED-HR4049
  9386. [[./img/a.jpg]]
  9387. @end example
  9388. @noindent
  9389. Such images can be displayed within the buffer. See @ref{Handling Links, , the discussion of
  9390. image links}.
  9391. Even though images and tables are prominent examples of captioned
  9392. structures, the same caption mechanism can apply to many
  9393. others---e.g., @LaTeX{} equations, source code blocks. Depending on the
  9394. export back-end, those may or may not be handled.
  9395. @node Literal Examples
  9396. @section Literal Examples
  9397. @cindex literal examples, markup
  9398. @cindex code line references, markup
  9399. You can include literal examples that should not be subjected to
  9400. markup. Such examples are typeset in monospace, so this is well
  9401. suited for source code and similar examples.
  9402. @cindex @samp{BEGIN_EXAMPLE}
  9403. @cindex example block
  9404. @example
  9405. #+BEGIN_EXAMPLE
  9406. Some example from a text file.
  9407. #+END_EXAMPLE
  9408. @end example
  9409. Note that such blocks may be @emph{indented} in order to align nicely with
  9410. indented text and in particular with plain list structure (see
  9411. @ref{Plain Lists}). For simplicity when using small examples, you can
  9412. also start the example lines with a colon followed by a space. There
  9413. may also be additional whitespace before the colon:
  9414. @example
  9415. Here is an example
  9416. : Some example from a text file.
  9417. @end example
  9418. @cindex formatting source code, markup rules
  9419. @vindex org-latex-listings
  9420. If the example is source code from a programming language, or any
  9421. other text that can be marked up by Font Lock in Emacs, you can ask
  9422. for the example to look like the fontified Emacs buffer@footnote{This works automatically for the HTML backend (it requires
  9423. version 1.34 of the @samp{htmlize.el} package, which you need to install).
  9424. Fontified code chunks in @LaTeX{} can be achieved using either the
  9425. listings package or the @uref{https://github.com/gpoore/minted, minted} package. Refer to
  9426. @code{org-export-latex-listings} for details.}. This
  9427. is done with the code block, where you also need to specify the name
  9428. of the major mode that should be used to fontify the example@footnote{Source code in code blocks may also be evaluated either
  9429. interactively or on export. See @ref{Working with Source Code} for more
  9430. information on evaluating code blocks.},
  9431. see @ref{Structure Templates} for shortcuts to easily insert code blocks.
  9432. @cindex @samp{BEGIN_SRC}
  9433. @cindex src block
  9434. @example
  9435. #+BEGIN_SRC emacs-lisp
  9436. (defun org-xor (a b)
  9437. "Exclusive or."
  9438. (if a (not b) b))
  9439. #+END_SRC
  9440. @end example
  9441. Both in @samp{example} and in @samp{src} snippets, you can add a @samp{-n} switch to
  9442. the end of the @samp{#+BEGIN} line, to get the lines of the example
  9443. numbered. The @samp{-n} takes an optional numeric argument specifying the
  9444. starting line number of the block. If you use a @samp{+n} switch, the
  9445. numbering from the previous numbered snippet is continued in the
  9446. current one. The @samp{+n} switch can also take a numeric argument. This
  9447. adds the value of the argument to the last line of the previous block
  9448. to determine the starting line number.
  9449. @example
  9450. #+BEGIN_SRC emacs-lisp -n 20
  9451. ;; This exports with line number 20.
  9452. (message "This is line 21")
  9453. #+END_SRC
  9454. #+BEGIN_SRC emacs-lisp +n 10
  9455. ;; This is listed as line 31.
  9456. (message "This is line 32")
  9457. #+END_SRC
  9458. @end example
  9459. In literal examples, Org interprets strings like @samp{(ref:name)} as
  9460. labels, and use them as targets for special hyperlinks like
  9461. @samp{[[(name)]]}---i.e., the reference name enclosed in single parenthesis.
  9462. In HTML, hovering the mouse over such a link remote-highlights the
  9463. corresponding code line, which is kind of cool.
  9464. You can also add a @samp{-r} switch which @emph{removes} the labels from the
  9465. source code@footnote{Adding @samp{-k} to @samp{-n -r} @emph{keeps} the labels in the source code
  9466. while using line numbers for the links, which might be useful to
  9467. explain those in an Org mode example code.}. With the @samp{-n} switch, links to these references
  9468. are labeled by the line numbers from the code listing. Otherwise
  9469. links use the labels with no parentheses. Here is an example:
  9470. @example
  9471. #+BEGIN_SRC emacs-lisp -n -r
  9472. (save-excursion (ref:sc)
  9473. (goto-char (point-min)) (ref:jump)
  9474. #+END_SRC
  9475. In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
  9476. jumps to point-min.
  9477. @end example
  9478. @cindex indentation, in source blocks
  9479. Finally, you can use @samp{-i} to preserve the indentation of a specific
  9480. code block (see @ref{Editing Source Code}).
  9481. @vindex org-coderef-label-format
  9482. If the syntax for the label format conflicts with the language syntax,
  9483. use a @samp{-l} switch to change the format, for example
  9484. @example
  9485. #+BEGIN_SRC pascal -n -r -l "((%s))"
  9486. @end example
  9487. @noindent
  9488. See also the variable @code{org-coderef-label-format}.
  9489. HTML export also allows examples to be published as text areas (see
  9490. @ref{Text areas in HTML export}).
  9491. Because the @samp{#+BEGIN} @dots{} @samp{#+END} patterns need to be added so often,
  9492. a shortcut is provided (see @ref{Structure Templates}).
  9493. @table @asis
  9494. @item @kbd{C-c '} (@code{org-edit-special})
  9495. @kindex C-c '
  9496. @findex org-edit-special
  9497. Edit the source code example at point in its native mode. This
  9498. works by switching to a temporary buffer with the source code.
  9499. You need to exit by pressing @kbd{C-c '} again@footnote{Upon exit, lines starting with @samp{*}, @samp{,*}, @samp{#+} and @samp{,#+} get
  9500. a comma prepended, to keep them from being interpreted by Org as
  9501. outline nodes or special syntax. These commas are stripped when
  9502. editing with @kbd{C-c '}, and also before export.}. The
  9503. edited version then replaces the old version in the Org buffer.
  9504. Fixed-width regions---where each line starts with a colon
  9505. followed by a space---are edited using @code{artist-mode}@footnote{You may select a different-mode with the variable
  9506. @code{org-edit-fixed-width-region-mode}.} to
  9507. allow creating ASCII drawings easily. Using this command in an
  9508. empty line creates a new fixed-width region.
  9509. @end table
  9510. @cindex storing link, in a source code buffer
  9511. Calling @code{org-store-link} (see @ref{Handling Links}) while editing a source
  9512. code example in a temporary buffer created with @kbd{C-c '}
  9513. prompts for a label. Make sure that it is unique in the current
  9514. buffer, and insert it with the proper formatting like @samp{(ref:label)} at
  9515. the end of the current line. Then the label is stored as a link
  9516. @samp{(label)}, for retrieval with @kbd{C-c C-l}.
  9517. @node Special Symbols
  9518. @section Special Symbols
  9519. @cindex math symbols
  9520. @cindex special symbols
  9521. @cindex @TeX{} macros
  9522. @cindex @LaTeX{} fragments, markup rules
  9523. @cindex HTML entities
  9524. @cindex @LaTeX{} entities
  9525. You can use @LaTeX{}-like syntax to insert special symbols---named
  9526. entities---like @samp{\alpha} to indicate the Greek letter, or @samp{\to} to indicate
  9527. an arrow. Completion for these symbols is available, just type @samp{\}
  9528. and maybe a few letters, and press @kbd{M-@key{TAB}} to see possible
  9529. completions. If you need such a symbol inside a word, terminate it
  9530. with a pair of curly brackets. For example
  9531. @example
  9532. Pro tip: Given a circle \Gamma of diameter d, the length of its
  9533. circumference is \pi@{@}d.
  9534. @end example
  9535. @findex org-entities-help
  9536. @vindex org-entities-user
  9537. A large number of entities is provided, with names taken from both
  9538. HTML and @LaTeX{}; you can comfortably browse the complete list from
  9539. a dedicated buffer using the command @code{org-entities-help}. It is also
  9540. possible to provide your own special symbols in the variable
  9541. @code{org-entities-user}.
  9542. During export, these symbols are transformed into the native format of
  9543. the exporter back-end. Strings like @samp{\alpha} are exported as @samp{&alpha;} in
  9544. the HTML output, and as @samp{\(\alpha\)} in the @LaTeX{} output. Similarly, @samp{\nbsp}
  9545. becomes @samp{&nbsp;} in HTML and @samp{~} in @LaTeX{}.
  9546. @cindex escaping characters
  9547. Entities may also be used as a way to escape markup in an Org
  9548. document, e.g., @samp{\under@{@}not underlined\under} exports as @samp{_not underlined_}.
  9549. @cindex special symbols, in-buffer display
  9550. If you would like to see entities displayed as UTF-8 characters, use
  9551. the following command@footnote{You can turn this on by default by setting the variable
  9552. @code{org-pretty-entities}, or on a per-file base with the @samp{STARTUP} option
  9553. @samp{entitiespretty}.}:
  9554. @table @asis
  9555. @item @kbd{C-c C-x \} (@code{org-toggle-pretty-entities})
  9556. @kindex C-c C-x \
  9557. @findex org-toggle-pretty-entities
  9558. Toggle display of entities as UTF-8 characters. This does not
  9559. change the buffer content which remains plain ASCII, but it
  9560. overlays the UTF-8 character for display purposes only.
  9561. @end table
  9562. @cindex shy hyphen, special symbol
  9563. @cindex dash, special symbol
  9564. @cindex ellipsis, special symbol
  9565. In addition to regular entities defined above, Org exports in
  9566. a special way@footnote{This behavior can be disabled with @samp{-} export setting (see
  9567. @ref{Export Settings}).} the following commonly used character
  9568. combinations: @samp{\-} is treated as a shy hyphen, @samp{--} and @samp{---} are
  9569. converted into dashes, and @samp{...} becomes a compact set of dots.
  9570. @node Subscripts and Superscripts
  9571. @section Subscripts and Superscripts
  9572. @cindex subscript
  9573. @cindex superscript
  9574. @samp{^} and @samp{_} are used to indicate super- and subscripts. To increase
  9575. the readability of ASCII text, it is not necessary, but OK, to
  9576. surround multi-character sub- and superscripts with curly braces. For
  9577. example
  9578. @example
  9579. The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand,
  9580. the radius of Alpha Centauri is R_@{Alpha Centauri@} = 1.28 x R_@{sun@}.
  9581. @end example
  9582. @vindex org-use-sub-superscripts
  9583. If you write a text where the underscore is often used in a different
  9584. context, Org's convention to always interpret these as subscripts can
  9585. get in your way. Configure the variable @code{org-use-sub-superscripts} to
  9586. change this convention. For example, when setting this variable to
  9587. @code{@{@}}, @samp{a_b} is not interpreted as a subscript, but @samp{a_@{b@}} is.
  9588. @table @asis
  9589. @item @kbd{C-c C-x \} (@code{org-toggle-pretty-entities~})
  9590. @kindex C-c C-x \
  9591. @findex org-toggle-pretty-entities
  9592. In addition to showing entities as UTF-8 characters, this command
  9593. also formats sub- and superscripts in a WYSIWYM way.
  9594. @end table
  9595. @node Embedded @LaTeX{}
  9596. @section Embedded @LaTeX{}
  9597. @cindex @TeX{} interpretation
  9598. @cindex @LaTeX{} interpretation
  9599. Plain ASCII is normally sufficient for almost all note taking.
  9600. Exceptions include scientific notes, which often require mathematical
  9601. symbols and the occasional formula. @LaTeX{}@footnote{@LaTeX{} is a macro system based on Donald@tie{}E.@tie{}Knuth's @TeX{}
  9602. system. Many of the features described here as ``@LaTeX{}'' are really
  9603. from @TeX{}, but for simplicity I am blurring this distinction.} is widely used to
  9604. typeset scientific documents. Org mode supports embedding @LaTeX{} code
  9605. into its files, because many academics are used to writing and reading
  9606. @LaTeX{} source code, and because it can be readily processed to produce
  9607. pretty output for a number of export back-ends.
  9608. @menu
  9609. * @LaTeX{} fragments:: Complex formulas made easy.
  9610. * Previewing @LaTeX{} fragments:: What will this snippet look like?
  9611. * CD@LaTeX{} mode:: Speed up entering of formulas.
  9612. @end menu
  9613. @node @LaTeX{} fragments
  9614. @subsection @LaTeX{} fragments
  9615. @cindex @LaTeX{} fragments
  9616. @vindex org-format-latex-header
  9617. Org mode can contain @LaTeX{} math fragments, and it supports ways to
  9618. process these for several export back-ends. When exporting to @LaTeX{},
  9619. the code is left as it is. When exporting to HTML, Org can use either
  9620. @uref{http://www.mathjax.org, MathJax} (see @ref{Math formatting in HTML export}) or transcode the math
  9621. into images (see @ref{Previewing @LaTeX{} fragments}).
  9622. @LaTeX{} fragments do not need any special marking at all. The following
  9623. snippets are identified as @LaTeX{} source code:
  9624. @itemize
  9625. @item
  9626. Environments of any kind@footnote{When MathJax is used, only the environments recognized by
  9627. MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is
  9628. used to create images, any @LaTeX{} environment is handled.}. The only requirement is that the
  9629. @samp{\begin} statement appears on a new line, preceded by only
  9630. whitespace.
  9631. @item
  9632. Text within the usual @LaTeX{} math delimiters. To avoid conflicts
  9633. with currency specifications, single @samp{$} characters are only
  9634. recognized as math delimiters if the enclosed text contains at most
  9635. two line breaks, is directly attached to the @samp{$} characters with no
  9636. whitespace in between, and if the closing @samp{$} is followed by
  9637. whitespace, punctuation or a dash. For the other delimiters, there
  9638. is no such restriction, so when in doubt, use @samp{\(...\)} as inline
  9639. math delimiters.
  9640. @end itemize
  9641. @noindent
  9642. For example:
  9643. @example
  9644. \begin@{equation@} % arbitrary environments,
  9645. x=\sqrt@{b@} % even tables, figures
  9646. \end@{equation@} % etc
  9647. If $a^2=b$ and \( b=2 \), then the solution must be
  9648. either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
  9649. @end example
  9650. @vindex org-export-with-latex
  9651. @LaTeX{} processing can be configured with the variable
  9652. @code{org-export-with-latex}. The default setting is @code{t} which means
  9653. MathJax for HTML, and no processing for ASCII and @LaTeX{} back-ends.
  9654. You can also set this variable on a per-file basis using one of these
  9655. lines:
  9656. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  9657. @item @samp{#+OPTIONS: tex:t}
  9658. @tab Do the right thing automatically (MathJax)
  9659. @item @samp{#+OPTIONS: tex:nil}
  9660. @tab Do not process @LaTeX{} fragments at all
  9661. @item @samp{#+OPTIONS: tex:verbatim}
  9662. @tab Verbatim export, for jsMath or so
  9663. @end multitable
  9664. @node Previewing @LaTeX{} fragments
  9665. @subsection Previewing @LaTeX{} fragments
  9666. @cindex @LaTeX{} fragments, preview
  9667. @vindex org-preview-latex-default-process
  9668. If you have a working @LaTeX{} installation and @samp{dvipng}, @samp{dvisvgm} or
  9669. @samp{convert} installed@footnote{These are respectively available at
  9670. @uref{http://sourceforge.net/projects/dvipng/}, @uref{http://dvisvgm.bplaced.net/}
  9671. and from the ImageMagick suite. Choose the converter by setting the
  9672. variable @code{org-preview-latex-default-process} accordingly.}, @LaTeX{} fragments can be processed to
  9673. produce images of the typeset expressions to be used for inclusion
  9674. while exporting to HTML (see @ref{@LaTeX{} fragments}), or for inline
  9675. previewing within Org mode.
  9676. @vindex org-format-latex-options
  9677. @vindex org-format-latex-header
  9678. You can customize the variables @code{org-format-latex-options} and
  9679. @code{org-format-latex-header} to influence some aspects of the preview.
  9680. In particular, the @code{:scale} (and for HTML export, @code{:html-scale})
  9681. property of the former can be used to adjust the size of the preview
  9682. images.
  9683. @table @asis
  9684. @item @kbd{C-c C-x C-l} (@code{org-toggle-latex-fragment})
  9685. @kindex C-c C-x C-l
  9686. @findex org-toggle-latex-fragment
  9687. Produce a preview image of the @LaTeX{} fragment at point and
  9688. overlay it over the source code. If there is no fragment at
  9689. point, process all fragments in the current entry (between two
  9690. headlines). When called with a prefix argument, process the
  9691. entire subtree. When called with two prefix arguments, or when
  9692. the cursor is before the first headline, process the entire
  9693. buffer.
  9694. @end table
  9695. @vindex org-startup-with-latex-preview
  9696. You can turn on the previewing of all @LaTeX{} fragments in a file with
  9697. @example
  9698. #+STARTUP: latexpreview
  9699. @end example
  9700. To disable it, simply use
  9701. @example
  9702. #+STARTUP: nolatexpreview
  9703. @end example
  9704. @node CD@LaTeX{} mode
  9705. @subsection Using CD@LaTeX{} to enter math
  9706. @cindex CD@LaTeX{}
  9707. CD@LaTeX{} mode is a minor mode that is normally used in combination with
  9708. a major @LaTeX{} mode like AUC@TeX{} in order to speed-up insertion of
  9709. environments and math templates. Inside Org mode, you can make use of
  9710. some of the features of CD@LaTeX{} mode. You need to install
  9711. @samp{cdlatex.el} and @samp{texmathp.el} (the latter comes also with AUC@TeX{})
  9712. from @uref{http://www.astro.uva.nl/~dominik/Tools/cdlatex}. Do not use
  9713. CD@LaTeX{} mode itself under Org mode, but use the light version
  9714. @code{org-cdlatex-mode} that comes as part of Org mode. Turn it on for the
  9715. current buffer with @kbd{M-x org-cdlatex-mode}, or for all Org
  9716. files with
  9717. @lisp
  9718. (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
  9719. @end lisp
  9720. When this mode is enabled, the following features are present (for
  9721. more details see the documentation of CD@LaTeX{} mode):
  9722. @table @asis
  9723. @item @kbd{C-c @{}
  9724. @kindex C-c @{
  9725. Insert an environment template.
  9726. @item @kbd{@key{TAB}}
  9727. @kindex TAB
  9728. The @kbd{@key{TAB}} key expands the template if the cursor is
  9729. inside a @LaTeX{} fragment@footnote{Org mode has a method to test if the cursor is inside such
  9730. a fragment, see the documentation of the function
  9731. @code{org-inside-LaTeX-fragment-p}.}. For example, @kbd{@key{TAB}}
  9732. expands @samp{fr} to @samp{\frac@{@}@{@}} and position the cursor correctly
  9733. inside the first brace. Another @kbd{@key{TAB}} gets you into the
  9734. second brace.
  9735. Even outside fragments, @kbd{@key{TAB}} expands environment
  9736. abbreviations at the beginning of a line. For example, if you
  9737. write @samp{equ} at the beginning of a line and press @kbd{@key{TAB}},
  9738. this abbreviation is expanded to an @samp{equation} environment. To
  9739. get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
  9740. @item @kbd{^}
  9741. @itemx @kbd{_}
  9742. @kindex _
  9743. @kindex ^
  9744. @vindex cdlatex-simplify-sub-super-scripts
  9745. Pressing @kbd{_} and @kbd{^} inside a @LaTeX{} fragment
  9746. inserts these characters together with a pair of braces. If you
  9747. use @kbd{@key{TAB}} to move out of the braces, and if the braces
  9748. surround only a single character or macro, they are removed again
  9749. (depending on the variable @code{cdlatex-simplify-sub-super-scripts}).
  9750. @item @kbd{`}
  9751. @kindex `
  9752. Pressing the backquote followed by a character inserts math
  9753. macros, also outside @LaTeX{} fragments. If you wait more than 1.5
  9754. seconds after the backquote, a help window pops up.
  9755. @item @kbd{'}
  9756. @kindex '
  9757. Pressing the single-quote followed by another character modifies
  9758. the symbol before point with an accent or a font. If you wait
  9759. more than 1.5 seconds after the single-quote, a help window pops
  9760. up. Character modification works only inside @LaTeX{} fragments;
  9761. outside the quote is normal.
  9762. @end table
  9763. @node Exporting
  9764. @chapter Exporting
  9765. @cindex exporting
  9766. Sometimes, you may want to pretty print your notes, publish them on
  9767. the web or even share them with people not using Org. In these cases,
  9768. the Org export facilities can be used to convert your documents to
  9769. a variety of other formats, while retaining as much structure (see
  9770. @ref{Document Structure}) and markup (see @ref{Markup}) as
  9771. possible.
  9772. @cindex export back-end
  9773. Libraries responsible for such translation are called back-ends. Org
  9774. ships with the following ones
  9775. @itemize
  9776. @item
  9777. @emph{ascii} (ASCII format)
  9778. @item
  9779. @emph{beamer} (@LaTeX{} Beamer format)
  9780. @item
  9781. @emph{html} (HTML format)
  9782. @item
  9783. @emph{icalendar} (iCalendar format)
  9784. @item
  9785. @emph{latex} (@LaTeX{} format)
  9786. @item
  9787. @emph{md} (Markdown format)
  9788. @item
  9789. @emph{odt} (OpenDocument Text format)
  9790. @item
  9791. @emph{org} (Org format)
  9792. @item
  9793. @emph{texinfo} (Texinfo format)
  9794. @item
  9795. @emph{man} (Man page format)
  9796. @end itemize
  9797. @noindent
  9798. Org also uses additional libraries located in @samp{contrib/} directory
  9799. (see @ref{Installation}). Users can install additional export libraries
  9800. for additional formats from the Emacs packaging system. For easy
  9801. discovery, these packages have a common naming scheme: @code{ox-NAME},
  9802. where @var{NAME} is one of the formats. For example,
  9803. @code{ox-koma-letter} @emph{koma-letter} back-end.
  9804. @vindex org-export-backends
  9805. Org loads back-ends for the following formats by default: ASCII, HTML,
  9806. iCalendar, @LaTeX{} and ODT. Org can load additional back-ends either of
  9807. two ways: through the @code{org-export-backends} variable configuration;
  9808. or, by requiring the library in the Emacs init file like this:
  9809. @lisp
  9810. (require 'ox-md)
  9811. @end lisp
  9812. @menu
  9813. * The Export Dispatcher:: The main interface.
  9814. * Export Settings:: Common export settings.
  9815. * Table of Contents:: The if and where of the table of contents.
  9816. * Include Files:: Include additional files into a document.
  9817. * Macro Replacement:: Use macros to create templates.
  9818. * Comment Lines:: What will not be exported.
  9819. * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding.
  9820. * Beamer Export::
  9821. * HTML Export:: Exporting to HTML.
  9822. * @LaTeX{} Export:: Exporting to @LaTeX{} and processing to PDF.
  9823. * Markdown Export:: Exporting to Markdown.
  9824. * OpenDocument Text Export:: Exporting to OpenDocument Text.
  9825. * Org Export:: Exporting to Org.
  9826. * Texinfo Export:: Exporting to Texinfo.
  9827. * iCalendar Export:: Exporting to iCalendar.
  9828. * Other Built-in Back-ends:: Exporting to a man page.
  9829. * Advanced Configuration:: Fine-tuning the export output.
  9830. * Export in Foreign Buffers:: Author tables and lists in Org syntax.
  9831. @end menu
  9832. @node The Export Dispatcher
  9833. @section The Export Dispatcher
  9834. @cindex dispatcher, for export commands
  9835. @cindex Export, dispatcher
  9836. The export dispatcher is the main interface for Org's exports.
  9837. A hierarchical menu presents the currently configured export formats.
  9838. Options are shown as easy toggle switches on the same screen.
  9839. @vindex org-export-dispatch-use-expert-ui
  9840. Org also has a minimal prompt interface for the export dispatcher.
  9841. When the variable @code{org-export-dispatch-use-expert-ui} is set to
  9842. a non-@code{nil} value, Org prompts in the minibuffer. To switch back to
  9843. the hierarchical menu, press @kbd{?}.
  9844. @table @asis
  9845. @item @kbd{C-c C-e} (@code{org-export})
  9846. @kindex C-c C-e
  9847. @findex org-export
  9848. Invokes the export dispatcher interface. The options show
  9849. default settings. The @kbd{C-u} prefix argument preserves
  9850. options from the previous export, including any sub-tree
  9851. selections.
  9852. @end table
  9853. Org exports the entire buffer by default. If the Org buffer has an
  9854. active region, then Org exports just that region.
  9855. Within the dispatcher interface, the following key combinations can
  9856. further alter what is exported, and how.
  9857. @table @asis
  9858. @item @kbd{C-a}
  9859. @kindex C-c C-e C-a
  9860. Toggle asynchronous export. Asynchronous export uses an external
  9861. Emacs process with a specially configured initialization file to
  9862. complete the exporting process in the background thereby
  9863. releasing the current interface. This is particularly useful
  9864. when exporting long documents.
  9865. Output from an asynchronous export is saved on the ``the export
  9866. stack''. To view this stack, call the export dispatcher with
  9867. a double @kbd{C-u} prefix argument. If already in the
  9868. export dispatcher menu, @kbd{&} displays the stack.
  9869. @vindex org-export-async-init-file
  9870. To make the background export process the default, customize the
  9871. variable, @code{org-export-in-background}. Additionally, you can set
  9872. the initialization file used by the background process with
  9873. @code{org-export-async-init-file}.
  9874. @vindex org-export-in-background
  9875. You can make asynchronous export the default by setting
  9876. @code{org-export-in-background}.
  9877. @item @kbd{C-b}
  9878. @kindex C-c C-e C-b
  9879. Toggle body-only export. Useful for excluding headers and
  9880. footers in the export. Affects only those back-end formats that
  9881. have such sections---like @samp{<head>...</head>} in HTML.
  9882. @item @{@{@{kbd(C-s@}@}@}
  9883. @kindex C-c C-e C-s
  9884. Toggle sub-tree export. When turned on, Org exports only the
  9885. sub-tree starting from the cursor position at the time the export
  9886. dispatcher was invoked. Org uses the top heading of this
  9887. sub-tree as the document's title. If the cursor is not on
  9888. a heading, Org uses the nearest enclosing header. If the cursor
  9889. is in the document preamble, Org signals an error and aborts
  9890. export.
  9891. @vindex org-export-initial-scope
  9892. To make the sub-tree export the default, customize the variable
  9893. @code{org-export-initial-scope}.
  9894. @item @kbd{C-v}
  9895. @kindex C-c C-e C-v
  9896. Toggle visible-only export. Useful for exporting only visible
  9897. parts of an Org document by adjusting outline visibility
  9898. settings.
  9899. @end table
  9900. @node Export Settings
  9901. @section Export Settings
  9902. @cindex options, for export
  9903. @cindex Export, settings
  9904. @cindex @samp{OPTIONS}, keyword
  9905. Export options can be set: globally with variables; for an individual
  9906. file by making variables buffer-local with in-buffer settings (see
  9907. @ref{In-buffer Settings}), by setting individual keywords, or by
  9908. specifying them in a compact form with the @samp{OPTIONS} keyword; or for
  9909. a tree by setting properties (see @ref{Properties and Columns}). Options
  9910. set at a specific level override options set at a more general level.
  9911. @cindex SETUPFILE, keyword
  9912. In-buffer settings may appear anywhere in the file, either directly or
  9913. indirectly through a file included using @samp{#+SETUPFILE: filename or
  9914. URL} syntax. Option keyword sets tailored to a particular back-end
  9915. can be inserted from the export dispatcher (see @ref{The Export Dispatcher}) using the @samp{Insert template} command by pressing
  9916. @kbd{#}. To insert keywords individually, a good way to make
  9917. sure the keyword is correct is to type @samp{#+} and then to use
  9918. @kbd{M-@key{TAB}}@footnote{Many desktops intercept @kbd{M-@key{TAB}} to switch windows.
  9919. Use @kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} instead.} for completion.
  9920. The export keywords available for every back-end, and their equivalent
  9921. global variables, include:
  9922. @table @asis
  9923. @item @samp{AUTHOR}
  9924. @cindex @samp{AUTHOR}, keyword
  9925. @vindex user-full-name
  9926. The document author (@code{user-full-name}).
  9927. @item @samp{CREATOR}
  9928. @cindex @samp{CREATOR}, keyword
  9929. @vindex org-expot-creator-string
  9930. Entity responsible for output generation
  9931. (@code{org-export-creator-string}).
  9932. @item @samp{DATE}
  9933. @cindex @samp{DATE}, keyword
  9934. @vindex org-export-date-timestamp-format
  9935. A date or a time-stamp@footnote{The variable @code{org-export-date-timestamp-format} defines how
  9936. this timestamp are exported.}.
  9937. @item @samp{EMAIL}
  9938. @cindex @samp{EMAIL}, keyword
  9939. @vindex user-mail-address
  9940. The email address (@code{user-mail-address}).
  9941. @item @samp{LANGUAGE}
  9942. @cindex @samp{LANGUAGE}, keyword
  9943. @vindex org-export-default-language
  9944. Language to use for translating certain strings
  9945. (@code{org-export-default-language}). With @samp{#+LANGUAGE: fr}, for
  9946. example, Org translates @samp{Table of contents} to the French @samp{Table
  9947. des matières}.
  9948. @item @samp{SELECT_TAGS}
  9949. @cindex @samp{SELECT_TAGS}, keyword
  9950. @vindex org-export-select-tags
  9951. The default value is @code{("export")}. When a tree is tagged with
  9952. @samp{export} (@code{org-export-select-tags}), Org selects that tree and
  9953. its sub-trees for export. Org excludes trees with @samp{noexport}
  9954. tags, see below. When selectively exporting files with @samp{export}
  9955. tags set, Org does not export any text that appears before the
  9956. first headline.
  9957. @item @samp{EXCLUDE_TAGS}
  9958. @cindex @samp{EXCLUDE_TAGS}, keyword
  9959. @vindex org-export-exclude-tags
  9960. The default value is @code{("noexport")}. When a tree is tagged with
  9961. @samp{noexport} (@code{org-export-exclude-tags}), Org excludes that tree
  9962. and its sub-trees from export. Entries tagged with @samp{noexport}
  9963. are unconditionally excluded from the export, even if they have
  9964. an @samp{export} tag. Even if a sub-tree is not exported, Org
  9965. executes any code blocks contained there.
  9966. @item @samp{TITLE}
  9967. @cindex @samp{TITLE}, keyword
  9968. @cindex document title
  9969. Org displays this title. For long titles, use multiple @samp{#+TITLE}
  9970. lines.
  9971. @item @samp{EXPORT_FILE_NAME}
  9972. @cindex @samp{EXPORT_FILE_NAME}, keyword
  9973. The name of the output file to be generated. Otherwise, Org
  9974. generates the file name based on the buffer name and the
  9975. extension based on the back-end format.
  9976. @end table
  9977. The @samp{OPTIONS} keyword is a compact form. To configure multiple
  9978. options, use several @samp{OPTIONS} lines. @samp{OPTIONS} recognizes the
  9979. following arguments.
  9980. @table @asis
  9981. @item @code{'}
  9982. @vindex org-export-with-smart-quotes
  9983. Toggle smart quotes (@code{org-export-with-smart-quotes}). Depending
  9984. on the language used, when activated, Org treats pairs of double
  9985. quotes as primary quotes, pairs of single quotes as secondary
  9986. quotes, and single quote marks as apostrophes.
  9987. @item @code{*}
  9988. @vindex org-export-with-emphasize
  9989. Toggle emphasized text (@code{org-export-with-emphasize}).
  9990. @item @code{-}
  9991. @vindex org-export-with-special-strings
  9992. Toggle conversion of special strings
  9993. (@code{org-export-with-special-strings}).
  9994. @item @code{:}
  9995. @vindex org-export-with-fixed-width
  9996. Toggle fixed-width sections (@code{org-export-with-fixed-width}).
  9997. @item @code{<}
  9998. @vindex org-export-with-timestamps
  9999. Toggle inclusion of time/date active/inactive stamps
  10000. (@code{org-export-with-timestamps}).
  10001. @item @code{\n}
  10002. @vindex org-export-preserve-breaks
  10003. Toggles whether to preserve line breaks
  10004. (@code{org-export-preserve-breaks}).
  10005. @item @code{^}
  10006. @vindex org-export-with-sub-superscripts
  10007. Toggle @TeX{}-like syntax for sub- and superscripts. If you write
  10008. @samp{^:@{@}}, @samp{a_@{b@}} is interpreted, but the simple @samp{a_b} is left as
  10009. it is (@code{org-export-with-sub-superscripts}).
  10010. @item @code{arch}
  10011. @vindex org-export-with-archived-trees
  10012. Configure how archived trees are exported. When set to
  10013. @code{headline}, the export process skips the contents and processes
  10014. only the headlines (@code{org-export-with-archived-trees}).
  10015. @item @code{author}
  10016. @vindex org-export-with-author
  10017. Toggle inclusion of author name into exported file
  10018. (@code{org-export-with-author}).
  10019. @item @code{broken-links}
  10020. @vindex org-export-with-broken-links
  10021. Toggles if Org should continue exporting upon finding a broken
  10022. internal link. When set to @code{mark}, Org clearly marks the problem
  10023. link in the output (@code{org-export-with-broken-links}).
  10024. @item @code{c}
  10025. @vindex org-export-with-clocks
  10026. Toggle inclusion of CLOCK keywords (@code{org-export-with-clocks}).
  10027. @item @code{creator}
  10028. @vindex org-export-with-creator
  10029. Toggle inclusion of creator information in the exported file
  10030. (@code{org-export-with-creator}).
  10031. @item @code{d}
  10032. @vindex org-export-with-drawers
  10033. Toggles inclusion of drawers, or list of drawers to include, or
  10034. list of drawers to exclude (@code{org-export-with-drawers}).
  10035. @item @code{date}
  10036. @vindex org-export-with-date
  10037. Toggle inclusion of a date into exported file
  10038. (@code{org-export-with-date}).
  10039. @item @code{e}
  10040. @vindex org-export-with-entities
  10041. Toggle inclusion of entities (@code{org-export-with-entities}).
  10042. @item @code{email}
  10043. @vindex org-export-with-email
  10044. Toggle inclusion of the author's e-mail into exported file
  10045. (@code{org-export-with-email}).
  10046. @item @code{f}
  10047. @vindex org-export-with-footnotes
  10048. Toggle the inclusion of footnotes (@code{org-export-with-footnotes}).
  10049. @item @code{H}
  10050. @vindex org-export-headline-levels
  10051. Set the number of headline levels for export
  10052. (@code{org-export-headline-levels}). Below that level, headlines are
  10053. treated differently. In most back-ends, they become list items.
  10054. @item @code{inline}
  10055. @vindex org-export-with-inlinetasks
  10056. Toggle inclusion of inlinetasks (@code{org-export-with-inlinetasks}).
  10057. @item @code{num}
  10058. @vindex org-export-with-section-numbers
  10059. @cindex @samp{UNNUMBERED}, property
  10060. Toggle section-numbers (@code{org-export-with-section-numbers}). When
  10061. set to number N, Org numbers only those headlines at level N or
  10062. above. Set @samp{UNNUMBERED} property to non-@code{nil} to disable
  10063. numbering of heading and subheadings entirely. Moreover, when
  10064. the value is @samp{notoc} the headline, and all its children, do not
  10065. appear in the table of contents either (see @ref{Table of Contents}).
  10066. @item @code{p}
  10067. @vindex org-export-with-planning
  10068. Toggle export of planning information
  10069. (@code{org-export-with-planning}). ``Planning information'' comes from
  10070. lines located right after the headline and contain any
  10071. combination of these cookies: @samp{SCHEDULED}, @samp{DEADLINE}, or
  10072. @samp{CLOSED}.
  10073. @item @code{pri}
  10074. @vindex org-export-with-priority
  10075. Toggle inclusion of priority cookies
  10076. (@code{org-export-with-priority}).
  10077. @item @code{prop}
  10078. @vindex org-export-with-properties
  10079. Toggle inclusion of property drawers, or list the properties to
  10080. include (@code{org-export-with-properties}).
  10081. @item @code{stat}
  10082. @vindex org-export-with-statistics-cookies
  10083. Toggle inclusion of statistics cookies
  10084. (@code{org-export-with-statistics-cookies}).
  10085. @item @code{tags}
  10086. @vindex org-export-with-tags
  10087. Toggle inclusion of tags, may also be @code{not-in-toc}
  10088. (@code{org-export-with-tags}).
  10089. @item @code{tasks}
  10090. @vindex org-export-with-tasks
  10091. Toggle inclusion of tasks (TODO items); or @code{nil} to remove all
  10092. tasks; or @code{todo} to remove DONE tasks; or list the keywords to
  10093. keep (@code{org-export-with-tasks}).
  10094. @item @code{tex}
  10095. @vindex org-export-with-latex
  10096. @code{nil} does not export; @code{t} exports; @code{verbatim} keeps everything
  10097. in verbatim (@code{org-export-with-latex}).
  10098. @item @code{timestamp}
  10099. @vindex org-export-time-stamp-file
  10100. Toggle inclusion of the creation time in the exported file
  10101. (@code{org-export-time-stamp-file}).
  10102. @item @code{title}
  10103. @vindex org-export-with-title
  10104. Toggle inclusion of title (@code{org-export-with-title}).
  10105. @item @code{toc}
  10106. @vindex org-export-with-toc
  10107. Toggle inclusion of the table of contents, or set the level limit
  10108. (@code{org-export-with-toc}).
  10109. @item @code{todo}
  10110. @vindex org-export-with-todo-keywords
  10111. Toggle inclusion of TODO keywords into exported text
  10112. (@code{org-export-with-todo-keywords}).
  10113. @item @code{|}
  10114. @vindex org-export-with-tables
  10115. Toggle inclusion of tables (@code{org-export-with-tables}).
  10116. @end table
  10117. When exporting sub-trees, special node properties in them can override
  10118. the above keywords. They are special because they have an @samp{EXPORT_}
  10119. prefix. For example, @samp{DATE} and @samp{EXPORT_FILE_NAME} keywords become,
  10120. respectively, @samp{EXPORT_DATE} and @samp{EXPORT_FILE_NAME}. Except for
  10121. @samp{SETUPFILE}, all other keywords listed above have an @samp{EXPORT_}
  10122. equivalent.
  10123. @cindex @samp{BIND}, keyword
  10124. @vindex org-export-allow-bind-keywords
  10125. If @code{org-export-allow-bind-keywords} is non-@code{nil}, Emacs variables can
  10126. become buffer-local during export by using the @samp{BIND} keyword. Its
  10127. syntax is @samp{#+BIND: variable value}. This is particularly useful for
  10128. in-buffer settings that cannot be changed using keywords.
  10129. @node Table of Contents
  10130. @section Table of Contents
  10131. @cindex table of contents
  10132. @cindex list of tables
  10133. @cindex list of listings
  10134. @cindex @samp{toc}, in @samp{OPTIONS} keyword
  10135. @vindex org-export-with-toc
  10136. The table of contents includes all headlines in the document. Its
  10137. depth is therefore the same as the headline levels in the file. If
  10138. you need to use a different depth, or turn it off entirely, set the
  10139. @code{org-export-with-toc} variable accordingly. You can achieve the same
  10140. on a per file basis, using the following @samp{toc} item in @samp{OPTIONS}
  10141. keyword:
  10142. @example
  10143. #+OPTIONS: toc:2 (only include two levels in TOC)
  10144. #+OPTIONS: toc:nil (no default TOC at all)
  10145. @end example
  10146. @cindex excluding entries from table of contents
  10147. @cindex table of contents, exclude entries
  10148. Org includes both numbered and unnumbered headlines in the table of
  10149. contents@footnote{At the moment, some export back-ends do not obey this
  10150. specification. For example, @LaTeX{} export excludes every unnumbered
  10151. headline from the table of contents.}. If you need to exclude an unnumbered headline,
  10152. along with all its children, set the @samp{UNNUMBERED} property to @samp{notoc}
  10153. value.
  10154. @example
  10155. * Subtree not numbered, not in table of contents either
  10156. :PROPERTIES:
  10157. :UNNUMBERED: notoc
  10158. :END:
  10159. @end example
  10160. @cindex @samp{TOC}, keyword
  10161. Org normally inserts the table of contents directly before the first
  10162. headline of the file. To move the table of contents to a different
  10163. location, first turn off the default with @code{org-export-with-toc}
  10164. variable or with @samp{#+OPTIONS: toc:nil}. Then insert @samp{#+TOC: headlines
  10165. N} at the desired location(s).
  10166. @example
  10167. #+OPTIONS: toc:nil
  10168. ...
  10169. #+TOC: headlines 2
  10170. @end example
  10171. To adjust the table of contents depth for a specific section of the
  10172. Org document, append an additional @samp{local} parameter. This parameter
  10173. becomes a relative depth for the current level. The following example
  10174. inserts a local table of contents, with direct children only.
  10175. @example
  10176. * Section
  10177. #+TOC: headlines 1 local
  10178. @end example
  10179. Note that for this feature to work properly in @LaTeX{} export, the Org
  10180. file requires the inclusion of the titletoc package. Because of
  10181. compatibility issues, titletoc has to be loaded @emph{before} hyperref.
  10182. Customize the @code{org-latex-default-packages-alist} variable.
  10183. Use the @samp{TOC} keyword to generate list of tables---respectively, all
  10184. listings---with captions.
  10185. @example
  10186. #+TOC: listings
  10187. #+TOC: tables
  10188. @end example
  10189. @cindex @samp{ALT_TITLE}, property
  10190. Normally Org uses the headline for its entry in the table of contents.
  10191. But with @samp{ALT_TITLE} property, a different entry can be specified for
  10192. the table of contents.
  10193. @node Include Files
  10194. @section Include Files
  10195. @cindex include files, during export
  10196. @cindex Export, include files
  10197. @cindex @samp{INCLUDE}, keyword
  10198. During export, you can include the content of another file. For
  10199. example, to include your @samp{.emacs} file, you could use:
  10200. @example
  10201. #+INCLUDE: "~/.emacs" src emacs-lisp
  10202. @end example
  10203. @noindent
  10204. The optional second and third parameter are the markup (e.g., @samp{quote},
  10205. @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the language for
  10206. formatting the contents. The markup is optional; if it is not given,
  10207. assume text is in Org syntax and process it normally. The @samp{INCLUDE}
  10208. keyword also allows additional parameters @samp{:prefix1} and @samp{:prefix} to
  10209. specify prefixes for the first line and for each following line,
  10210. @samp{:minlevel} in order to get Org mode content demoted to a specified
  10211. level, as well as any options accepted by the selected markup. For
  10212. example, to include a file as an item, use:
  10213. @example
  10214. #+INCLUDE: "~/snippets/xx" :prefix1 " + " :prefix " "
  10215. @end example
  10216. You can also include a portion of a file by specifying a lines range
  10217. using the @samp{:lines} parameter. The line at the upper end of the range
  10218. is not included. The start and/or the end of the range may be omitted
  10219. to use the obvious defaults.
  10220. @table @asis
  10221. @item @samp{#+INCLUDE: "~/.emacs" :lines "5-10"}
  10222. Include lines 5 to 10, 10 excluded.
  10223. @item @samp{#+INCLUDE: "~/.emacs" :lines "-10"}
  10224. Include lines 1 to 10, 10 excluded.
  10225. @item @samp{#+INCLUDE: "~/.emacs" :lines "10-"}
  10226. Include lines from 10 to EOF.
  10227. @end table
  10228. You can visit the file being included with the following command.
  10229. @table @asis
  10230. @item @kbd{C-c '} (@code{org-edit~special})
  10231. @kindex C-c '
  10232. @findex org-edit-special
  10233. Visit the include file at point.
  10234. @end table
  10235. @node Macro Replacement
  10236. @section Macro Replacement
  10237. @cindex macro replacement, during export
  10238. @cindex @samp{MACRO}, keyword
  10239. @vindex org-export-global-macros
  10240. Macros replace text snippets during export. Macros are defined
  10241. globally in @code{org-export-global-macros}, or document-wise with the
  10242. following syntax:
  10243. @example
  10244. #+MACRO: name replacement text; $1, $2 are arguments
  10245. @end example
  10246. @noindent
  10247. which can be referenced using @samp{@{@{@{name(arg1, arg2)@}@}@}}@footnote{Since commas separate the arguments, commas within arguments
  10248. have to be escaped with the backslash character. So only those
  10249. backslash characters before a comma need escaping with another
  10250. backslash character.}. For
  10251. example
  10252. @example
  10253. #+MACRO: poem The rose is $1, The violet's $2. Life's ordered: Org assists you.
  10254. @{@{@{poem(red,blue)@}@}@}
  10255. @end example
  10256. @noindent
  10257. becomes
  10258. @example
  10259. The rose is red, The violet's blue. Life's ordered: Org assists you.
  10260. @end example
  10261. As a special case, Org parses any replacement text starting with
  10262. @samp{(eval} as an Emacs Lisp expression and evaluates it accordingly.
  10263. Within such templates, arguments become strings. Thus, the following
  10264. macro
  10265. @example
  10266. #+MACRO: gnucheck (eval (concat "GNU/" (capitalize $1)))
  10267. @end example
  10268. @noindent
  10269. turns @samp{@{@{@{gnucheck(linux)@}@}@}} into @samp{GNU/Linux} during export.
  10270. Org recognizes macro references in following Org markup areas:
  10271. paragraphs, headlines, verse blocks, tables cells and lists. Org also
  10272. recognizes macro references in keywords, such as @samp{CAPTION}, @samp{TITLE},
  10273. @samp{AUTHOR}, @samp{DATE}, and for some back-end specific export options.
  10274. Org comes with following pre-defined macros:
  10275. @table @asis
  10276. @item @samp{@{@{@{keyword(NAME)@}@}@}}
  10277. @itemx @samp{@{@{@{title@}@}@}}
  10278. @itemx @samp{@{@{@{author@}@}@}}
  10279. @itemx @samp{@{@{@{email@}@}@}}
  10280. @cindex @samp{keyword}, macro
  10281. @cindex @samp{title}, macro
  10282. @cindex @samp{author}, macro
  10283. @cindex @samp{email}, macro
  10284. The @samp{keyword} macro collects all values from @var{NAME}
  10285. keywords throughout the buffer, separated with white space.
  10286. @samp{title}, @samp{author} and @samp{email} macros are shortcuts for,
  10287. respectively, @samp{@{@{@{keyword(TITLE)@}@}@}}, @samp{@{@{@{keyword(AUTHOR)@}@}@}} and
  10288. @samp{@{@{@{keyword(EMAIL)@}@}@}}.
  10289. @item @samp{@{@{@{date@}@}@}}
  10290. @itemx @samp{@{@{@{date(FORMAT)@}@}@}}
  10291. @cindex @samp{date}, macro
  10292. This macro refers to the @samp{DATE} keyword. @var{FORMAT} is an
  10293. optional argument to the @samp{date} macro that is used only if @samp{DATE}
  10294. is a single timestamp. @var{FORMAT} should be a format
  10295. string understood by @code{format-time-string}.
  10296. @item @samp{@{@{@{time(FORMAT)@}@}@}}
  10297. @itemx @samp{@{@{@{modification-time(FORMAT, VC)@}@}@}}
  10298. @cindex @samp{time}, macro
  10299. @cindex @samp{modification-time}, macro
  10300. These macros refer to the document's date and time of export and
  10301. date and time of modification. @var{FORMAT} is a string
  10302. understood by @code{format-time-string}. If the second argument to
  10303. the @code{modification-time} macro is non-@code{nil}, Org uses @samp{vc.el} to
  10304. retrieve the document's modification time from the version
  10305. control system. Otherwise Org reads the file attributes.
  10306. @item @samp{@{@{@{input-file@}@}@}}
  10307. @cindex @samp{input-file}, macro
  10308. This macro refers to the filename of the exported file.
  10309. @item @samp{@{@{@{property(PROPERTY-NAME)@}@}@}}
  10310. @itemx @samp{@{@{@{property(PROPERTY-NAME, SEARCH OPTION)@}@}@}}
  10311. @cindex @samp{property}, macro
  10312. This macro returns the value of property @var{PROPERTY-NAME}
  10313. in the current entry. If @var{SEARCH-OPTION} (see @ref{Search Options}) refers to a remote entry, use it instead.
  10314. @item @samp{@{@{@{n@}@}@}}
  10315. @itemx @samp{@{@{@{n(NAME)@}@}@}}
  10316. @itemx @samp{@{@{@{n(NAME, ACTION)@}@}@}}
  10317. @cindex @samp{n}, macro
  10318. @cindex counter, macro
  10319. This macro implements custom counters by returning the number of
  10320. times the macro has been expanded so far while exporting the
  10321. buffer. You can create more than one counter using different
  10322. @var{NAME} values. If @var{ACTION} is @samp{-}, previous
  10323. value of the counter is held, i.e., the specified counter is not
  10324. incremented. If the value is a number, the specified counter is
  10325. set to that value. If it is any other non-empty string, the
  10326. specified counter is reset to 1. You may leave @var{NAME}
  10327. empty to reset the default counter.
  10328. @end table
  10329. @vindex org-hide-macro-markers
  10330. The surrounding brackets can be made invisible by setting
  10331. @code{org-hide-macro-markers} non-@code{nil}.
  10332. Org expands macros at the very beginning of the export process.
  10333. @node Comment Lines
  10334. @section Comment Lines
  10335. @cindex exporting, not
  10336. @cindex comment lines
  10337. Lines starting with zero or more whitespace characters followed by one
  10338. @samp{#} and a whitespace are treated as comments and, as such, are not
  10339. exported.
  10340. @cindex @samp{BEGIN_COMMENT}
  10341. @cindex comment block
  10342. Likewise, regions surrounded by @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT}
  10343. are not exported.
  10344. @cindex comment trees
  10345. Finally, a @samp{COMMENT} keyword at the beginning of an entry, but after
  10346. any other keyword or priority cookie, comments out the entire subtree.
  10347. In this case, the subtree is not exported and no code block within it
  10348. is executed either@footnote{For a less drastic behavior, consider using a select tag (see
  10349. @ref{Export Settings}) instead.}. The command below helps changing the
  10350. comment status of a headline.
  10351. @table @asis
  10352. @item @kbd{C-c ;} (@code{org-toggle-comment})
  10353. @kindex C-c ;
  10354. @findex org-toggle-comment
  10355. Toggle the @samp{COMMENT} keyword at the beginning of an entry.
  10356. @end table
  10357. @node ASCII/Latin-1/UTF-8 export
  10358. @section ASCII/Latin-1/UTF-8 export
  10359. @cindex ASCII export
  10360. @cindex Latin-1 export
  10361. @cindex UTF-8 export
  10362. ASCII export produces an output file containing only plain ASCII
  10363. characters. This is the simplest and most direct text output. It
  10364. does not contain any Org markup. Latin-1 and UTF-8 export use
  10365. additional characters and symbols available in these encoding
  10366. standards. All three of these export formats offer the most basic of
  10367. text output for maximum portability.
  10368. @vindex org-ascii-text-width
  10369. On export, Org fills and justifies text according to the text width
  10370. set in @code{org-ascii-text-width}.
  10371. @vindex org-ascii-links-to-notes
  10372. Org exports links using a footnote-like style where the descriptive
  10373. part is in the text and the link is in a note before the next heading.
  10374. See the variable @code{org-ascii-links-to-notes} for details.
  10375. @anchor{ASCII export commands}
  10376. @subheading ASCII export commands
  10377. @table @asis
  10378. @item @kbd{C-c C-e t a} (@code{org-ascii-export-to-ascii})
  10379. @itemx @kbd{C-c C-e t l}
  10380. @itemx @kbd{C-c C-e t u}
  10381. @kindex C-c C-e t a
  10382. @kindex C-c C-e t l
  10383. @kindex C-c C-e t u
  10384. @findex org-ascii-export-to-ascii
  10385. Export as an ASCII file with a @samp{.txt} extension. For
  10386. @samp{myfile.org}, Org exports to @samp{myfile.txt}, overwriting without
  10387. warning. For @samp{myfile.txt}, Org exports to @samp{myfile.txt.txt} in
  10388. order to prevent data loss.
  10389. @end table
  10390. @table @asis
  10391. @item @kbd{C-c C-e t A} (@code{org-ascii-export-to-ascii})
  10392. @itemx @kbd{C-c C-e t L}
  10393. @itemx @kbd{C-c C-e t U}
  10394. @kindex C-c C-e t A
  10395. @kindex C-c C-e t L
  10396. @kindex C-c C-e t U
  10397. @findex org-ascii-export-to-ascii
  10398. Export to a temporary buffer. Does not create a file.
  10399. @end table
  10400. @anchor{ASCII specific export settings}
  10401. @subheading ASCII specific export settings
  10402. The ASCII export back-end has one extra keyword for customizing ASCII
  10403. output. Setting this keyword works similar to the general options
  10404. (see @ref{Export Settings}).
  10405. @table @asis
  10406. @item @samp{SUBTITLE}
  10407. @cindex @samp{SUBTITLE}, keyword
  10408. The document subtitle. For long subtitles, use multiple
  10409. @samp{#+SUBTITLE} lines in the Org file. Org prints them on one
  10410. continuous line, wrapping into multiple lines if necessary.
  10411. @end table
  10412. @anchor{Header and sectioning structure}
  10413. @subheading Header and sectioning structure
  10414. Org converts the first three outline levels into headlines for ASCII
  10415. export. The remaining levels are turned into lists. To change this
  10416. cut-off point where levels become lists, see @ref{Export Settings}.
  10417. @anchor{Quoting ASCII text}
  10418. @subheading Quoting ASCII text
  10419. To insert text within the Org file by the ASCII back-end, use one the
  10420. following constructs, inline, keyword, or export block:
  10421. @cindex @samp{ASCII}, keyword
  10422. @cindex @samp{BEGIN_EXPORT ascii}
  10423. @example
  10424. Inline text @@@@ascii:and additional text@@@@ within a paragraph.
  10425. #+ASCII: Some text
  10426. #+BEGIN_EXPORT ascii
  10427. Org exports text in this block only when using ASCII back-end.
  10428. #+END_EXPORT
  10429. @end example
  10430. @anchor{ASCII specific attributes}
  10431. @subheading ASCII specific attributes
  10432. @cindex @samp{ATTR_ASCII}, keyword
  10433. @cindex horizontal rules, in ASCII export
  10434. ASCII back-end recognizes only one attribute, @code{:width}, which
  10435. specifies the width of an horizontal rule in number of characters.
  10436. The keyword and syntax for specifying widths is:
  10437. @example
  10438. #+ATTR_ASCII: :width 10
  10439. -----
  10440. @end example
  10441. @anchor{ASCII special blocks}
  10442. @subheading ASCII special blocks
  10443. @cindex special blocks, in ASCII export
  10444. @cindex @samp{BEGIN_JUSTIFYLEFT}
  10445. @cindex @samp{BEGIN_JUSTIFYRIGHT}
  10446. Besides @samp{#+BEGIN_CENTER} blocks (see @ref{Paragraphs}), ASCII back-end has
  10447. these two left and right justification blocks:
  10448. @example
  10449. #+BEGIN_JUSTIFYLEFT
  10450. It's just a jump to the left...
  10451. #+END_JUSTIFYLEFT
  10452. #+BEGIN_JUSTIFYRIGHT
  10453. ...and then a step to the right.
  10454. #+END_JUSTIFYRIGHT
  10455. @end example
  10456. @node Beamer Export
  10457. @section Beamer Export
  10458. @cindex Beamer export
  10459. Org uses Beamer export to convert an Org file tree structure into
  10460. high-quality interactive slides for presentations. Beamer is a @LaTeX{}
  10461. document class for creating presentations in PDF, HTML, and other
  10462. popular display formats.
  10463. @menu
  10464. * Beamer export commands:: For creating Beamer documents.
  10465. * Beamer specific export settings:: For customizing Beamer export.
  10466. * Frames and Blocks in Beamer:: For composing Beamer slides.
  10467. * Beamer specific syntax:: For using in Org documents.
  10468. * Editing support:: Editing support.
  10469. * A Beamer example:: A complete presentation.
  10470. @end menu
  10471. @node Beamer export commands
  10472. @subsection Beamer export commands
  10473. @table @asis
  10474. @item @kbd{C-c C-e l b} (@code{org-beamer-export-to-latex})
  10475. @kindex C-c C-e l b
  10476. @findex org-beamer-export-to-latex
  10477. Export as @LaTeX{} file with a @samp{.tex} extension. For @samp{myfile.org},
  10478. Org exports to @samp{myfile.tex}, overwriting without warning.
  10479. @item @kbd{C-c C-e l B} (@code{org-beamer-export-as-latex})
  10480. @kindex C-c C-e l B
  10481. @findex org-beamer-export-as-latex
  10482. Export to a temporary buffer. Does not create a file.
  10483. @item @kbd{C-c C-e l P} (@code{org-beamer-export-to-pdf})
  10484. @kindex C-c C-e l P
  10485. @findex org-beamer-export-to-pdf
  10486. Export as @LaTeX{} file and then convert it to PDF format.
  10487. @item @kbd{C-c C-e l O}
  10488. @kindex C-c C-e l O
  10489. Export as @LaTeX{} file, convert it to PDF format, and then open the
  10490. PDF file.
  10491. @end table
  10492. @node Beamer specific export settings
  10493. @subsection Beamer specific export settings
  10494. Beamer export back-end has several additional keywords for customizing
  10495. Beamer output. These keywords work similar to the general options
  10496. settings (see @ref{Export Settings}).
  10497. @table @asis
  10498. @item @samp{BEAMER_THEME}
  10499. @cindex @samp{BEAMER_THEME}, keyword
  10500. @vindex org-beamer-theme
  10501. The Beamer layout theme (@code{org-beamer-theme}). Use square
  10502. brackets for options. For example:
  10503. @example
  10504. #+BEAMER_THEME: Rochester [height=20pt]
  10505. @end example
  10506. @item @samp{BEAMER_FONT_THEME}
  10507. @cindex @samp{BEAMER_FONT_THEME}, keyword
  10508. The Beamer font theme.
  10509. @item @samp{BEAMER_INNER_THEME}
  10510. @cindex @samp{BEAMER_INNER_THEME}, keyword
  10511. The Beamer inner theme.
  10512. @item @samp{BEAMER_OUTER_THEME}
  10513. @cindex @samp{BEAMER_OUTER_THEME}, keyword
  10514. The Beamer outer theme.
  10515. @item @samp{BEAMER_HEADER}
  10516. @cindex @samp{BEAMER_HEADER}, keyword
  10517. Arbitrary lines inserted in the preamble, just before the
  10518. @samp{hyperref} settings.
  10519. @item @samp{DESCRIPTION}
  10520. @cindex @samp{DESCRIPTION}, keyword
  10521. The document description. For long descriptions, use multiple
  10522. @samp{DESCRIPTION} keywords. By default, @samp{hyperref} inserts
  10523. @samp{DESCRIPTION} as metadata. Use @code{org-latex-hyperref-template} to
  10524. configure document metadata. Use @code{org-latex-title-command} to
  10525. configure typesetting of description as part of front matter.
  10526. @item @samp{KEYWORDS}
  10527. @cindex @samp{KEYWORDS}, keyword
  10528. The keywords for defining the contents of the document. Use
  10529. multiple @samp{KEYWORDS} lines if necessary. By default, @samp{hyperref}
  10530. inserts @samp{KEYWORDS} as metadata. Use
  10531. @code{org-latex-hyperref-template} to configure document metadata.
  10532. Use @code{org-latex-title-command} to configure typesetting of
  10533. keywords as part of front matter.
  10534. @item @samp{SUBTITLE}
  10535. @cindex @samp{SUBTITLE}, keyword
  10536. Document's subtitle. For typesetting, use
  10537. @code{org-beamer-subtitle-format} string. Use
  10538. @code{org-latex-hyperref-template} to configure document metadata.
  10539. Use @code{org-latex-title-command} to configure typesetting of
  10540. subtitle as part of front matter.
  10541. @end table
  10542. @node Frames and Blocks in Beamer
  10543. @subsection Frames and Blocks in Beamer
  10544. Org transforms heading levels into Beamer's sectioning elements,
  10545. frames and blocks. Any Org tree with a not-too-deep-level nesting
  10546. should in principle be exportable as a Beamer presentation.
  10547. @itemize
  10548. @item
  10549. @vindex org-beamer-frame-level
  10550. Org headlines become Beamer frames when the heading level in Org is
  10551. equal to @code{org-beamer-frame-level} or @samp{H} value in a @samp{OPTIONS} line
  10552. (see @ref{Export Settings}).
  10553. @cindex @samp{BEAMER_ENV}, property
  10554. Org overrides headlines to frames conversion for the current tree of
  10555. an Org file if it encounters the @samp{BEAMER_ENV} property set to
  10556. @samp{frame} or @samp{fullframe}. Org ignores whatever
  10557. @code{org-beamer-frame-level} happens to be for that headline level in
  10558. the Org tree. In Beamer terminology, a full frame is a frame
  10559. without its title.
  10560. @item
  10561. Org exports a Beamer frame's objects as block environments. Org can
  10562. enforce wrapping in special block types when @samp{BEAMER_ENV} property
  10563. is set@footnote{If @samp{BEAMER_ENV} is set, Org export adds @samp{B_environment} tag
  10564. to make it visible. The tag serves as a visual aid and has no
  10565. semantic relevance.}. For valid values see
  10566. @code{org-beamer-environments-default}. To add more values, see
  10567. @code{org-beamer-environments-extra}.
  10568. @vindex org-beamer-environments-default
  10569. @vindex org-beamer-environments-extra
  10570. @item
  10571. @cindex @samp{BEAMER_REF}, property
  10572. If @samp{BEAMER_ENV} is set to @samp{appendix}, Org exports the entry as an
  10573. appendix. When set to @samp{note}, Org exports the entry as a note
  10574. within the frame or between frames, depending on the entry's heading
  10575. level. When set to @samp{noteNH}, Org exports the entry as a note
  10576. without its title. When set to @samp{againframe}, Org exports the entry
  10577. with @samp{\againframe} command, which makes setting the @samp{BEAMER_REF}
  10578. property mandatory because @samp{\againframe} needs frame to resume.
  10579. When @samp{ignoreheading} is set, Org export ignores the entry's headline
  10580. but not its content. This is useful for inserting content between
  10581. frames. It is also useful for properly closing a @samp{column}
  10582. environment. @@end itemize
  10583. @cindex @samp{BEAMER_ACT}, property
  10584. @cindex @samp{BEAMER_OPT}, property
  10585. When @samp{BEAMER_ACT} is set for a headline, Org export translates that
  10586. headline as an overlay or action specification. When enclosed in
  10587. square brackets, Org export makes the overlay specification
  10588. a default. Use @samp{BEAMER_OPT} to set any options applicable to the
  10589. current Beamer frame or block. The Beamer export back-end wraps
  10590. with appropriate angular or square brackets. It also adds the
  10591. @samp{fragile} option for any code that may require a verbatim block.
  10592. @cindex @samp{BEAMER_COL}, property
  10593. To create a column on the Beamer slide, use the @samp{BEAMER_COL}
  10594. property for its headline in the Org file. Set the value of
  10595. @samp{BEAMER_COL} to a decimal number representing the fraction of the
  10596. total text width. Beamer export uses this value to set the column's
  10597. width and fills the column with the contents of the Org entry. If
  10598. the Org entry has no specific environment defined, Beamer export
  10599. ignores the heading. If the Org entry has a defined environment,
  10600. Beamer export uses the heading as title. Behind the scenes, Beamer
  10601. export automatically handles @LaTeX{} column separations for contiguous
  10602. headlines. To manually adjust them for any unique configurations
  10603. needs, use the @samp{BEAMER_ENV} property.
  10604. @end itemize
  10605. @node Beamer specific syntax
  10606. @subsection Beamer specific syntax
  10607. Since Org's Beamer export back-end is an extension of the @LaTeX{}
  10608. back-end, it recognizes other @LaTeX{} specific syntax---for example,
  10609. @samp{#+LATEX:} or @samp{#+ATTR_LATEX:}. See @ref{@LaTeX{} Export}, for details.
  10610. Beamer export wraps the table of contents generated with @samp{toc:t}
  10611. @samp{OPTION} keyword in a @samp{frame} environment. Beamer export does not
  10612. wrap the table of contents generated with @samp{TOC} keyword (see @ref{Table of Contents}). Use square brackets for specifying options.
  10613. @example
  10614. #+TOC: headlines [currentsection]
  10615. @end example
  10616. Insert Beamer-specific code using the following constructs:
  10617. @cindex @samp{BEAMER}, keyword
  10618. @cindex @samp{BEGIN_EXPORT beamer}
  10619. @example
  10620. #+BEAMER: \pause
  10621. #+BEGIN_EXPORT beamer
  10622. Only Beamer export back-end exports this.
  10623. #+END_BEAMER
  10624. Text @@@@beamer:some code@@@@ within a paragraph.
  10625. @end example
  10626. Inline constructs, such as the last one above, are useful for adding
  10627. overlay specifications to objects with @code{bold}, @code{item}, @code{link},
  10628. @code{radio-target} and @code{target} types. Enclose the value in angular
  10629. brackets and place the specification at the beginning of the object as
  10630. shown in this example:
  10631. @example
  10632. A *@@@@beamer:<2->@@@@useful* feature
  10633. @end example
  10634. @cindex @samp{ATTR_BEAMER}, keyword
  10635. Beamer export recognizes the @samp{ATTR_BEAMER} keyword with the following
  10636. attributes from Beamer configurations: @samp{:environment} for changing
  10637. local Beamer environment, @samp{:overlay} for specifying Beamer overlays in
  10638. angular or square brackets, and @samp{:options} for inserting optional
  10639. arguments.
  10640. @example
  10641. #+ATTR_BEAMER: :environment nonindentlist
  10642. - item 1, not indented
  10643. - item 2, not indented
  10644. - item 3, not indented
  10645. @end example
  10646. @example
  10647. #+ATTR_BEAMER: :overlay <+->
  10648. - item 1
  10649. - item 2
  10650. @end example
  10651. @example
  10652. #+ATTR_BEAMER: :options [Lagrange]
  10653. Let $G$ be a finite group, and let $H$ be
  10654. a subgroup of $G$. Then the order of $H$ divides the order of $G$.
  10655. @end example
  10656. @node Editing support
  10657. @subsection Editing support
  10658. The @code{org-beamer-mode} is a special minor mode for faster editing of
  10659. Beamer documents.
  10660. @example
  10661. #+STARTUP: beamer
  10662. @end example
  10663. @table @asis
  10664. @item @kbd{C-c C-b} (@code{org-beamer-select-environment})
  10665. @kindex C-c C-b
  10666. @findex org-beamer-select-environment
  10667. The @code{org-beamer-mode} provides this key for quicker selections in
  10668. Beamer normal environments, and for selecting the @samp{BEAMER_COL}
  10669. property.
  10670. @end table
  10671. @node A Beamer example
  10672. @subsection A Beamer example
  10673. Here is an example of an Org document ready for Beamer export.
  10674. @example
  10675. ;#+TITLE: Example Presentation
  10676. ;#+AUTHOR: Carsten Dominik
  10677. ;#+OPTIONS: H:2 toc:t num:t
  10678. ;#+LATEX_CLASS: beamer
  10679. ;#+LATEX_CLASS_OPTIONS: [presentation]
  10680. ;#+BEAMER_THEME: Madrid
  10681. ;#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) %8BEAMER_OPT(Opt)
  10682. * This is the first structural section
  10683. ** Frame 1
  10684. *** Thanks to Eric Fraga :B_block:
  10685. :PROPERTIES:
  10686. :BEAMER_COL: 0.48
  10687. :BEAMER_ENV: block
  10688. :END:
  10689. for the first viable Beamer setup in Org
  10690. *** Thanks to everyone else :B_block:
  10691. :PROPERTIES:
  10692. :BEAMER_COL: 0.48
  10693. :BEAMER_ACT: <2->
  10694. :BEAMER_ENV: block
  10695. :END:
  10696. for contributing to the discussion
  10697. **** This will be formatted as a beamer note :B_note:
  10698. :PROPERTIES:
  10699. :BEAMER_env: note
  10700. :END:
  10701. ** Frame 2 (where we will not use columns)
  10702. *** Request
  10703. Please test this stuff!
  10704. @end example
  10705. @node HTML Export
  10706. @section HTML Export
  10707. @cindex HTML export
  10708. Org mode contains an HTML exporter with extensive HTML formatting
  10709. compatible with XHTML 1.0 strict standard.
  10710. @menu
  10711. * HTML export commands:: Invoking HTML export.
  10712. * HTML specific export settings:: Settings for HTML export.
  10713. * HTML doctypes:: Exporting various (X)HTML flavors.
  10714. * HTML preamble and postamble:: Inserting preamble and postamble.
  10715. * Quoting HTML tags:: Using direct HTML in Org files.
  10716. * Links in HTML export:: Inserting and formatting links.
  10717. * Tables in HTML export:: How to modify the formatting of tables.
  10718. * Images in HTML export:: How to insert figures into HTML output.
  10719. * Math formatting in HTML export:: Beautiful math also on the web.
  10720. * Text areas in HTML export:: An alternate way to show an example.
  10721. * CSS support:: Changing the appearance of the output.
  10722. * JavaScript support:: Info and folding in a web browser.
  10723. @end menu
  10724. @node HTML export commands
  10725. @subsection HTML export commands
  10726. @table @asis
  10727. @item @kbd{C-c C-e h h} (@code{org-html-export-to-html})
  10728. @kindex C-c C-e h h
  10729. @kindex C-c C-e h o
  10730. @findex org-html-export-to-html
  10731. Export as HTML file with a @samp{.html} extension. For @samp{myfile.org},
  10732. Org exports to @samp{myfile.html}, overwriting without warning.
  10733. @{@{@{kbd@{C-c C-e h o)@}@}@} exports to HTML and opens it in a web
  10734. browser.
  10735. @item @kbd{C-c C-e h H} (@code{org-html-export-as-html})
  10736. @kindex C-c C-e h H
  10737. @findex org-html-export-as-html
  10738. Exports to a temporary buffer. Does not create a file.
  10739. @end table
  10740. @node HTML specific export settings
  10741. @subsection HTML specific export settings
  10742. HTML export has a number of keywords, similar to the general options
  10743. settings described in @ref{Export Settings}.
  10744. @table @asis
  10745. @item @samp{DESCRIPTION}
  10746. @cindex @samp{DESCRIPTION}, keyword
  10747. This is the document's description, which the HTML exporter
  10748. inserts it as a HTML meta tag in the HTML file. For long
  10749. descriptions, use multiple @samp{DESCRIPTION} lines. The exporter
  10750. takes care of wrapping the lines properly.
  10751. @item @samp{HTML_DOCTYPE}
  10752. @cindex @samp{HTML_DOCTYPE}, keyword
  10753. @vindex org-html-doctype
  10754. Specify the document type, for example: HTML5
  10755. (@code{org-html-doctype}).
  10756. @item @samp{HTML_CONTAINER}
  10757. @cindex @samp{HTML_CONTAINER}, keyword
  10758. @vindex org-html-container-element
  10759. Specify the HTML container, such as @samp{div}, for wrapping sections
  10760. and elements (@code{org-html-container-element}).
  10761. @item @samp{HTML_LINK_HOME}
  10762. @cindex @samp{HTML_LINK_HOME}, keyword
  10763. @vindex org-html-link-home
  10764. The URL for home link (@code{org-html-link-home}).
  10765. @item @samp{HTML_LINK_UP}
  10766. @cindex @samp{HTML_LINK_UP}, keyword
  10767. @vindex org-html-link-up
  10768. The URL for the up link of exported HTML pages
  10769. (@code{org-html-link-up}).
  10770. @item @samp{HTML_MATHJAX}
  10771. @cindex @samp{HTML_MATHJAX}, keyword
  10772. @vindex org-html-mathjax-options
  10773. Options for MathJax (@code{org-html-mathjax-options}). MathJax is
  10774. used to typeset @LaTeX{} math in HTML documents. See @ref{Math formatting in HTML export}, for an example.
  10775. @item @samp{HTML_HEAD}
  10776. @cindex @samp{HTML_HEAD}, keyword
  10777. @vindex org-html-head
  10778. Arbitrary lines for appending to the HTML document's head
  10779. (@code{org-html-head}).
  10780. @item @samp{HTML_HEAD_EXTRA}
  10781. @cindex @samp{HTML_HEAD_EXTRA}, keyword
  10782. @vindex org-html-head-extra
  10783. More arbitrary lines for appending to the HTML document's head
  10784. (@code{org-html-head-extra}).
  10785. @item @samp{KEYWORDS}
  10786. @cindex @samp{KEYWORDS}, keyword
  10787. Keywords to describe the document's content. HTML exporter
  10788. inserts these keywords as HTML meta tags. For long keywords, use
  10789. multiple @samp{KEYWORDS} lines.
  10790. @item @samp{LATEX_HEADER}
  10791. @cindex @samp{LATEX_HEADER}, keyword
  10792. Arbitrary lines for appending to the preamble; HTML exporter
  10793. appends when transcoding @LaTeX{} fragments to images (see @ref{Math formatting in HTML export}).
  10794. @item @samp{SUBTITLE}
  10795. @cindex @samp{SUBTITLE}, keyword
  10796. The document's subtitle. HTML exporter formats subtitle if
  10797. document type is @samp{HTML5} and the CSS has a @samp{subtitle} class.
  10798. @end table
  10799. Some of these keywords are explained in more detail in the following
  10800. sections of the manual.
  10801. @node HTML doctypes
  10802. @subsection HTML doctypes
  10803. Org can export to various (X)HTML flavors.
  10804. @vindex org-html-doctype
  10805. @vindex org-html-doctype-alist
  10806. Set the @code{org-html-doctype} variable for different (X)HTML variants.
  10807. Depending on the variant, the HTML exporter adjusts the syntax of HTML
  10808. conversion accordingly. Org includes the following ready-made
  10809. variants:
  10810. @itemize
  10811. @item
  10812. @code{"html4-strict"}
  10813. @item
  10814. @code{"html4-transitional"}
  10815. @item
  10816. @code{"html4-frameset"}
  10817. @item
  10818. @code{"xhtml-strict"}
  10819. @item
  10820. @code{"xhtml-transitional"}
  10821. @item
  10822. @code{"xhtml-frameset"}
  10823. @item
  10824. @code{"xhtml-11"}
  10825. @item
  10826. @code{"html5"}
  10827. @item
  10828. @code{"xhtml5"}
  10829. @end itemize
  10830. @noindent
  10831. See the variable @code{org-html-doctype-alist} for details. The default is
  10832. @code{"xhtml-strict"}.
  10833. @vindex org-html-html5-fancy
  10834. @cindex @samp{HTML5}, export new elements
  10835. Org's HTML exporter does not by default enable new block elements
  10836. introduced with the HTML5 standard. To enable them, set
  10837. @code{org-html-html5-fancy} to non-@code{nil}. Or use an @samp{OPTIONS} line in the
  10838. file to set @samp{html5-fancy}.
  10839. HTML5 documents can now have arbitrary @samp{#+BEGIN} @dots{} @samp{#+END} blocks.
  10840. For example:
  10841. @example
  10842. #+BEGIN_aside
  10843. Lorem ipsum
  10844. #+END_aside
  10845. @end example
  10846. @noindent
  10847. exports to:
  10848. @example
  10849. <aside>
  10850. <p>Lorem ipsum</p>
  10851. </aside>
  10852. @end example
  10853. @noindent
  10854. while this:
  10855. @example
  10856. #+ATTR_HTML: :controls controls :width 350
  10857. #+BEGIN_video
  10858. #+HTML: <source src="movie.mp4" type="video/mp4">
  10859. #+HTML: <source src="movie.ogg" type="video/ogg">
  10860. Your browser does not support the video tag.
  10861. #+END_video
  10862. @end example
  10863. @noindent
  10864. exports to:
  10865. @example
  10866. <video controls="controls" width="350">
  10867. <source src="movie.mp4" type="video/mp4">
  10868. <source src="movie.ogg" type="video/ogg">
  10869. <p>Your browser does not support the video tag.</p>
  10870. </video>
  10871. @end example
  10872. @vindex org-html-html5-elements
  10873. When special blocks do not have a corresponding HTML5 element, the
  10874. HTML exporter reverts to standard translation (see
  10875. @code{org-html-html5-elements}). For example, @samp{#+BEGIN_lederhosen} exports
  10876. to @code{<div class="lederhosen">}.
  10877. Special blocks cannot have headlines. For the HTML exporter to wrap
  10878. the headline and its contents in @code{<section>} or @code{<article>} tags, set
  10879. the @samp{HTML_CONTAINER} property for the headline.
  10880. @node HTML preamble and postamble
  10881. @subsection HTML preamble and postamble
  10882. @vindex org-html-preamble
  10883. @vindex org-html-postamble
  10884. @vindex org-html-preamble-format
  10885. @vindex org-html-postamble-format
  10886. @vindex org-html-validation-link
  10887. @vindex org-export-creator-string
  10888. @vindex org-export-time-stamp-file
  10889. The HTML exporter has delineations for preamble and postamble. The
  10890. default value for @code{org-html-preamble} is @code{t}, which makes the HTML
  10891. exporter insert the preamble. See the variable
  10892. @code{org-html-preamble-format} for the format string.
  10893. Set @code{org-html-preamble} to a string to override the default format
  10894. string. If the string is a function, the HTML exporter expects the
  10895. function to return a string upon execution. The HTML exporter inserts
  10896. this string in the preamble. The HTML exporter does not insert
  10897. a preamble if @code{org-html-preamble} is set @code{nil}.
  10898. The default value for @code{org-html-postamble} is @code{auto}, which makes the
  10899. HTML exporter build a postamble from looking up author's name, email
  10900. address, creator's name, and date. Set @code{org-html-postamble} to @code{t} to
  10901. insert the postamble in the format specified in the
  10902. @code{org-html-postamble-format} variable. The HTML exporter does not
  10903. insert a postamble if @code{org-html-postamble} is set to @code{nil}.
  10904. @node Quoting HTML tags
  10905. @subsection Quoting HTML tags
  10906. The HTML export back-end transforms @samp{<} and @samp{>} to @samp{&lt;} and @samp{&gt;}.
  10907. To include raw HTML code in the Org file so the HTML export back-end
  10908. can insert that HTML code in the output, use this inline syntax:
  10909. @samp{@@@@html:...@@@@}. For example:
  10910. @example
  10911. @@@@html:<b>@@@@bold text@@@@html:</b>@@@@
  10912. @end example
  10913. @cindex @samp{HTML}, keyword
  10914. @cindex @samp{BEGIN_EXPORT html}
  10915. For larger raw HTML code blocks, use these HTML export code blocks:
  10916. @example
  10917. #+HTML: Literal HTML code for export
  10918. #+BEGIN_EXPORT html
  10919. All lines between these markers are exported literally
  10920. #+END_EXPORT
  10921. @end example
  10922. @node Links in HTML export
  10923. @subsection Links in HTML export
  10924. @cindex links, in HTML export
  10925. @cindex internal links, in HTML export
  10926. @cindex external links, in HTML export
  10927. The HTML export back-end transforms Org's internal links (see
  10928. @ref{Internal Links}) to equivalent HTML links in the output. The back-end
  10929. similarly handles Org's automatic links created by radio targets (see
  10930. @ref{Radio Targets}) similarly. For Org links to external files, the
  10931. back-end transforms the links to @emph{relative} paths.
  10932. @vindex org-html-link-org-files-as-html
  10933. For Org links to other @samp{.org} files, the back-end automatically
  10934. changes the file extension to @samp{.html} and makes file paths relative.
  10935. If the @samp{.org} files have an equivalent @samp{.html} version at the same
  10936. location, then the converted links should work without any further
  10937. manual intervention. However, to disable this automatic path
  10938. translation, set @code{org-html-link-org-files-as-html} to @code{nil}. When
  10939. disabled, the HTML export back-end substitutes the ID-based links in
  10940. the HTML output. For more about linking files when publishing to
  10941. a directory, see @ref{Publishing links}.
  10942. Org files can also have special directives to the HTML export
  10943. back-end. For example, by using @samp{#+ATTR_HTML} lines to specify new
  10944. format attributes to @code{<a>} or @code{<img>} tags. This example shows
  10945. changing the link's title and style:
  10946. @cindex @samp{ATTR_HTML}, keyword
  10947. @example
  10948. #+ATTR_HTML: :title The Org mode homepage :style color:red;
  10949. [[https://orgmode.org]]
  10950. @end example
  10951. @node Tables in HTML export
  10952. @subsection Tables in HTML export
  10953. @cindex tables, in HTML
  10954. @vindex org-export-html-table-tag
  10955. The HTML export back-end uses @code{org-html-table-default-attributes} when
  10956. exporting Org tables to HTML. By default, the exporter does not draw
  10957. frames and cell borders. To change for this for a table, use the
  10958. following lines before the table in the Org file:
  10959. @cindex @samp{CAPTION}, keyword
  10960. @cindex @samp{ATTR_HTML}, keyword
  10961. @example
  10962. #+CAPTION: This is a table with lines around and between cells
  10963. #+ATTR_HTML: border="2" rules="all" frame="border"
  10964. @end example
  10965. The HTML export back-end preserves column groupings in Org tables (see
  10966. @ref{Column Groups}) when exporting to HTML.
  10967. Additional options for customizing tables for HTML export.
  10968. @table @asis
  10969. @item @code{org-html-table-align-individual-fields}
  10970. @vindex org-html-table-align-individual-fields
  10971. Non-@code{nil} attaches style attributes for alignment to each table
  10972. field.
  10973. @item @code{org-html-table-caption-above}
  10974. @vindex org-html-table-caption-above
  10975. Non-@code{nil} places caption string at the beginning of the table.
  10976. @item @code{org-html-table-data-tags}
  10977. @vindex org-html-table-data-tags
  10978. Opening and ending tags for table data fields.
  10979. @item @code{org-html-table-default-attributes}
  10980. @vindex org-html-table-default-attributes
  10981. Default attributes and values for table tags.
  10982. @item @code{org-html-table-header-tags}
  10983. @vindex org-html-table-header-tags
  10984. Opening and ending tags for table's header fields.
  10985. @item @code{org-html-table-row-tags}
  10986. @vindex org-html-table-row-tags
  10987. Opening and ending tags for table rows.
  10988. @item @code{org-html-table-use-header-tags-for-first-column}
  10989. @vindex org-html-table-use-header-tags-for-first-column
  10990. Non-@code{nil} formats column one in tables with header tags.
  10991. @end table
  10992. @node Images in HTML export
  10993. @subsection Images in HTML export
  10994. @cindex images, inline in HTML
  10995. @cindex inlining images in HTML
  10996. The HTML export back-end has features to convert Org image links to
  10997. HTML inline images and HTML clickable image links.
  10998. @vindex org-html-inline-images
  10999. When the link in the Org file has no description, the HTML export
  11000. back-end by default in-lines that image. For example:
  11001. @samp{[[file:myimg.jpg]]} is in-lined, while @samp{[[file:myimg.jpg][the image]]} links to the text,
  11002. @samp{the image}. For more details, see the variable
  11003. @code{org-html-inline-images}.
  11004. On the other hand, if the description part of the Org link is itself
  11005. another link, such as @samp{file:} or @samp{http:} URL pointing to an image, the
  11006. HTML export back-end in-lines this image and links to the main image.
  11007. This Org syntax enables the back-end to link low-resolution thumbnail
  11008. to the high-resolution version of the image, as shown in this example:
  11009. @example
  11010. [[file:highres.jpg][file:thumb.jpg]]
  11011. @end example
  11012. To change attributes of in-lined images, use @samp{#+ATTR_HTML} lines in
  11013. the Org file. This example shows realignment to right, and adds @code{alt}
  11014. and @code{title} attributes in support of text viewers and modern web
  11015. accessibility standards.
  11016. @cindex @samp{CAPTION}, keyword
  11017. @cindex @samp{ATTR_HTML}, keyword
  11018. @example
  11019. #+CAPTION: A black cat stalking a spider
  11020. #+ATTR_HTML: :alt cat/spider image :title Action! :align right
  11021. [[./img/a.jpg]]
  11022. @end example
  11023. @noindent
  11024. The HTML export back-end copies the @samp{http} links from the Org file as
  11025. is.
  11026. @node Math formatting in HTML export
  11027. @subsection Math formatting in HTML export
  11028. @cindex MathJax
  11029. @cindex dvipng
  11030. @cindex dvisvgm
  11031. @cindex ImageMagick
  11032. @vindex org-html-mathjax-options~
  11033. @LaTeX{} math snippets (see @ref{@LaTeX{} fragments}) can be displayed in two
  11034. different ways on HTML pages. The default is to use the @uref{http://www.mathjax.org, MathJax},
  11035. 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
  11036. @uref{http://www.mathjax.org, MathJax}.}. Some MathJax
  11037. display options can be configured via @code{org-html-mathjax-options}, or
  11038. in the buffer. For example, with the following settings,
  11039. @example
  11040. #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
  11041. #+HTML_MATHJAX: cancel.js noErrors.js
  11042. @end example
  11043. @noindent
  11044. equation labels are displayed on the left margin and equations are
  11045. five em from the left margin. In addition, it loads the two MathJax
  11046. 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
  11047. about extensions.}.
  11048. @vindex org-html-mathjax-template
  11049. See the docstring of @code{org-html-mathjax-options} for all supported
  11050. variables. The MathJax template can be configure via
  11051. @code{org-html-mathjax-template}.
  11052. If you prefer, you can also request that @LaTeX{} fragments are processed
  11053. into small images that will be inserted into the browser page. Before
  11054. the availability of MathJax, this was the default method for Org
  11055. files. This method requires that the dvipng program, dvisvgm or
  11056. ImageMagick suite is available on your system. You can still get this
  11057. processing with
  11058. @example
  11059. #+OPTIONS: tex:dvipng
  11060. @end example
  11061. @example
  11062. #+OPTIONS: tex:dvisvgm
  11063. @end example
  11064. @noindent
  11065. or
  11066. @example
  11067. #+OPTIONS: tex:imagemagick
  11068. @end example
  11069. @node Text areas in HTML export
  11070. @subsection Text areas in HTML export
  11071. @cindex text areas, in HTML
  11072. Before Org mode's Babel, one popular approach to publishing code in
  11073. HTML was by using @samp{:textarea}. The advantage of this approach was
  11074. that copying and pasting was built into browsers with simple
  11075. JavaScript commands. Even editing before pasting was made simple.
  11076. The HTML export back-end can create such text areas. It requires an
  11077. @samp{#+ATTR_HTML} line as shown in the example below with the @samp{:textarea}
  11078. option. This must be followed by either an example or a source code
  11079. block. Other Org block types do not honor the @samp{:textarea} option.
  11080. By default, the HTML export back-end creates a text area 80 characters
  11081. wide and height just enough to fit the content. Override these
  11082. defaults with @samp{:width} and @samp{:height} options on the @samp{#+ATTR_HTML}
  11083. line.
  11084. @example
  11085. #+ATTR_HTML: :textarea t :width 40
  11086. #+BEGIN_EXAMPLE
  11087. (defun org-xor (a b)
  11088. "Exclusive or."
  11089. (if a (not b) b))
  11090. #+END_EXAMPLE
  11091. @end example
  11092. @node CSS support
  11093. @subsection CSS support
  11094. @cindex CSS, for HTML export
  11095. @cindex HTML export, CSS
  11096. @vindex org-export-html-todo-kwd-class-prefix
  11097. @vindex org-export-html-tag-class-prefix
  11098. You can modify the CSS style definitions for the exported file. The
  11099. HTML exporter assigns the following special CSS classes@footnote{If the classes on TODO keywords and tags lead to conflicts,
  11100. use the variables @code{org-html-todo-kwd-class-prefix} and
  11101. @code{org-html-tag-class-prefix} to make them unique.} to
  11102. appropriate parts of the document---your style specifications may
  11103. change these, in addition to any of the standard classes like for
  11104. headlines, tables, etc.
  11105. @multitable {aaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  11106. @item @code{p.author}
  11107. @tab author information, including email
  11108. @item @code{p.date}
  11109. @tab publishing date
  11110. @item @code{p.creator}
  11111. @tab creator info, about org mode version
  11112. @item @code{.title}
  11113. @tab document title
  11114. @item @code{.subtitle}
  11115. @tab document subtitle
  11116. @item @code{.todo}
  11117. @tab TODO keywords, all not-done states
  11118. @item @code{.done}
  11119. @tab the DONE keywords, all states that count as done
  11120. @item @code{.WAITING}
  11121. @tab each TODO keyword also uses a class named after itself
  11122. @item @code{.timestamp}
  11123. @tab timestamp
  11124. @item @code{.timestamp-kwd}
  11125. @tab keyword associated with a timestamp, like @samp{SCHEDULED}
  11126. @item @code{.timestamp-wrapper}
  11127. @tab span around keyword plus timestamp
  11128. @item @code{.tag}
  11129. @tab tag in a headline
  11130. @item @code{._HOME}
  11131. @tab each tag uses itself as a class, ``@@'' replaced by ``_''
  11132. @item @code{.target}
  11133. @tab target for links
  11134. @item @code{.linenr}
  11135. @tab the line number in a code example
  11136. @item @code{.code-highlighted}
  11137. @tab for highlighting referenced code lines
  11138. @item @code{div.outline-N}
  11139. @tab div for outline level N (headline plus text)
  11140. @item @code{div.outline-text-N}
  11141. @tab extra div for text at outline level N
  11142. @item @code{.section-number-N}
  11143. @tab section number in headlines, different for each level
  11144. @item @code{.figure-number}
  11145. @tab label like ``Figure 1:''
  11146. @item @code{.table-number}
  11147. @tab label like ``Table 1:''
  11148. @item @code{.listing-number}
  11149. @tab label like ``Listing 1:''
  11150. @item @code{div.figure}
  11151. @tab how to format an in-lined image
  11152. @item @code{pre.src}
  11153. @tab formatted source code
  11154. @item @code{pre.example}
  11155. @tab normal example
  11156. @item @code{p.verse}
  11157. @tab verse paragraph
  11158. @item @code{div.footnotes}
  11159. @tab footnote section headline
  11160. @item @code{p.footnote}
  11161. @tab footnote definition paragraph, containing a footnote
  11162. @item @code{.footref}
  11163. @tab a footnote reference number (always a <sup>)
  11164. @item @code{.footnum}
  11165. @tab footnote number in footnote definition (always <sup>)
  11166. @item @code{.org-svg}
  11167. @tab default class for a linked @samp{.svg} image
  11168. @end multitable
  11169. @vindex org-html-style-default
  11170. @vindex org-html-head
  11171. @vindex org-html-head-extra
  11172. @cindex @samp{HTML_INCLUDE_STYLE}, keyword
  11173. The HTML export back-end includes a compact default style in each
  11174. exported HTML file. To override the default style with another style,
  11175. use these keywords in the Org file. They will replace the global
  11176. defaults the HTML exporter uses.
  11177. @cindex @samp{HTML_HEAD}, keyword
  11178. @cindex @samp{HTML_HEAD_EXTRA}, keyword
  11179. @example
  11180. #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
  11181. #+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />
  11182. @end example
  11183. @vindex org-html-head-include-default-style
  11184. To just turn off the default style, customize
  11185. @code{org-html-head-include-default-style} variable, or use this option
  11186. line in the Org file.
  11187. @cindex @samp{html-style}, @samp{OPTIONS} item
  11188. @example
  11189. #+OPTIONS: html-style:nil
  11190. @end example
  11191. For longer style definitions, either use several @samp{HTML_HEAD} and
  11192. @samp{HTML_HEAD_EXTRA} keywords, or use @code{<style> ... </style>} blocks
  11193. around them. Both of these approaches can avoid referring to an
  11194. external file.
  11195. @cindex @samp{HTML_CONTAINER_CLASS}, property
  11196. In order to add styles to a sub-tree, use the @samp{HTML_CONTAINER_CLASS}
  11197. property to assign a class to the tree. In order to specify CSS
  11198. styles for a particular headline, you can use the id specified in
  11199. a @samp{CUSTOM_ID} property.
  11200. Never change the @code{org-html-style-default} constant. Instead use other
  11201. simpler ways of customizing as described above.
  11202. @node JavaScript support
  11203. @subsection JavaScript supported display of web pages
  11204. Sebastian Rose has written a JavaScript program especially designed to
  11205. enhance the web viewing experience of HTML files created with Org.
  11206. This program enhances large files in two different ways of viewing.
  11207. One is an @emph{Info}-like mode where each section is displayed separately
  11208. and navigation can be done with the @kbd{n} and @kbd{p}
  11209. keys, and some other keys as well, press @kbd{?} for an overview
  11210. of the available keys. The second one has a @emph{folding} view, much like
  11211. Org provides inside Emacs. The script is available at
  11212. @uref{https://orgmode.org/org-info.js} and the documentation at
  11213. @uref{https://orgmode.org/worg/code/org-info-js/}. The script is hosted on
  11214. @uref{https://orgmode.org}, but for reliability, prefer installing it on your
  11215. own web server.
  11216. To use this program, just add this line to the Org file:
  11217. @cindex @samp{INFOJS_OPT}, keyword
  11218. @example
  11219. #+INFOJS_OPT: view:info toc:nil
  11220. @end example
  11221. @noindent
  11222. The HTML header now has the code needed to automatically invoke the
  11223. script. For setting options, use the syntax from the above line for
  11224. options described below:
  11225. @table @asis
  11226. @item @samp{path:}
  11227. The path to the script. The default is to grab the script from
  11228. @uref{https://orgmode.org/org-info.js}, but you might want to have
  11229. a local copy and use a path like @samp{../scripts/org-info.js}.
  11230. @item @samp{view:}
  11231. Initial view when the website is first shown. Possible values are:
  11232. @multitable {aaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  11233. @item @samp{info}
  11234. @tab Info-like interface with one section per page
  11235. @item @samp{overview}
  11236. @tab Folding interface, initially showing only top-level
  11237. @item @samp{content}
  11238. @tab Folding interface, starting with all headlines visible
  11239. @item @samp{showall}
  11240. @tab Folding interface, all headlines and text visible
  11241. @end multitable
  11242. @item @samp{sdepth:}
  11243. Maximum headline level still considered as an independent section
  11244. for info and folding modes. The default is taken from
  11245. @code{org-export-headline-levels}, i.e., the @samp{H} switch in @samp{OPTIONS}.
  11246. If this is smaller than in @code{org-export-headline-levels}, each
  11247. info/folding section can still contain child headlines.
  11248. @item @samp{toc:}
  11249. Should the table of contents @emph{initially} be visible? Even when
  11250. @samp{nil}, you can always get to the ``toc'' with @kbd{i}.
  11251. @item @samp{tdepth:}
  11252. The depth of the table of contents. The defaults are taken from
  11253. the variables @code{org-export-headline-levels} and
  11254. @code{org-export-with-toc}.
  11255. @item @samp{ftoc:}
  11256. Does the CSS of the page specify a fixed position for the ``toc''?
  11257. If yes, the toc is displayed as a section.
  11258. @item @samp{ltoc:}
  11259. Should there be short contents (children) in each section? Make
  11260. this @samp{above} if the section should be above initial text.
  11261. @item @samp{mouse:}
  11262. Headings are highlighted when the mouse is over them. Should be
  11263. @samp{underline} (default) or a background color like @samp{#cccccc}.
  11264. @item @samp{buttons:}
  11265. Should view-toggle buttons be everywhere? When @samp{nil} (the
  11266. default), only one such button is present.
  11267. @end table
  11268. @noindent
  11269. @vindex org-infojs-options
  11270. @vindex org-export-html-use-infojs
  11271. You can choose default values for these options by customizing the
  11272. variable @code{org-infojs-options}. If you always want to apply the script
  11273. to your pages, configure the variable @code{org-export-html-use-infojs}.
  11274. @node @LaTeX{} Export
  11275. @section @LaTeX{} Export
  11276. @cindex @LaTeX{} export
  11277. @cindex PDF export
  11278. The @LaTeX{} export back-end can handle complex documents, incorporate
  11279. standard or custom @LaTeX{} document classes, generate documents using
  11280. alternate @LaTeX{} engines, and produce fully linked PDF files with
  11281. indexes, bibliographies, and tables of contents, destined for
  11282. interactive online viewing or high-quality print publication.
  11283. While the details are covered in-depth in this section, here are some
  11284. quick references to variables for the impatient: for engines, see
  11285. @code{org-latex-compiler}; for build sequences, see
  11286. @code{org-latex-pdf-process}; for packages, see
  11287. @code{org-latex-default-packages-alist} and @code{org-latex-packages-alist}.
  11288. An important note about the @LaTeX{} export back-end: it is sensitive to
  11289. blank lines in the Org document. That's because @LaTeX{} itself depends
  11290. on blank lines to tell apart syntactical elements, such as paragraphs.
  11291. @menu
  11292. * @LaTeX{}/PDF export commands:: For producing @LaTeX{} and PDF documents.
  11293. * @LaTeX{} specific export settings:: Unique to this @LaTeX{} back-end.
  11294. * @LaTeX{} header and sectioning:: Setting up the export file structure.
  11295. * Quoting @LaTeX{} code:: Incorporating literal @LaTeX{} code.
  11296. * Tables in @LaTeX{} export:: Options for exporting tables to @LaTeX{}.
  11297. * Images in @LaTeX{} export:: How to insert figures into @LaTeX{} output.
  11298. * Plain lists in @LaTeX{} export:: Attributes specific to lists.
  11299. * Source blocks in @LaTeX{} export:: Attributes specific to source code blocks.
  11300. * Example blocks in @LaTeX{} export:: Attributes specific to example blocks.
  11301. * Special blocks in @LaTeX{} export:: Attributes specific to special blocks.
  11302. * Horizontal rules in @LaTeX{} export:: Attributes specific to horizontal rules.
  11303. @end menu
  11304. @node @LaTeX{}/PDF export commands
  11305. @subsection @LaTeX{}/PDF export commands
  11306. @table @asis
  11307. @item @kbd{C-c C-e l l} (@code{org-latex-export-to-latex})
  11308. @kindex C-c C-e l l
  11309. @findex org-latex-export-to-latex~
  11310. Export to a @LaTeX{} file with a @samp{.tex} extension. For
  11311. @samp{myfile.org}, Org exports to @samp{myfile.tex}, overwriting without
  11312. warning.
  11313. @item @kbd{C-c C-e l L} (@code{org-latex-export-as-latex})
  11314. @kindex C-c C-e l L
  11315. @findex org-latex-export-as-latex
  11316. Export to a temporary buffer. Do not create a file.
  11317. @item @kbd{C-c C-e l p} (@code{org-latex-export-to-pdf})
  11318. @kindex C-c C-e l p
  11319. @findex org-latex-export-to-pdf
  11320. Export as @LaTeX{} file and convert it to PDF file.
  11321. @item @kbd{C-c C-e l o}
  11322. @kindex C-c C-e l o
  11323. Export as @LaTeX{} file and convert it to PDF, then open the PDF
  11324. using the default viewer.
  11325. @item @kbd{M-x org-export-region-as-latex}
  11326. Convert the region to @LaTeX{} under the assumption that it was in Org
  11327. mode syntax before. This is a global command that can be invoked in
  11328. any buffer.
  11329. @end table
  11330. @vindex org-latex-compiler
  11331. @vindex org-latex-bibtex-compiler
  11332. @vindex org-latex-default-packages-alist
  11333. @cindex pdflatex
  11334. @cindex xelatex
  11335. @cindex lualatex
  11336. @cindex @samp{LATEX_COMPILER}, keyword
  11337. The @LaTeX{} export back-end can use any of these @LaTeX{} engines:
  11338. @samp{pdflatex}, @samp{xelatex}, and @samp{lualatex}. These engines compile @LaTeX{}
  11339. files with different compilers, packages, and output options. The
  11340. @LaTeX{} export back-end finds the compiler version to use from
  11341. @code{org-latex-compiler} variable or the @samp{#+LATEX_COMPILER} keyword in the
  11342. Org file. See the docstring for the
  11343. @code{org-latex-default-packages-alist} for loading packages with certain
  11344. compilers. Also see @code{org-latex-bibtex-compiler} to set the
  11345. bibliography compiler@footnote{This does not allow setting different bibliography compilers
  11346. for different files. However, ``smart'' @LaTeX{} compilation systems, such
  11347. as latexmk, can select the correct bibliography compiler.}.
  11348. @node @LaTeX{} specific export settings
  11349. @subsection @LaTeX{} specific export settings
  11350. The @LaTeX{} export back-end has several additional keywords for
  11351. customizing @LaTeX{} output. Setting these keywords works similar to the
  11352. general options (see @ref{Export Settings}).
  11353. @table @asis
  11354. @item @samp{DESCRIPTION}
  11355. @cindex @samp{DESCRIPTION}, keyword
  11356. @vindex org-latex-hyperref-template
  11357. @vindex org-latex-title-command
  11358. The document's description. The description along with author
  11359. name, keywords, and related file metadata are inserted in the
  11360. output file by the hyperref package. See
  11361. @code{org-latex-hyperref-template} for customizing metadata items.
  11362. See @code{org-latex-title-command} for typesetting description into
  11363. the document's front matter. Use multiple @samp{DESCRIPTION} keywords
  11364. for long descriptions.
  11365. @item @samp{LATEX_CLASS}
  11366. @cindex @samp{LATEX_CLASS}, keyword
  11367. @vindex org-latex-default-class
  11368. @vindex org-latex-classes
  11369. This is @LaTeX{} document class, such as @emph{article}, @emph{report},
  11370. @emph{book}, and so on, which contain predefined preamble and headline
  11371. level mapping that the @LaTeX{} export back-end needs. The back-end
  11372. reads the default class name from the @code{org-latex-default-class}
  11373. variable. Org has @emph{article} as the default class. A valid
  11374. default class must be an element of @code{org-latex-classes}.
  11375. @item @samp{LATEX_CLASS_OPTIONS}
  11376. @cindex @samp{LATEX_CLASS_OPTIONS}, keyword
  11377. Options the @LaTeX{} export back-end uses when calling the @LaTeX{}
  11378. document class.
  11379. @item @samp{LATEX_COMPILER}
  11380. @cindex @samp{LATEX_COMPILER}, keyword
  11381. @vindex org-latex-compiler
  11382. The compiler, such as @samp{pdflatex}, @samp{xelatex}, @samp{lualatex}, for
  11383. producing the PDF. See @code{org-latex-compiler}.
  11384. @item @samp{LATEX_HEADER}
  11385. @itemx @samp{LATEX_HEADER_EXTRA}
  11386. @cindex @samp{LATEX_HEADER}, keyword
  11387. @cindex @samp{LATEX_HEADER_EXTRA}, keyword
  11388. @vindex org-latex-classes
  11389. Arbitrary lines to add to the document's preamble, before the
  11390. hyperref settings. See @code{org-latex-classes} for adjusting the
  11391. structure and order of the @LaTeX{} headers.
  11392. @item @samp{KEYWORDS}
  11393. @cindex @samp{KEYWORDS}, keyword
  11394. @vindex org-latex-hyperref-template
  11395. @vindex org-latex-title-command
  11396. The keywords for the document. The description along with author
  11397. name, keywords, and related file metadata are inserted in the
  11398. output file by the hyperref package. See
  11399. @code{org-latex-hyperref-template} for customizing metadata items.
  11400. See @code{org-latex-title-command} for typesetting description into
  11401. the document's front matter. Use multiple @samp{KEYWORDS} lines if
  11402. necessary.
  11403. @item @samp{SUBTITLE}
  11404. @cindex @samp{SUBTITLE}, keyword
  11405. @vindex org-latex-subtitle-separate
  11406. @vindex org-latex-subtitle-format
  11407. The document's subtitle. It is typeset as per
  11408. @code{org-latex-subtitle-format}. If @code{org-latex-subtitle-separate} is
  11409. non-@code{nil}, it is typed as part of the @code{\title} macro. See
  11410. @code{org-latex-hyperref-template} for customizing metadata items.
  11411. See @code{org-latex-title-command} for typesetting description
  11412. into the document's front matter.
  11413. @end table
  11414. The following sections have further details.
  11415. @node @LaTeX{} header and sectioning
  11416. @subsection @LaTeX{} header and sectioning structure
  11417. @cindex @LaTeX{} class
  11418. @cindex @LaTeX{} sectioning structure
  11419. @cindex @LaTeX{} header
  11420. @cindex header, for @LaTeX{} files
  11421. @cindex sectioning structure, for @LaTeX{} export
  11422. The @LaTeX{} export back-end converts the first three of Org's outline
  11423. levels into @LaTeX{} headlines. The remaining Org levels are exported as
  11424. lists. To change this globally for the cut-off point between levels
  11425. and lists, (see @ref{Export Settings}).
  11426. By default, the @LaTeX{} export back-end uses the @emph{article} class.
  11427. @vindex org-latex-default-class
  11428. @vindex org-latex-classes
  11429. @vindex org-latex-default-packages-alist
  11430. @vindex org-latex-packages-alist
  11431. To change the default class globally, edit @code{org-latex-default-class}.
  11432. To change the default class locally in an Org file, add option lines
  11433. @samp{#+LATEX_CLASS: myclass}. To change the default class for just a part
  11434. of the Org file, set a sub-tree property, @samp{EXPORT_LATEX_CLASS}. The
  11435. class name entered here must be valid member of @code{org-latex-classes}.
  11436. This variable defines a header template for each class into which the
  11437. exporter splices the values of @code{org-latex-default-packages-alist} and
  11438. @code{org-latex-packages-alist}. Use the same three variables to define
  11439. custom sectioning or custom classes.
  11440. @cindex @samp{LATEX_CLASS}, keyword
  11441. @cindex @samp{LATEX_CLASS_OPTIONS}, keyword
  11442. @cindex @samp{EXPORT_LATEX_CLASS}, property
  11443. @cindex @samp{EXPORT_LATEX_CLASS_OPTIONS}, property
  11444. The @LaTeX{} export back-end sends the @samp{LATEX_CLASS_OPTIONS} keyword and
  11445. @samp{EXPORT_LATEX_CLASS_OPTIONS} property as options to the @LaTeX{}
  11446. @code{\documentclass} macro. The options and the syntax for specifying
  11447. them, including enclosing them in square brackets, follow @LaTeX{}
  11448. conventions.
  11449. @example
  11450. #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]
  11451. @end example
  11452. @cindex @samp{LATEX_HEADER}, keyword
  11453. @cindex @samp{LATEX_HEADER_EXTRA}, keyword
  11454. The @LaTeX{} export back-end appends values from @samp{LATEX_HEADER} and
  11455. @samp{LATEX_HEADER_EXTRA} keywords to the @LaTeX{} header. The docstring for
  11456. @code{org-latex-classes} explains in more detail. Also note that @LaTeX{}
  11457. export back-end does not append @samp{LATEX_HEADER_EXTRA} to the header
  11458. when previewing @LaTeX{} snippets (see @ref{Previewing @LaTeX{} fragments}).
  11459. A sample Org file with the above headers:
  11460. @example
  11461. #+LATEX_CLASS: article
  11462. #+LATEX_CLASS_OPTIONS: [a4paper]
  11463. #+LATEX_HEADER: \usepackage@{xyz@}
  11464. * Headline 1
  11465. some text
  11466. * Headline 2
  11467. some more text
  11468. @end example
  11469. @node Quoting @LaTeX{} code
  11470. @subsection Quoting @LaTeX{} code
  11471. The @LaTeX{} export back-end can insert any arbitrary @LaTeX{} code, see
  11472. @ref{Embedded @LaTeX{}}. There are three ways to embed such code in the Org
  11473. file and they all use different quoting syntax.
  11474. @cindex inline, in @LaTeX{} export
  11475. Inserting in-line quoted with @@ symbols:
  11476. @example
  11477. Code embedded in-line @@@@latex:any arbitrary LaTeX code@@@@ in a paragraph.
  11478. @end example
  11479. @cindex @samp{LATEX}, keyword
  11480. Inserting as one or more keyword lines in the Org file:
  11481. @example
  11482. #+LATEX: any arbitrary LaTeX code
  11483. @end example
  11484. @cindex @samp{BEGIN_EXPORT latex}
  11485. Inserting as an export block in the Org file, where the back-end
  11486. exports any code between begin and end markers:
  11487. @example
  11488. #+BEGIN_EXPORT latex
  11489. any arbitrary LaTeX code
  11490. #+END_EXPORT
  11491. @end example
  11492. @node Tables in @LaTeX{} export
  11493. @subsection Tables in @LaTeX{} export
  11494. @cindex tables, in @LaTeX{} export
  11495. The @LaTeX{} export back-end can pass several @LaTeX{} attributes for table
  11496. contents and layout. Besides specifying label and caption (see
  11497. @ref{Images and Tables}), the other valid @LaTeX{} attributes include:
  11498. @table @asis
  11499. @item @samp{:mode}
  11500. @vindex org-latex-default-table-mode
  11501. The @LaTeX{} export back-end wraps the table differently depending
  11502. on the mode for accurate rendering of math symbols. Mode is
  11503. either @samp{table}, @samp{math}, @samp{inline-math} or @samp{verbatim}.
  11504. For @samp{math} or @samp{inline-math} mode, @LaTeX{} export back-end wraps the
  11505. table in a math environment, but every cell in it is exported
  11506. as-is. The @LaTeX{} export back-end determines the default mode
  11507. from @code{org-latex-default-table-mode}. The @LaTeX{} export back-end
  11508. merges contiguous tables in the same mode into a single
  11509. environment.
  11510. @item @samp{:environment}
  11511. @vindex org-latex-default-table-environment
  11512. Set the default @LaTeX{} table environment for the @LaTeX{} export
  11513. back-end to use when exporting Org tables. Common @LaTeX{} table
  11514. environments are provided by these packages: tabularx, longtable,
  11515. array, tabu, and bmatrix. For packages, such as tabularx and
  11516. tabu, or any newer replacements, include them in the
  11517. @code{org-latex-packages-alist} variable so the @LaTeX{} export back-end
  11518. can insert the appropriate load package headers in the converted
  11519. @LaTeX{} file. Look in the docstring for the
  11520. @code{org-latex-packages-alist} variable for configuring these
  11521. packages for @LaTeX{} snippet previews, if any.
  11522. @item @samp{:caption}
  11523. Use @samp{CAPTION} keyword to set a simple caption for a table (see
  11524. @ref{Images and Tables}). For custom captions, use @samp{:caption}
  11525. attribute, which accepts raw @LaTeX{} code. @samp{:caption} value
  11526. overrides @samp{CAPTION} value.
  11527. @item @samp{:float}
  11528. @itemx @samp{:placement}
  11529. The table environments by default are not floats in @LaTeX{}. To
  11530. make them floating objects use @samp{:float} with one of the following
  11531. options: @samp{sideways}, @samp{multicolumn}, @samp{t}, and @samp{nil}.
  11532. @LaTeX{} floats can also have additional layout @samp{:placement}
  11533. attributes. These are the usual @samp{[h t b p ! H]} permissions
  11534. specified in square brackets. Note that for @samp{:float sideways}
  11535. tables, the @LaTeX{} export back-end ignores @samp{:placement}
  11536. attributes.
  11537. @item @samp{:align}
  11538. @itemx @samp{:font}
  11539. @itemx @samp{:width}
  11540. The @LaTeX{} export back-end uses these attributes for regular
  11541. tables to set their alignments, fonts, and widths.
  11542. @item @samp{:spread}
  11543. When @samp{:spread} is non-@code{nil}, the @LaTeX{} export back-end spreads or
  11544. shrinks the table by the @samp{:width} for tabu and longtabu
  11545. environments. @samp{:spread} has no effect if @samp{:width} is not set.
  11546. @item @samp{:booktabs}
  11547. @itemx @samp{:center}
  11548. @itemx @samp{:rmlines}
  11549. @vindex org-latex-tables-booktabs
  11550. @vindex org-latex-tables-centered
  11551. All three commands are toggles. @samp{:booktabs} brings in modern
  11552. typesetting enhancements to regular tables. The booktabs package
  11553. has to be loaded through @code{org-latex-packages-alist}. @samp{:center}
  11554. is for centering the table. @samp{:rmlines} removes all but the very
  11555. first horizontal line made of ASCII characters from ``table.el''
  11556. tables only.
  11557. @item @samp{:math-prefix}
  11558. @itemx @samp{:math-suffix}
  11559. @itemx @samp{:math-arguments}
  11560. The @LaTeX{} export back-end inserts @samp{:math-prefix} string value in
  11561. a math environment before the table. The @LaTeX{} export back-end
  11562. inserts @samp{:math-suffix} string value in a math environment after
  11563. the table. The @LaTeX{} export back-end inserts @samp{:math-arguments}
  11564. string value between the macro name and the table's contents.
  11565. @samp{:math-arguments} comes in use for matrix macros that require
  11566. more than one argument, such as @samp{qbordermatrix}.
  11567. @end table
  11568. @LaTeX{} table attributes help formatting tables for a wide range of
  11569. situations, such as matrix product or spanning multiple pages:
  11570. @example
  11571. #+ATTR_LATEX: :environment longtable :align l|lp@{3cm@}r|l
  11572. | ... | ... |
  11573. | ... | ... |
  11574. #+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times
  11575. | a | b |
  11576. | c | d |
  11577. #+ATTR_LATEX: :mode math :environment bmatrix
  11578. | 1 | 2 |
  11579. | 3 | 4 |
  11580. @end example
  11581. Set the caption with the @LaTeX{} command
  11582. @samp{\bicaption@{HeadingA@}@{HeadingB@}}:
  11583. @example
  11584. #+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
  11585. | ... | ... |
  11586. | ... | ... |
  11587. @end example
  11588. @node Images in @LaTeX{} export
  11589. @subsection Images in @LaTeX{} export
  11590. @cindex images, inline in LaTeX
  11591. @cindex inlining images in LaTeX
  11592. @cindex @samp{ATTR_LATEX}, keyword
  11593. The @LaTeX{} export back-end processes image links in Org files that do
  11594. not have descriptions, such as these links @samp{[[file:img.jpg]]} or
  11595. @samp{[[./img.jpg]]}, as direct image insertions in the final PDF output. In
  11596. the PDF, they are no longer links but actual images embedded on the
  11597. page. The @LaTeX{} export back-end uses @samp{\includegraphics} macro to
  11598. insert the image. But for TikZ (@uref{http://sourceforge.net/projects/pgf/})
  11599. images, the back-end uses an @code{\input} macro wrapped within
  11600. a @code{tikzpicture} environment.
  11601. For specifying image @samp{:width}, @samp{:height}, and other @samp{:options}, use
  11602. this syntax:
  11603. @example
  11604. #+ATTR_LATEX: :width 5cm :options angle=90
  11605. [[./img/sed-hr4049.pdf]]
  11606. @end example
  11607. For custom commands for captions, use the @samp{:caption} attribute. It
  11608. overrides the default @samp{#+CAPTION} value:
  11609. @example
  11610. #+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
  11611. [[./img/sed-hr4049.pdf]]
  11612. @end example
  11613. When captions follow the method as described in @ref{Images and Tables},
  11614. the @LaTeX{} export back-end wraps the picture in a floating @samp{figure}
  11615. environment. To float an image without specifying a caption, set the
  11616. @samp{:float} attribute to one of the following:
  11617. @table @asis
  11618. @item @samp{t}
  11619. For a standard @samp{figure} environment; used by default whenever an
  11620. image has a caption.
  11621. @item @samp{multicolumn}
  11622. To span the image across multiple columns of a page; the back-end
  11623. wraps the image in a @samp{figure*} environment.
  11624. @item @samp{wrap}
  11625. For text to flow around the image on the right; the figure
  11626. occupies the left half of the page.
  11627. @item @samp{sideways}
  11628. For a new page with the image sideways, rotated ninety degrees,
  11629. in a @samp{sidewaysfigure} environment; overrides @samp{:placement}
  11630. setting.
  11631. @item @samp{nil}
  11632. To avoid a @samp{:float} even if using a caption.
  11633. @end table
  11634. @noindent
  11635. Use the @samp{placement} attribute to modify a floating environment's
  11636. placement.
  11637. @example
  11638. #+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement @{r@}@{0.4\textwidth@}
  11639. [[./img/hst.png]]
  11640. @end example
  11641. @vindex org-latex-images-centered
  11642. @cindex center image in LaTeX export
  11643. @cindex image, centering in LaTeX export
  11644. The @LaTeX{} export back-end centers all images by default. Setting
  11645. @samp{:center} to @samp{nil} disables centering. To disable centering globally,
  11646. set @code{org-latex-images-centered} to @samp{t}.
  11647. Set the @samp{:comment-include} attribute to non-@code{nil} value for the @LaTeX{}
  11648. export back-end to comment out the @samp{\includegraphics} macro.
  11649. @node Plain lists in @LaTeX{} export
  11650. @subsection Plain lists in @LaTeX{} export
  11651. @cindex plain lists, in @LaTeX{} export
  11652. @cindex @samp{ATTR_LATEX}, keyword
  11653. The @LaTeX{} export back-end accepts the @samp{environment} and @samp{options}
  11654. attributes for plain lists. Both attributes work together for
  11655. customizing lists, as shown in the examples:
  11656. @example
  11657. #+LATEX_HEADER: \usepackage[inline]@{enumitem@}
  11658. Some ways to say "Hello":
  11659. #+ATTR_LATEX: :environment itemize*
  11660. #+ATTR_LATEX: :options [label=@{@}, itemjoin=@{,@}, itemjoin*=@{, and@}]
  11661. - Hola
  11662. - Bonjour
  11663. - Guten Tag.
  11664. @end example
  11665. Since @LaTeX{} supports only four levels of nesting for lists, use an
  11666. external package, such as @samp{enumitem} in @LaTeX{}, for levels deeper than
  11667. four:
  11668. @example
  11669. #+LATEX_HEADER: \usepackage@{enumitem@}
  11670. #+LATEX_HEADER: \renewlist@{itemize@}@{itemize@}@{9@}
  11671. #+LATEX_HEADER: \setlist[itemize]@{label=$\circ$@}
  11672. - One
  11673. - Two
  11674. - Three
  11675. - Four
  11676. - Five
  11677. @end example
  11678. @node Source blocks in @LaTeX{} export
  11679. @subsection Source blocks in @LaTeX{} export
  11680. @cindex source blocks, in @LaTeX{} export
  11681. @cindex @samp{ATTR_LATEX}, keyword
  11682. The @LaTeX{} export back-end can make source code blocks into floating
  11683. objects through the attributes @samp{:float} and @samp{:options}. For @samp{:float}:
  11684. @table @asis
  11685. @item @samp{t}
  11686. Makes a source block float; by default floats any source block
  11687. with a caption.
  11688. @item @samp{multicolumn}
  11689. Spans the source block across multiple columns of a page.
  11690. @item @samp{nil}
  11691. Avoids a @samp{:float} even if using a caption; useful for source code
  11692. blocks that may not fit on a page.
  11693. @end table
  11694. @example
  11695. #+ATTR_LATEX: :float nil
  11696. #+BEGIN_SRC emacs-lisp
  11697. Lisp code that may not fit in a single page.
  11698. #+END_SRC
  11699. @end example
  11700. @vindex org-latex-listings-options
  11701. @vindex org-latex-minted-options
  11702. The @LaTeX{} export back-end passes string values in @samp{:options} to @LaTeX{}
  11703. packages for customization of that specific source block. In the
  11704. example below, the @samp{:options} are set for Minted. Minted is a source
  11705. code highlighting @LaTeX{} package with many configurable options.
  11706. @example
  11707. #+ATTR_LATEX: :options commentstyle=\bfseries
  11708. #+BEGIN_SRC emacs-lisp
  11709. (defun Fib (n)
  11710. (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
  11711. #+END_SRC
  11712. @end example
  11713. To apply similar configuration options for all source blocks in
  11714. a file, use the @code{org-latex-listings-options} and
  11715. @code{org-latex-minted-options} variables.
  11716. @node Example blocks in @LaTeX{} export
  11717. @subsection Example blocks in @LaTeX{} export
  11718. @cindex example blocks, in @LaTeX{} export
  11719. @cindex verbatim blocks, in @LaTeX{} export
  11720. @cindex @samp{ATTR_LATEX}, keyword
  11721. The @LaTeX{} export back-end wraps the contents of example blocks in
  11722. a @samp{verbatim} environment. To change this behavior to use another
  11723. environment globally, specify an appropriate export filter (see
  11724. @ref{Advanced Configuration}). To change this behavior to use another
  11725. environment for each block, use the @samp{:environment} parameter to
  11726. specify a custom environment.
  11727. @example
  11728. #+ATTR_LATEX: :environment myverbatim
  11729. #+BEGIN_EXAMPLE
  11730. This sentence is false.
  11731. #+END_EXAMPLE
  11732. @end example
  11733. @node Special blocks in @LaTeX{} export
  11734. @subsection Special blocks in @LaTeX{} export
  11735. @cindex special blocks, in @LaTeX{} export
  11736. @cindex abstract, in @LaTeX{} export
  11737. @cindex proof, in @LaTeX{} export
  11738. @cindex @samp{ATTR_LATEX}, keyword
  11739. For other special blocks in the Org file, the @LaTeX{} export back-end
  11740. makes a special environment of the same name. The back-end also takes
  11741. @samp{:options}, if any, and appends as-is to that environment's opening
  11742. string. For example:
  11743. @example
  11744. #+BEGIN_abstract
  11745. We demonstrate how to solve the Syracuse problem.
  11746. #+END_abstract
  11747. #+ATTR_LATEX: :options [Proof of important theorem]
  11748. #+BEGIN_proof
  11749. ...
  11750. Therefore, any even number greater than 2 is the sum of two primes.
  11751. #+END_proof
  11752. @end example
  11753. @noindent
  11754. exports to
  11755. @example
  11756. \begin@{abstract@}
  11757. We demonstrate how to solve the Syracuse problem.
  11758. \end@{abstract@}
  11759. \begin@{proof@}[Proof of important theorem]
  11760. ...
  11761. Therefore, any even number greater than 2 is the sum of two primes.
  11762. \end@{proof@}
  11763. @end example
  11764. If you need to insert a specific caption command, use @samp{:caption}
  11765. attribute. It overrides standard @samp{CAPTION} value, if any. For
  11766. example:
  11767. @example
  11768. #+ATTR_LATEX: :caption \MyCaption@{HeadingA@}
  11769. #+BEGIN_proof
  11770. ...
  11771. #+END_proof
  11772. @end example
  11773. @node Horizontal rules in @LaTeX{} export
  11774. @subsection Horizontal rules in @LaTeX{} export
  11775. @cindex horizontal rules, in @LaTeX{} export
  11776. @cindex @samp{ATTR_LATEX}, keyword
  11777. The @LaTeX{} export back-end converts horizontal rules by the specified
  11778. @samp{:width} and @samp{:thickness} attributes. For example:
  11779. @example
  11780. #+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt
  11781. -----
  11782. @end example
  11783. @node Markdown Export
  11784. @section Markdown Export
  11785. @cindex Markdown export
  11786. The Markdown export back-end, ``md'', converts an Org file to a Markdown
  11787. format, as defined at @uref{http://daringfireball.net/projects/markdown/}.
  11788. Since ``md'' is built on top of the HTML back-end, any Org constructs
  11789. not supported by Markdown, such as tables, the underlying ``html''
  11790. back-end (see @ref{HTML Export}) converts them.
  11791. @anchor{Markdown export commands}
  11792. @subheading Markdown export commands
  11793. @table @asis
  11794. @item @kbd{C-c C-e m m} (@code{org-md-export-to-markdown})
  11795. @kindex C-c C-c m m
  11796. @findex org-md-export-to-markdown
  11797. Export to a text file with Markdown syntax. For @samp{myfile.org},
  11798. Org exports to @samp{myfile.md}, overwritten without warning.
  11799. @item @kbd{C-c C-e m M} (@code{org-md-export-as-markdown})
  11800. @kindex C-c C-c m M
  11801. @findex org-md-export-as-markdown
  11802. Export to a temporary buffer. Does not create a file.
  11803. @item @kbd{C-c C-e m o}
  11804. @kindex C-c C-e m o
  11805. Export as a text file with Markdown syntax, then open it.
  11806. @end table
  11807. @anchor{Header and sectioning structure (1)}
  11808. @subheading Header and sectioning structure
  11809. @vindex org-md-headline-style
  11810. Based on @code{org-md-headline-style}, Markdown export can generate
  11811. headlines of both @emph{atx} and @emph{setext} types. @emph{atx} limits headline
  11812. levels to two whereas @emph{setext} limits headline levels to six. Beyond
  11813. these limits, the export back-end converts headlines to lists. To set
  11814. a limit to a level before the absolute limit (see @ref{Export Settings}).
  11815. @node OpenDocument Text Export
  11816. @section OpenDocument Text Export
  11817. @cindex ODT
  11818. @cindex OpenDocument
  11819. @cindex export, OpenDocument
  11820. @cindex LibreOffice
  11821. The ODT export back-end handles creating of OpenDocument Text (ODT)
  11822. format. Documents created by this exporter use the
  11823. @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
  11824. (OpenDocument) Version 1.2}.} and are compatible
  11825. with LibreOffice 3.4.
  11826. @menu
  11827. * Pre-requisites for ODT export:: Required packages.
  11828. * ODT export commands:: Invoking export.
  11829. * ODT specific export settings:: Configuration options.
  11830. * Extending ODT export:: Producing DOC, PDF files.
  11831. * Applying custom styles:: Styling the output.
  11832. * Links in ODT export:: Handling and formatting links.
  11833. * Tables in ODT export:: Org tables conversions.
  11834. * Images in ODT export:: Inserting images.
  11835. * Math formatting in ODT export:: Formatting @LaTeX{} fragments.
  11836. * Labels and captions in ODT export:: Rendering objects.
  11837. * Literal examples in ODT export:: For source code and example blocks.
  11838. * Advanced topics in ODT export:: For power users.
  11839. @end menu
  11840. @node Pre-requisites for ODT export
  11841. @subsection Pre-requisites for ODT export
  11842. @cindex zip
  11843. The ODT export back-end relies on the zip program to create the final
  11844. compressed ODT output. Check if @samp{zip} is locally available and
  11845. executable. Without it, export cannot finish.
  11846. @node ODT export commands
  11847. @subsection ODT export commands
  11848. @table @asis
  11849. @item @kbd{C-c C-e o o} (@code{org-export-to-odt})
  11850. @kindex C-c C-e o o
  11851. @findex org-export-to-odt
  11852. Export as OpenDocument Text file.
  11853. @cindex @samp{EXPORT_FILE_NAME}, property
  11854. @vindex org-odt-preferred-output-format
  11855. If @code{org-odt-preferred-output-format} is specified, the ODT export
  11856. back-end automatically converts the exported file to that format.
  11857. For @samp{myfile.org}, Org exports to @samp{myfile.odt}, overwriting
  11858. without warning. The ODT export back-end exports a region only
  11859. if a region was active.
  11860. If the selected region is a single tree, the ODT export back-end
  11861. makes the tree head the document title. Incidentally, @kbd{C-c @@} selects the current sub-tree. If the tree head entry has,
  11862. or inherits, an @samp{EXPORT_FILE_NAME} property, the ODT export
  11863. back-end uses that for file name.
  11864. @item @kbd{C-c C-e o O}
  11865. @kindex C-c C-e o O
  11866. Export as an OpenDocument Text file and open the resulting file.
  11867. @vindex org-export-odt-preferred-output-format
  11868. If @code{org-export-odt-preferred-output-format} is specified, open
  11869. the converted file instead. See @ref{Automatically exporting to other formats}.
  11870. @end table
  11871. @node ODT specific export settings
  11872. @subsection ODT specific export settings
  11873. The ODT export back-end has several additional keywords for
  11874. customizing ODT output. Setting these keywords works similar to the
  11875. general options (see @ref{Export Settings}).
  11876. @table @asis
  11877. @item @samp{DESCRIPTION}
  11878. @cindex @samp{DESCRIPTION}, keyword
  11879. This is the document's description, which the ODT export back-end
  11880. inserts as document metadata. For long descriptions, use
  11881. multiple lines, prefixed with @samp{DESCRIPTION}.
  11882. @item @samp{KEYWORDS}
  11883. @cindex @samp{KEYWORDS}, keyword
  11884. The keywords for the document. The ODT export back-end inserts
  11885. the description along with author name, keywords, and related
  11886. file metadata as metadata in the output file. Use multiple
  11887. @samp{KEYWORDS} if necessary.
  11888. @item @samp{ODT_STYLES_FILE}
  11889. @cindex @samp{ODT_STYLES_FILE}, keyword
  11890. @vindex org-odt-styles-file
  11891. The ODT export back-end uses the @code{org-odt-styles-file} by
  11892. default. See @ref{Applying custom styles} for details.
  11893. @item @samp{SUBTITLE}
  11894. @cindex @samp{SUBTITLE}, keyword
  11895. The document subtitle.
  11896. @end table
  11897. @node Extending ODT export
  11898. @subsection Extending ODT export
  11899. The ODT export back-end can produce documents in other formats besides
  11900. ODT using a specialized ODT converter process. Its common interface
  11901. works with popular converters to produce formats such as @samp{doc}, or
  11902. convert a document from one format, say @samp{csv}, to another format, say
  11903. @samp{xls}.
  11904. @cindex @file{unoconv}
  11905. @vindex org-odt-convert-process
  11906. Customize @code{org-odt-convert-process} variable to point to @samp{unoconv},
  11907. which is the ODT's preferred converter. Working installations of
  11908. LibreOffice would already have @samp{unoconv} installed. Alternatively,
  11909. other converters may be substituted here. See @ref{Configuring a document converter}.
  11910. @anchor{Automatically exporting to other formats}
  11911. @subsubheading Automatically exporting to other formats
  11912. @vindex org-odt-preferred-output-format
  11913. If ODT format is just an intermediate step to get to other formats,
  11914. such as @samp{doc}, @samp{docx}, @samp{rtf}, or @samp{pdf}, etc., then extend the ODT
  11915. export back-end to directly produce that format. Specify the final
  11916. format in the @code{org-odt-preferred-output-format} variable. This is one
  11917. way to extend (see @ref{ODT export commands}).
  11918. @anchor{Converting between document formats}
  11919. @subsubheading Converting between document formats
  11920. The Org export back-end is made to be inter-operable with a wide range
  11921. of text document format converters. Newer generation converters, such
  11922. as LibreOffice and Pandoc, can handle hundreds of formats at once.
  11923. Org provides a consistent interaction with whatever converter is
  11924. installed. Here are some generic commands:
  11925. @table @asis
  11926. @item @kbd{M-x org-odt-convert}
  11927. @findex org-odt-convert
  11928. Convert an existing document from one format to another. With
  11929. a prefix argument, opens the newly produced file.
  11930. @end table
  11931. @node Applying custom styles
  11932. @subsection Applying custom styles
  11933. @cindex styles, custom
  11934. @cindex template, custom
  11935. The ODT export back-end comes with many OpenDocument styles (see
  11936. @ref{Working with OpenDocument style files}). To expand or further
  11937. customize these built-in style sheets, either edit the style sheets
  11938. directly or generate them using an application such as LibreOffice.
  11939. The example here shows creating a style using LibreOffice.
  11940. @anchor{Applying custom styles the easy way}
  11941. @subsubheading Applying custom styles: the easy way
  11942. @enumerate
  11943. @item
  11944. Create a sample @samp{example.org} file with settings as shown below,
  11945. and export it to ODT format.
  11946. @example
  11947. #+OPTIONS: H:10 num:t
  11948. @end example
  11949. @item
  11950. Open the above @samp{example.odt} using LibreOffice. Use the @emph{Stylist}
  11951. to locate the target styles, which typically have the ``Org'' prefix.
  11952. Open one, modify, and save as either OpenDocument Text (ODT) or
  11953. OpenDocument Template (OTT) file.
  11954. @item
  11955. @vindex org-odt-styles-file
  11956. Customize the variable @code{org-odt-styles-file} and point it to the
  11957. newly created file. For additional configuration options, see
  11958. @ref{x-overriding-factory-styles, , Overriding factory styles}.
  11959. @cindex @samp{ODT_STYLES_FILE}, keyword
  11960. To apply an ODT style to a particular file, use the
  11961. @samp{ODT_STYLES_FILE} keyword as shown in the example below:
  11962. @example
  11963. #+ODT_STYLES_FILE: "/path/to/example.ott"
  11964. @end example
  11965. @noindent
  11966. or
  11967. @example
  11968. #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
  11969. @end example
  11970. @end enumerate
  11971. @anchor{Using third-party styles and templates}
  11972. @subsubheading Using third-party styles and templates
  11973. The ODT export back-end relies on many templates and style names.
  11974. Using third-party styles and templates can lead to mismatches.
  11975. Templates derived from built in ODT templates and styles seem to have
  11976. fewer problems.
  11977. @node Links in ODT export
  11978. @subsection Links in ODT export
  11979. @cindex links, in ODT export
  11980. ODT exporter creates native cross-references for internal links. It
  11981. creates Internet-style links for all other links.
  11982. A link with no description and pointing to a regular, un-itemized,
  11983. outline heading is replaced with a cross-reference and section number
  11984. of the heading.
  11985. A @samp{\ref@{label@}}-style reference to an image, table etc., is replaced
  11986. with a cross-reference and sequence number of the labeled entity. See
  11987. @ref{Labels and captions in ODT export}.
  11988. @node Tables in ODT export
  11989. @subsection Tables in ODT export
  11990. @cindex tables, in ODT export
  11991. The ODT export back-end handles native Org mode tables (see @ref{Tables})
  11992. and simple @samp{table.el} tables. Complex @samp{table.el} tables having column
  11993. or row spans are not supported. Such tables are stripped from the
  11994. exported document.
  11995. By default, the ODT export back-end exports a table with top and
  11996. bottom frames and with ruled lines separating row and column groups
  11997. (see @ref{Column Groups}). All tables are typeset to occupy the same
  11998. width. The ODT export back-end honors any table alignments and
  11999. relative widths for columns (see @ref{Column Width and Alignment}).
  12000. Note that the ODT export back-end interprets column widths as weighted
  12001. ratios, the default weight being 1.
  12002. @cindex @samp{ATTR_ODT}, keyword
  12003. Specifying @samp{:rel-width} property on an @samp{ATTR_ODT} line controls the
  12004. width of the table. For example:
  12005. @example
  12006. #+ATTR_ODT: :rel-width 50
  12007. | Area/Month | Jan | Feb | Mar | Sum |
  12008. |---------------+-------+-------+-------+-------|
  12009. | / | < | | | < |
  12010. | <l13> | <r5> | <r5> | <r5> | <r6> |
  12011. | North America | 1 | 21 | 926 | 948 |
  12012. | Middle East | 6 | 75 | 844 | 925 |
  12013. | Asia Pacific | 9 | 27 | 790 | 826 |
  12014. |---------------+-------+-------+-------+-------|
  12015. | Sum | 16 | 123 | 2560 | 2699 |
  12016. @end example
  12017. On export, the above table takes 50% of text width area. The exporter
  12018. sizes the columns in the ratio: 13:5:5:5:6. The first column is
  12019. left-aligned and rest of the columns, right-aligned. Vertical rules
  12020. separate the header and the last column. Horizontal rules separate
  12021. the header and the last row.
  12022. For even more customization, create custom table styles and associate
  12023. them with a table using the @samp{ATTR_ODT} keyword. See @ref{Customizing tables in ODT export}.
  12024. @node Images in ODT export
  12025. @subsection Images in ODT export
  12026. @cindex images, embedding in ODT
  12027. @cindex embedding images in ODT
  12028. @anchor{Embedding images}
  12029. @subsubheading Embedding images
  12030. The ODT export back-end processes image links in Org files that do not
  12031. have descriptions, such as these links @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]},
  12032. as direct image insertions in the final output. Either of these
  12033. examples works:
  12034. @example
  12035. [[file:img.png]]
  12036. @end example
  12037. @example
  12038. [[./img.png]]
  12039. @end example
  12040. @anchor{Embedding clickable images}
  12041. @subsubheading Embedding clickable images
  12042. For clickable images, provide a link whose description is another link
  12043. to an image file. For example, to embed an image
  12044. @samp{org-mode-unicorn.png} which when clicked jumps to @uref{https://orgmode.org}
  12045. website, do the following
  12046. @example
  12047. [[https://orgmode.org][./org-mode-unicorn.png]]
  12048. @end example
  12049. @anchor{Sizing and scaling of embedded images}
  12050. @subsubheading Sizing and scaling of embedded images
  12051. @cindex @samp{ATTR_ODT}, keyword
  12052. Control the size and scale of the embedded images with the @samp{ATTR_ODT}
  12053. attribute.
  12054. @cindex identify, ImageMagick
  12055. @vindex org-odt-pixels-per-inch
  12056. The ODT export back-end starts with establishing the size of the image
  12057. in the final document. The dimensions of this size are measured in
  12058. centimeters. The back-end then queries the image file for its
  12059. dimensions measured in pixels. For this measurement, the back-end
  12060. relies on ImageMagick's identify program or Emacs @code{create-image} and
  12061. @code{image-size} API. ImageMagick is the preferred choice for large file
  12062. sizes or frequent batch operations. The back-end then converts the
  12063. pixel dimensions using @code{org-odt-pixels-per-inch} into the familiar 72
  12064. dpi or 96 dpi. The default value for this is in
  12065. @code{display-pixels-per-inch}, which can be tweaked for better results
  12066. based on the capabilities of the output device. Here are some common
  12067. image scaling operations:
  12068. @table @asis
  12069. @item Explicitly size the image
  12070. To embed @samp{img.png} as a 10 cm x 10 cm image, do the following:
  12071. @example
  12072. #+ATTR_ODT: :width 10 :height 10
  12073. [[./img.png]]
  12074. @end example
  12075. @item Scale the image
  12076. To embed @samp{img.png} at half its size, do the following:
  12077. @example
  12078. #+ATTR_ODT: :scale 0.5
  12079. [[./img.png]]
  12080. @end example
  12081. @item Scale the image to a specific width
  12082. To embed @samp{img.png} with a width of 10 cm while retaining the
  12083. original height:width ratio, do the following:
  12084. @example
  12085. #+ATTR_ODT: :width 10
  12086. [[./img.png]]
  12087. @end example
  12088. @item Scale the image to a specific height
  12089. To embed @samp{img.png} with a height of 10 cm while retaining the
  12090. original height:width ratio, do the following:
  12091. @example
  12092. #+ATTR_ODT: :height 10
  12093. [[./img.png]]
  12094. @end example
  12095. @end table
  12096. @anchor{Anchoring of images}
  12097. @subsubheading Anchoring of images
  12098. @cindex @samp{ATTR_ODT}, keyword
  12099. The ODT export back-end can anchor images to @samp{"as-char"},
  12100. @samp{"paragraph"}, or @samp{"page"}. Set the preferred anchor using the
  12101. @samp{:anchor} property of the @samp{ATTR_ODT} line.
  12102. To create an image that is anchored to a page:
  12103. @example
  12104. #+ATTR_ODT: :anchor "page"
  12105. [[./img.png]]
  12106. @end example
  12107. @node Math formatting in ODT export
  12108. @subsection Math formatting in ODT export
  12109. The ODT exporter has special support for handling math.
  12110. @menu
  12111. * @LaTeX{} math snippets:: Embedding in @LaTeX{} format.
  12112. * MathML and OpenDocument formula files:: Embedding in native format.
  12113. @end menu
  12114. @node @LaTeX{} math snippets
  12115. @subsubsection @LaTeX{} math snippets
  12116. @LaTeX{} math snippets (see @ref{@LaTeX{} fragments}) can be embedded in the ODT
  12117. document in one of the following ways:
  12118. @table @asis
  12119. @item MathML
  12120. @cindex MathML
  12121. Add this line to the Org file. This option is activated on
  12122. a per-file basis.
  12123. @example
  12124. #+OPTIONS: tex:t
  12125. @end example
  12126. With this option, @LaTeX{} fragments are first converted into MathML
  12127. fragments using an external @LaTeX{}-to-MathML converter program.
  12128. The resulting MathML fragments are then embedded as an
  12129. OpenDocument Formula in the exported document.
  12130. @vindex org-latex-to-mathml-convert-command
  12131. @vindex org-latex-to-mathml-jar-file
  12132. You can specify the @LaTeX{}-to-MathML converter by customizing the
  12133. variables @code{org-latex-to-mathml-convert-command} and
  12134. @code{org-latex-to-mathml-jar-file}.
  12135. If you prefer to use MathToWeb@footnote{See @uref{http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl, MathToWeb}.} as your converter, you can
  12136. configure the above variables as shown below.
  12137. @lisp
  12138. (setq org-latex-to-mathml-convert-command
  12139. "java -jar %j -unicode -force -df %o %I"
  12140. org-latex-to-mathml-jar-file
  12141. "/path/to/mathtoweb.jar")
  12142. @end lisp
  12143. To use @LaTeX{}​ML@footnote{See @uref{http://dlmf.nist.gov/LaTeXML/}.} use
  12144. @lisp
  12145. (setq org-latex-to-mathml-convert-command
  12146. "latexmlmath \"%i\" --presentationmathml=%o")
  12147. @end lisp
  12148. To quickly verify the reliability of the @LaTeX{}-to-MathML
  12149. converter, use the following commands:
  12150. @table @asis
  12151. @item @kbd{M-x org-export-as-odf}
  12152. Convert a @LaTeX{} math snippet to an OpenDocument formula
  12153. (@samp{.odf}) file.
  12154. @item @kbd{M-x org-export-as-odf-and-open}
  12155. Convert a @LaTeX{} math snippet to an OpenDocument formula
  12156. (@samp{.odf}) file and open the formula file with the
  12157. system-registered application.
  12158. @end table
  12159. @item PNG images
  12160. @cindex dvipng
  12161. @cindex dvisvgm
  12162. @cindex ImageMagick
  12163. Add this line to the Org file. This option is activated on
  12164. a per-file basis.
  12165. @example
  12166. #+OPTIONS: tex:dvipng
  12167. @end example
  12168. @example
  12169. #+OPTIONS: tex:dvisvgm
  12170. @end example
  12171. @noindent
  12172. or
  12173. @example
  12174. #+OPTIONS: tex:imagemagick
  12175. @end example
  12176. Under this option, @LaTeX{} fragments are processed into PNG or SVG
  12177. images and the resulting images are embedded in the exported
  12178. document. This method requires dvipng program, dvisvgm or
  12179. ImageMagick programs.
  12180. @end table
  12181. @node MathML and OpenDocument formula files
  12182. @subsubsection MathML and OpenDocument formula files
  12183. When embedding @LaTeX{} math snippets in ODT documents is not reliable,
  12184. there is one more option to try. Embed an equation by linking to its
  12185. MathML (@samp{.mml}) source or its OpenDocument formula (@samp{.odf}) file as
  12186. shown below:
  12187. @example
  12188. [[./equation.mml]]
  12189. @end example
  12190. @noindent
  12191. or
  12192. @example
  12193. [[./equation.odf]]
  12194. @end example
  12195. @node Labels and captions in ODT export
  12196. @subsection Labels and captions in ODT export
  12197. ODT format handles labeling and captioning of objects based on their
  12198. types. Inline images, tables, @LaTeX{} fragments, and Math formulas are
  12199. numbered and captioned separately. Each object also gets a unique
  12200. sequence number based on its order of first appearance in the Org
  12201. file. Each category has its own sequence. A caption is just a label
  12202. applied to these objects.
  12203. @example
  12204. #+CAPTION: Bell curve
  12205. #+NAME: fig:SED-HR4049
  12206. [[./img/a.png]]
  12207. @end example
  12208. When rendered, it may show as follows in the exported document:
  12209. @example
  12210. Figure 2: Bell curve
  12211. @end example
  12212. @vindex org-odt-category-map-alist
  12213. To modify the category component of the caption, customize the option
  12214. @code{org-odt-category-map-alist}. For example, to tag embedded images
  12215. with the string ``Illustration'' instead of the default string ``Figure'',
  12216. use the following setting:
  12217. @lisp
  12218. (setq org-odt-category-map-alist
  12219. '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)))
  12220. @end lisp
  12221. With the above modification, the previous example changes to:
  12222. @example
  12223. Illustration 2: Bell curve
  12224. @end example
  12225. @node Literal examples in ODT export
  12226. @subsection Literal examples in ODT export
  12227. The ODT export back-end supports literal examples (see @ref{Literal Examples}) with full fontification. Internally, the ODT export
  12228. back-end relies on @samp{htmlfontify.el} to generate the style definitions
  12229. needed for fancy listings. The auto-generated styles get @samp{OrgSrc}
  12230. prefix and inherit colors from the faces used by Emacs Font Lock
  12231. library for that source language.
  12232. @vindex org-odt-fontify-srcblocks
  12233. For custom fontification styles, customize the
  12234. @code{org-odt-create-custom-styles-for-srcblocks} option.
  12235. @vindex org-odt-create-custom-styles-for-srcblocks
  12236. To turn off fontification of literal examples, customize the
  12237. @code{org-odt-fontify-srcblocks} option.
  12238. @node Advanced topics in ODT export
  12239. @subsection Advanced topics in ODT export
  12240. The ODT export back-end has extensive features useful for power users
  12241. and frequent uses of ODT formats.
  12242. @anchor{Configuring a document converter}
  12243. @subsubheading Configuring a document converter
  12244. @cindex convert
  12245. @cindex doc, docx, rtf
  12246. @cindex converter
  12247. The ODT export back-end works with popular converters with little or
  12248. no extra configuration. See @ref{Extending ODT export}. The following is
  12249. for unsupported converters or tweaking existing defaults.
  12250. @table @asis
  12251. @item Register the converter
  12252. @vindex org-export-odt-convert-processes
  12253. Add the name of the converter to the @code{org-odt-convert-processes}
  12254. variable. Note that it also requires how the converter is
  12255. invoked on the command line. See the variable's docstring for
  12256. details.
  12257. @item Configure its capabilities
  12258. @vindex org-export-odt-convert-capabilities
  12259. Specify which formats the converter can handle by customizing the
  12260. variable @code{org-odt-convert-capabilities}. Use the entry for the
  12261. default values in this variable for configuring the new
  12262. converter. Also see its docstring for details.
  12263. @item Choose the converter
  12264. @vindex org-export-odt-convert-process
  12265. Select the newly added converter as the preferred one by
  12266. customizing the option @code{org-odt-convert-process}.
  12267. @end table
  12268. @anchor{Working with OpenDocument style files}
  12269. @subsubheading Working with OpenDocument style files
  12270. @cindex styles, custom
  12271. @cindex template, custom
  12272. This section explores the internals of the ODT exporter; the means by which
  12273. it produces styled documents; the use of automatic and custom OpenDocument
  12274. styles.
  12275. The ODT exporter relies on two files for generating its output. These
  12276. files are bundled with the distribution under the directory pointed to
  12277. by the variable @code{org-odt-styles-dir}. The two files are:
  12278. @table @asis
  12279. @item @samp{OrgOdtStyles.xml} @anchor{x-orgodtstyles-xml}
  12280. This file contributes to the @samp{styles.xml} file of the final ODT
  12281. document. This file gets modified for the following purposes:
  12282. @enumerate
  12283. @item
  12284. To control outline numbering based on user settings;
  12285. @item
  12286. To add styles generated by @samp{htmlfontify.el} for fontification of
  12287. code blocks.
  12288. @end enumerate
  12289. @item @samp{OrgOdtContentTemplate.xml} @anchor{x-orgodtcontenttemplate-xml}
  12290. This file contributes to the @samp{content.xml} file of the final ODT
  12291. document. The contents of the Org outline are inserted between the
  12292. @samp{<office:text>} @dots{} @samp{</office:text>} elements of this file.
  12293. Apart from serving as a template file for the final @samp{content.xml},
  12294. the file serves the following purposes:
  12295. @enumerate
  12296. @item
  12297. It contains automatic styles for formatting of tables which are
  12298. referenced by the exporter;
  12299. @item
  12300. It contains @samp{<text:sequence-decl>} @dots{} @samp{</text:sequence-decl>}
  12301. elements that control numbering of tables, images, equations, and
  12302. similar entities.
  12303. @end enumerate
  12304. @end table
  12305. @anchor{x-overriding-factory-styles} The following two variables control
  12306. the location from where the ODT exporter picks up the custom styles
  12307. and content template files. Customize these variables to override the
  12308. factory styles used by the exporter.
  12309. @table @asis
  12310. @item @code{org-odt-styles-file}
  12311. The ODT export back-end uses the file pointed to by this
  12312. variable, such as @samp{styles.xml}, for the final output. It can
  12313. take one of the following values:
  12314. @table @asis
  12315. @item @samp{FILE.xml}
  12316. Use this file instead of the default @samp{styles.xml}
  12317. @item @samp{FILE.odt} or @samp{FILE.ott}
  12318. Use the @samp{styles.xml} contained in the specified OpenDocument
  12319. Text or Template file
  12320. @item @samp{FILE.odt} or @samp{FILE.ott} and a subset of included files
  12321. Use the @samp{styles.xml} contained in the specified OpenDocument
  12322. Text or Template file. Additionally extract the specified
  12323. member files and embed those within the final ODT document.
  12324. Use this option if the @samp{styles.xml} file references additional
  12325. files like header and footer images.
  12326. @item @code{nil}
  12327. Use the default @samp{styles.xml}.
  12328. @end table
  12329. @item @code{org-odt-content-template-file}
  12330. Use this variable to specify the blank @samp{content.xml} used in the
  12331. final output.
  12332. @end table
  12333. @anchor{Creating one-off styles}
  12334. @subsubheading Creating one-off styles
  12335. The ODT export back-end can read embedded raw OpenDocument XML from
  12336. the Org file. Such direct formatting is useful for one-off instances.
  12337. @table @asis
  12338. @item Embedding ODT tags as part of regular text
  12339. Enclose OpenDocument syntax in @samp{@@@@odt:...@@@@} for inline markup.
  12340. For example, to highlight a region of text do the following:
  12341. @example
  12342. @@@@odt:<text:span text:style-name="Highlight">This is highlighted
  12343. text</text:span>@@@@. But this is regular text.
  12344. @end example
  12345. @strong{Hint:} To see the above example in action, edit the @samp{styles.xml}
  12346. (see @ref{x-orgodtstyles-xml, , Factory styles}) and add a custom @emph{Highlight} style as shown
  12347. below:
  12348. @example
  12349. <style:style style:name="Highlight" style:family="text">
  12350. <style:text-properties fo:background-color="#ff0000"/>
  12351. </style:style>
  12352. @end example
  12353. @item Embedding a one-line OpenDocument XML
  12354. @cindex @samp{ODT}, keyword
  12355. The ODT export back-end can read one-liner options with @samp{#+ODT:}
  12356. in the Org file. For example, to force a page break:
  12357. @example
  12358. #+ODT: <text:p text:style-name="PageBreak"/>
  12359. @end example
  12360. @strong{Hint:} To see the above example in action, edit your
  12361. @samp{styles.xml} (see @ref{x-orgodtstyles-xml, , Factory styles}) and add a custom @samp{PageBreak}
  12362. style as shown below.
  12363. @example
  12364. <style:style style:name="PageBreak" style:family="paragraph"
  12365. style:parent-style-name="Text_20_body">
  12366. <style:paragraph-properties fo:break-before="page"/>
  12367. </style:style>
  12368. @end example
  12369. @item Embedding a block of OpenDocument XML
  12370. The ODT export back-end can also read ODT export blocks for
  12371. OpenDocument XML. Such blocks use the @samp{#+BEGIN_EXPORT odt}
  12372. @dots{} @samp{#+END_EXPORT} constructs.
  12373. For example, to create a one-off paragraph that uses bold text,
  12374. do the following:
  12375. @example
  12376. #+BEGIN_EXPORT odt
  12377. <text:p text:style-name="Text_20_body_20_bold">
  12378. This paragraph is specially formatted and uses bold text.
  12379. </text:p>
  12380. #+END_EXPORT
  12381. @end example
  12382. @end table
  12383. @anchor{Customizing tables in ODT export}
  12384. @subsubheading Customizing tables in ODT export
  12385. @cindex tables, in ODT export
  12386. @cindex @samp{ATTR_ODT}, keyword
  12387. Override the default table format by specifying a custom table style
  12388. with the @samp{#+ATTR_ODT} line. For a discussion on default formatting of
  12389. tables, see @ref{Tables in ODT export}.
  12390. This feature closely mimics the way table templates are defined in the
  12391. OpenDocument-v1.2 specification.@footnote{@uref{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, OpenDocument-v1.2 Specification}}
  12392. @vindex org-odt-table-styles
  12393. For quick preview of this feature, install the settings below and export the
  12394. table that follows:
  12395. @lisp
  12396. (setq org-export-odt-table-styles
  12397. (append org-export-odt-table-styles
  12398. '(("TableWithHeaderRowAndColumn" "Custom"
  12399. ((use-first-row-styles . t)
  12400. (use-first-column-styles . t)))
  12401. ("TableWithFirstRowandLastRow" "Custom"
  12402. ((use-first-row-styles . t)
  12403. (use-last-row-styles . t))))))
  12404. @end lisp
  12405. @example
  12406. #+ATTR_ODT: :style TableWithHeaderRowAndColumn
  12407. | Name | Phone | Age |
  12408. | Peter | 1234 | 17 |
  12409. | Anna | 4321 | 25 |
  12410. @end example
  12411. The example above used @samp{Custom} template and installed two table
  12412. styles @samp{TableWithHeaderRowAndColumn} and
  12413. @samp{TableWithFirstRowandLastRow}. @strong{Important:} The OpenDocument styles
  12414. needed for producing the above template were pre-defined. They are
  12415. available in the section marked @samp{Custom Table Template} in
  12416. @samp{OrgOdtContentTemplate.xml} (see @ref{x-orgodtcontenttemplate-xml, , Factory styles}). For adding new
  12417. templates, define new styles there.
  12418. To use this feature proceed as follows:
  12419. @enumerate
  12420. @item
  12421. Create a table template@footnote{See the @samp{<table:table-template>} element of the
  12422. OpenDocument-v1.2 specification.}.
  12423. A table template is set of @samp{table-cell} and @samp{paragraph} styles for
  12424. each of the following table cell categories:
  12425. @itemize
  12426. @item
  12427. Body
  12428. @item
  12429. First column
  12430. @item
  12431. Last column
  12432. @item
  12433. First row
  12434. @item
  12435. Last row
  12436. @item
  12437. Even row
  12438. @item
  12439. Odd row
  12440. @item
  12441. Even column
  12442. @item
  12443. Odd Column
  12444. @end itemize
  12445. The names for the above styles must be chosen based on the name of
  12446. the table template using a well-defined convention.
  12447. The naming convention is better illustrated with an example. For
  12448. a table template with the name @samp{Custom}, the needed style names are
  12449. listed in the following table.
  12450. @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  12451. @headitem Cell type
  12452. @tab Cell style
  12453. @tab Paragraph style
  12454. @item Body
  12455. @tab @samp{CustomTableCell}
  12456. @tab @samp{CustomTableParagraph}
  12457. @item First column
  12458. @tab @samp{CustomFirstColumnTableCell}
  12459. @tab @samp{CustomFirstColumnTableParagraph}
  12460. @item Last column
  12461. @tab @samp{CustomLastColumnTableCell}
  12462. @tab @samp{CustomLastColumnTableParagraph}
  12463. @item First row
  12464. @tab @samp{CustomFirstRowTableCell}
  12465. @tab @samp{CustomFirstRowTableParagraph}
  12466. @item Last row
  12467. @tab @samp{CustomLastRowTableCell}
  12468. @tab @samp{CustomLastRowTableParagraph}
  12469. @item Even row
  12470. @tab @samp{CustomEvenRowTableCell}
  12471. @tab @samp{CustomEvenRowTableParagraph}
  12472. @item Odd row
  12473. @tab @samp{CustomOddRowTableCell}
  12474. @tab @samp{CustomOddRowTableParagraph}
  12475. @item Even column
  12476. @tab @samp{CustomEvenColumnTableCell}
  12477. @tab @samp{CustomEvenColumnTableParagraph}
  12478. @item Odd column
  12479. @tab @samp{CustomOddColumnTableCell}
  12480. @tab @samp{CustomOddColumnTableParagraph}
  12481. @end multitable
  12482. To create a table template with the name @samp{Custom}, define the above
  12483. styles in the @samp{<office:automatic-styles>} @dots{}
  12484. @samp{</office:automatic-styles>} element of the content template file
  12485. (see @ref{x-orgodtcontenttemplate-xml, , Factory styles}).
  12486. @item
  12487. Define a table style@footnote{See the attributes @samp{table:template-name},
  12488. @samp{table:use-first-row-styles}, @samp{table:use-last-row-styles},
  12489. @samp{table:use-first-column-styles}, @samp{table:use-last-column-styles},
  12490. @samp{table:use-banding-rows-styles}, and @samp{table:use-banding-column-styles}
  12491. of the @samp{<table:table>} element in the OpenDocument-v1.2 specification.}.
  12492. @vindex org-odt-table-styles
  12493. To define a table style, create an entry for the style in the
  12494. variable @code{org-odt-table-styles} and specify the following:
  12495. @itemize
  12496. @item
  12497. the name of the table template created in step (1),
  12498. @item
  12499. the set of cell styles in that template that are to be activated.
  12500. @end itemize
  12501. For example, the entry below defines two different table styles
  12502. @samp{TableWithHeaderRowAndColumn} and @samp{TableWithFirstRowandLastRow}
  12503. based on the same template @samp{Custom}. The styles achieve their
  12504. intended effect by selectively activating the individual cell
  12505. styles in that template.
  12506. @lisp
  12507. (setq org-export-odt-table-styles
  12508. (append org-export-odt-table-styles
  12509. '(("TableWithHeaderRowAndColumn" "Custom"
  12510. ((use-first-row-styles . t)
  12511. (use-first-column-styles . t)))
  12512. ("TableWithFirstRowandLastRow" "Custom"
  12513. ((use-first-row-styles . t)
  12514. (use-last-row-styles . t))))))
  12515. @end lisp
  12516. @item
  12517. Associate a table with the table style.
  12518. To do this, specify the table style created in step (2) as part of
  12519. the @samp{ATTR_ODT} line as shown below.
  12520. @example
  12521. #+ATTR_ODT: :style TableWithHeaderRowAndColumn
  12522. | Name | Phone | Age |
  12523. | Peter | 1234 | 17 |
  12524. | Anna | 4321 | 25 |
  12525. @end example
  12526. @end enumerate
  12527. @anchor{Validating OpenDocument XML}
  12528. @subsubheading Validating OpenDocument XML
  12529. Sometimes ODT format files may not open due to @samp{.odt} file corruption.
  12530. To verify if such a file is corrupt, validate it against the
  12531. OpenDocument Relax NG Compact (RNC) syntax schema. But first the
  12532. @samp{.odt} files have to be decompressed using @samp{zip}. Note that @samp{.odt}
  12533. files are ZIP archives: @ref{File Archives,,,emacs,}. The contents of
  12534. ODT files are in XML. For general help with validation---and
  12535. schema-sensitive editing---of XML files:
  12536. @ref{Introduction,,,nxml-mode,}.
  12537. @vindex org-export-odt-schema-dir
  12538. Customize @code{org-odt-schema-dir} to point to a directory with
  12539. OpenDocument RNC files and the needed schema-locating rules. The ODT
  12540. export back-end takes care of updating the
  12541. @code{rng-schema-locating-files}.
  12542. @node Org Export
  12543. @section Org Export
  12544. @cindex Org export
  12545. @emph{org} export back-end creates a normalized version of the Org document
  12546. in current buffer. The exporter evaluates Babel code (see @ref{Evaluating Code Blocks}) and removes content specific to other back-ends.
  12547. @anchor{Org export commands}
  12548. @subheading Org export commands
  12549. @table @asis
  12550. @item @kbd{C-c C-e O o} (@code{org-org-export-to-org})
  12551. @kindex C-c C-e O o
  12552. @findex org-org-export-to-org
  12553. Export as an Org file with a @samp{.org} extension. For @samp{myfile.org},
  12554. Org exports to @samp{myfile.org.org}, overwriting without warning.
  12555. @item @kbd{C-c C-e O v} (~~)
  12556. @kindex C-c C-e O v
  12557. Export to an Org file, then open it.
  12558. @end table
  12559. @node Texinfo Export
  12560. @section Texinfo Export
  12561. @menu
  12562. * Texinfo export commands:: Invoking commands.
  12563. * Texinfo specific export settings:: Setting the environment.
  12564. * Texinfo file header:: Generating the header.
  12565. * Texinfo title and copyright page:: Creating preamble pages.
  12566. * Info directory file:: Installing a manual in Info file hierarchy.
  12567. * Headings and sectioning structure:: Building document structure.
  12568. * Indices:: Creating indices.
  12569. * Quoting Texinfo code:: Incorporating literal Texinfo code.
  12570. * Plain lists in Texinfo export:: List attributes.
  12571. * Tables in Texinfo export:: Table attributes.
  12572. * Images in Texinfo export:: Image attributes.
  12573. * Special blocks in Texinfo export:: Special block attributes.
  12574. * A Texinfo example:: Processing Org to Texinfo.
  12575. @end menu
  12576. @node Texinfo export commands
  12577. @subsection Texinfo export commands
  12578. @table @asis
  12579. @item @kbd{C-c C-e i t} (@code{org-texinfo-export-to-texinfo})
  12580. @kindex C-c C-e i t
  12581. @findex org-texinfo-export-to-texinfo
  12582. Export as a Texinfo file with @samp{.texi} extension. For
  12583. @samp{myfile.org}, Org exports to @samp{myfile.texi}, overwriting without
  12584. warning.
  12585. @item @kbd{C-c C-e i i} (@code{org-texinfo-export-to-info})
  12586. @kindex C-c C-e i i
  12587. @findex org-texinfo-export-to-info
  12588. @vindex org-texinfo-info-process
  12589. Export to Texinfo format first and then process it to make an
  12590. Info file. To generate other formats, such as DocBook, customize
  12591. the @code{org-texinfo-info-process} variable.
  12592. @end table
  12593. @node Texinfo specific export settings
  12594. @subsection Texinfo specific export settings
  12595. The Texinfo export back-end has several additional keywords for
  12596. customizing Texinfo output. Setting these keywords works similar to
  12597. the general options (see @ref{Export Settings}).
  12598. @table @asis
  12599. @item @samp{SUBTITLE}
  12600. @cindex @samp{SUBTITLE}, keyword
  12601. The document subtitle.
  12602. @item @samp{SUBAUTHOR}
  12603. @cindex @samp{SUBAUTHOR}, keyword
  12604. Additional authors for the document.
  12605. @item @samp{TEXINFO_FILENAME}
  12606. @cindex @samp{TEXINFO_FILENAME}, keyword
  12607. The Texinfo filename.
  12608. @item @samp{TEXINFO_CLASS}
  12609. @cindex @samp{TEXINFO_CLASS}, keyword
  12610. @vindex org-texinfo-default-class
  12611. The default document class (@code{org-texinfo-default-class}), which
  12612. must be a member of @code{org-texinfo-classes}.
  12613. @item @samp{TEXINFO_HEADER}
  12614. @cindex @samp{TEXINFO_HEADER}, keyword
  12615. Arbitrary lines inserted at the end of the header.
  12616. @item @samp{TEXINFO_POST_HEADER}
  12617. @cindex @samp{TEXINFO_POST_HEADER}, keyword
  12618. Arbitrary lines inserted after the end of the header.
  12619. @item @samp{TEXINFO_DIR_CATEGORY}
  12620. @cindex @samp{TEXINFO_DIR_CATEGORY}, keyword
  12621. The directory category of the document.
  12622. @item @samp{TEXINFO_DIR_TITLE}
  12623. @cindex @samp{TEXINFO_DIR_TITLE}, keyword
  12624. The directory title of the document.
  12625. @item @samp{TEXINFO_DIR_DESC}
  12626. @cindex @samp{TEXINFO_DIR_DESC}, keyword
  12627. The directory description of the document.
  12628. @item @samp{TEXINFO_PRINTED_TITLE}
  12629. @cindex @samp{TEXINFO_PRINTED_TITLE}, keyword
  12630. The printed title of the document.
  12631. @end table
  12632. @node Texinfo file header
  12633. @subsection Texinfo file header
  12634. @cindex @samp{TEXINFO_FILENAME}, keyword
  12635. After creating the header for a Texinfo file, the Texinfo back-end
  12636. automatically generates a name and destination path for the Info file.
  12637. To override this default with a more sensible path and name, specify
  12638. the @samp{TEXINFO_FILENAME} keyword.
  12639. @vindex org-texinfo-coding-system
  12640. @cindex @samp{TEXINFO_HEADER}, keyword
  12641. Along with the output's file name, the Texinfo header also contains
  12642. language details (see @ref{Export Settings}) and encoding system as set in
  12643. the @code{org-texinfo-coding-system} variable. Insert @samp{TEXINFO_HEADER}
  12644. keywords for each additional command in the header, for example:
  12645. @example
  12646. #+TEXINFO_HEADER: @@synindex
  12647. @end example
  12648. @cindex @samp{TEXINFO_CLASS}, keyword
  12649. @vindex org-texinfo-classes
  12650. Instead of repeatedly installing the same set of commands, define
  12651. a class in @code{org-texinfo-classes} once, and then activate it in the
  12652. document by setting the @samp{TEXINFO_CLASS} keyword to that class.
  12653. @node Texinfo title and copyright page
  12654. @subsection Texinfo title and copyright page
  12655. @cindex @samp{TEXINFO_PRINTED_TITLE}, keyword
  12656. The default template for hard copy output has a title page with
  12657. @samp{TITLE} and @samp{AUTHOR} keywords (see @ref{Export Settings}). To replace the
  12658. regular title with something different for the printed version, use
  12659. the @samp{TEXINFO_PRINTED_TITLE} and @samp{SUBTITLE} keywords. Both expect raw
  12660. Texinfo code for setting their values.
  12661. @cindex @samp{SUBAUTHOR}, keyword
  12662. If one @samp{AUTHOR} line is not sufficient, add multiple @samp{SUBAUTHOR}
  12663. keywords. They have to be set in raw Texinfo code.
  12664. @example
  12665. #+AUTHOR: Jane Smith
  12666. #+SUBAUTHOR: John Doe
  12667. #+TEXINFO_PRINTED_TITLE: This Long Title@@@@inlinefmt@{tex,@@*@} Is Broken in @@TeX@{@}
  12668. @end example
  12669. @cindex @samp{COPYING}, property
  12670. Copying material is defined in a dedicated headline with a non-@code{nil}
  12671. @samp{COPYING} property. The back-end inserts the contents within
  12672. a @samp{@@copying} command at the beginning of the document. The heading
  12673. itself does not appear in the structure of the document.
  12674. Copyright information is printed on the back of the title page.
  12675. @example
  12676. * Legalese
  12677. :PROPERTIES:
  12678. :COPYING: t
  12679. :END:
  12680. This is a short example of a complete Texinfo file, version 1.0.
  12681. Copyright \copy 2016 Free Software Foundation, Inc.
  12682. @end example
  12683. @node Info directory file
  12684. @subsection Info directory file
  12685. @cindex @samp{dir} file, in Texinfo export
  12686. @cindex Info directory file, in Texinfo export
  12687. @cindex @code{install-info}, in Texinfo export
  12688. @cindex @samp{TEXINFO_DIR_CATEGORY}, keyword
  12689. @cindex @samp{TEXINFO_DIR_TITLE}, keyword
  12690. @cindex @samp{TEXINFO_DIR_DESC}, keyword
  12691. The end result of the Texinfo export process is the creation of an
  12692. Info file. This Info file's metadata has variables for category,
  12693. title, and description: @samp{TEXINFO_DIR_CATEGORY}, @samp{TEXINFO_DIR_TITLE},
  12694. and @samp{TEXINFO_DIR_DESC} keywords that establish where in the Info
  12695. hierarchy the file fits.
  12696. Here is an example that writes to the Info directory file:
  12697. @example
  12698. #+TEXINFO_DIR_CATEGORY: Emacs
  12699. #+TEXINFO_DIR_TITLE: Org Mode: (org)
  12700. #+TEXINFO_DIR_DESC: Outline-based notes management and organizer
  12701. @end example
  12702. @node Headings and sectioning structure
  12703. @subsection Headings and sectioning structure
  12704. @vindex org-texinfo-classes
  12705. @vindex org-texinfo-default-class
  12706. @cindex @samp{TEXINFO_CLASS}, keyword
  12707. The Texinfo export back-end uses a pre-defined scheme to convert Org
  12708. headlines to equivalent Texinfo structuring commands. A scheme like
  12709. this maps top-level headlines to numbered chapters tagged as
  12710. @code{@@chapter} and lower-level headlines to unnumbered chapters tagged as
  12711. @code{@@unnumbered}. To override such mappings to introduce @code{@@part} or
  12712. other Texinfo structuring commands, define a new class in
  12713. @code{org-texinfo-classes}. Activate the new class with the
  12714. @samp{TEXINFO_CLASS} keyword. When no new class is defined and activated,
  12715. the Texinfo export back-end defaults to the
  12716. @code{org-texinfo-default-class}.
  12717. If an Org headline's level has no associated Texinfo structuring
  12718. command, or is below a certain threshold (see @ref{Export Settings}), then
  12719. the Texinfo export back-end makes it into a list item.
  12720. @cindex @samp{APPENDIX}, property
  12721. The Texinfo export back-end makes any headline with a non-@code{nil}
  12722. @samp{APPENDIX} property into an appendix. This happens independent of the
  12723. Org headline level or the @samp{TEXINFO_CLASS} keyword.
  12724. @cindex @samp{ALT_TITLE}, property
  12725. @cindex @samp{DESCRIPTION}, property
  12726. The Texinfo export back-end creates a menu entry after the Org
  12727. headline for each regular sectioning structure. To override this with
  12728. 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
  12729. @samp{DESCRIPTION} property. Here's an example that uses both to override
  12730. the default menu entry:
  12731. @example
  12732. * Controlling Screen Display
  12733. :PROPERTIES:
  12734. :ALT_TITLE: Display
  12735. :DESCRIPTION: Controlling Screen Display
  12736. :END:
  12737. @end example
  12738. @cindex Top node, in Texinfo export
  12739. The text before the first headline belongs to the @emph{Top} node, i.e.,
  12740. the node in which a reader enters an Info manual. As such, it is
  12741. expected not to appear in printed output generated from the @samp{.texi}
  12742. file. See @ref{The Top Node,,,texinfo,}, for more information.
  12743. @node Indices
  12744. @subsection Indices
  12745. @cindex @samp{CINDEX}, keyword
  12746. @cindex concept index, in Texinfo export
  12747. @cindex @samp{FINDEX}, keyword
  12748. @cindex function index, in Texinfo export
  12749. @cindex @samp{KINDEX}, keyword
  12750. @cindex keystroke index, in Texinfo export
  12751. @cindex @samp{PINDEX}, keyword
  12752. @cindex program index, in Texinfo export
  12753. @cindex @samp{TINDEX}, keyword
  12754. @cindex data type index, in Texinfo export
  12755. @cindex @samp{VINDEX}, keyword
  12756. @cindex variable index, in Texinfo export
  12757. The Texinfo export back-end recognizes these indexing keywords if used
  12758. in the Org file: @samp{CINDEX}, @samp{FINDEX}, @samp{KINDEX}, @samp{PINDEX}, @samp{TINDEX} and
  12759. @samp{VINDEX}. Write their value as verbatim Texinfo code; in particular,
  12760. @samp{@{}, @samp{@}} and @samp{@@} characters need to be escaped with @samp{@@} if they do not
  12761. belong to a Texinfo command.
  12762. @example
  12763. #+CINDEX: Defining indexing entries
  12764. @end example
  12765. @cindex @samp{INDEX}, property
  12766. For the back-end to generate an index entry for a headline, set the
  12767. @samp{INDEX} property to @samp{cp} or @samp{vr}. These abbreviations come from
  12768. Texinfo that stand for concept index and variable index. The Texinfo
  12769. manual has abbreviations for all other kinds of indexes. The back-end
  12770. exports the headline as an unnumbered chapter or section command, and
  12771. then inserts the index after its contents.
  12772. @example
  12773. * Concept Index
  12774. :PROPERTIES:
  12775. :INDEX: cp
  12776. :END:
  12777. @end example
  12778. @node Quoting Texinfo code
  12779. @subsection Quoting Texinfo code
  12780. Use any of the following three methods to insert or escape raw Texinfo
  12781. code:
  12782. @cindex @samp{TEXINFO}, keyword
  12783. @cindex @samp{BEGIN_EXPORT texinfo}
  12784. @example
  12785. Richard @@@@texinfo:@@sc@{@@@@Stallman@@@@texinfo:@}@@@@ commence' GNU.
  12786. #+TEXINFO: @@need800
  12787. This paragraph is preceded by...
  12788. #+BEGIN_EXPORT texinfo
  12789. @@auindex Johnson, Mark
  12790. @@auindex Lakoff, George
  12791. #+END_EXPORT
  12792. @end example
  12793. @node Plain lists in Texinfo export
  12794. @subsection Plain lists in Texinfo export
  12795. @cindex @samp{ATTR_TEXINFO}, keyword
  12796. @cindex two-column tables, in Texinfo export
  12797. @cindex table types, in Texinfo export
  12798. The Texinfo export back-end by default converts description lists in
  12799. the Org file using the default command @samp{@@table}, which results in
  12800. a table with two columns. To change this behavior, specify
  12801. @samp{:table-type} with @samp{ftable} or @samp{vtable} attributes. For more
  12802. information, see @ref{Two-column Tables,,,texinfo,}.
  12803. @vindex org-texinfo-table-default-markup
  12804. The Texinfo export back-end by default also applies a text highlight
  12805. based on the defaults stored in @code{org-texinfo-table-default-markup}.
  12806. To override the default highlight command, specify another one with
  12807. the @samp{:indic} attribute.
  12808. @cindex multiple items in Texinfo lists
  12809. Org syntax is limited to one entry per list item. Nevertheless, the
  12810. Texinfo export back-end can split that entry according to any text
  12811. provided through the @samp{:sep} attribute. Each part then becomes a new
  12812. entry in the first column of the table.
  12813. The following example illustrates all the attributes above:
  12814. @example
  12815. #+ATTR_TEXINFO: :table-type vtable :sep , :indic asis
  12816. - foo, bar :: This is the common text for variables foo and bar.
  12817. @end example
  12818. @noindent
  12819. becomes
  12820. @example
  12821. @@vtable @@asis
  12822. @@item foo
  12823. @@itemx bar
  12824. This is the common text for variables foo and bar.
  12825. @@end table
  12826. @end example
  12827. @node Tables in Texinfo export
  12828. @subsection Tables in Texinfo export
  12829. @cindex @samp{ATTR_TEXINFO}, keyword
  12830. When exporting tables, the Texinfo export back-end uses the widest
  12831. cell width in each column. To override this and instead specify as
  12832. fractions of line length, use the @samp{:columns} attribute. See example
  12833. below.
  12834. @example
  12835. #+ATTR_TEXINFO: :columns .5 .5
  12836. | a cell | another cell |
  12837. @end example
  12838. @node Images in Texinfo export
  12839. @subsection Images in Texinfo export
  12840. @cindex @samp{ATTR_TEXINFO}, keyword
  12841. Insert a file link to the image in the Org file, and the Texinfo
  12842. export back-end inserts the image. These links must have the usual
  12843. supported image extensions and no descriptions. To scale the image,
  12844. use @samp{:width} and @samp{:height} attributes. For alternate text, use @samp{:alt}
  12845. and specify the text using Texinfo code, as shown in the example:
  12846. @example
  12847. #+ATTR_TEXINFO: :width 1in :alt Alternate @@i@{text@}
  12848. [[ridt.pdf]]
  12849. @end example
  12850. @node Special blocks in Texinfo export
  12851. @subsection Special blocks in Texinfo export
  12852. @cindex @samp{ATTR_TEXINFO}, keyword
  12853. The Texinfo export back-end converts special blocks to commands with
  12854. the same name. It also adds any @samp{:options} attributes to the end of
  12855. the command, as shown in this example:
  12856. @example
  12857. #+ATTR_TEXINFO: :options org-org-export-to-org ...
  12858. #+BEGIN_defun
  12859. A somewhat obsessive function name.
  12860. #+END_defun
  12861. @end example
  12862. @noindent
  12863. becomes
  12864. @example
  12865. @@defun org-org-export-to-org ...
  12866. A somewhat obsessive function name.
  12867. @@end defun
  12868. @end example
  12869. @node A Texinfo example
  12870. @subsection A Texinfo example
  12871. Here is a more detailed example Org file. See
  12872. @ref{GNU Sample Texts,,,texinfo,} for an equivalent example using
  12873. Texinfo code.
  12874. @example
  12875. #+TITLE: GNU Sample @{@{@{version@}@}@}
  12876. #+SUBTITLE: for version @{@{@{version@}@}@}, @{@{@{updated@}@}@}
  12877. #+AUTHOR: A.U. Thor
  12878. #+EMAIL: bug-sample@@gnu.org
  12879. #+OPTIONS: ':t toc:t author:t email:t
  12880. #+LANGUAGE: en
  12881. #+MACRO: version 2.0
  12882. #+MACRO: updated last updated 4 March 2014
  12883. #+TEXINFO_FILENAME: sample.info
  12884. #+TEXINFO_HEADER: @@syncodeindex pg cp
  12885. #+TEXINFO_DIR_CATEGORY: Texinfo documentation system
  12886. #+TEXINFO_DIR_TITLE: sample: (sample)
  12887. #+TEXINFO_DIR_DESC: Invoking sample
  12888. #+TEXINFO_PRINTED_TITLE: GNU Sample
  12889. This manual is for GNU Sample (version @{@{@{version@}@}@},
  12890. @{@{@{updated@}@}@}).
  12891. * Copying
  12892. :PROPERTIES:
  12893. :COPYING: t
  12894. :END:
  12895. This manual is for GNU Sample (version @{@{@{version@}@}@},
  12896. @{@{@{updated@}@}@}), which is an example in the Texinfo documentation.
  12897. Copyright \copy 2016 Free Software Foundation, Inc.
  12898. #+BEGIN_QUOTE
  12899. Permission is granted to copy, distribute and/or modify this
  12900. document under the terms of the GNU Free Documentation License,
  12901. Version 1.3 or any later version published by the Free Software
  12902. Foundation; with no Invariant Sections, with no Front-Cover Texts,
  12903. and with no Back-Cover Texts. A copy of the license is included in
  12904. the section entitled "GNU Free Documentation License".
  12905. #+END_QUOTE
  12906. * Invoking sample
  12907. #+PINDEX: sample
  12908. #+CINDEX: invoking @@command@{sample@}
  12909. This is a sample manual. There is no sample program to invoke, but
  12910. if there were, you could see its basic usage and command line
  12911. options here.
  12912. * GNU Free Documentation License
  12913. :PROPERTIES:
  12914. :APPENDIX: t
  12915. :END:
  12916. #+TEXINFO: @@include fdl.texi
  12917. * Index
  12918. :PROPERTIES:
  12919. :INDEX: cp
  12920. :END:
  12921. @end example
  12922. @node iCalendar Export
  12923. @section iCalendar Export
  12924. @cindex iCalendar export
  12925. A large part of Org mode's interoperability success is its ability to
  12926. easily export to or import from external applications. The iCalendar
  12927. export back-end takes calendar data from Org files and exports to the
  12928. standard iCalendar format.
  12929. @vindex org-icalendar-include-todo
  12930. @vindex org-icalendar-use-deadline
  12931. @vindex org-icalendar-use-scheduled
  12932. The iCalendar export back-end can also incorporate TODO entries based
  12933. on the configuration of the @code{org-icalendar-include-todo} variable.
  12934. The back-end exports plain timestamps as @samp{VEVENT}, TODO items as
  12935. @samp{VTODO}, and also create events from deadlines that are in non-TODO
  12936. items. The back-end uses the deadlines and scheduling dates in Org
  12937. TODO items for setting the start and due dates for the iCalendar TODO
  12938. entry. Consult the @code{org-icalendar-use-deadline} and
  12939. @code{org-icalendar-use-scheduled} variables for more details.
  12940. @vindex org-icalendar-categories
  12941. @vindex org-icalendar-alarm-time
  12942. For tags on the headline, the iCalendar export back-end makes them
  12943. into iCalendar categories. To tweak the inheritance of tags and TODO
  12944. states, configure the variable @code{org-icalendar-categories}. To assign
  12945. clock alarms based on time, configure the @code{org-icalendar-alarm-time}
  12946. variable.
  12947. @vindex org-icalendar-store-UID
  12948. @cindex @samp{ID}, property
  12949. The iCalendar format standard requires globally unique identifier---or
  12950. UID---for each entry. The iCalendar export back-end creates UIDs
  12951. during export. To save a copy of the UID in the Org file set the
  12952. variable @code{org-icalendar-store-UID}. The back-end looks for the @samp{ID}
  12953. property of the entry for re-using the same UID for subsequent
  12954. exports.
  12955. Since a single Org entry can result in multiple iCalendar
  12956. entries---timestamp, deadline, scheduled item, or TODO item---Org adds
  12957. prefixes to the UID, depending on which part of the Org entry
  12958. triggered the creation of the iCalendar entry. Prefixing ensures UIDs
  12959. remains unique, yet enable synchronization programs trace the
  12960. connections.
  12961. @table @asis
  12962. @item @kbd{C-c C-e c f} (@code{org-icalendar-export-to-ics})
  12963. @kindex C-c C-e c f
  12964. @findex org-icalendar-export-to-ics
  12965. Create iCalendar entries from the current Org buffer and store
  12966. them in the same directory, using a file extension @samp{.ics}.
  12967. @item @kbd{C-c C-e c a} (@code{org-icalendar-export-agenda-files})
  12968. @kindex C-c C-e c a
  12969. @findex org-icalendar-export-agenda-files
  12970. Create iCalendar entries from Org files in @code{org-agenda-files} and
  12971. store in a separate iCalendar file for each Org file.
  12972. @item @kbd{C-c C-e c c} (@code{org-icalendar-combine-agenda-files})
  12973. @kindex C-c C-e c c
  12974. @findex org-icalendar-combine-agenda-files
  12975. @vindex org-icalendar-combined-agenda-file
  12976. Create a combined iCalendar file from Org files in
  12977. @code{org-agenda-files} and write it to
  12978. @code{org-icalendar-combined-agenda-file} file name.
  12979. @end table
  12980. @cindex @samp{SUMMARY}, property
  12981. @cindex @samp{DESCRIPTION}, property
  12982. @cindex @samp{LOCATION}, property
  12983. @cindex @samp{TIMEZONE}, property
  12984. The iCalendar export back-end includes @samp{SUMMARY}, @samp{DESCRIPTION},
  12985. @samp{LOCATION} and @samp{TIMEZONE} properties from the Org entries when
  12986. exporting. To force the back-end to inherit the @samp{LOCATION} and
  12987. @samp{TIMEZONE} properties, configure the @code{org-use-property-inheritance}
  12988. variable.
  12989. @vindex org-icalendar-include-body
  12990. When Org entries do not have @samp{SUMMARY}, @samp{DESCRIPTION} and @samp{LOCATION}
  12991. properties, the iCalendar export back-end derives the summary from the
  12992. headline, and derives the description from the body of the Org item.
  12993. The @code{org-icalendar-include-body} variable limits the maximum number of
  12994. characters of the content are turned into its description.
  12995. The @samp{TIMEZONE} property can be used to specify a per-entry time zone,
  12996. and is applied to any entry with timestamp information. Time zones
  12997. should be specified as per the IANA time zone database format, e.g.,
  12998. @samp{Asia/Almaty}. Alternately, the property value can be @samp{UTC}, to force
  12999. UTC time for this entry only.
  13000. Exporting to iCalendar format depends in large part on the
  13001. capabilities of the destination application. Some are more lenient
  13002. than others. Consult the Org mode FAQ for advice on specific
  13003. applications.
  13004. @node Other Built-in Back-ends
  13005. @section Other Built-in Back-ends
  13006. Other export back-ends included with Org are:
  13007. @itemize
  13008. @item
  13009. @samp{ox-man.el}: Export to a man page.
  13010. @end itemize
  13011. To activate such back-ends, either customize @code{org-export-backends} or
  13012. load directly with @code{(require 'ox-man)}. On successful load, the
  13013. back-end adds new keys in the export dispatcher (see @ref{The Export Dispatcher}).
  13014. Follow the comment section of such files, for example, @samp{ox-man.el},
  13015. for usage and configuration details.
  13016. @node Advanced Configuration
  13017. @section Advanced Configuration
  13018. @anchor{Hooks}
  13019. @subheading Hooks
  13020. @vindex org-export-before-processing-hook
  13021. @vindex org-export-before-parsing-hook
  13022. The export process executes two hooks before the actual exporting
  13023. begins. The first hook, @code{org-export-before-processing-hook}, runs
  13024. before any expansions of macros, Babel code, and include keywords in
  13025. the buffer. The second hook, @code{org-export-before-parsing-hook}, runs
  13026. before the buffer is parsed.
  13027. Functions added to these hooks are called with a single argument: the
  13028. export back-end actually used, as a symbol. You may use them for
  13029. heavy duty structural modifications of the document. For example, you
  13030. can remove every headline in the buffer during export like this:
  13031. @lisp
  13032. (defun my-headline-removal (backend)
  13033. "Remove all headlines in the current buffer.
  13034. BACKEND is the export back-end being used, as a symbol."
  13035. (org-map-entries
  13036. (lambda () (delete-region (point) (line-beginning-position 2)))))
  13037. (add-hook 'org-export-before-parsing-hook 'my-headline-removal)
  13038. @end lisp
  13039. @anchor{Filters}
  13040. @subheading Filters
  13041. @cindex Filters, exporting
  13042. Filters are lists of functions to be applied to certain parts for
  13043. a given back-end. The output from the first function in the filter is
  13044. passed on to the next function in the filter. The final output is the
  13045. output from the final function in the filter.
  13046. The Org export process has many filter sets applicable to different
  13047. types of objects, plain text, parse trees, export options, and final
  13048. output formats. The filters are named after the element type or
  13049. object type: @code{org-export-filter-TYPE-functions}, where @var{TYPE}
  13050. is the type targeted by the filter. Valid types are:
  13051. @multitable @columnfractions 0.33 0.33 0.33
  13052. @item body
  13053. @tab bold
  13054. @tab babel-call
  13055. @item center-block
  13056. @tab clock
  13057. @tab code
  13058. @item diary-sexp
  13059. @tab drawer
  13060. @tab dynamic-block
  13061. @item entity
  13062. @tab example-block
  13063. @tab export-block
  13064. @item export-snippet
  13065. @tab final-output
  13066. @tab fixed-width
  13067. @item footnote-definition
  13068. @tab footnote-reference
  13069. @tab headline
  13070. @item horizontal-rule
  13071. @tab inline-babel-call
  13072. @tab inline-src-block
  13073. @item inlinetask
  13074. @tab italic
  13075. @tab item
  13076. @item keyword
  13077. @tab latex-environment
  13078. @tab latex-fragment
  13079. @item line-break
  13080. @tab link
  13081. @tab node-property
  13082. @item options
  13083. @tab paragraph
  13084. @tab parse-tree
  13085. @item plain-list
  13086. @tab plain-text
  13087. @tab planning
  13088. @item property-drawer
  13089. @tab quote-block
  13090. @tab radio-target
  13091. @item section
  13092. @tab special-block
  13093. @tab src-block
  13094. @item statistics-cookie
  13095. @tab strike-through
  13096. @tab subscript
  13097. @item superscript
  13098. @tab table
  13099. @tab table-cell
  13100. @item table-row
  13101. @tab target
  13102. @tab timestamp
  13103. @item underline
  13104. @tab verbatim
  13105. @tab verse-block
  13106. @end multitable
  13107. Here is an example filter that replaces non-breaking spaces @code{ } in the
  13108. Org buffer with @samp{~} for the @LaTeX{} back-end.
  13109. @lisp
  13110. (defun my-latex-filter-nobreaks (text backend info)
  13111. "Ensure \" \" are properly handled in LaTeX export."
  13112. (when (org-export-derived-backend-p backend 'latex)
  13113. (replace-regexp-in-string " " "~" text)))
  13114. (add-to-list 'org-export-filter-plain-text-functions
  13115. 'my-latex-filter-nobreaks)
  13116. @end lisp
  13117. A filter requires three arguments: the code to be transformed, the
  13118. name of the back-end, and some optional information about the export
  13119. process. The third argument can be safely ignored. Note the use of
  13120. @code{org-export-derived-backend-p} predicate that tests for @emph{latex}
  13121. back-end or any other back-end, such as @emph{beamer}, derived from
  13122. @emph{latex}.
  13123. @anchor{Defining filters for individual files}
  13124. @subheading Defining filters for individual files
  13125. The Org export can filter not just for back-ends, but also for
  13126. specific files through the @samp{BIND} keyword. Here is an example with
  13127. two filters; one removes brackets from time stamps, and the other
  13128. removes strike-through text. The filter functions are defined in
  13129. a code block in the same Org file, which is a handy location for
  13130. debugging.
  13131. @example
  13132. #+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
  13133. #+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
  13134. #+BEGIN_SRC emacs-lisp :exports results :results none
  13135. (defun tmp-f-timestamp (s backend info)
  13136. (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
  13137. (defun tmp-f-strike-through (s backend info) "")
  13138. #+END_SRC
  13139. @end example
  13140. @anchor{Extending an existing back-end}
  13141. @subheading Extending an existing back-end
  13142. Some parts of the conversion process can be extended for certain
  13143. elements so as to introduce a new or revised translation. That is how
  13144. the HTML export back-end was extended to handle Markdown format. The
  13145. extensions work seamlessly so any aspect of filtering not done by the
  13146. extended back-end is handled by the original back-end. Of all the
  13147. export customization in Org, extending is very powerful as it operates
  13148. at the parser level.
  13149. For this example, make the @emph{ascii} back-end display the language used
  13150. in a source code block. Also make it display only when some attribute
  13151. is non-@code{nil}, like the following:
  13152. @example
  13153. #+ATTR_ASCII: :language t
  13154. @end example
  13155. Then extend ASCII back-end with a custom ``my-ascii'' back-end.
  13156. @lisp
  13157. (defun my-ascii-src-block (src-block contents info)
  13158. "Transcode a SRC-BLOCK element from Org to ASCII.
  13159. CONTENTS is nil. INFO is a plist used as a communication
  13160. channel."
  13161. (if (not (org-export-read-attribute :attr_ascii src-block :language))
  13162. (org-export-with-backend 'ascii src-block contents info)
  13163. (concat
  13164. (format ",--[ %s ]--\n%s`----"
  13165. (org-element-property :language src-block)
  13166. (replace-regexp-in-string
  13167. "^" "| "
  13168. (org-element-normalize-string
  13169. (org-export-format-code-default src-block info)))))))
  13170. (org-export-define-derived-backend 'my-ascii 'ascii
  13171. :translate-alist '((src-block . my-ascii-src-block)))
  13172. @end lisp
  13173. The @code{my-ascii-src-block} function looks at the attribute above the
  13174. current element. If not true, hands over to @emph{ascii} back-end. If
  13175. true, which it is in this example, it creates a box around the code
  13176. and leaves room for the inserting a string for language. The last
  13177. form creates the new back-end that springs to action only when
  13178. translating @code{src-block} type elements.
  13179. To use the newly defined back-end, evaluate the following from an Org
  13180. buffer:
  13181. @lisp
  13182. (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*")
  13183. @end lisp
  13184. Further steps to consider would be an interactive function,
  13185. self-installing an item in the export dispatcher menu, and other
  13186. user-friendly improvements.
  13187. @node Export in Foreign Buffers
  13188. @section Export in Foreign Buffers
  13189. The export back-ends in Org often include commands to convert selected
  13190. regions. A convenient feature of this in-place conversion is that the
  13191. exported output replaces the original source. Here are such
  13192. functions:
  13193. @table @asis
  13194. @item @code{org-html-convert-region-to-html}
  13195. @findex org-html-convert-region-to-html
  13196. Convert the selected region into HTML.
  13197. @item @code{org-latex-convert-region-to-latex}
  13198. @findex org-latex-convert-region-to-latex
  13199. Convert the selected region into @LaTeX{}.
  13200. @item @code{org-texinfo-convert-region-to-texinfo}
  13201. @findex org-texinfo-convert-region-to-texinfo
  13202. Convert the selected region into Texinfo.
  13203. @item @code{org-md-convert-region-to-md}
  13204. @findex org-md-convert-region-to-md
  13205. Convert the selected region into Markdown.
  13206. @end table
  13207. In-place conversions are particularly handy for quick conversion of
  13208. tables and lists in foreign buffers. For example, turn on the minor
  13209. mode @kbd{M-x orgstruct-mode} in an HTML buffer, then use the
  13210. convenient Org keyboard commands to create a list, select it, and
  13211. covert it to HTML with @kbd{M-x org-html-convert-region-to-html}.
  13212. @node Publishing
  13213. @chapter Publishing
  13214. @cindex publishing
  13215. Org includes a publishing management system that allows you to
  13216. configure automatic HTML conversion of @emph{projects} composed of
  13217. interlinked Org files. You can also configure Org to automatically
  13218. upload your exported HTML pages and related attachments, such as
  13219. images and source code files, to a web server.
  13220. You can also use Org to convert files into PDF, or even combine HTML
  13221. and PDF conversion so that files are available in both formats on the
  13222. server.
  13223. Publishing has been contributed to Org by David O'Toole.
  13224. @menu
  13225. * Configuration:: Defining projects.
  13226. * Uploading Files:: How to get files up on the server.
  13227. * Sample Configuration:: Example projects.
  13228. * Triggering Publication:: Publication commands.
  13229. @end menu
  13230. @node Configuration
  13231. @section Configuration
  13232. Publishing needs significant configuration to specify files,
  13233. destination and many other properties of a project.
  13234. @menu
  13235. * Project alist:: The central configuration variable.
  13236. * Sources and destinations:: From here to there.
  13237. * Selecting files:: What files are part of the project?
  13238. * Publishing action:: Setting the function doing the publishing.
  13239. * Publishing options:: Tweaking HTML/@LaTeX{} export.
  13240. * Publishing links:: Which links keep working after publishing?
  13241. * Site map:: Generating a list of all pages.
  13242. * Generating an index:: An index that reaches across pages.
  13243. @end menu
  13244. @node Project alist
  13245. @subsection The variable @code{org-publish-project-alist}
  13246. @cindex projects, for publishing
  13247. @vindex org-publish-project-alist
  13248. Publishing is configured almost entirely through setting the value of
  13249. one variable, called @code{org-publish-project-alist}. Each element of the
  13250. list configures one project, and may be in one of the two following
  13251. forms:
  13252. @lisp
  13253. ("project-name" :property value :property value ...)
  13254. @end lisp
  13255. @noindent
  13256. i.e., a well-formed property list with alternating keys and values,
  13257. or:
  13258. @lisp
  13259. ("project-name" :components ("project-name" "project-name" ...))
  13260. @end lisp
  13261. In both cases, projects are configured by specifying property values.
  13262. A project defines the set of files that are to be published, as well
  13263. as the publishing configuration to use when publishing those files.
  13264. When a project takes the second form listed above, the individual
  13265. members of the @code{:components} property are taken to be sub-projects,
  13266. which group together files requiring different publishing options.
  13267. When you publish such a ``meta-project'', all the components are also
  13268. published, in the sequence given.
  13269. @node Sources and destinations
  13270. @subsection Sources and destinations for files
  13271. @cindex directories, for publishing
  13272. Most properties are optional, but some should always be set. In
  13273. particular, Org needs to know where to look for source files, and
  13274. where to put published files.
  13275. @table @asis
  13276. @item @code{:base-directory}
  13277. Directory containing publishing source files.
  13278. @item @code{:publishing-directory}
  13279. Directory where output files are published. You can directly
  13280. publish to a webserver using a file name syntax appropriate for
  13281. the Emacs tramp package. Or you can publish to a local directory
  13282. and use external tools to upload your website (see @ref{Uploading Files}).
  13283. @item @code{:preparation-function}
  13284. Function or list of functions to be called before starting the
  13285. publishing process, for example, to run @samp{make} for updating files
  13286. to be published. Each preparation function is called with
  13287. a single argument, the project property list.
  13288. @item @code{:completion-function}
  13289. Function or list of functions called after finishing the
  13290. publishing process, for example, to change permissions of the
  13291. resulting files. Each completion function is called with
  13292. a single argument, the project property list.
  13293. @end table
  13294. @node Selecting files
  13295. @subsection Selecting files
  13296. @cindex files, selecting for publishing
  13297. By default, all files with extension @samp{.org} in the base directory are
  13298. considered part of the project. This can be modified by setting the
  13299. following properties
  13300. @table @asis
  13301. @item @code{:base-extension}
  13302. Extension---without the dot---of source files. This actually
  13303. is a regular expression. Set this to the symbol @code{any} if you
  13304. want to get all files in @code{:base-directory}, even without
  13305. extension.
  13306. @item @code{:exclude}
  13307. Regular expression to match file names that should not be published,
  13308. even though they have been selected on the basis of their extension.
  13309. @item @code{:include}
  13310. List of files to be included regardless of @code{:base-extension} and
  13311. @code{:exclude}.
  13312. @item @code{:recursive}
  13313. Non-@code{nil} means, check base-directory recursively for files to
  13314. publish.
  13315. @end table
  13316. @node Publishing action
  13317. @subsection Publishing action
  13318. @cindex action, for publishing
  13319. Publishing means that a file is copied to the destination directory
  13320. and possibly transformed in the process. The default transformation
  13321. is to export Org files as HTML files, and this is done by the function
  13322. @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
  13323. @code{org-publish-org-to-pdf}, or as ASCII, Texinfo, etc., using the
  13324. corresponding functions.
  13325. If you want to publish the Org file as an @samp{.org} file but with
  13326. @emph{archived}, @emph{commented}, and @emph{tag-excluded} trees removed, use
  13327. @code{org-publish-org-to-org}. This produces @samp{file.org} and put it in the
  13328. publishing directory. If you want a htmlized version of this file,
  13329. set the parameter @code{:htmlized-source} to @code{t}. It produces
  13330. @samp{file.org.html} in the publishing directory@footnote{If the publishing directory is the same as the source
  13331. directory, @samp{file.org} is exported as @samp{file.org.org}, so you probably
  13332. do not want to do this.}.
  13333. Other files like images only need to be copied to the publishing
  13334. destination; for this you can use @code{org-publish-attachment}. For
  13335. non-Org files, you always need to specify the publishing function:
  13336. @table @asis
  13337. @item @code{:publishing-function}
  13338. Function executing the publication of a file. This may also be
  13339. a list of functions, which are all called in turn.
  13340. @item @code{:plain-source}
  13341. Non-@code{nil} means, publish plain source.
  13342. @item @code{:htmlized-source}
  13343. Non-@code{nil} means, publish htmlized source.
  13344. @end table
  13345. The function must accept three arguments: a property list containing
  13346. at least a @code{:publishing-directory} property, the name of the file to
  13347. be published, and the path to the publishing directory of the output
  13348. file. It should take the specified file, make the necessary
  13349. transformation, if any, and place the result into the destination
  13350. folder.
  13351. @node Publishing options
  13352. @subsection Options for the exporters
  13353. @cindex options, for publishing
  13354. @cindex publishing options
  13355. The property list can be used to set many export options for the HTML
  13356. and @LaTeX{} exporters. In most cases, these properties correspond to
  13357. user variables in Org. The table below lists these properties along
  13358. with the variable they belong to. See the documentation string for
  13359. the respective variable for details.
  13360. @vindex org-publish-project-alist
  13361. When a property is given a value in @code{org-publish-project-alist}, its
  13362. setting overrides the value of the corresponding user variable, if
  13363. any, during publishing. Options set within a file (see @ref{Export Settings}), however, override everything.
  13364. @anchor{Generic properties}
  13365. @subsubheading Generic properties
  13366. @multitable {aaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13367. @item @code{:archived-trees}
  13368. @tab @code{org-export-with-archived-trees}
  13369. @item @code{:exclude-tags}
  13370. @tab @code{org-export-exclude-tags}
  13371. @item @code{:headline-levels}
  13372. @tab @code{org-export-headline-levels}
  13373. @item @code{:language}
  13374. @tab @code{org-export-default-language}
  13375. @item @code{:preserve-breaks}
  13376. @tab @code{org-export-preserve-breaks}
  13377. @item @code{:section-numbers}
  13378. @tab @code{org-export-with-section-numbers}
  13379. @item @code{:select-tags}
  13380. @tab @code{org-export-select-tags}
  13381. @item @code{:with-author}
  13382. @tab @code{org-export-with-author}
  13383. @item @code{:with-broken-links}
  13384. @tab @code{org-export-with-broken-links}
  13385. @item @code{:with-clocks}
  13386. @tab @code{org-export-with-clocks}
  13387. @item @code{:with-creator}
  13388. @tab @code{org-export-with-creator}
  13389. @item @code{:with-date}
  13390. @tab @code{org-export-with-date}
  13391. @item @code{:with-drawers}
  13392. @tab @code{org-export-with-drawers}
  13393. @item @code{:with-email}
  13394. @tab @code{org-export-with-email}
  13395. @item @code{:with-emphasize}
  13396. @tab @code{org-export-with-emphasize}
  13397. @item @code{:with-fixed-width}
  13398. @tab @code{org-export-with-fixed-width}
  13399. @item @code{:with-footnotes}
  13400. @tab @code{org-export-with-footnotes}
  13401. @item @code{:with-latex}
  13402. @tab @code{org-export-with-latex}
  13403. @item @code{:with-planning}
  13404. @tab @code{org-export-with-planning}
  13405. @item @code{:with-priority}
  13406. @tab @code{org-export-with-priority}
  13407. @item @code{:with-properties}
  13408. @tab @code{org-export-with-properties}
  13409. @item @code{:with-special-strings}
  13410. @tab @code{org-export-with-special-strings}
  13411. @item @code{:with-sub-superscript}
  13412. @tab @code{org-export-with-sub-superscripts}
  13413. @item @code{:with-tables}
  13414. @tab @code{org-export-with-tables}
  13415. @item @code{:with-tags}
  13416. @tab @code{org-export-with-tags}
  13417. @item @code{:with-tasks}
  13418. @tab @code{org-export-with-tasks}
  13419. @item @code{:with-timestamps}
  13420. @tab @code{org-export-with-timestamps}
  13421. @item @code{:with-title}
  13422. @tab @code{org-export-with-title}
  13423. @item @code{:with-toc}
  13424. @tab @code{org-export-with-toc}
  13425. @item @code{:with-todo-keywords}
  13426. @tab @code{org-export-with-todo-keywords}
  13427. @end multitable
  13428. @anchor{ASCII specific properties}
  13429. @subsubheading ASCII specific properties
  13430. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13431. @item @code{:ascii-bullets}
  13432. @tab @code{org-ascii-bullets}
  13433. @item @code{:ascii-caption-above}
  13434. @tab @code{org-ascii-caption-above}
  13435. @item @code{:ascii-charset}
  13436. @tab @code{org-ascii-charset}
  13437. @item @code{:ascii-global-margin}
  13438. @tab @code{org-ascii-global-margin}
  13439. @item @code{:ascii-format-drawer-function}
  13440. @tab @code{org-ascii-format-drawer-function}
  13441. @item @code{:ascii-format-inlinetask-function}
  13442. @tab @code{org-ascii-format-inlinetask-function}
  13443. @item @code{:ascii-headline-spacing}
  13444. @tab @code{org-ascii-headline-spacing}
  13445. @item @code{:ascii-indented-line-width}
  13446. @tab @code{org-ascii-indented-line-width}
  13447. @item @code{:ascii-inlinetask-width}
  13448. @tab @code{org-ascii-inlinetask-width}
  13449. @item @code{:ascii-inner-margin}
  13450. @tab @code{org-ascii-inner-margin}
  13451. @item @code{:ascii-links-to-notes}
  13452. @tab @code{org-ascii-links-to-notes}
  13453. @item @code{:ascii-list-margin}
  13454. @tab @code{org-ascii-list-margin}
  13455. @item @code{:ascii-paragraph-spacing}
  13456. @tab @code{org-ascii-paragraph-spacing}
  13457. @item @code{:ascii-quote-margin}
  13458. @tab @code{org-ascii-quote-margin}
  13459. @item @code{:ascii-table-keep-all-vertical-lines}
  13460. @tab @code{org-ascii-table-keep-all-vertical-lines}
  13461. @item @code{:ascii-table-use-ascii-art}
  13462. @tab @code{org-ascii-table-use-ascii-art}
  13463. @item @code{:ascii-table-widen-columns}
  13464. @tab @code{org-ascii-table-widen-columns}
  13465. @item @code{:ascii-text-width}
  13466. @tab @code{org-ascii-text-width}
  13467. @item @code{:ascii-underline}
  13468. @tab @code{org-ascii-underline}
  13469. @item @code{:ascii-verbatim-format}
  13470. @tab @code{org-ascii-verbatim-format}
  13471. @end multitable
  13472. @anchor{Beamer specific properties}
  13473. @subsubheading Beamer specific properties
  13474. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13475. @item @code{:beamer-theme}
  13476. @tab @code{org-beamer-theme}
  13477. @item @code{:beamer-column-view-format}
  13478. @tab @code{org-beamer-column-view-format}
  13479. @item @code{:beamer-environments-extra}
  13480. @tab @code{org-beamer-environments-extra}
  13481. @item @code{:beamer-frame-default-options}
  13482. @tab @code{org-beamer-frame-default-options}
  13483. @item @code{:beamer-outline-frame-options}
  13484. @tab @code{org-beamer-outline-frame-options}
  13485. @item @code{:beamer-outline-frame-title}
  13486. @tab @code{org-beamer-outline-frame-title}
  13487. @item @code{:beamer-subtitle-format}
  13488. @tab @code{org-beamer-subtitle-format}
  13489. @end multitable
  13490. @anchor{HTML specific properties}
  13491. @subsubheading HTML specific properties
  13492. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13493. @item @code{:html-allow-name-attribute-in-anchors}
  13494. @tab @code{org-html-allow-name-attribute-in-anchors}
  13495. @item @code{:html-checkbox-type}
  13496. @tab @code{org-html-checkbox-type}
  13497. @item @code{:html-container}
  13498. @tab @code{org-html-container-element}
  13499. @item @code{:html-divs}
  13500. @tab @code{org-html-divs}
  13501. @item @code{:html-doctype}
  13502. @tab @code{org-html-doctype}
  13503. @item @code{:html-extension}
  13504. @tab @code{org-html-extension}
  13505. @item @code{:html-footnote-format}
  13506. @tab @code{org-html-footnote-format}
  13507. @item @code{:html-footnote-separator}
  13508. @tab @code{org-html-footnote-separator}
  13509. @item @code{:html-footnotes-section}
  13510. @tab @code{org-html-footnotes-section}
  13511. @item @code{:html-format-drawer-function}
  13512. @tab @code{org-html-format-drawer-function}
  13513. @item @code{:html-format-headline-function}
  13514. @tab @code{org-html-format-headline-function}
  13515. @item @code{:html-format-inlinetask-function}
  13516. @tab @code{org-html-format-inlinetask-function}
  13517. @item @code{:html-head-extra}
  13518. @tab @code{org-html-head-extra}
  13519. @item @code{:html-head-include-default-style}
  13520. @tab @code{org-html-head-include-default-style}
  13521. @item @code{:html-head-include-scripts}
  13522. @tab @code{org-html-head-include-scripts}
  13523. @item @code{:html-head}
  13524. @tab @code{org-html-head}
  13525. @item @code{:html-home/up-format}
  13526. @tab @code{org-html-home/up-format}
  13527. @item @code{:html-html5-fancy}
  13528. @tab @code{org-html-html5-fancy}
  13529. @item @code{:html-indent}
  13530. @tab @code{org-html-indent}
  13531. @item @code{:html-infojs-options}
  13532. @tab @code{org-html-infojs-options}
  13533. @item @code{:html-infojs-template}
  13534. @tab @code{org-html-infojs-template}
  13535. @item @code{:html-inline-image-rules}
  13536. @tab @code{org-html-inline-image-rules}
  13537. @item @code{:html-inline-images}
  13538. @tab @code{org-html-inline-images}
  13539. @item @code{:html-link-home}
  13540. @tab @code{org-html-link-home}
  13541. @item @code{:html-link-org-files-as-html}
  13542. @tab @code{org-html-link-org-files-as-html}
  13543. @item @code{:html-link-up}
  13544. @tab @code{org-html-link-up}
  13545. @item @code{:html-link-use-abs-url}
  13546. @tab @code{org-html-link-use-abs-url}
  13547. @item @code{:html-mathjax-options}
  13548. @tab @code{org-html-mathjax-options}
  13549. @item @code{:html-mathjax-template}
  13550. @tab @code{org-html-mathjax-template}
  13551. @item @code{:html-metadata-timestamp-format}
  13552. @tab @code{org-html-metadata-timestamp-format}
  13553. @item @code{:html-postamble-format}
  13554. @tab @code{org-html-postamble-format}
  13555. @item @code{:html-postamble}
  13556. @tab @code{org-html-postamble}
  13557. @item @code{:html-preamble-format}
  13558. @tab @code{org-html-preamble-format}
  13559. @item @code{:html-preamble}
  13560. @tab @code{org-html-preamble}
  13561. @item @code{:html-table-align-individual-field}
  13562. @tab @code{de@{org-html-table-align-individual-fields}
  13563. @item @code{:html-table-attributes}
  13564. @tab @code{org-html-table-default-attributes}
  13565. @item @code{:html-table-caption-above}
  13566. @tab @code{org-html-table-caption-above}
  13567. @item @code{:html-table-data-tags}
  13568. @tab @code{org-html-table-data-tags}
  13569. @item @code{:html-table-header-tags}
  13570. @tab @code{org-html-table-header-tags}
  13571. @item @code{:html-table-row-tags}
  13572. @tab @code{org-html-table-row-tags}
  13573. @item @code{:html-table-use-header-tags-for-first-column}
  13574. @tab @code{org-html-table-use-header-tags-for-first-column}
  13575. @item @code{:html-tag-class-prefix}
  13576. @tab @code{org-html-tag-class-prefix}
  13577. @item @code{:html-text-markup-alist}
  13578. @tab @code{org-html-text-markup-alist}
  13579. @item @code{:html-todo-kwd-class-prefix}
  13580. @tab @code{org-html-todo-kwd-class-prefix}
  13581. @item @code{:html-toplevel-hlevel}
  13582. @tab @code{org-html-toplevel-hlevel}
  13583. @item @code{:html-use-infojs}
  13584. @tab @code{org-html-use-infojs}
  13585. @item @code{:html-validation-link}
  13586. @tab @code{org-html-validation-link}
  13587. @item @code{:html-viewport}
  13588. @tab @code{org-html-viewport}
  13589. @item @code{:html-xml-declaration}
  13590. @tab @code{org-html-xml-declaration}
  13591. @end multitable
  13592. @anchor{@LaTeX{} specific properties}
  13593. @subsubheading @LaTeX{} specific properties
  13594. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13595. @item @code{:latex-active-timestamp-format}
  13596. @tab @code{org-latex-active-timestamp-format}
  13597. @item @code{:latex-caption-above}
  13598. @tab @code{org-latex-caption-above}
  13599. @item @code{:latex-classes}
  13600. @tab @code{org-latex-classes}
  13601. @item @code{:latex-class}
  13602. @tab @code{org-latex-default-class}
  13603. @item @code{:latex-compiler}
  13604. @tab @code{org-latex-compiler}
  13605. @item @code{:latex-default-figure-position}
  13606. @tab @code{org-latex-default-figure-position}
  13607. @item @code{:latex-default-table-environment}
  13608. @tab @code{org-latex-default-table-environment}
  13609. @item @code{:latex-default-table-mode}
  13610. @tab @code{org-latex-default-table-mode}
  13611. @item @code{:latex-diary-timestamp-format}
  13612. @tab @code{org-latex-diary-timestamp-format}
  13613. @item @code{:latex-footnote-defined-format}
  13614. @tab @code{org-latex-footnote-defined-format}
  13615. @item @code{:latex-footnote-separator}
  13616. @tab @code{org-latex-footnote-separator}
  13617. @item @code{:latex-format-drawer-function}
  13618. @tab @code{org-latex-format-drawer-function}
  13619. @item @code{:latex-format-headline-function}
  13620. @tab @code{org-latex-format-headline-function}
  13621. @item @code{:latex-format-inlinetask-function}
  13622. @tab @code{org-latex-format-inlinetask-function}
  13623. @item @code{:latex-hyperref-template}
  13624. @tab @code{org-latex-hyperref-template}
  13625. @item @code{:latex-image-default-height}
  13626. @tab @code{org-latex-image-default-height}
  13627. @item @code{:latex-image-default-option}
  13628. @tab @code{org-latex-image-default-option}
  13629. @item @code{:latex-image-default-width}
  13630. @tab @code{org-latex-image-default-width}
  13631. @item @code{:latex-images-centered}
  13632. @tab @code{org-latex-images-centered}
  13633. @item @code{:latex-inactive-timestamp-format}
  13634. @tab @code{org-latex-inactive-timestamp-format}
  13635. @item @code{:latex-inline-image-rules}
  13636. @tab @code{org-latex-inline-image-rules}
  13637. @item @code{:latex-link-with-unknown-path-format}
  13638. @tab @code{org-latex-link-with-unknown-path-format}
  13639. @item @code{:latex-listings-langs}
  13640. @tab @code{org-latex-listings-langs}
  13641. @item @code{:latex-listings-options}
  13642. @tab @code{org-latex-listings-options}
  13643. @item @code{:latex-listings}
  13644. @tab @code{org-latex-listings}
  13645. @item @code{:latex-minted-langs}
  13646. @tab @code{org-latex-minted-langs}
  13647. @item @code{:latex-minted-options}
  13648. @tab @code{org-latex-minted-options}
  13649. @item @code{:latex-prefer-user-labels}
  13650. @tab @code{org-latex-prefer-user-labels}
  13651. @item @code{:latex-subtitle-format}
  13652. @tab @code{org-latex-subtitle-format}
  13653. @item @code{:latex-subtitle-separate}
  13654. @tab @code{org-latex-subtitle-separate}
  13655. @item @code{:latex-table-scientific-notation}
  13656. @tab @code{org-latex-table-scientific-notation}
  13657. @item @code{:latex-tables-booktabs}
  13658. @tab @code{org-latex-tables-booktabs}
  13659. @item @code{:latex-tables-centered}
  13660. @tab @code{org-latex-tables-centered}
  13661. @item @code{:latex-text-markup-alist}
  13662. @tab @code{org-latex-text-markup-alist}
  13663. @item @code{:latex-title-command}
  13664. @tab @code{org-latex-title-command}
  13665. @item @code{:latex-toc-command}
  13666. @tab @code{org-latex-toc-command}
  13667. @end multitable
  13668. @anchor{Markdown specific properties}
  13669. @subsubheading Markdown specific properties
  13670. @multitable {aaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaa}
  13671. @item @code{:md-footnote-format}
  13672. @tab @code{org-md-footnote-format}
  13673. @item @code{:md-footnotes-section}
  13674. @tab @code{org-md-footnotes-section}
  13675. @item @code{:md-headline-style}
  13676. @tab @code{org-md-headline-style}
  13677. @end multitable
  13678. @anchor{ODT specific properties}
  13679. @subsubheading ODT specific properties
  13680. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13681. @item @code{:odt-content-template-file}
  13682. @tab @code{org-odt-content-template-file}
  13683. @item @code{:odt-display-outline-level}
  13684. @tab @code{org-odt-display-outline-level}
  13685. @item @code{:odt-fontify-srcblocks}
  13686. @tab @code{org-odt-fontify-srcblocks}
  13687. @item @code{:odt-format-drawer-function}
  13688. @tab @code{org-odt-format-drawer-function}
  13689. @item @code{:odt-format-headline-function}
  13690. @tab @code{org-odt-format-headline-function}
  13691. @item @code{:odt-format-inlinetask-function}
  13692. @tab @code{org-odt-format-inlinetask-function}
  13693. @item @code{:odt-inline-formula-rules}
  13694. @tab @code{org-odt-inline-formula-rules}
  13695. @item @code{:odt-inline-image-rules}
  13696. @tab @code{org-odt-inline-image-rules}
  13697. @item @code{:odt-pixels-per-inch}
  13698. @tab @code{org-odt-pixels-per-inch}
  13699. @item @code{:odt-styles-file}
  13700. @tab @code{org-odt-styles-file}
  13701. @item @code{:odt-table-styles}
  13702. @tab @code{org-odt-table-styles}
  13703. @item @code{:odt-use-date-fields}
  13704. @tab @code{org-odt-use-date-fields}
  13705. @end multitable
  13706. @anchor{Texinfo specific properties}
  13707. @subsubheading Texinfo specific properties
  13708. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13709. @item @code{:texinfo-active-timestamp-format}
  13710. @tab @code{org-texinfo-active-timestamp-format}
  13711. @item @code{:texinfo-classes}
  13712. @tab @code{org-texinfo-classes}
  13713. @item @code{:texinfo-class}
  13714. @tab @code{org-texinfo-default-class}
  13715. @item @code{:texinfo-table-default-markup}
  13716. @tab @code{org-texinfo-table-default-markup}
  13717. @item @code{:texinfo-diary-timestamp-format}
  13718. @tab @code{org-texinfo-diary-timestamp-format}
  13719. @item @code{:texinfo-filename}
  13720. @tab @code{org-texinfo-filename}
  13721. @item @code{:texinfo-format-drawer-function}
  13722. @tab @code{org-texinfo-format-drawer-function}
  13723. @item @code{:texinfo-format-headline-function}
  13724. @tab @code{org-texinfo-format-headline-function}
  13725. @item @code{:texinfo-format-inlinetask-function}
  13726. @tab @code{org-texinfo-format-inlinetask-function}
  13727. @item @code{:texinfo-inactive-timestamp-format}
  13728. @tab @code{org-texinfo-inactive-timestamp-format}
  13729. @item @code{:texinfo-link-with-unknown-path-format}
  13730. @tab @code{org-texinfo-link-with-unknown-path-format}
  13731. @item @code{:texinfo-node-description-column}
  13732. @tab @code{org-texinfo-node-description-column}
  13733. @item @code{:texinfo-table-scientific-notation}
  13734. @tab @code{org-texinfo-table-scientific-notation}
  13735. @item @code{:texinfo-tables-verbatim}
  13736. @tab @code{org-texinfo-tables-verbatim}
  13737. @item @code{:texinfo-text-markup-alist}
  13738. @tab @code{org-texinfo-text-markup-alist}
  13739. @end multitable
  13740. @node Publishing links
  13741. @subsection Publishing links
  13742. @cindex links, publishing
  13743. To create a link from one Org file to another, you would use something
  13744. like @samp{[[file:foo.org][The foo]]} or simply @samp{[[file:foo.org]]} (see @ref{External Links}). When
  13745. published, this link becomes a link to @samp{foo.html}. You can thus
  13746. interlink the pages of your ``Org web'' project and the links will work
  13747. as expected when you publish them to HTML. If you also publish the
  13748. Org source file and want to link to it, use an @samp{http} link instead of
  13749. a @samp{file:} link, because @samp{file} links are converted to link to the
  13750. corresponding @samp{.html} file.
  13751. You may also link to related files, such as images. Provided you are
  13752. careful with relative file names, and provided you have also
  13753. configured Org to upload the related files, these links will work too.
  13754. See @ref{Complex example}, for an example of this
  13755. usage.
  13756. Eventually, links between published documents can contain some search
  13757. options (see @ref{Search Options}), which will be resolved to
  13758. the appropriate location in the linked file. For example, once
  13759. published to HTML, the following links all point to a dedicated anchor
  13760. in @samp{foo.html}.
  13761. @example
  13762. [[file:foo.org::*heading]]
  13763. [[file:foo.org::#custom-id]]
  13764. [[file:foo.org::target]]
  13765. @end example
  13766. @node Site map
  13767. @subsection Generating a sitemap
  13768. @cindex sitemap, of published pages
  13769. The following properties may be used to control publishing of
  13770. a map of files for a given project.
  13771. @table @asis
  13772. @item @code{:auto-sitemap}
  13773. When non-@code{nil}, publish a sitemap during
  13774. @code{org-publish-current-project} or @code{org-publish-all}.
  13775. @item @code{:sitemap-filename}
  13776. Filename for output of sitemap. Defaults to @samp{sitemap.org}, which
  13777. becomes @samp{sitemap.html}.
  13778. @item @code{:sitemap-title}
  13779. Title of sitemap page. Defaults to name of file.
  13780. @item @code{:sitemap-format-entry}
  13781. @findex org-publish-find-date
  13782. @findex org-publish-find-property
  13783. @findex org-publish-find-title
  13784. With this option one can tell how a site-map entry is formatted
  13785. in the site-map. It is a function called with three arguments:
  13786. the file or directory name relative to base directory of the
  13787. project, the site-map style and the current project. It is
  13788. expected to return a string. Default value turns file names into
  13789. links and use document titles as descriptions. For specific
  13790. formatting needs, one can use @code{org-publish-find-date},
  13791. @code{org-publish-find-title} and @code{org-publish-find-property}, to
  13792. retrieve additional information about published documents.
  13793. @item @code{:sitemap-function}
  13794. Plug-in function to use for generation of the sitemap. It is
  13795. called with two arguments: the title of the site-map and
  13796. a representation of the files and directories involved in the
  13797. project as a nested list, which can further be transformed using
  13798. @code{org-list-to-generic}, @code{org-list-to-subtree} and alike. Default
  13799. value generates a plain list of links to all files in the
  13800. project.
  13801. @item @code{:sitemap-sort-folders}
  13802. Where folders should appear in the sitemap. Set this to @code{first}
  13803. (default) or @code{last} to display folders first or last,
  13804. respectively. When set to @code{ignore}, folders are ignored
  13805. altogether. Any other value mixes files and folders. This
  13806. variable has no effect when site-map style is @code{tree}.
  13807. @item @code{:sitemap-sort-files}
  13808. How the files are sorted in the site map. Set this to
  13809. @code{alphabetically} (default), @code{chronologically} or
  13810. @code{anti-chronologically}. @code{chronologically} sorts the files with
  13811. older date first while @code{anti-chronologically} sorts the files
  13812. with newer date first. @code{alphabetically} sorts the files
  13813. alphabetically. The date of a file is retrieved with
  13814. @code{org-publish-find-date}.
  13815. @item @code{:sitemap-ignore-case}
  13816. Should sorting be case-sensitive? Default @code{nil}.
  13817. @item @code{:sitemap-file-entry-format}
  13818. With this option one can tell how a sitemap's entry is formatted
  13819. in the sitemap. This is a format string with some escape
  13820. sequences: @code{%t} stands for the title of the file, @code{%a} stands for
  13821. the author of the file and @code{%d} stands for the date of the file.
  13822. The date is retrieved with the @code{org-publish-find-date} function
  13823. and formatted with @code{org-publish-sitemap-date-format}. Default
  13824. @code{%t}.
  13825. @item @code{:sitemap-date-format}
  13826. Format string for the @code{format-time-string} function that tells
  13827. how a sitemap entry's date is to be formatted. This property
  13828. bypasses @code{org-publish-sitemap-date-format} which defaults to
  13829. @code{%Y-%m-%d}.
  13830. @end table
  13831. @node Generating an index
  13832. @subsection Generating an index
  13833. @cindex index, in a publishing project
  13834. Org mode can generate an index across the files of a publishing project.
  13835. @table @asis
  13836. @item @code{:makeindex}
  13837. When non-@code{nil}, generate in index in the file @samp{theindex.org} and
  13838. publish it as @samp{theindex.html}.
  13839. @end table
  13840. The file is created when first publishing a project with the
  13841. @code{:makeindex} set. The file only contains a statement @samp{#+INCLUDE:
  13842. "theindex.inc"}. You can then build around this include statement by
  13843. adding a title, style information, etc.
  13844. @cindex @samp{INDEX}, keyword
  13845. Index entries are specified with @samp{INDEX} keyword. An entry that
  13846. contains an exclamation mark creates a sub item.
  13847. @example
  13848. *** Curriculum Vitae
  13849. #+INDEX: CV
  13850. #+INDEX: Application!CV
  13851. @end example
  13852. @node Uploading Files
  13853. @section Uploading Files
  13854. @cindex rsync
  13855. @cindex unison
  13856. For those people already utilizing third party sync tools such as
  13857. Rsync or Unison, it might be preferable not to use the built-in remote
  13858. publishing facilities of Org mode which rely heavily on Tramp. Tramp,
  13859. while very useful and powerful, tends not to be so efficient for
  13860. multiple file transfer and has been known to cause problems under
  13861. heavy usage.
  13862. Specialized synchronization utilities offer several advantages. In
  13863. addition to timestamp comparison, they also do content and
  13864. permissions/attribute checks. For this reason you might prefer to
  13865. publish your web to a local directory---possibly even @emph{in place} with
  13866. your Org files---and then use Unison or Rsync to do the
  13867. synchronization with the remote host.
  13868. Since Unison, for example, can be configured as to which files to
  13869. transfer to a certain remote destination, it can greatly simplify the
  13870. project publishing definition. Simply keep all files in the correct
  13871. location, process your Org files with @code{org-publish} and let the
  13872. synchronization tool do the rest. You do not need, in this scenario,
  13873. to include attachments such as JPG, CSS or PNG files in the project
  13874. definition since the third-party tool syncs them.
  13875. Publishing to a local directory is also much faster than to a remote
  13876. one, so that you can afford more easily to republish entire projects.
  13877. If you set @code{org-publish-use-timestamps-flag} to @code{nil}, you gain the
  13878. main benefit of re-including any changed external files such as source
  13879. example files you might include with @samp{INCLUDE} keyword. The timestamp
  13880. mechanism in Org is not smart enough to detect if included files have
  13881. been modified.
  13882. @node Sample Configuration
  13883. @section Sample Configuration
  13884. Below we provide two example configurations. The first one is
  13885. a simple project publishing only a set of Org files. The second
  13886. example is more complex, with a multi-component project.
  13887. @menu
  13888. * Simple example:: One-component publishing.
  13889. * Complex example:: A multi-component publishing example.
  13890. @end menu
  13891. @node Simple example
  13892. @subsection Example: simple publishing configuration
  13893. This example publishes a set of Org files to the @samp{public_html}
  13894. directory on the local machine.
  13895. @lisp
  13896. (setq org-publish-project-alist
  13897. '(("org"
  13898. :base-directory "~/org/"
  13899. :publishing-directory "~/public_html"
  13900. :section-numbers nil
  13901. :table-of-contents nil
  13902. :style "<link rel=\"stylesheet\"
  13903. href=\"../other/mystyle.css\"
  13904. type=\"text/css\"/>")))
  13905. @end lisp
  13906. @node Complex example
  13907. @subsection Example: complex publishing configuration
  13908. This more complicated example publishes an entire website, including
  13909. Org files converted to HTML, image files, Emacs Lisp source code, and
  13910. style sheets. The publishing directory is remote and private files
  13911. are excluded.
  13912. To ensure that links are preserved, care should be taken to replicate
  13913. your directory structure on the web server, and to use relative file
  13914. paths. For example, if your Org files are kept in @samp{~/org/} and your
  13915. publishable images in @samp{~/images/}, you would link to an image with
  13916. @example
  13917. file:../images/myimage.png
  13918. @end example
  13919. On the web server, the relative path to the image should be the same.
  13920. You can accomplish this by setting up an @samp{images/} folder in the right
  13921. place on the web server, and publishing images to it.
  13922. @lisp
  13923. (setq org-publish-project-alist
  13924. '(("orgfiles"
  13925. :base-directory "~/org/"
  13926. :base-extension "org"
  13927. :publishing-directory "/ssh:user@@host:~/html/notebook/"
  13928. :publishing-function org-html-publish-to-html
  13929. :exclude "PrivatePage.org" ;; regexp
  13930. :headline-levels 3
  13931. :section-numbers nil
  13932. :with-toc nil
  13933. :html-head "<link rel=\"stylesheet\"
  13934. href=\"../other/mystyle.css\" type=\"text/css\"/>"
  13935. :html-preamble t)
  13936. ("images"
  13937. :base-directory "~/images/"
  13938. :base-extension "jpg\\|gif\\|png"
  13939. :publishing-directory "/ssh:user@@host:~/html/images/"
  13940. :publishing-function org-publish-attachment)
  13941. ("other"
  13942. :base-directory "~/other/"
  13943. :base-extension "css\\|el"
  13944. :publishing-directory "/ssh:user@@host:~/html/other/"
  13945. :publishing-function org-publish-attachment)
  13946. ("website" :components ("orgfiles" "images" "other"))))
  13947. @end lisp
  13948. @node Triggering Publication
  13949. @section Triggering Publication
  13950. Once properly configured, Org can publish with the following commands:
  13951. @table @asis
  13952. @item @kbd{C-c C-e X} (@code{org-publish})
  13953. @kindex C-c C-e X
  13954. @findex org-publish
  13955. Prompt for a specific project and publish all files that belong
  13956. to it.
  13957. @item @kbd{C-c C-e P} (@code{org-publish-current-project})
  13958. @kindex C-c C-e P
  13959. @findex org-publish-current-project
  13960. Publish the project containing the current file.
  13961. @item @kbd{C-c C-e F} (@code{org-publish-current-file})
  13962. @kindex C-c C-e F
  13963. @findex org-publish-current-file
  13964. Publish only the current file.
  13965. @item @kbd{C-c C-e E} (@code{org-publish-all})
  13966. @kindex C-c C-e E
  13967. @findex org-publish-all
  13968. Publish every project.
  13969. @end table
  13970. @vindex org-publish-use-timestamps-flag
  13971. Org uses timestamps to track when a file has changed. The above
  13972. functions normally only publish changed files. You can override this
  13973. and force publishing of all files by giving a prefix argument to any
  13974. of the commands above, or by customizing the variable
  13975. @code{org-publish-use-timestamps-flag}. This may be necessary in
  13976. particular if files include other files via @samp{SETUPFILE} or @samp{INCLUDE}
  13977. keywords.
  13978. @node Working with Source Code
  13979. @chapter Working with Source Code
  13980. @cindex source code, working with
  13981. Source code here refers to any plain text collection of computer
  13982. instructions, possibly with comments, written using a human-readable
  13983. programming language. Org can manage source code in an Org document
  13984. when the source code is identified with begin and end markers.
  13985. Working with source code begins with identifying source code blocks.
  13986. A source code block can be placed almost anywhere in an Org document;
  13987. it is not restricted to the preamble or the end of the document.
  13988. However, Org cannot manage a source code block if it is placed inside
  13989. an Org comment or within a fixed width section.
  13990. Here is an example source code block in the Emacs Lisp language:
  13991. @example
  13992. #+BEGIN_SRC emacs-lisp
  13993. (defun org-xor (a b)
  13994. "Exclusive or."
  13995. (if a (not b) b))
  13996. #+END_SRC
  13997. @end example
  13998. Org can manage the source code in the block delimited by @samp{#+BEGIN_SRC}
  13999. @dots{} @samp{#+END_SRC} in several ways that can simplify housekeeping tasks
  14000. essential to modern source code maintenance. Org can edit, format,
  14001. extract, export, and publish source code blocks. Org can also compile
  14002. and execute a source code block, then capture the results. The Org
  14003. mode literature sometimes refers to source code blocks as @emph{live code}
  14004. blocks because they can alter the content of the Org document or the
  14005. material that it exports. Users can control how live they want each
  14006. source code block by tweaking the header arguments (see @ref{Using Header Arguments}) for compiling, execution, extraction, and
  14007. exporting.
  14008. Source code blocks are one of many Org block types, which also include
  14009. @samp{quote}, @samp{export}, @samp{verse}, @samp{latex}, @samp{example}, and @samp{verbatim}. This
  14010. section pertains to blocks between @samp{#+BEGIN_SRC} and @samp{#+END_SRC}.
  14011. For editing and formatting a source code block, Org uses an
  14012. appropriate Emacs major mode that includes features specifically
  14013. designed for source code in that language.
  14014. Org can extract one or more source code blocks and write them to one
  14015. or more source files---a process known as @emph{tangling} in literate
  14016. programming terminology.
  14017. For exporting and publishing, Org's back-ends can format a source code
  14018. block appropriately, often with native syntax highlighting.
  14019. For executing and compiling a source code block, the user can
  14020. configure Org to select the appropriate compiler. Org provides
  14021. facilities to collect the result of the execution or compiler output,
  14022. insert it into the Org document, and/or export it. In addition to
  14023. text results, Org can insert links to other data types, including
  14024. audio, video, and graphics. Org can also link a compiler error
  14025. message to the appropriate line in the source code block.
  14026. An important feature of Org's management of source code blocks is the
  14027. ability to pass variables, functions, and results to one another using
  14028. a common syntax for source code blocks in any language. Although most
  14029. literate programming facilities are restricted to one language or
  14030. another, Org's language-agnostic approach lets the literate programmer
  14031. match each programming task with the appropriate computer language and
  14032. to mix them all together in a single Org document. This
  14033. interoperability among languages explains why Org's source code
  14034. management facility was named @emph{Org Babel} by its originators, Eric
  14035. Schulte and Dan Davison.
  14036. Org mode fulfills the promise of easy verification and maintenance of
  14037. publishing reproducible research by keeping text, data, code,
  14038. configuration settings of the execution environment, the results of
  14039. the execution, and associated narratives, claims, references, and
  14040. internal and external links in a single Org document.
  14041. Details of Org's facilities for working with source code are described
  14042. in the following sections.
  14043. @menu
  14044. * Structure of Code Blocks:: Code block syntax described.
  14045. * Using Header Arguments:: Different ways to set header arguments.
  14046. * Environment of a Code Block:: Arguments, sessions, working directory...
  14047. * Evaluating Code Blocks:: Place results of evaluation in the Org buffer.
  14048. * Results of Evaluation:: Choosing a results type, post-processing...
  14049. * Exporting Code Blocks:: Export contents and/or results.
  14050. * Extracting Source Code:: Create pure source code files.
  14051. * Languages:: List of supported code block languages.
  14052. * Editing Source Code:: Language major-mode editing.
  14053. * Noweb Reference Syntax:: Literate programming in Org mode.
  14054. * Library of Babel:: Use and contribute to a library of useful code blocks.
  14055. * Key bindings and Useful Functions:: Work quickly with code blocks.
  14056. * Batch Execution:: Call functions from the command line.
  14057. @end menu
  14058. @node Structure of Code Blocks
  14059. @section Structure of Code Blocks
  14060. @cindex code block, structure
  14061. @cindex source code, block structure
  14062. @cindex @samp{NAME} keyword, in source blocks
  14063. @cindex @samp{BEGIN_SRC}
  14064. Org offers two ways to structure source code in Org documents: in
  14065. a source code block, and directly inline. Both specifications are
  14066. shown below.
  14067. A source code block conforms to this structure:
  14068. @example
  14069. #+NAME: <name>
  14070. #+BEGIN_SRC <language> <switches> <header arguments>
  14071. <body>
  14072. #+END_SRC
  14073. @end example
  14074. Do not be put-off by having to remember the source block syntax. Org
  14075. mode offers a command for wrapping existing text in a block (see
  14076. @ref{Structure Templates}). Org also works with other completion systems
  14077. in Emacs, some of which predate Org and have custom domain-specific
  14078. languages for defining templates. Regular use of templates reduces
  14079. errors, increases accuracy, and maintains consistency.
  14080. @cindex source code, inline
  14081. An inline code block conforms to this structure:
  14082. @example
  14083. src_<language>@{<body>@}
  14084. @end example
  14085. @noindent
  14086. or
  14087. @example
  14088. src_<language>[<header arguments>]@{<body>@}
  14089. @end example
  14090. @table @asis
  14091. @item @samp{#+NAME: <name>}
  14092. Optional. Names the source block so it can be called, like
  14093. a function, from other source blocks or inline code to evaluate
  14094. or to capture the results. Code from other blocks, other files,
  14095. and from table formulas (see @ref{The spreadsheet}) can use the name
  14096. to reference a source block. This naming serves the same purpose
  14097. as naming Org tables. Org mode requires unique names. For
  14098. duplicate names, Org mode's behavior is undefined.
  14099. @item @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}
  14100. Mandatory. They mark the start and end of a block that Org
  14101. requires. The @samp{#+BEGIN_SRC} line takes additional arguments, as
  14102. described next.
  14103. @item @samp{<language>}
  14104. @cindex language, in code blocks
  14105. Mandatory. It is the identifier of the source code language in
  14106. the block. See @ref{Languages}, for identifiers of supported
  14107. languages.
  14108. @item @samp{<switches>}
  14109. @cindex switches, in code blocks
  14110. Optional. Switches provide finer control of the code execution,
  14111. export, and format (see the discussion of switches in @ref{Literal Examples}).
  14112. @item @samp{<header arguments>}
  14113. @cindex header arguments, in code blocks
  14114. Optional. Heading arguments control many aspects of evaluation,
  14115. export and tangling of code blocks (see @ref{Using Header Arguments}).
  14116. Using Org's properties feature, header arguments can be
  14117. selectively applied to the entire buffer or specific sub-trees of
  14118. the Org document.
  14119. @item @samp{<body>}
  14120. Source code in the dialect of the specified language identifier.
  14121. @end table
  14122. @node Using Header Arguments
  14123. @section Using Header Arguments
  14124. Org comes with many header arguments common to all languages. New
  14125. header arguments are added for specific languages as they become
  14126. available for use in source code blocks. A header argument is
  14127. specified with an initial colon followed by the argument's name in
  14128. lowercase.
  14129. Since header arguments can be set in several ways, Org prioritizes
  14130. them in case of overlaps or conflicts by giving local settings
  14131. a higher priority. Header values in function calls, for example,
  14132. override header values from global defaults.
  14133. @anchor{System-wide header arguments}
  14134. @subheading System-wide header arguments
  14135. @vindex org-babel-default-header-args
  14136. @vindex org-babel-default-header-args
  14137. System-wide values of header arguments can be specified by customizing
  14138. the @code{org-babel-default-header-args} variable, which defaults to the
  14139. following values:
  14140. @example
  14141. :session => "none"
  14142. :results => "replace"
  14143. :exports => "code"
  14144. :cache => "no"
  14145. :noweb => "no"
  14146. @end example
  14147. The example below sets @samp{:noweb} header arguments to @samp{yes}, which makes
  14148. Org expand @samp{:noweb} references by default.
  14149. @lisp
  14150. (setq org-babel-default-header-args
  14151. (cons '(:noweb . "yes")
  14152. (assq-delete-all :noweb org-babel-default-header-args)))
  14153. @end lisp
  14154. @cindex language specific default header arguments
  14155. @cindex default header arguments per language
  14156. Each language can have separate default header arguments by
  14157. customizing the variable @code{org-babel-default-header-args:<LANG>}, where
  14158. @var{<LANG>} is the name of the language. For details, see the
  14159. language-specific online documentation at
  14160. @uref{https://orgmode.org/worg/org-contrib/babel/}.
  14161. @anchor{Header arguments in Org mode properties}
  14162. @subheading Header arguments in Org mode properties
  14163. For header arguments applicable to the buffer, use @samp{PROPERTY} keyword
  14164. anywhere in the Org file (see @ref{Property Syntax}).
  14165. The following example makes all the R code blocks execute in the same
  14166. session. Setting @samp{:results} to @samp{silent} ignores the results of
  14167. executions for all blocks, not just R code blocks; no results inserted
  14168. for any block.
  14169. @example
  14170. #+PROPERTY: header-args:R :session *R*
  14171. #+PROPERTY: header-args :results silent
  14172. @end example
  14173. @vindex org-use-property-inheritance
  14174. Header arguments set through Org's property drawers (see @ref{Property Syntax}) apply at the sub-tree level on down. Since these property
  14175. drawers can appear anywhere in the file hierarchy, Org uses outermost
  14176. call or source block to resolve the values. Org ignores
  14177. @code{org-use-property-inheritance} setting.
  14178. In this example, @samp{:cache} defaults to @samp{yes} for all code blocks in the
  14179. sub-tree.
  14180. @example
  14181. * sample header
  14182. :PROPERTIES:
  14183. :header-args: :cache yes
  14184. :END:
  14185. @end example
  14186. @kindex C-c C-x p
  14187. @findex org-set-property
  14188. Properties defined through @code{org-set-property} function, bound to
  14189. @kbd{C-c C-x p}, apply to all active languages. They override
  14190. properties set in @code{org-babel-default-header-args}.
  14191. @cindex language specific header arguments properties
  14192. @cindex header arguments per language
  14193. Language-specific header arguments are also read from properties
  14194. @samp{header-args:<LANG>} where @var{<LANG>} is the language
  14195. identifier. For example,
  14196. @example
  14197. * Heading
  14198. :PROPERTIES:
  14199. :header-args:clojure: :session *clojure-1*
  14200. :header-args:R: :session *R*
  14201. :END:
  14202. ** Subheading
  14203. :PROPERTIES:
  14204. :header-args:clojure: :session *clojure-2*
  14205. :END:
  14206. @end example
  14207. @noindent
  14208. would force separate sessions for Clojure blocks in @samp{Heading} and
  14209. @samp{Subheading}, but use the same session for all R blocks. Blocks in
  14210. @samp{Subheading} inherit settings from @samp{Heading}.
  14211. @anchor{Code block specific header arguments}
  14212. @subheading Code block specific header arguments
  14213. Header arguments are most commonly set at the source code block level,
  14214. on the @samp{#+BEGIN_SRC} line. Arguments set at this level take
  14215. precedence over those set in the @code{org-babel-default-header-args}
  14216. variable, and also those set as header properties.
  14217. In the following example, setting @samp{:results} to @samp{silent} makes it
  14218. ignore results of the code execution. Setting @samp{:exports} to @samp{code}
  14219. exports only the body of the code block to HTML or @LaTeX{}.
  14220. @example
  14221. #+NAME: factorial
  14222. #+BEGIN_SRC haskell :results silent :exports code :var n=0
  14223. fac 0 = 1
  14224. fac n = n * fac (n-1)
  14225. #+END_SRC
  14226. @end example
  14227. The same header arguments in an inline code block:
  14228. @example
  14229. src_haskell[:exports both]@{fac 5@}
  14230. @end example
  14231. @cindex @samp{HEADER}, keyword
  14232. Code block header arguments can span multiple lines using @samp{#+HEADER:}
  14233. on each line. Note that Org currently accepts the plural spelling of
  14234. @samp{#+HEADER:} only as a convenience for backward-compatibility. It may
  14235. be removed at some point.
  14236. Multi-line header arguments on an unnamed code block:
  14237. @example
  14238. #+HEADER: :var data1=1
  14239. #+BEGIN_SRC emacs-lisp :var data2=2
  14240. (message "data1:%S, data2:%S" data1 data2)
  14241. #+END_SRC
  14242. #+RESULTS:
  14243. : data1:1, data2:2
  14244. @end example
  14245. Multi-line header arguments on a named code block:
  14246. @example
  14247. #+NAME: named-block
  14248. #+HEADER: :var data=2
  14249. #+BEGIN_SRC emacs-lisp
  14250. (message "data:%S" data)
  14251. #+END_SRC
  14252. #+RESULTS: named-block
  14253. : data:2
  14254. @end example
  14255. @anchor{Header arguments in function calls}
  14256. @subheading Header arguments in function calls
  14257. Header arguments in function calls are the most specific and override
  14258. all other settings in case of an overlap. They get the highest
  14259. priority. Two @samp{#+CALL:} examples are shown below. For the complete
  14260. syntax of @samp{CALL} keyword, see @ref{Evaluating Code Blocks}.
  14261. In this example, @samp{:exports results} header argument is applied to the
  14262. evaluation of the @samp{#+CALL:} line.
  14263. @example
  14264. #+CALL: factorial(n=5) :exports results
  14265. @end example
  14266. In this example, @samp{:session special} header argument is applied to the
  14267. evaluation of @samp{factorial} code block.
  14268. @example
  14269. #+CALL: factorial[:session special](n=5)
  14270. @end example
  14271. @node Environment of a Code Block
  14272. @section Environment of a Code Block
  14273. @anchor{Passing arguments}
  14274. @subheading Passing arguments
  14275. @cindex passing arguments to code blocks
  14276. @cindex arguments, in code blocks
  14277. @cindex @samp{var}, header argument
  14278. Use @samp{var} for passing arguments to source code blocks. The specifics
  14279. of variables in code blocks vary by the source language and are
  14280. covered in the language-specific documentation. The syntax for @samp{var},
  14281. however, is the same for all languages. This includes declaring
  14282. a variable, and assigning a default value.
  14283. The following syntax is used to pass arguments to code blocks using
  14284. the @samp{var} header argument.
  14285. @example
  14286. :var NAME=ASSIGN
  14287. @end example
  14288. @noindent
  14289. @var{NAME} is the name of the variable bound in the code block
  14290. body. @var{ASSIGN} is a literal value, such as a string,
  14291. a number, a reference to a table, a list, a literal example, another
  14292. code block---with or without arguments---or the results of evaluating
  14293. a code block.
  14294. Here are examples of passing values by reference:
  14295. @table @asis
  14296. @item table
  14297. A table named with a @samp{NAME} keyword.
  14298. @example
  14299. #+NAME: example-table
  14300. | 1 |
  14301. | 2 |
  14302. | 3 |
  14303. | 4 |
  14304. #+NAME: table-length
  14305. #+BEGIN_SRC emacs-lisp :var table=example-table
  14306. (length table)
  14307. #+END_SRC
  14308. #+RESULTS: table-length
  14309. : 4
  14310. @end example
  14311. When passing a table, you can treat specially the row, or the
  14312. column, containing labels for the columns, or the rows, in the
  14313. table.
  14314. @cindex @samp{colnames}, header argument
  14315. The @samp{colnames} header argument accepts @samp{yes}, @samp{no}, or @samp{nil}
  14316. values. The default value is @samp{nil}: if an input table has column
  14317. names---because the second row is a horizontal rule---then Org
  14318. removes the column names, processes the table, puts back the
  14319. column names, and then writes the table to the results block.
  14320. Using @samp{yes}, Org does the same to the first row, even if the
  14321. initial table does not contain any horizontal rule. When set to
  14322. @samp{no}, Org does not pre-process column names at all.
  14323. @example
  14324. #+NAME: less-cols
  14325. | a |
  14326. |---|
  14327. | b |
  14328. | c |
  14329. #+BEGIN_SRC python :var tab=less-cols :colnames nil
  14330. return [[val + '*' for val in row] for row in tab]
  14331. #+END_SRC
  14332. #+RESULTS:
  14333. | a |
  14334. |----|
  14335. | b* |
  14336. | c* |
  14337. @end example
  14338. @cindex @samp{rownames}, header argument
  14339. Similarly, the @samp{rownames} header argument can take two values:
  14340. @samp{yes} or @samp{no}. When set to @samp{yes}, Org removes the first column,
  14341. processes the table, puts back the first column, and then writes
  14342. the table to the results block. The default is @samp{no}, which means
  14343. Org does not pre-process the first column. Note that Emacs Lisp
  14344. code blocks ignore @samp{rownames} header argument because of the ease
  14345. of table-handling in Emacs.
  14346. @example
  14347. #+NAME: with-rownames
  14348. | one | 1 | 2 | 3 | 4 | 5 |
  14349. | two | 6 | 7 | 8 | 9 | 10 |
  14350. #+BEGIN_SRC python :var tab=with-rownames :rownames yes
  14351. return [[val + 10 for val in row] for row in tab]
  14352. #+END_SRC
  14353. #+RESULTS:
  14354. | one | 11 | 12 | 13 | 14 | 15 |
  14355. | two | 16 | 17 | 18 | 19 | 20 |
  14356. @end example
  14357. @item list
  14358. A simple named list.
  14359. @example
  14360. #+NAME: example-list
  14361. - simple
  14362. - not
  14363. - nested
  14364. - list
  14365. #+BEGIN_SRC emacs-lisp :var x=example-list
  14366. (print x)
  14367. #+END_SRC
  14368. #+RESULTS:
  14369. | simple | list |
  14370. @end example
  14371. Note that only the top level list items are passed along. Nested
  14372. list items are ignored.
  14373. @item code block without arguments
  14374. A code block name, as assigned by @samp{NAME} keyword from the example
  14375. above, optionally followed by parentheses.
  14376. @example
  14377. #+BEGIN_SRC emacs-lisp :var length=table-length()
  14378. (* 2 length)
  14379. #+END_SRC
  14380. #+RESULTS:
  14381. : 8
  14382. @end example
  14383. @item code block with arguments
  14384. A code block name, as assigned by @samp{NAME} keyword, followed by
  14385. parentheses and optional arguments passed within the parentheses.
  14386. @example
  14387. #+NAME: double
  14388. #+BEGIN_SRC emacs-lisp :var input=8
  14389. (* 2 input)
  14390. #+END_SRC
  14391. #+RESULTS: double
  14392. : 16
  14393. #+NAME: squared
  14394. #+BEGIN_SRC emacs-lisp :var input=double(input=1)
  14395. (* input input)
  14396. #+END_SRC
  14397. #+RESULTS: squared
  14398. : 4
  14399. @end example
  14400. @item literal example
  14401. A literal example block named with a @samp{NAME} keyword.
  14402. @example
  14403. #+NAME: literal-example
  14404. #+BEGIN_EXAMPLE
  14405. A literal example
  14406. on two lines
  14407. #+END_EXAMPLE
  14408. #+NAME: read-literal-example
  14409. #+BEGIN_SRC emacs-lisp :var x=literal-example
  14410. (concatenate #'string x " for you.")
  14411. #+END_SRC
  14412. #+RESULTS: read-literal-example
  14413. : A literal example
  14414. : on two lines for you.
  14415. @end example
  14416. @end table
  14417. Indexing variable values enables referencing portions of a variable.
  14418. Indexes are 0 based with negative values counting backwards from the
  14419. end. If an index is separated by commas then each subsequent section
  14420. indexes as the next dimension. Note that this indexing occurs
  14421. @emph{before} other table-related header arguments are applied, such as
  14422. @samp{hlines}, @samp{colnames} and @samp{rownames}. The following example assigns
  14423. the last cell of the first row the table @samp{example-table} to the
  14424. variable @samp{data}:
  14425. @example
  14426. #+NAME: example-table
  14427. | 1 | a |
  14428. | 2 | b |
  14429. | 3 | c |
  14430. | 4 | d |
  14431. #+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
  14432. data
  14433. #+END_SRC
  14434. #+RESULTS:
  14435. : a
  14436. @end example
  14437. Two integers separated by a colon reference a range of variable
  14438. values. In that case the entire inclusive range is referenced. For
  14439. example the following assigns the middle three rows of @samp{example-table}
  14440. to @samp{data}.
  14441. @example
  14442. #+NAME: example-table
  14443. | 1 | a |
  14444. | 2 | b |
  14445. | 3 | c |
  14446. | 4 | d |
  14447. | 5 | 3 |
  14448. #+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
  14449. data
  14450. #+END_SRC
  14451. #+RESULTS:
  14452. | 2 | b |
  14453. | 3 | c |
  14454. | 4 | d |
  14455. @end example
  14456. To pick the entire range, use an empty index, or the single character
  14457. @samp{*}. @samp{0:-1} does the same thing. Example below shows how to
  14458. reference the first column only.
  14459. @example
  14460. #+NAME: example-table
  14461. | 1 | a |
  14462. | 2 | b |
  14463. | 3 | c |
  14464. | 4 | d |
  14465. #+BEGIN_SRC emacs-lisp :var data=example-table[,0]
  14466. data
  14467. #+END_SRC
  14468. #+RESULTS:
  14469. | 1 | 2 | 3 | 4 |
  14470. @end example
  14471. Index referencing can be used for tables and code blocks. Index
  14472. referencing can handle any number of dimensions. Commas delimit
  14473. multiple dimensions, as shown below.
  14474. @example
  14475. #+NAME: 3D
  14476. #+BEGIN_SRC emacs-lisp
  14477. '(((1 2 3) (4 5 6) (7 8 9))
  14478. ((10 11 12) (13 14 15) (16 17 18))
  14479. ((19 20 21) (22 23 24) (25 26 27)))
  14480. #+END_SRC
  14481. #+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
  14482. data
  14483. #+END_SRC
  14484. #+RESULTS:
  14485. | 11 | 14 | 17 |
  14486. @end example
  14487. Note that row names and column names are not removed prior to variable
  14488. indexing. You need to take them into account, even when @samp{colnames} or
  14489. @samp{rownames} header arguments remove them.
  14490. Emacs lisp code can also set the values for variables. To
  14491. differentiate a value from Lisp code, Org interprets any value
  14492. starting with @samp{(}, @samp{[}, @samp{'} or @samp{`} as Emacs Lisp code. The result of
  14493. evaluating that code is then assigned to the value of that variable.
  14494. The following example shows how to reliably query and pass the file
  14495. name of the Org mode buffer to a code block using headers. We need
  14496. reliability here because the file's name could change once the code in
  14497. the block starts executing.
  14498. @example
  14499. #+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
  14500. wc -w $filename
  14501. #+END_SRC
  14502. @end example
  14503. Note that values read from tables and lists are not mistakenly
  14504. evaluated as Emacs Lisp code, as illustrated in the following example.
  14505. @example
  14506. #+NAME: table
  14507. | (a b c) |
  14508. #+HEADER: :var data=table[0,0]
  14509. #+BEGIN_SRC perl
  14510. $data
  14511. #+END_SRC
  14512. #+RESULTS:
  14513. : (a b c)
  14514. @end example
  14515. @anchor{Using sessions}
  14516. @subheading Using sessions
  14517. @cindex using sessions in code blocks
  14518. @cindex @samp{session}, header argument
  14519. Two code blocks can share the same environment. The @samp{session} header
  14520. argument is for running multiple source code blocks under one session.
  14521. Org runs code blocks with the same session name in the same
  14522. interpreter process.
  14523. @table @asis
  14524. @item @samp{none}
  14525. Default. Each code block gets a new interpreter process to
  14526. execute. The process terminates once the block is evaluated.
  14527. @item @var{STRING}
  14528. Any string besides @samp{none} turns that string into the name of that
  14529. session. For example, @samp{:session STRING} names it @samp{STRING}. If
  14530. @samp{session} has no value, then the session name is derived from the
  14531. source language identifier. Subsequent blocks with the same
  14532. source code language use the same session. Depending on the
  14533. language, state variables, code from other blocks, and the
  14534. overall interpreted environment may be shared. Some interpreted
  14535. languages support concurrent sessions when subsequent source code
  14536. language blocks change session names.
  14537. @end table
  14538. Only languages that provide interactive evaluation can have session
  14539. support. Not all languages provide this support, such as C and ditaa.
  14540. Even languages, such as Python and Haskell, that do support
  14541. interactive evaluation impose limitations on allowable language
  14542. constructs that can run interactively. Org inherits those limitations
  14543. for those code blocks running in a session.
  14544. @anchor{Choosing a working directory}
  14545. @subheading Choosing a working directory
  14546. @cindex working directory, in a code block
  14547. @cindex @samp{dir}, header argument
  14548. The @samp{dir} header argument specifies the default directory during code
  14549. block execution. If it is absent, then the directory associated with
  14550. the current buffer is used. In other words, supplying @samp{:dir PATH}
  14551. temporarily has the same effect as changing the current directory with
  14552. @kbd{M-x cd PATH}, and then not setting @samp{dir}. Under the
  14553. surface, @samp{dir} simply sets the value of the Emacs variable
  14554. @code{default-directory}.
  14555. For example, to save the plot file in the @samp{Work/} folder of the home
  14556. directory---notice tilde is expanded:
  14557. @example
  14558. #+BEGIN_SRC R :file myplot.png :dir ~/Work
  14559. matplot(matrix(rnorm(100), 10), type="l")
  14560. #+END_SRC
  14561. @end example
  14562. To evaluate the code block on a remote machine, supply a remote
  14563. directory name using Tramp syntax. For example:
  14564. @example
  14565. #+BEGIN_SRC R :file plot.png :dir /scp:dand@@yakuba.princeton.edu:
  14566. plot(1:10, main=system("hostname", intern=TRUE))
  14567. #+END_SRC
  14568. @end example
  14569. Org first captures the text results as usual for insertion in the Org
  14570. file. Then Org also inserts a link to the remote file, thanks to
  14571. Emacs Tramp. Org constructs the remote path to the file name from
  14572. @samp{dir} and @code{default-directory}, as illustrated here:
  14573. @example
  14574. [[file:/scp:dand@@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
  14575. @end example
  14576. When @samp{dir} is used with @samp{session}, Org sets the starting directory for
  14577. a new session. But Org does not alter the directory of an already
  14578. existing session.
  14579. Do not use @samp{dir} with @samp{:exports results} or with @samp{:exports both} to
  14580. avoid Org inserting incorrect links to remote files. That is because
  14581. Org does not expand @code{default directory} to avoid some underlying
  14582. portability issues.
  14583. @anchor{Inserting headers and footers}
  14584. @subheading Inserting headers and footers
  14585. @cindex headers, in code blocks
  14586. @cindex footers, in code blocks
  14587. @cindex @samp{prologue}, header argument
  14588. The @samp{prologue} header argument is for appending to the top of the code
  14589. block for execution, like a reset instruction. For example, you may
  14590. use @samp{:prologue "reset"} in a Gnuplot code block or, for every such
  14591. block:
  14592. @lisp
  14593. (add-to-list 'org-babel-default-header-args:gnuplot
  14594. '((:prologue . "reset")))
  14595. @end lisp
  14596. @cindex @samp{epilogue}, header argument
  14597. Likewise, the value of the @samp{epilogue} header argument is for appending
  14598. to the end of the code block for execution.
  14599. @node Evaluating Code Blocks
  14600. @section Evaluating Code Blocks
  14601. @cindex code block, evaluating
  14602. @cindex source code, evaluating
  14603. @cindex @samp{RESULTS}, keyword
  14604. A note about security: With code evaluation comes the risk of harm.
  14605. Org safeguards by prompting for user's permission before executing any
  14606. code in the source block. To customize this safeguard, or disable it,
  14607. see @ref{Code Evaluation Security}.
  14608. @anchor{How to evaluate source code}
  14609. @subheading How to evaluate source code
  14610. Org captures the results of the code block evaluation and inserts them
  14611. in the Org file, right after the code block. The insertion point is
  14612. after a newline and the @samp{RESULTS} keyword. Org creates the @samp{RESULTS}
  14613. keyword if one is not already there.
  14614. By default, Org enables only Emacs Lisp code blocks for execution.
  14615. See @ref{Languages} to enable other languages.
  14616. @kindex C-c C-c
  14617. @kindex C-c C-v e
  14618. @findex org-babel-execute-src-block
  14619. Org provides many ways to execute code blocks. @kbd{C-c C-c} or
  14620. @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
  14621. to remove code evaluation from the @kbd{C-c C-c} key binding.} calls the
  14622. @code{org-babel-execute-src-block} function, which executes the code in the
  14623. block, collects the results, and inserts them in the buffer.
  14624. @cindex @samp{CALL}, keyword
  14625. @vindex org-babel-inline-result-wrap
  14626. By calling a named code block@footnote{Actually, the constructs @samp{call_<name>()} and @samp{src_<lang>@{@}}
  14627. are not evaluated when they appear in a keyword line---i.e. lines
  14628. starting with @samp{#+KEYWORD:}, see @ref{In-buffer Settings}.} from an Org mode buffer or
  14629. a table. Org can call the named code blocks from the current Org mode
  14630. buffer or from the ``Library of Babel'' (see @ref{Library of Babel}).
  14631. The syntax for @samp{CALL} keyword is:
  14632. @example
  14633. #+CALL: <name>(<arguments>)
  14634. #+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
  14635. @end example
  14636. The syntax for inline named code blocks is:
  14637. @example
  14638. ... call_<name>(<arguments>) ...
  14639. ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
  14640. @end example
  14641. When inline syntax is used, the result is wrapped based on the
  14642. variable @code{org-babel-inline-result-wrap}, which by default is set to
  14643. @code{"=%s="} to produce verbatim text suitable for markup.
  14644. @table @asis
  14645. @item @samp{<name>}
  14646. 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
  14647. located in another file, start @samp{<name>} with the file name
  14648. followed by a colon. For example, in order to execute a block
  14649. named @samp{clear-data} in @samp{file.org}, you can write the following:
  14650. @example
  14651. #+CALL: file.org:clear-data()
  14652. @end example
  14653. @item @samp{<arguments>}
  14654. Org passes arguments to the code block using standard function
  14655. call syntax. For example, a @samp{#+CALL:} line that passes @samp{4} to
  14656. a code block named @samp{double}, which declares the header argument
  14657. @samp{:var n=2}, would be written as:
  14658. @example
  14659. #+CALL: double(n=4)
  14660. @end example
  14661. @noindent
  14662. Note how this function call syntax is different from the header
  14663. argument syntax.
  14664. @item @samp{<inside header arguments>}
  14665. Org passes inside header arguments to the named code block using
  14666. the header argument syntax. Inside header arguments apply to
  14667. code block evaluation. For example, @samp{[:results output]} collects
  14668. results printed to stdout during code execution of that block.
  14669. Note how this header argument syntax is different from the
  14670. function call syntax.
  14671. @item @samp{<end header arguments>}
  14672. End header arguments affect the results returned by the code
  14673. block. For example, @samp{:results html} wraps the results in
  14674. a @samp{#+BEGIN_EXPORT html} block before inserting the results in the
  14675. Org buffer.
  14676. @end table
  14677. @anchor{Limit code block evaluation}
  14678. @subheading Limit code block evaluation
  14679. @cindex @samp{eval}, header argument
  14680. @cindex control code block evaluation
  14681. The @samp{eval} header argument can limit evaluation of specific code
  14682. blocks and @samp{CALL} keyword. It is useful for protection against
  14683. evaluating untrusted code blocks by prompting for a confirmation.
  14684. @table @asis
  14685. @item @samp{never} or @samp{no}
  14686. Org never evaluates the source code.
  14687. @item @samp{query}
  14688. Org prompts the user for permission to evaluate the source code.
  14689. @item @samp{never-export} or @samp{no-export}
  14690. Org does not evaluate the source code when exporting, yet the
  14691. user can evaluate it interactively.
  14692. @item @samp{query-export}
  14693. Org prompts the user for permission to evaluate the source code
  14694. during export.
  14695. @end table
  14696. If @samp{eval} header argument is not set, then Org determines whether to
  14697. evaluate the source code from the @code{org-confirm-babel-evaluate}
  14698. variable (see @ref{Code Evaluation Security}).
  14699. @anchor{Cache results of evaluation}
  14700. @subheading Cache results of evaluation
  14701. @cindex @samp{cache}, header argument
  14702. @cindex cache results of code evaluation
  14703. The @samp{cache} header argument is for caching results of evaluating code
  14704. blocks. Caching results can avoid re-evaluating a code block that
  14705. have not changed since the previous run. To benefit from the cache
  14706. and avoid redundant evaluations, the source block must have a result
  14707. already present in the buffer, and neither the header
  14708. arguments---including the value of @samp{var} references---nor the text of
  14709. the block itself has changed since the result was last computed. This
  14710. feature greatly helps avoid long-running calculations. For some edge
  14711. cases, however, the cached results may not be reliable.
  14712. The caching feature is best for when code blocks are pure functions,
  14713. that is functions that return the same value for the same input
  14714. arguments (see @ref{Environment of a Code Block}), and that do not have
  14715. side effects, and do not rely on external variables other than the
  14716. input arguments. Functions that depend on a timer, file system
  14717. objects, and random number generators are clearly unsuitable for
  14718. caching.
  14719. A note of warning: when @samp{cache} is used in a session, caching may
  14720. cause unexpected results.
  14721. When the caching mechanism tests for any source code changes, it does
  14722. not expand Noweb style references (see @ref{Noweb Reference Syntax}). For
  14723. reasons why, see @uref{http://thread.gmane.org/gmane.emacs.orgmode/79046}.
  14724. The @samp{cache} header argument can have one of two values: @samp{yes} or @samp{no}.
  14725. @table @asis
  14726. @item @samp{no}
  14727. Default. No caching of results; code block evaluated every
  14728. time.
  14729. @item @samp{yes}
  14730. Whether to run the code or return the cached results is
  14731. determined by comparing the SHA1 hash value of the combined code
  14732. block and arguments passed to it. This hash value is packed on
  14733. the @samp{#+RESULTS:} line from previous evaluation. When hash values
  14734. match, Org does not evaluate the code block. When hash values
  14735. mismatch, Org evaluates the code block, inserts the results,
  14736. recalculates the hash value, and updates @samp{#+RESULTS:} line.
  14737. @end table
  14738. In this example, both functions are cached. But @samp{caller} runs only if
  14739. the result from @samp{random} has changed since the last run.
  14740. @example
  14741. #+NAME: random
  14742. #+BEGIN_SRC R :cache yes
  14743. runif(1)
  14744. #+END_SRC
  14745. #+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
  14746. 0.4659510825295
  14747. #+NAME: caller
  14748. #+BEGIN_SRC emacs-lisp :var x=random :cache yes
  14749. x
  14750. #+END_SRC
  14751. #+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
  14752. 0.254227238707244
  14753. @end example
  14754. @node Results of Evaluation
  14755. @section Results of Evaluation
  14756. @cindex code block, results of evaluation
  14757. @cindex source code, results of evaluation
  14758. @cindex @samp{results}, header argument
  14759. How Org handles results of a code block execution depends on many
  14760. header arguments working together. The primary determinant, however,
  14761. is the @samp{results} header argument. It accepts four classes of options.
  14762. Each code block can take only one option per class:
  14763. @table @asis
  14764. @item collection
  14765. For how the results should be collected from the code block;
  14766. @item type
  14767. For which type of result the code block will return; affects how
  14768. Org processes and inserts results in the Org buffer;
  14769. @item format
  14770. For the result; affects how Org processes and inserts results in
  14771. the Org buffer;
  14772. @item handling
  14773. For processing results after evaluation of the code block;
  14774. @end table
  14775. @anchor{Collection}
  14776. @subheading Collection
  14777. Collection options specify the results. Choose one of the options;
  14778. they are mutually exclusive.
  14779. @table @asis
  14780. @item @samp{value}
  14781. Default. Functional mode. Org gets the value by wrapping the
  14782. code in a function definition in the language of the source
  14783. block. That is why when using @samp{:results value}, code should
  14784. execute like a function and return a value. For languages like
  14785. Python, an explicit @code{return} statement is mandatory when using
  14786. @samp{:results value}. Result is the value returned by the last
  14787. statement in the code block.
  14788. When evaluating the code block in a session (see @ref{Environment of a Code Block}), Org passes the code to an interpreter running as
  14789. an interactive Emacs inferior process. Org gets the value from
  14790. the source code interpreter's last statement output. Org has to
  14791. use language-specific methods to obtain the value. For example,
  14792. from the variable @code{_} in Python and Ruby, and the value of
  14793. @code{.Last.value} in R.
  14794. @item @samp{output}
  14795. Scripting mode. Org passes the code to an external process
  14796. running the interpreter. Org returns the contents of the
  14797. standard output stream as text results.
  14798. When using a session, Org passes the code to the interpreter
  14799. running as an interactive Emacs inferior process. Org
  14800. concatenates any text output from the interpreter and returns the
  14801. collection as a result.
  14802. Note that this collection is not the same as that would be
  14803. collected from stdout of a non-interactive interpreter running as
  14804. an external process. Compare for example these two blocks:
  14805. @example
  14806. #+BEGIN_SRC python :results output
  14807. print "hello"
  14808. 2
  14809. print "bye"
  14810. #+END_SRC
  14811. #+RESULTS:
  14812. : hello
  14813. : bye
  14814. @end example
  14815. In the above non-session mode, the ``2'' is not printed; so it does
  14816. not appear in results.
  14817. @example
  14818. #+BEGIN_SRC python :results output :session
  14819. print "hello"
  14820. 2
  14821. print "bye"
  14822. #+END_SRC
  14823. #+RESULTS:
  14824. : hello
  14825. : 2
  14826. : bye
  14827. @end example
  14828. In the above session, the interactive interpreter receives and
  14829. prints ``2''. Results show that.
  14830. @end table
  14831. @anchor{Type}
  14832. @subheading Type
  14833. Type tells what result types to expect from the execution of the code
  14834. block. Choose one of the options; they are mutually exclusive. The
  14835. default behavior is to automatically determine the result type.
  14836. @table @asis
  14837. @item @samp{table}
  14838. @itemx @samp{vector}
  14839. Interpret the results as an Org table. If the result is a single
  14840. value, create a table with one row and one column. Usage
  14841. example: @samp{:results value table}.
  14842. @cindex @samp{hlines}, header argument
  14843. In-between each table row or below the table headings, sometimes
  14844. results have horizontal lines, which are also known as ``hlines''.
  14845. The @samp{hlines} argument with the default @samp{no} value strips such
  14846. lines from the input table. For most code, this is desirable, or
  14847. else those @samp{hline} symbols raise unbound variable errors.
  14848. A @samp{yes} accepts such lines, as demonstrated in the following
  14849. example.
  14850. @example
  14851. #+NAME: many-cols
  14852. | a | b | c |
  14853. |---+---+---|
  14854. | d | e | f |
  14855. |---+---+---|
  14856. | g | h | i |
  14857. #+NAME: no-hline
  14858. #+BEGIN_SRC python :var tab=many-cols :hlines no
  14859. return tab
  14860. #+END_SRC
  14861. #+RESULTS: no-hline
  14862. | a | b | c |
  14863. | d | e | f |
  14864. | g | h | i |
  14865. #+NAME: hlines
  14866. #+BEGIN_SRC python :var tab=many-cols :hlines yes
  14867. return tab
  14868. #+END_SRC
  14869. #+RESULTS: hlines
  14870. | a | b | c |
  14871. |---+---+---|
  14872. | d | e | f |
  14873. |---+---+---|
  14874. | g | h | i |
  14875. @end example
  14876. @item @samp{list}
  14877. Interpret the results as an Org list. If the result is a single
  14878. value, create a list of one element.
  14879. @item @samp{scalar}
  14880. @itemx @samp{verbatim}
  14881. Interpret literally and insert as quoted text. Do not create
  14882. a table. Usage example: @samp{:results value verbatim}.
  14883. @item @samp{file}
  14884. Interpret as a filename. Save the results of execution of the
  14885. code block to that file, then insert a link to it. You can
  14886. control both the filename and the description associated to the
  14887. link.
  14888. @cindex @samp{file}, header argument
  14889. @cindex @samp{output-dir}, header argument
  14890. Org first tries to generate the filename from the value of the
  14891. @samp{file} header argument and the directory specified using the
  14892. @samp{output-dir} header arguments. If @samp{output-dir} is not specified,
  14893. Org assumes it is the current directory.
  14894. @example
  14895. #+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/
  14896. size(2cm);
  14897. draw(unitcircle);
  14898. #+END_SRC
  14899. @end example
  14900. @cindex @samp{file-ext}, header argument
  14901. If @samp{file} is missing, Org generates the base name of the output
  14902. file from the name of the code block, and its extension from the
  14903. @samp{file-ext} header argument. In that case, both the name and the
  14904. extension are mandatory.
  14905. @example
  14906. #+name: circle
  14907. #+BEGIN_SRC asymptote :results value file :file-ext pdf
  14908. size(2cm);
  14909. draw(unitcircle);
  14910. #+END_SRC
  14911. @end example
  14912. @cindex @samp{file-desc}, header argument
  14913. The @samp{file-desc} header argument defines the description (see
  14914. @ref{Link Format}) for the link. If @samp{file-desc} has no value, Org
  14915. uses the generated file name for both the ``link'' and
  14916. ``description'' parts of the link.
  14917. @end table
  14918. @anchor{Format}
  14919. @subheading Format
  14920. Format pertains to the type of the result returned by the code block.
  14921. Choose one of the options; they are mutually exclusive. The default
  14922. follows from the type specified above.
  14923. @table @asis
  14924. @item @samp{raw}
  14925. Interpreted as raw Org mode. Inserted directly into the buffer.
  14926. Aligned if it is a table. Usage example: @samp{:results value raw}.
  14927. @item @samp{org}
  14928. Results enclosed in a @samp{BEGIN_SRC org} block. For comma-escape,
  14929. either @kbd{@key{TAB}} in the block, or export the file. Usage
  14930. example: @samp{:results value org}.
  14931. @item @samp{html}
  14932. Results enclosed in a @samp{BEGIN_EXPORT html} block. Usage example:
  14933. @samp{:results value html}.
  14934. @item @samp{latex}
  14935. Results enclosed in a @samp{BEGIN_EXPORT latex} block. Usage example:
  14936. @samp{:results value latex}.
  14937. @item @samp{code}
  14938. Result enclosed in a code block. Useful for parsing. Usage
  14939. example: @samp{:results value code}.
  14940. @item @samp{pp}
  14941. Result converted to pretty-print source code. Enclosed in a code
  14942. block. Languages supported: Emacs Lisp, Python, and Ruby. Usage
  14943. example: @samp{:results value pp}.
  14944. @item @samp{drawer}
  14945. Result wrapped in a @samp{RESULTS} drawer. Useful for containing
  14946. @samp{raw} or @samp{org} results for later scripting and automated
  14947. processing. Usage example: @samp{:results value drawer}.
  14948. @end table
  14949. @anchor{Handling}
  14950. @subheading Handling
  14951. Handling options after collecting the results.
  14952. @table @asis
  14953. @item @samp{silent}
  14954. Do not insert results in the Org mode buffer, but echo them in
  14955. the minibuffer. Usage example: @samp{:results output silent}.
  14956. @item @samp{replace}
  14957. Default. Insert results in the Org buffer. Remove previous
  14958. results. Usage example: @samp{:results output replace}.
  14959. @item @samp{append}
  14960. Append results to the Org buffer. Latest results are at the
  14961. bottom. Does not remove previous results. Usage example:
  14962. @samp{:results output append}.
  14963. @item @samp{prepend}
  14964. Prepend results to the Org buffer. Latest results are at the
  14965. top. Does not remove previous results. Usage example: @samp{:results
  14966. output prepend}.
  14967. @end table
  14968. @anchor{Post-processing}
  14969. @subheading Post-processing
  14970. @cindex @samp{post}, header argument
  14971. @cindex @samp{*this*}, in @samp{post} header argument
  14972. The @samp{post} header argument is for post-processing results from block
  14973. evaluation. When @samp{post} has any value, Org binds the results to
  14974. @code{*this*} variable for easy passing to @samp{var} header argument
  14975. specifications (see @ref{Environment of a Code Block}). That makes results
  14976. available to other code blocks, or even for direct Emacs Lisp code
  14977. execution.
  14978. The following two examples illustrate @samp{post} header argument in
  14979. action. The first one shows how to attach an @samp{ATTR_LATEX} keyword
  14980. using @samp{post}.
  14981. @example
  14982. #+NAME: attr_wrap
  14983. #+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output
  14984. echo "#+ATTR_LATEX: :width $width"
  14985. echo "$data"
  14986. #+END_SRC
  14987. #+HEADER: :file /tmp/it.png
  14988. #+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer
  14989. digraph@{
  14990. a -> b;
  14991. b -> c;
  14992. c -> a;
  14993. @}
  14994. #+end_src
  14995. #+RESULTS:
  14996. :RESULTS:
  14997. #+ATTR_LATEX :width 5cm
  14998. [[file:/tmp/it.png]]
  14999. :END:
  15000. @end example
  15001. The second example shows use of @samp{colnames} header argument in @samp{post}
  15002. to pass data between code blocks.
  15003. @example
  15004. #+NAME: round-tbl
  15005. #+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f"
  15006. (mapcar (lambda (row)
  15007. (mapcar (lambda (cell)
  15008. (if (numberp cell)
  15009. (format fmt cell)
  15010. cell))
  15011. row))
  15012. tbl)
  15013. #+end_src
  15014. #+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*)
  15015. set.seed(42)
  15016. data.frame(foo=rnorm(1))
  15017. #+END_SRC
  15018. #+RESULTS:
  15019. | foo |
  15020. |-------|
  15021. | 1.371 |
  15022. @end example
  15023. @node Exporting Code Blocks
  15024. @section Exporting Code Blocks
  15025. @cindex code block, exporting
  15026. @cindex source code, exporting
  15027. It is possible to export the @emph{code} of code blocks, the @emph{results} of
  15028. code block evaluation, @emph{both} the code and the results of code block
  15029. evaluation, or @emph{none}. Org defaults to exporting @emph{code} for most
  15030. languages. For some languages, such as ditaa, Org defaults to
  15031. @emph{results}. To export just the body of code blocks, see @ref{Literal Examples}. To selectively export sub-trees of an Org document, see
  15032. @ref{Exporting}.
  15033. @cindex @samp{export}, header argument
  15034. The @samp{exports} header argument is to specify if that part of the Org
  15035. file is exported to, say, HTML or @LaTeX{} formats.
  15036. @table @asis
  15037. @item @samp{code}
  15038. The default. The body of code is included into the exported
  15039. file. Example: @samp{:exports code}.
  15040. @item @samp{results}
  15041. The results of evaluation of the code is included in the exported
  15042. file. Example: @samp{:exports results}.
  15043. @item @samp{both}
  15044. Both the code and results of evaluation are included in the
  15045. exported file. Example: @samp{:exports both}.
  15046. @item @samp{none}
  15047. Neither the code nor the results of evaluation is included in the
  15048. exported file. Whether the code is evaluated at all depends on
  15049. other options. Example: @samp{:exports none}.
  15050. @end table
  15051. @vindex org-export-use-babel
  15052. To stop Org from evaluating code blocks to speed exports, use the
  15053. header argument @samp{:eval never-export} (see @ref{Evaluating Code Blocks}).
  15054. To stop Org from evaluating code blocks for greater security, set the
  15055. @code{org-export-use-babel} variable to @code{nil}, but understand that header
  15056. arguments will have no effect.
  15057. Turning off evaluation comes in handy when batch processing. For
  15058. example, markup languages for wikis, which have a high risk of
  15059. untrusted code. Stopping code block evaluation also stops evaluation
  15060. of all header arguments of the code block. This may not be desirable
  15061. in some circumstances. So during export, to allow evaluation of just
  15062. the header arguments but not any code evaluation in the source block,
  15063. set @samp{:eval never-export} (see @ref{Evaluating Code Blocks}).
  15064. Org never evaluates code blocks in commented sub-trees when exporting
  15065. (see @ref{Comment Lines}). On the other hand, Org does evaluate code
  15066. blocks in sub-trees excluded from export (see @ref{Export Settings}).
  15067. @node Extracting Source Code
  15068. @section Extracting Source Code
  15069. @cindex tangling
  15070. @cindex source code, extracting
  15071. @cindex code block, extracting source code
  15072. Extracting source code from code blocks is a basic task in literate
  15073. programming. Org has features to make this easy. In literate
  15074. programming parlance, documents on creation are @emph{woven} with code and
  15075. documentation, and on export, the code is tangled for execution by
  15076. a computer. Org facilitates weaving and tangling for producing,
  15077. maintaining, sharing, and exporting literate programming documents.
  15078. Org provides extensive customization options for extracting source
  15079. code.
  15080. When Org tangles code blocks, it expands, merges, and transforms them.
  15081. Then Org recomposes them into one or more separate files, as
  15082. configured through the options. During this tangling process, Org
  15083. expands variables in the source code, and resolves any Noweb style
  15084. references (see @ref{Noweb Reference Syntax}).
  15085. @anchor{Header arguments}
  15086. @subheading Header arguments
  15087. @cindex @samp{tangle}, header argument
  15088. The @samp{tangle} header argument specifies if the code block is exported
  15089. to source file(s).
  15090. @table @asis
  15091. @item @samp{yes}
  15092. Export the code block to source file. The file name for the
  15093. source file is derived from the name of the Org file, and the
  15094. file extension is derived from the source code language
  15095. identifier. Example: @samp{:tangle yes}.
  15096. @item @samp{no}
  15097. The default. Do not extract the code in a source code file.
  15098. Example: @samp{:tangle no}.
  15099. @item @var{FILENAME}
  15100. Export the code block to source file whose file name is derived
  15101. from any string passed to the @samp{tangle} header argument. Org
  15102. derives the file name as being relative to the directory of the
  15103. Org file's location. Example: @samp{:tangle FILENAME}.
  15104. @end table
  15105. @cindex @samp{mkdirp}, header argument
  15106. The @samp{mkdirp} header argument creates parent directories for tangled
  15107. files if the directory does not exist. @samp{yes} enables directory
  15108. creation and @samp{no} inhibits directory creation.
  15109. @cindex @samp{comments}, header argument
  15110. The @samp{comments} header argument controls inserting comments into
  15111. tangled files. These are above and beyond whatever comments may
  15112. already exist in the code block.
  15113. @table @asis
  15114. @item @samp{no}
  15115. The default. Do not insert any extra comments during tangling.
  15116. @item @samp{link}
  15117. Wrap the code block in comments. Include links pointing back to
  15118. the place in the Org file from where the code was tangled.
  15119. @item @samp{yes}
  15120. Kept for backward compatibility; same as @samp{link}.
  15121. @item @samp{org}
  15122. Nearest headline text from Org file is inserted as comment. The
  15123. exact text that is inserted is picked from the leading context of
  15124. the source block.
  15125. @item @samp{both}
  15126. Includes both @samp{link} and @samp{org} options.
  15127. @item @samp{noweb}
  15128. Includes @samp{link} option, expands Noweb references (see @ref{Noweb Reference Syntax}), and wraps them in link comments inside the
  15129. body of the code block.
  15130. @end table
  15131. @cindex @samp{padline}, header argument
  15132. The @samp{padline} header argument controls insertion of newlines to pad
  15133. source code in the tangled file.
  15134. @table @asis
  15135. @item @samp{yes}
  15136. Default. Insert a newline before and after each code block in
  15137. the tangled file.
  15138. @item @samp{no}
  15139. Do not insert newlines to pad the tangled code blocks.
  15140. @end table
  15141. @cindex @samp{shebang}, header argument
  15142. The @samp{shebang} header argument can turn results into executable script
  15143. files. By setting it to a string value---for example, @samp{:shebang
  15144. "#!/bin/bash"}---Org inserts that string as the first line of the
  15145. tangled file that the code block is extracted to. Org then turns on
  15146. the tangled file's executable permission.
  15147. @cindex @samp{no-expand}, header argument
  15148. By default Org expands code blocks during tangling. The @samp{no-expand}
  15149. header argument turns off such expansions. Note that one side-effect
  15150. of expansion by @code{org-babel-expand-src-block} also assigns values (see
  15151. @ref{Environment of a Code Block}) to variables. Expansions also replace
  15152. Noweb references with their targets (see @ref{Noweb Reference Syntax}).
  15153. Some of these expansions may cause premature assignment, hence this
  15154. option. This option makes a difference only for tangling. It has no
  15155. effect when exporting since code blocks for execution have to be
  15156. expanded anyway.
  15157. @anchor{Functions}
  15158. @subheading Functions
  15159. @table @asis
  15160. @item @code{org-babel-tangle}
  15161. @findex org-babel-tangle
  15162. @kindex C-c C-v t
  15163. Tangle the current file. Bound to @kbd{C-c C-v t}.
  15164. With prefix argument only tangle the current code block.
  15165. @item @code{org-babel-tangle-file}
  15166. @findex org-babel-tangle-file
  15167. @kindex C-c C-v f
  15168. Choose a file to tangle. Bound to @kbd{C-c C-v f}.
  15169. @end table
  15170. @anchor{Hooks (1)}
  15171. @subheading Hooks
  15172. @table @asis
  15173. @item @code{org-babel-post-tangle-hook}
  15174. @vindex org-babel-post-tangle-hook
  15175. This hook is run from within code files tangled by
  15176. @code{org-babel-tangle}, making it suitable for post-processing,
  15177. compilation, and evaluation of code in the tangled files.
  15178. @end table
  15179. @anchor{Jumping between code and Org}
  15180. @subheading Jumping between code and Org
  15181. @findex org-babel-tangle-jump-to-org
  15182. Debuggers normally link errors and messages back to the source code.
  15183. But for tangled files, we want to link back to the Org file, not to
  15184. the tangled source file. To make this extra jump, Org uses
  15185. @code{org-babel-tangle-jump-to-org} function with two additional source
  15186. code block header arguments:
  15187. @enumerate
  15188. @item
  15189. Set @samp{padline} to true---this is the default setting.
  15190. @item
  15191. Set @samp{comments} to @samp{link}, which makes Org insert links to the Org
  15192. file.
  15193. @end enumerate
  15194. @node Languages
  15195. @section Languages
  15196. @cindex babel, languages
  15197. @cindex source code, languages
  15198. @cindex code block, languages
  15199. Code blocks in the following languages are supported.
  15200. @multitable {aaaaaaaaaa} {aaaaaaaaaa} {aaaaaaaaaaaaaa} {aaaaaaaaaa}
  15201. @headitem Language
  15202. @tab Identifier
  15203. @tab Language
  15204. @tab Identifier
  15205. @item Asymptote
  15206. @tab asymptote
  15207. @tab Awk
  15208. @tab awk
  15209. @item C
  15210. @tab C
  15211. @tab C++
  15212. @tab C++
  15213. @item Clojure
  15214. @tab clojure
  15215. @tab CSS
  15216. @tab css
  15217. @item D
  15218. @tab d
  15219. @tab ditaa
  15220. @tab ditaa
  15221. @item Graphviz
  15222. @tab dot
  15223. @tab Emacs Calc
  15224. @tab calc
  15225. @item Emacs Lisp
  15226. @tab emacs-lisp
  15227. @tab Fortran
  15228. @tab fortran
  15229. @item Gnuplot
  15230. @tab gnuplot
  15231. @tab Haskell
  15232. @tab haskell
  15233. @item Java
  15234. @tab java
  15235. @tab Javascript
  15236. @tab js
  15237. @item @LaTeX{}
  15238. @tab latex
  15239. @tab Ledger
  15240. @tab ledger
  15241. @item Lisp
  15242. @tab lisp
  15243. @tab Lilypond
  15244. @tab lilypond
  15245. @item Lua
  15246. @tab lua
  15247. @tab MATLAB
  15248. @tab matlab
  15249. @item Mscgen
  15250. @tab mscgen
  15251. @tab Objective Caml
  15252. @tab ocaml
  15253. @item Octave
  15254. @tab octave
  15255. @tab Org mode
  15256. @tab org
  15257. @item Oz
  15258. @tab oz
  15259. @tab Perl
  15260. @tab perl
  15261. @item Plantuml
  15262. @tab plantuml
  15263. @tab Processing.js
  15264. @tab processing
  15265. @item Python
  15266. @tab python
  15267. @tab R
  15268. @tab R
  15269. @item Ruby
  15270. @tab ruby
  15271. @tab Sass
  15272. @tab sass
  15273. @item Scheme
  15274. @tab scheme
  15275. @tab GNU Screen
  15276. @tab screen
  15277. @item Sed
  15278. @tab sed
  15279. @tab shell
  15280. @tab sh
  15281. @item SQL
  15282. @tab sql
  15283. @tab SQLite
  15284. @tab sqlite
  15285. @item Vala
  15286. @tab vala
  15287. @tab
  15288. @tab
  15289. @end multitable
  15290. Additional documentation for some languages is at
  15291. @uref{https://orgmode.org/worg/org-contrib/babel/languages.html}.
  15292. @vindex org-babel-load-languages
  15293. By default, only Emacs Lisp is enabled for evaluation. To enable or
  15294. disable other languages, customize the @code{org-babel-load-languages}
  15295. variable either through the Emacs customization interface, or by
  15296. adding code to the init file as shown next.
  15297. In this example, evaluation is disabled for Emacs Lisp, and enabled
  15298. for R.
  15299. @lisp
  15300. (org-babel-do-load-languages
  15301. 'org-babel-load-languages
  15302. '((emacs-lisp . nil)
  15303. (R . t)))
  15304. @end lisp
  15305. Note that this is not the only way to enable a language. Org also
  15306. enables languages when loaded with @code{require} statement. For example,
  15307. the following enables execution of Clojure code blocks:
  15308. @lisp
  15309. (require 'ob-clojure)
  15310. @end lisp
  15311. @node Editing Source Code
  15312. @section Editing Source Code
  15313. @cindex code block, editing
  15314. @cindex source code, editing
  15315. @kindex C-c '
  15316. Use @kbd{C-c '} to edit the current code block. It opens a new
  15317. major-mode edit buffer containing the body of the source code block,
  15318. ready for any edits. Use @kbd{C-c '} again to close the buffer
  15319. and return to the Org buffer.
  15320. @kindex C-x C-s
  15321. @vindex org-edit-src-auto-save-idle-delay
  15322. @cindex auto-save, in code block editing
  15323. @kbd{C-x C-s} saves the buffer and updates the contents of the
  15324. Org buffer. Set @code{org-edit-src-auto-save-idle-delay} to save the base
  15325. buffer after a certain idle delay time. Set
  15326. @code{org-edit-src-turn-on-auto-save} to auto-save this buffer into
  15327. a separate file using Auto-save mode.
  15328. While editing the source code in the major mode, the Org Src minor
  15329. mode remains active. It provides these customization variables as
  15330. described below. For even more variables, look in the customization
  15331. group @code{org-edit-structure}.
  15332. @table @asis
  15333. @item @code{org-src-lang-modes}
  15334. @vindex org-src-lang-modes
  15335. If an Emacs major-mode named @code{<LANG>-mode} exists, where
  15336. @var{<LANG>} is the language identifier from code block's
  15337. header line, then the edit buffer uses that major mode. Use this
  15338. variable to arbitrarily map language identifiers to major modes.
  15339. @item @code{org-src-window-setup}
  15340. @vindex org-src-window-setup
  15341. For specifying Emacs window arrangement when the new edit buffer
  15342. is created.
  15343. @item @code{org-src-preserve-indentation}
  15344. @cindex indentation, in code blocks
  15345. @vindex org-src-preserve-indentation
  15346. Default is @code{nil}. Source code is indented. This indentation
  15347. applies during export or tangling, and depending on the context,
  15348. may alter leading spaces and tabs. When non-@code{nil}, source code
  15349. is aligned with the leftmost column. No lines are modified
  15350. during export or tangling, which is very useful for white-space
  15351. sensitive languages, such as Python.
  15352. @item @code{org-src-ask-before-returning-to-edit-buffer}
  15353. @vindex org-src-ask-before-returning-to-edit-buffer
  15354. When @code{nil}, Org returns to the edit buffer without further
  15355. prompts. The default prompts for a confirmation.
  15356. @end table
  15357. @vindex org-src-fontify-natively
  15358. @vindex org-src-block-faces
  15359. Set @code{org-src-fontify-natively} to non-@code{nil} to turn on native code
  15360. fontification in the @emph{Org} buffer. Fontification of code blocks can
  15361. give visual separation of text and code on the display page. To
  15362. further customize the appearance of @code{org-block} for specific
  15363. languages, customize @code{org-src-block-faces}. The following example
  15364. shades the background of regular blocks, and colors source blocks only
  15365. for Python and Emacs Lisp languages.
  15366. @lisp
  15367. (require 'color)
  15368. (set-face-attribute 'org-block nil :background
  15369. (color-darken-name
  15370. (face-attribute 'default :background) 3))
  15371. (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
  15372. ("python" (:background "#E5FFB8"))))
  15373. @end lisp
  15374. @node Noweb Reference Syntax
  15375. @section Noweb Reference Syntax
  15376. @cindex code block, Noweb reference
  15377. @cindex syntax, Noweb
  15378. @cindex source code, Noweb reference
  15379. Org supports named blocks in Noweb@footnote{For Noweb literate programming details, see
  15380. @uref{http://www.cs.tufts.edu/~nr/noweb/}.} style syntax:
  15381. @example
  15382. <<CODE-BLOCK-ID>>
  15383. @end example
  15384. Org can replace the construct with the source code, or the results of
  15385. evaluation, of the code block identified as @var{CODE-BLOCK-ID}.
  15386. @cindex @samp{noweb}, header argument
  15387. The @samp{noweb} header argument controls expansion of Noweb syntax
  15388. references. Expansions occur when source code blocks are evaluated,
  15389. tangled, or exported.
  15390. @table @asis
  15391. @item @samp{no}
  15392. Default. No expansion of Noweb syntax references in the body of
  15393. the code when evaluating, tangling, or exporting.
  15394. @item @samp{yes}
  15395. Expansion of Noweb syntax references in the body of the code
  15396. block when evaluating, tangling, or exporting.
  15397. @item @samp{tangle}
  15398. Expansion of Noweb syntax references in the body of the code
  15399. block when tangling. No expansion when evaluating or exporting.
  15400. @item @samp{no-export}
  15401. Expansion of Noweb syntax references in the body of the code
  15402. block when evaluating or tangling. No expansion when exporting.
  15403. @item @samp{strip-export}
  15404. Expansion of Noweb syntax references in the body of the code
  15405. block when expanding prior to evaluating or tangling. Removes
  15406. Noweb syntax references when exporting.
  15407. @item @samp{eval}
  15408. Expansion of Noweb syntax references in the body of the code
  15409. block only before evaluating.
  15410. @end table
  15411. In the following example,
  15412. @example
  15413. #+NAME: initialization
  15414. #+BEGIN_SRC emacs-lisp
  15415. (setq sentence "Never a foot too far, even.")
  15416. #+END_SRC
  15417. #+BEGIN_SRC emacs-lisp :noweb yes
  15418. <<initialization>>
  15419. (reverse sentence)
  15420. #+END_SRC
  15421. @end example
  15422. @noindent
  15423. the second code block is expanded as
  15424. @example
  15425. #+BEGIN_SRC emacs-lisp :noweb yes
  15426. (setq sentence "Never a foot too far, even.")
  15427. (reverse sentence)
  15428. #+END_SRC
  15429. @end example
  15430. Noweb insertions honor prefix characters that appear before the Noweb
  15431. syntax reference. This behavior is illustrated in the following
  15432. example. Because the @samp{<<example>>} Noweb reference appears behind the
  15433. SQL comment syntax, each line of the expanded Noweb reference is
  15434. commented. With:
  15435. @example
  15436. #+NAME: example
  15437. #+BEGIN_SRC text
  15438. this is the
  15439. multi-line body of example
  15440. #+END_SRC
  15441. @end example
  15442. @noindent
  15443. this code block:
  15444. @example
  15445. #+BEGIN_SRC sql :noweb yes
  15446. ---<<example>>
  15447. #+END_SRC
  15448. @end example
  15449. @noindent
  15450. expands to:
  15451. @example
  15452. #+BEGIN_SRC sql :noweb yes
  15453. ---this is the
  15454. ---multi-line body of example
  15455. #+END_SRC
  15456. @end example
  15457. Since this change does not affect Noweb replacement text without
  15458. newlines in them, inline Noweb references are acceptable.
  15459. This feature can also be used for management of indentation in
  15460. exported code snippets. With:
  15461. @example
  15462. #+NAME: if-true
  15463. #+BEGIN_SRC python :exports none
  15464. print('do things when true')
  15465. #+end_src
  15466. #+name: if-false
  15467. #+begin_src python :exports none
  15468. print('do things when false')
  15469. #+end_src
  15470. @end example
  15471. @noindent
  15472. this code block:
  15473. @example
  15474. #+begin_src python :noweb yes :results output
  15475. if true:
  15476. <<if-true>>
  15477. else:
  15478. <<if-false>>
  15479. #+end_src
  15480. @end example
  15481. @noindent
  15482. expands to:
  15483. @example
  15484. if true:
  15485. print('do things when true')
  15486. else:
  15487. print('do things when false')
  15488. @end example
  15489. @cindex @samp{noweb-ref}, header argument
  15490. When expanding Noweb style references, Org concatenates code blocks by
  15491. matching the reference name to either the code block name or, if none
  15492. is found, to the @samp{noweb-ref} header argument.
  15493. For simple concatenation, set this @samp{noweb-ref} header argument at the
  15494. sub-tree or file level. In the example Org file shown next, the body
  15495. of the source code in each block is extracted for concatenation to
  15496. a pure code file when tangled.
  15497. @example
  15498. #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
  15499. <<fullest-disk>>
  15500. #+END_SRC
  15501. * the mount point of the fullest disk
  15502. :PROPERTIES:
  15503. :header-args: :noweb-ref fullest-disk
  15504. :END:
  15505. ** query all mounted disks
  15506. #+BEGIN_SRC sh
  15507. df \
  15508. #+END_SRC
  15509. ** strip the header row
  15510. #+BEGIN_SRC sh
  15511. |sed '1d' \
  15512. #+END_SRC
  15513. ** output mount point of fullest disk
  15514. #+BEGIN_SRC sh
  15515. |awk '@{if (u < +$5) @{u = +$5; m = $6@}@} END @{print m@}'
  15516. #+END_SRC
  15517. @end example
  15518. @cindex @samp{noweb-sep}, header argument
  15519. By default a newline separates each noweb reference concatenation. To
  15520. change this newline separator, edit the @samp{noweb-sep} header argument.
  15521. Eventually, Org can include the results of a code block rather than
  15522. its body. To that effect, append parentheses, possibly including
  15523. arguments, to the code block name, as shown below.
  15524. @example
  15525. <<code-block-name(optional arguments)>>
  15526. @end example
  15527. Note that when using the above approach to a code block's results, the
  15528. code block name set by @samp{NAME} keyword is required; the reference set
  15529. by @samp{noweb-ref} does not work in that case.
  15530. Here is an example that demonstrates how the exported content changes
  15531. when Noweb style references are used with parentheses versus without.
  15532. With:
  15533. @example
  15534. #+NAME: some-code
  15535. #+BEGIN_SRC python :var num=0 :results output :exports none
  15536. print(num*10)
  15537. #+END_SRC
  15538. @end example
  15539. @noindent
  15540. this code block:
  15541. @example
  15542. #+BEGIN_SRC text :noweb yes
  15543. <<some-code>>
  15544. #+END_SRC
  15545. @end example
  15546. @noindent
  15547. expands to:
  15548. @example
  15549. print(num*10)
  15550. @end example
  15551. Below, a similar Noweb style reference is used, but with parentheses,
  15552. while setting a variable @samp{num} to 10:
  15553. @example
  15554. #+BEGIN_SRC text :noweb yes
  15555. <<some-code(num=10)>>
  15556. #+END_SRC
  15557. @end example
  15558. @noindent
  15559. Note that now the expansion contains the results of the code block
  15560. @samp{some-code}, not the code block itself:
  15561. @example
  15562. 100
  15563. @end example
  15564. @node Library of Babel
  15565. @section Library of Babel
  15566. @cindex babel, library of
  15567. @cindex source code, library
  15568. @cindex code block, library
  15569. The ``Library of Babel'' is a collection of code blocks. Like
  15570. a function library, these code blocks can be called from other Org
  15571. files. A collection of useful code blocks is available on @uref{https://orgmode.org/worg/library-of-babel.html, Worg}. For
  15572. remote code block evaluation syntax, see @ref{Evaluating Code Blocks}.
  15573. @kindex C-c C-v i
  15574. @findex org-babel-lob-ingest
  15575. For any user to add code to the library, first save the code in
  15576. regular code blocks of an Org file, and then load the Org file with
  15577. @code{org-babel-lob-ingest}, which is bound to @kbd{C-c C-v i}.
  15578. @node Key bindings and Useful Functions
  15579. @section Key bindings and Useful Functions
  15580. @cindex code block, key bindings
  15581. Many common Org mode key sequences are re-bound depending on
  15582. the context.
  15583. Active key bindings in code blocks:
  15584. @kindex C-c C-c
  15585. @findex org-babel-execute-src-block
  15586. @kindex C-c C-o
  15587. @findex org-babel-open-src-block-result
  15588. @kindex M-UP
  15589. @findex org-babel-load-in-session
  15590. @kindex M-DOWN
  15591. @findex org-babel-pop-to-session
  15592. @multitable @columnfractions 0.2 0.55
  15593. @headitem Key binding
  15594. @tab Function
  15595. @item @kbd{C-c C-c}
  15596. @tab @code{org-babel-execute-src-block}
  15597. @item @kbd{C-c C-o}
  15598. @tab @code{org-babel-open-src-block-result}
  15599. @item @kbd{M-@key{UP}}
  15600. @tab @code{org-babel-load-in-session}
  15601. @item @kbd{M-@key{DOWN}}
  15602. @tab @code{org-babel-pop-to-session}
  15603. @end multitable
  15604. Active key bindings in Org mode buffer:
  15605. @kindex C-c C-v p
  15606. @kindex C-c C-v C-p
  15607. @kindex C-c C-v n
  15608. @kindex C-c C-v C-n
  15609. @kindex C-c C-v e
  15610. @kindex C-c C-v C-e
  15611. @kindex C-c C-v o
  15612. @kindex C-c C-v C-o
  15613. @kindex C-c C-v v
  15614. @kindex C-c C-v C-v
  15615. @kindex C-c C-v u
  15616. @kindex C-c C-v C-u
  15617. @kindex C-c C-v g
  15618. @kindex C-c C-v C-g
  15619. @kindex C-c C-v r
  15620. @kindex C-c C-v C-r
  15621. @kindex C-c C-v b
  15622. @kindex C-c C-v C-b
  15623. @kindex C-c C-v s
  15624. @kindex C-c C-v C-s
  15625. @kindex C-c C-v d
  15626. @kindex C-c C-v C-d
  15627. @kindex C-c C-v t
  15628. @kindex C-c C-v C-t
  15629. @kindex C-c C-v f
  15630. @kindex C-c C-v C-f
  15631. @kindex C-c C-v c
  15632. @kindex C-c C-v C-c
  15633. @kindex C-c C-v j
  15634. @kindex C-c C-v C-j
  15635. @kindex C-c C-v l
  15636. @kindex C-c C-v C-l
  15637. @kindex C-c C-v i
  15638. @kindex C-c C-v C-i
  15639. @kindex C-c C-v I
  15640. @kindex C-c C-v C-I
  15641. @kindex C-c C-v z
  15642. @kindex C-c C-v C-z
  15643. @kindex C-c C-v a
  15644. @kindex C-c C-v C-a
  15645. @kindex C-c C-v h
  15646. @kindex C-c C-v C-h
  15647. @kindex C-c C-v x
  15648. @kindex C-c C-v C-x
  15649. @findex org-babel-previous-src-block
  15650. @findex org-babel-next-src-block
  15651. @findex org-babel-execute-maybe
  15652. @findex org-babel-open-src-block-result
  15653. @findex org-babel-expand-src-block
  15654. @findex org-babel-goto-src-block-head
  15655. @findex org-babel-goto-named-src-block
  15656. @findex org-babel-goto-named-result
  15657. @findex org-babel-execute-buffer
  15658. @findex org-babel-execute-subtree
  15659. @findex org-babel-demarcate-block
  15660. @findex org-babel-tangle
  15661. @findex org-babel-tangle-file
  15662. @findex org-babel-check-src-block
  15663. @findex org-babel-insert-header-arg
  15664. @findex org-babel-load-in-session
  15665. @findex org-babel-lob-ingest
  15666. @findex org-babel-view-src-block-info
  15667. @findex org-babel-switch-to-session-with-code
  15668. @findex org-babel-sha1-hash
  15669. @findex org-babel-describe-bindings
  15670. @findex org-babel-do-key-sequence-in-edit-buffer
  15671. @multitable @columnfractions 0.45 0.55
  15672. @headitem Key binding
  15673. @tab Function
  15674. @item @kbd{C-c C-v p} or @kbd{C-c C-v C-p}
  15675. @tab @code{org-babel-previous-src-block}
  15676. @item @kbd{C-c C-v n} or @kbd{C-c C-v C-n}
  15677. @tab @code{org-babel-next-src-block}
  15678. @item @kbd{C-c C-v e} or @kbd{C-c C-v C-e}
  15679. @tab @code{org-babel-execute-maybe}
  15680. @item @kbd{C-c C-v o} or @kbd{C-c C-v C-o}
  15681. @tab @code{org-babel-open-src-block-result}
  15682. @item @kbd{C-c C-v v} or @kbd{C-c C-v C-v}
  15683. @tab @code{org-babel-expand-src-block}
  15684. @item @kbd{C-c C-v u} or @kbd{C-c C-v C-u}
  15685. @tab @code{org-babel-goto-src-block-head}
  15686. @item @kbd{C-c C-v g} or @kbd{C-c C-v C-g}
  15687. @tab @code{org-babel-goto-named-src-block}
  15688. @item @kbd{C-c C-v r} or @kbd{C-c C-v C-r}
  15689. @tab @code{org-babel-goto-named-result}
  15690. @item @kbd{C-c C-v b} or @kbd{C-c C-v C-b}
  15691. @tab @code{org-babel-execute-buffer}
  15692. @item @kbd{C-c C-v s} or @kbd{C-c C-v C-s}
  15693. @tab @code{org-babel-execute-subtree}
  15694. @item @kbd{C-c C-v d} or @kbd{C-c C-v C-d}
  15695. @tab @code{org-babel-demarcate-block}
  15696. @item @kbd{C-c C-v t} or @kbd{C-c C-v C-t}
  15697. @tab @code{org-babel-tangle}
  15698. @item @kbd{C-c C-v f} or @kbd{C-c C-v C-f}
  15699. @tab @code{org-babel-tangle-file}
  15700. @item @kbd{C-c C-v c} or @kbd{C-c C-v C-c}
  15701. @tab @code{org-babel-check-src-block}
  15702. @item @kbd{C-c C-v j} or @kbd{C-c C-v C-j}
  15703. @tab @code{org-babel-insert-header-arg}
  15704. @item @kbd{C-c C-v l} or @kbd{C-c C-v C-l}
  15705. @tab @code{org-babel-load-in-session}
  15706. @item @kbd{C-c C-v i} or @kbd{C-c C-v C-i}
  15707. @tab @code{org-babel-lob-ingest}
  15708. @item @kbd{C-c C-v I} or @kbd{C-c C-v C-I}
  15709. @tab @code{org-babel-view-src-block-info}
  15710. @item @kbd{C-c C-v z} or @kbd{C-c C-v C-z}
  15711. @tab @code{org-babel-switch-to-session-with-code}
  15712. @item @kbd{C-c C-v a} or @kbd{C-c C-v C-a}
  15713. @tab @code{org-babel-sha1-hash}
  15714. @item @kbd{C-c C-v h} or @kbd{C-c C-v C-h}
  15715. @tab @code{org-babel-describe-bindings}
  15716. @item @kbd{C-c C-v x} or @kbd{C-c C-v C-x}
  15717. @tab @code{org-babel-do-key-sequence-in-edit-buffer}
  15718. @end multitable
  15719. @node Batch Execution
  15720. @section Batch Execution
  15721. @cindex code block, batch execution
  15722. @cindex source code, batch execution
  15723. Org mode features, including working with source code facilities can
  15724. be invoked from the command line. This enables building shell scripts
  15725. for batch processing, running automated system tasks, and expanding
  15726. Org mode's usefulness.
  15727. The sample script shows batch processing of multiple files using
  15728. @code{org-babel-tangle}.
  15729. @example
  15730. #!/bin/sh
  15731. # Tangle files with Org mode
  15732. #
  15733. emacs -Q --batch --eval "
  15734. (progn
  15735. (require 'ob-tangle)
  15736. (dolist (file command-line-args-left)
  15737. (with-current-buffer (find-file-noselect file)
  15738. (org-babel-tangle))))
  15739. " "$@@"
  15740. @end example
  15741. @node Miscellaneous
  15742. @chapter Miscellaneous
  15743. @menu
  15744. * Completion:: M-@key{TAB} guesses completions.
  15745. * Structure Templates:: Quick insertion of structural elements.
  15746. * Speed Keys:: Electric commands at the beginning of a headline.
  15747. * Code Evaluation Security:: Org files evaluate in-line code.
  15748. * Customization:: Adapting Org to your taste.
  15749. * In-buffer Settings:: Overview of keywords.
  15750. * The Very Busy @kbd{C-c C-c} Key:: When in doubt, press @kbd{C-c C-c}.
  15751. * Clean View:: Getting rid of leading stars in the outline.
  15752. * TTY Keys:: Using Org on a tty.
  15753. * Interaction:: With other Emacs packages.
  15754. * Org Crypt:: Encrypting Org files.
  15755. @end menu
  15756. @node Completion
  15757. @section Completion
  15758. @cindex completion, of @TeX{} symbols
  15759. @cindex completion, of TODO keywords
  15760. @cindex completion, of dictionary words
  15761. @cindex completion, of option keywords
  15762. @cindex completion, of tags
  15763. @cindex completion, of property keys
  15764. @cindex completion, of link abbreviations
  15765. @cindex @TeX{} symbol completion
  15766. @cindex TODO keywords completion
  15767. @cindex dictionary word completion
  15768. @cindex option keyword completion
  15769. @cindex tag completion
  15770. @cindex link abbreviations, completion of
  15771. Org has in-buffer completions. Unlike minibuffer completions, which
  15772. are useful for quick command interactions, Org's in-buffer completions
  15773. are more suitable for content creation in Org documents. Type one or
  15774. more letters and invoke the hot key to complete the text in-place.
  15775. Depending on the context and the keys, Org offers different types of
  15776. completions. No minibuffer is involved. Such mode-specific hot keys
  15777. have become an integral part of Emacs and Org provides several
  15778. shortcuts.
  15779. @table @asis
  15780. @item @kbd{M-@key{TAB}}
  15781. @kindex M-TAB
  15782. Complete word at point.
  15783. @itemize
  15784. @item
  15785. At the beginning of a headline, complete TODO keywords.
  15786. @item
  15787. After @samp{\}, complete @TeX{} symbols supported by the exporter.
  15788. @item
  15789. After @samp{*}, complete headlines in the current buffer so that
  15790. they can be used in search links like:
  15791. @example
  15792. [[*find this headline]]
  15793. @end example
  15794. @item
  15795. After @samp{:} in a headline, complete tags. Org deduces the list
  15796. of tags from the @samp{TAGS} in-buffer option (see @ref{Setting Tags}),
  15797. the variable @code{org-tag-alist}, or from all tags used in the
  15798. current buffer.
  15799. @item
  15800. After @samp{:} and not in a headline, complete property keys. The
  15801. list of keys is constructed dynamically from all keys used in
  15802. the current buffer.
  15803. @item
  15804. After @samp{[}, complete link abbreviations (see @ref{Link Abbreviations}).
  15805. @item
  15806. After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
  15807. file-specific @samp{OPTIONS}. After option keyword is complete,
  15808. pressing @kbd{M-@key{TAB}} again inserts example settings for
  15809. this keyword.
  15810. @item
  15811. After @samp{STARTUP} keyword, complete startup items.
  15812. @item
  15813. When point is anywhere else, complete dictionary words using
  15814. Ispell.
  15815. @end itemize
  15816. @end table
  15817. @node Structure Templates
  15818. @section Structure Templates
  15819. @cindex template insertion
  15820. @cindex insertion, of templates
  15821. With just a few keystrokes, it is possible to insert empty structural
  15822. blocks, such as @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}, or to wrap existing
  15823. text in such a block.
  15824. @table @asis
  15825. @item @kbd{C-c C-x w} (@code{org-insert-structure-template})
  15826. Prompt for a type of block structure, and insert the block at
  15827. point. If the region is active, it is wrapped in the block.
  15828. First prompts the user for a key, which is used to look up
  15829. a structure type from the values below. If the key is
  15830. @kbd{@key{TAB}}, the user is prompted to enter a type.
  15831. @end table
  15832. @vindex org-structure-template-alist
  15833. Available structure types are defined in
  15834. @code{org-structure-template-alist}, see the docstring for adding or
  15835. changing values.
  15836. @cindex Tempo
  15837. @cindex template expansion
  15838. @cindex insertion, of templates
  15839. @vindex org-tempo-keywords-alist
  15840. @vindex org-structure-template-alist
  15841. Org Tempo expands snippets to structures defined in
  15842. @code{org-structure-template-alist} and @code{org-tempo-keywords-alist}. For
  15843. example, @kbd{< s @key{TAB}} creates a code block. Enable it by
  15844. customizing @code{org-modules} or add @code{(require 'org-tempo)} to your Emacs
  15845. init file@footnote{For more information, please refer to the commentary section
  15846. in @samp{org-tempo.el}.}.
  15847. @multitable @columnfractions 0.1 0.9
  15848. @item @kbd{a}
  15849. @tab @samp{#+BEGIN_EXPORT ascii} @dots{} @samp{#+END_EXPORT}
  15850. @item @kbd{c}
  15851. @tab @samp{#+BEGIN_CENTER} @dots{} @samp{#+END_CENTER}
  15852. @item @kbd{C}
  15853. @tab @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT}
  15854. @item @kbd{e}
  15855. @tab @samp{#+BEGIN_EXAMPLE} @dots{} @samp{#+END_EXAMPLE}
  15856. @item @kbd{h}
  15857. @tab @samp{#+BEGIN_EXPORT html} @dots{} @samp{#+END_EXPORT}
  15858. @item @kbd{l}
  15859. @tab @samp{#+BEGIN_EXPORT latex} @dots{} @samp{#+END_EXPORT}
  15860. @item @kbd{q}
  15861. @tab @samp{#+BEGIN_QUOTE} @dots{} @samp{#+END_QUOTE}
  15862. @item @kbd{s}
  15863. @tab @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}
  15864. @item @kbd{v}
  15865. @tab @samp{#+BEGIN_VERSE} @dots{} @samp{#+END_VERSE}
  15866. @end multitable
  15867. @node Speed Keys
  15868. @section Speed Keys
  15869. @cindex speed keys
  15870. Single keystrokes can execute custom commands in an Org file when the
  15871. cursor is on a headline. Without the extra burden of a meta or
  15872. modifier key, Speed Keys can speed navigation or execute custom
  15873. commands. Besides faster navigation, Speed Keys may come in handy on
  15874. small mobile devices that do not have full keyboards. Speed Keys may
  15875. also work on TTY devices known for their problems when entering Emacs
  15876. key chords.
  15877. @vindex org-use-speed-commands
  15878. By default, Org has Speed Keys disabled. To activate Speed Keys, set
  15879. the variable @code{org-use-speed-commands} to a non-@code{nil} value. To
  15880. trigger a Speed Key, the cursor must be at the beginning of an Org
  15881. headline, before any of the stars.
  15882. @vindex org-speed-commands-user
  15883. @findex org-speed-command-help
  15884. Org comes with a pre-defined list of Speed Keys. To add or modify
  15885. Speed Keys, customize the variable, @code{org-speed-commands-user}. For
  15886. more details, see the variable's docstring. With Speed Keys
  15887. activated, @kbd{M-x org-speed-command-help}, or @kbd{?} when
  15888. cursor is at the beginning of an Org headline, shows currently active
  15889. Speed Keys, including the user-defined ones.
  15890. @node Code Evaluation Security
  15891. @section Code Evaluation and Security Issues
  15892. Unlike plain text, running code comes with risk. Each @samp{src} code
  15893. block, in terms of risk, is equivalent to an executable file. Org
  15894. therefore puts a few confirmation prompts by default. This is to
  15895. alert the casual user from accidentally running untrusted code.
  15896. For users who do not run code blocks or write code regularly, Org's
  15897. default settings should suffice. However, some users may want to
  15898. tweak the prompts for fewer interruptions. To weigh the risks of
  15899. automatic execution of code blocks, here are some details about code
  15900. evaluation.
  15901. Org evaluates code in the following circumstances:
  15902. @table @asis
  15903. @item @emph{Source code blocks}
  15904. Org evaluates @samp{src} code blocks in an Org file during export.
  15905. Org also evaluates a @samp{src} code block with the @kbd{C-c C-c}
  15906. key chord. Users exporting or running code blocks must load
  15907. files only from trusted sources. Be wary of customizing
  15908. variables that remove or alter default security measures.
  15909. @defopt org-confirm-babel-evaluate
  15910. When @code{t}, Org prompts the user for confirmation before executing
  15911. each code block. When @code{nil}, Org executes code blocks without
  15912. prompting the user for confirmation. When this option is set to
  15913. a custom function, Org invokes the function with these two
  15914. arguments: the source code language and the body of the code
  15915. block. The custom function must return either a @code{t} or @code{nil},
  15916. which determines if the user is prompted. Each source code
  15917. language can be handled separately through this function
  15918. argument.
  15919. @end defopt
  15920. For example, here is how to execute ditaa code blocks without
  15921. prompting:
  15922. @lisp
  15923. (defun my-org-confirm-babel-evaluate (lang body)
  15924. (not (string= lang "ditaa"))) ;don't ask for ditaa
  15925. (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
  15926. @end lisp
  15927. @item @emph{Following @samp{shell} and @samp{elisp} links}
  15928. Org has two link types that can directly evaluate code (see
  15929. @ref{External Links}). Because such code is not visible, these links
  15930. have a potential risk. Org therefore prompts the user when it
  15931. encounters such links. The customization variables are:
  15932. @defopt org-confirm-shell-link-function
  15933. Function that prompts the user before executing a shell link.
  15934. @end defopt
  15935. @defopt org-confirm-elisp-link-function
  15936. Function that prompts the user before executing an Emacs Lisp link.
  15937. @end defopt
  15938. @item @emph{Formulas in tables}
  15939. Formulas in tables (see @ref{The spreadsheet}) are code that is
  15940. evaluated either by the Calc interpreter, or by the Emacs Lisp
  15941. interpreter.
  15942. @end table
  15943. @node Customization
  15944. @section Customization
  15945. @cindex customization
  15946. @cindex options, for customization
  15947. @cindex variables, for customization
  15948. Org has more than 500 variables for customization. They can be
  15949. accessed through the usual @kbd{M-x org-customize} command. Or
  15950. through the Org menu: Org @arrow{} Customization @arrow{} Browse Org Group.
  15951. Org also has per-file settings for some variables (see @ref{In-buffer Settings}).
  15952. @node In-buffer Settings
  15953. @section Summary of In-Buffer Settings
  15954. @cindex in-buffer settings
  15955. @cindex special keywords
  15956. In-buffer settings start with @samp{#+}, followed by a keyword, a colon,
  15957. and then a word for each setting. Org accepts multiple settings on
  15958. the same line. Org also accepts multiple lines for a keyword. This
  15959. manual describes these settings throughout. A summary follows here.
  15960. @cindex refresh set-up
  15961. @kbd{C-c C-c} activates any changes to the in-buffer settings.
  15962. Closing and reopening the Org file in Emacs also activates the
  15963. changes.
  15964. @table @asis
  15965. @item @samp{#+ARCHIVE: %s_done}
  15966. @cindex @samp{ARCHIVE}, keyword
  15967. @vindex org-archive-location
  15968. Sets the archive location of the agenda file. The corresponding
  15969. variable is @code{org-archive-location}.
  15970. @item @samp{#+CATEGORY}
  15971. @cindex @samp{CATEGORY}, keyword
  15972. Sets the category of the agenda file, which applies to the entire
  15973. document.
  15974. @item @samp{#+COLUMNS: %25ITEM ...}
  15975. @cindex @samp{COLUMNS}, property
  15976. Set the default format for columns view. This format applies
  15977. when columns view is invoked in locations where no @samp{COLUMNS}
  15978. property applies.
  15979. @item @samp{#+CONSTANTS: name1=value1 ...}
  15980. @cindex @samp{CONSTANTS}, keyword
  15981. @vindex org-table-formula-constants
  15982. @vindex org-table-formula
  15983. Set file-local values for constants that table formulas can use.
  15984. This line sets the local variable
  15985. @code{org-table-formula-constants-local}. The global version of this
  15986. variable is @code{org-table-formula-constants}.
  15987. @item @samp{#+FILETAGS: :tag1:tag2:tag3:}
  15988. @cindex @samp{FILETAGS}, keyword
  15989. Set tags that all entries in the file inherit from, including the
  15990. top-level entries.
  15991. @item @samp{#+LINK: linkword replace}
  15992. @cindex @samp{LINK}, keyword
  15993. @vindex org-link-abbrev-alist
  15994. Each line specifies one abbreviation for one link. Use multiple
  15995. @samp{LINK} keywords for more, see @ref{Link Abbreviations}. The
  15996. corresponding variable is @code{org-link-abbrev-alist}.
  15997. @item @samp{#+PRIORITIES: highest lowest default}
  15998. @cindex @samp{PRIORITIES}, keyword
  15999. @vindex org-highest-priority
  16000. @vindex org-lowest-priority
  16001. @vindex org-default-priority
  16002. This line sets the limits and the default for the priorities.
  16003. All three must be either letters A--Z or numbers 0--9. The
  16004. highest priority must have a lower ASCII number than the lowest
  16005. priority.
  16006. @item @samp{#+PROPERTY: Property_Name Value}
  16007. @cindex @samp{PROPERTY}, keyword
  16008. This line sets a default inheritance value for entries in the
  16009. current buffer, most useful for specifying the allowed values of
  16010. a property.
  16011. @item @samp{#+SETUPFILE: file}
  16012. @cindex @samp{SETUPFILE}, keyword
  16013. The setup file or a URL pointing to such file is for additional
  16014. in-buffer settings. Org loads this file and parses it for any
  16015. settings in it only when Org opens the main file. If URL is
  16016. specified, the contents are downloaded and stored in a temporary
  16017. file cache. @kbd{C-c C-c} on the settings line parses and
  16018. loads the file, and also resets the temporary file cache. Org
  16019. also parses and loads the document during normal exporting
  16020. process. Org parses the contents of this document as if it was
  16021. included in the buffer. It can be another Org file. To visit
  16022. the file---not a URL---use @kbd{C-c '} while the cursor is
  16023. on the line with the file name.
  16024. @item @samp{#+STARTUP:}
  16025. @cindex @samp{STARTUP}, keyword
  16026. Startup options Org uses when first visiting a file.
  16027. @vindex org-startup-folded
  16028. The first set of options deals with the initial visibility of the
  16029. outline tree. The corresponding variable for global default
  16030. settings is @code{org-startup-folded} with a default value of @code{t},
  16031. which is the same as @code{overview}.
  16032. @table @asis
  16033. @item @samp{overview}
  16034. Top-level headlines only.
  16035. @item @samp{content}
  16036. All headlines.
  16037. @item @samp{showall}
  16038. No folding on any entry.
  16039. @item @samp{showeverything}
  16040. Show even drawer contents.
  16041. @end table
  16042. @vindex org-startup-indented
  16043. Dynamic virtual indentation is controlled by the variable
  16044. @code{org-startup-indented}.@footnote{Note that @code{org-indent-mode} also sets the @code{wrap-prefix}
  16045. property, such that @code{visual-line-mode} (or purely setting @code{word-wrap})
  16046. wraps long lines (including headlines) correctly indented.}
  16047. @table @asis
  16048. @item @samp{indent}
  16049. Start with @code{org-indent-mode} turned on.
  16050. @item @samp{noindent}
  16051. Start with @code{org-indent-mode} turned off.
  16052. @end table
  16053. @vindex org-startup-align-all-tables
  16054. Aligns tables consistently upon visiting a file. The corresponding
  16055. variable is @code{org-startup-align-all-tables} with @code{nil} as default
  16056. value.
  16057. @table @asis
  16058. @item @samp{align}
  16059. Align all tables.
  16060. @item @samp{noalign}
  16061. Do not align tables on startup.
  16062. @end table
  16063. @vindex org-startup-shrink-all-tables
  16064. Shrink table columns with a width cookie. The corresponding
  16065. variable is @code{org-startup-shrink-all-tables} with @code{nil} as default
  16066. value.
  16067. @vindex org-startup-with-inline-images
  16068. When visiting a file, inline images can be automatically displayed.
  16069. The corresponding variable is @code{org-startup-with-inline-images},
  16070. with a default value @code{nil} to avoid delays when visiting a file.
  16071. @table @asis
  16072. @item @samp{inlineimages}
  16073. Show inline images.
  16074. @item @samp{noinlineimages}
  16075. Do not show inline images on startup.
  16076. @end table
  16077. @vindex org-log-done
  16078. @vindex org-log-note-clock-out
  16079. @vindex org-log-repeat
  16080. Logging the closing and reopening of TODO items and clock
  16081. intervals can be configured using these options (see variables
  16082. @code{org-log-done}, @code{org-log-note-clock-out}, and @code{org-log-repeat}).
  16083. @table @asis
  16084. @item @samp{logdone}
  16085. Record a timestamp when an item is marked DONE.
  16086. @item @samp{lognotedone}
  16087. Record timestamp and a note when DONE.
  16088. @item @samp{nologdone}
  16089. Do not record when items are marked DONE.
  16090. @item @samp{logrepeat}
  16091. Record a time when reinstating a repeating item.
  16092. @item @samp{lognoterepeat}
  16093. Record a note when reinstating a repeating item.
  16094. @item @samp{nologrepeat}
  16095. Do not record when reinstating repeating item.
  16096. @item @samp{lognoteclock-out}
  16097. Record a note when clocking out.
  16098. @item @samp{nolognoteclock-out}
  16099. Do not record a note when clocking out.
  16100. @item @samp{logreschedule}
  16101. Record a timestamp when scheduling time changes.
  16102. @item @samp{lognotereschedule}
  16103. Record a note when scheduling time changes.
  16104. @item @samp{nologreschedule}
  16105. Do not record when a scheduling date changes.
  16106. @item @samp{logredeadline}
  16107. Record a timestamp when deadline changes.
  16108. @item @samp{lognoteredeadline}
  16109. Record a note when deadline changes.
  16110. @item @samp{nologredeadline}
  16111. Do not record when a deadline date changes.
  16112. @item @samp{logrefile}
  16113. Record a timestamp when refiling.
  16114. @item @samp{lognoterefile}
  16115. Record a note when refiling.
  16116. @item @samp{nologrefile}
  16117. Do not record when refiling.
  16118. @end table
  16119. @vindex org-hide-leading-stars
  16120. @vindex org-odd-levels-only
  16121. Here are the options for hiding leading stars in outline headings,
  16122. and for indenting outlines. The corresponding variables are
  16123. @code{org-hide-leading-stars} and @code{org-odd-levels-only}, both with
  16124. a default setting @code{nil} (meaning @samp{showstars} and @samp{oddeven}).
  16125. @table @asis
  16126. @item @samp{hidestars}
  16127. Make all but one of the stars starting a headline invisible.
  16128. @item @samp{showstars}
  16129. Show all stars starting a headline.
  16130. @item @samp{indent}
  16131. Virtual indentation according to outline level.
  16132. @item @samp{noindent}
  16133. No virtual indentation according to outline level.
  16134. @item @samp{odd}
  16135. Allow only odd outline levels (1, 3, @dots{}).
  16136. @item @samp{oddeven}
  16137. Allow all outline levels.
  16138. @end table
  16139. @vindex org-put-time-stamp-overlays
  16140. @vindex org-time-stamp-overlay-formats
  16141. To turn on custom format overlays over timestamps (variables
  16142. @code{org-put-time-stamp-overlays} and @code{org-time-stamp-overlay-formats}),
  16143. use:
  16144. @table @asis
  16145. @item @samp{customtime}
  16146. Overlay custom time format.
  16147. @end table
  16148. @vindex constants-unit-system
  16149. The following options influence the table spreadsheet (variable
  16150. @code{constants-unit-system}).
  16151. @table @asis
  16152. @item @samp{constcgs}
  16153. @samp{constants.el} should use the c-g-s unit system.
  16154. @item @samp{constSI}
  16155. @samp{constants.el} should use the SI unit system.
  16156. @end table
  16157. @vindex org-footnote-define-inline
  16158. @vindex org-footnote-auto-label
  16159. @vindex org-footnote-auto-adjust
  16160. To influence footnote settings, use the following keywords. The
  16161. corresponding variables are @code{org-footnote-define-inline},
  16162. @code{org-footnote-auto-label}, and @code{org-footnote-auto-adjust}.
  16163. @table @asis
  16164. @item @samp{fninline}
  16165. Define footnotes inline.
  16166. @item @samp{fnnoinline}
  16167. Define footnotes in separate section.
  16168. @item @samp{fnlocal}
  16169. Define footnotes near first reference, but not inline.
  16170. @item @samp{fnprompt}
  16171. Prompt for footnote labels.
  16172. @item @samp{fnauto}
  16173. Create @samp{[fn:1]}-like labels automatically (default).
  16174. @item @samp{fnconfirm}
  16175. Offer automatic label for editing or confirmation.
  16176. @item @samp{fnadjust}
  16177. Automatically renumber and sort footnotes.
  16178. @item @samp{nofnadjust}
  16179. Do not renumber and sort automatically.
  16180. @end table
  16181. @vindex org-hide-block-startup
  16182. To hide blocks on startup, use these keywords. The corresponding
  16183. variable is @code{org-hide-block-startup}.
  16184. @table @asis
  16185. @item @samp{hideblocks}
  16186. Hide all begin/end blocks on startup.
  16187. @item @samp{nohideblocks}
  16188. Do not hide blocks on startup.
  16189. @end table
  16190. @vindex org-pretty-entities
  16191. The display of entities as UTF-8 characters is governed by the
  16192. variable @code{org-pretty-entities} and the keywords
  16193. @table @asis
  16194. @item @samp{entitiespretty}
  16195. Show entities as UTF-8 characters where possible.
  16196. @item @samp{entitiesplain}
  16197. Leave entities plain.
  16198. @end table
  16199. @item @samp{#+TAGS: TAG1(c1) TAG2(c2)}
  16200. @cindex @samp{TAGS}, keyword
  16201. @vindex org-tag-alist
  16202. These lines (several such lines are allowed) specify the valid
  16203. tags in this file, and (potentially) the corresponding @emph{fast tag
  16204. selection} keys. The corresponding variable is @code{org-tag-alist}.
  16205. @item @samp{#+TODO:}
  16206. @itemx @samp{#+SEQ_TODO:}
  16207. @itemx @samp{#+TYP_TODO:}
  16208. @cindex @samp{SEQ_TODO}, keyword
  16209. @cindex @samp{TODO}, keyword
  16210. @cindex @samp{TYP_TODO}, keyword
  16211. @vindex org-todo-keywords
  16212. These lines set the TODO keywords and their interpretation in the
  16213. current file. The corresponding variable is @code{org-todo-keywords}.
  16214. @end table
  16215. @node The Very Busy @kbd{C-c C-c} Key
  16216. @section The Very Busy @kbd{C-c C-c} Key
  16217. @kindex C-c C-c
  16218. @cindex @kbd{C-c C-c}, overview
  16219. The @kbd{C-c C-c} key in Org serves many purposes depending on
  16220. the context. It is probably the most over-worked, multi-purpose key
  16221. combination in Org. Its uses are well documented throughout this
  16222. manual, but here is a consolidated list for easy reference.
  16223. @itemize
  16224. @item
  16225. If any highlights shown in the buffer from the creation of a sparse
  16226. tree, or from clock display, remove such highlights.
  16227. @item
  16228. If the cursor is in one of the special @samp{KEYWORD} lines, scan the
  16229. buffer for these lines and update the information. Also reset the
  16230. Org file cache used to temporary store the contents of URLs used as
  16231. values for keywords like @samp{SETUPFILE}.
  16232. @item
  16233. If the cursor is inside a table, realign the table. The table
  16234. realigns even if automatic table editor is turned off.
  16235. @item
  16236. If the cursor is on a @samp{TBLFM} keyword, re-apply the formulas to the
  16237. entire table.
  16238. @item
  16239. If the current buffer is a capture buffer, close the note and file
  16240. it. With a prefix argument, also jump to the target location after
  16241. saving the note.
  16242. @item
  16243. If the cursor is on a @samp{<<<target>>>}, update radio targets and
  16244. corresponding links in this buffer.
  16245. @item
  16246. If the cursor is on a property line or at the start or end of
  16247. a property drawer, offer property commands.
  16248. @item
  16249. If the cursor is at a footnote reference, go to the corresponding
  16250. definition, and @emph{vice versa}.
  16251. @item
  16252. If the cursor is on a statistics cookie, update it.
  16253. @item
  16254. If the cursor is in a plain list item with a checkbox, toggle the
  16255. status of the checkbox.
  16256. @item
  16257. If the cursor is on a numbered item in a plain list, renumber the
  16258. ordered list.
  16259. @item
  16260. If the cursor is on the @samp{#+BEGIN} line of a dynamic block, the block
  16261. is updated.
  16262. @item
  16263. If the cursor is at a timestamp, fix the day name in the timestamp.
  16264. @end itemize
  16265. @node Clean View
  16266. @section A Cleaner Outline View
  16267. @cindex hiding leading stars
  16268. @cindex dynamic indentation
  16269. @cindex odd-levels-only outlines
  16270. @cindex clean outline view
  16271. Org's default outline with stars and no indents can become too
  16272. cluttered for short documents. For @emph{book-like} long documents, the
  16273. effect is not as noticeable. Org provides an alternate stars and
  16274. indentation scheme, as shown on the right in the following table. It
  16275. uses only one star and indents text to line with the heading:
  16276. @example
  16277. * Top level headline | * Top level headline
  16278. ** Second level | * Second level
  16279. *** Third level | * Third level
  16280. some text | some text
  16281. *** Third level | * Third level
  16282. more text | more text
  16283. * Another top level headline | * Another top level headline
  16284. @end example
  16285. @noindent
  16286. @cindex Indent mode
  16287. @findex org-indent-mode
  16288. To turn this mode on, use the minor mode, @code{org-indent-mode}. Text
  16289. lines that are not headlines are prefixed with spaces to vertically
  16290. align with the headline text@footnote{The @code{org-indent-mode} also sets the @code{wrap-prefix} correctly
  16291. for indenting and wrapping long lines of headlines or text. This
  16292. minor mode handles @code{visual-line-mode} and directly applied settings
  16293. through @code{word-wrap}.}.
  16294. @vindex org-indent-indentation-per-level
  16295. To make more horizontal space, the headlines are shifted by two stars.
  16296. This can be configured by the @code{org-indent-indentation-per-level}
  16297. variable. Only one star on each headline is visible, the rest are
  16298. masked with the same font color as the background.
  16299. Note that turning on @code{org-indent-mode} sets @code{org-hide-leading-stars}
  16300. to @code{t} and @code{org-adapt-indentation} to @code{nil}.
  16301. @vindex org-startup-indented
  16302. To globally turn on @code{org-indent-mode} for all files, customize the
  16303. variable @code{org-startup-indented}.
  16304. To turn on indenting for individual files, use @samp{STARTUP} keyword as
  16305. follows:
  16306. @example
  16307. #+STARTUP: indent
  16308. @end example
  16309. Indent on startup makes Org use hard spaces to align text with
  16310. headings as shown in examples below.
  16311. @table @asis
  16312. @item @emph{Indentation of text below headlines}
  16313. Indent text to align with the headline.
  16314. @example
  16315. *** Third level
  16316. more text, now indented
  16317. @end example
  16318. @vindex org-adapt-indentation
  16319. Org supports this with paragraph filling, line wrapping, and
  16320. structure editing, preserving or adapting the indentation as
  16321. appropriate@footnote{Also see the variable @code{org-adapt-indentation}.}.
  16322. @item @emph{Hiding leading stars}
  16323. @vindex org-hide-leading-stars
  16324. Org can make leading stars invisible. For global preference,
  16325. configure the variable @code{org-hide-leading-stars}. For per-file
  16326. preference, use these file @samp{STARTUP} options:
  16327. @example
  16328. #+STARTUP: hidestars
  16329. #+STARTUP: showstars
  16330. @end example
  16331. With stars hidden, the tree is shown as:
  16332. @example
  16333. * Top level headline
  16334. * Second level
  16335. * Third level
  16336. ...
  16337. @end example
  16338. @noindent
  16339. @vindex org-hide, face
  16340. Because Org makes the font color the same as the background color
  16341. to hide to stars, sometimes @code{org-hide} face may need tweaking to
  16342. get the effect right. For some black and white combinations,
  16343. @code{grey90} on a white background might mask the stars better.
  16344. @item @emph{Odd levels}
  16345. @vindex org-odd-levels-only
  16346. Using stars for only odd levels, 1, 3, 5, @dots{}, can also clean up
  16347. 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
  16348. on.}.
  16349. For Org to properly handle this cleaner structure during edits
  16350. and exports, configure the variable @code{org-odd-levels-only}. To
  16351. set this per-file, use either one of the following lines:
  16352. @example
  16353. #+STARTUP: odd
  16354. #+STARTUP: oddeven
  16355. @end example
  16356. 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}.
  16357. @end table
  16358. @node TTY Keys
  16359. @section Using Org on a TTY
  16360. @cindex tty key bindings
  16361. Org provides alternative key bindings for TTY and modern mobile
  16362. devices that cannot handle cursor keys and complex modifier key
  16363. chords. Some of these workarounds may be more cumbersome than
  16364. necessary. Users should look into customizing these further based on
  16365. their usage needs. For example, the normal @kbd{S-<cursor>} for
  16366. editing timestamp might be better with @kbd{C-c .} chord.
  16367. @multitable @columnfractions 0.2 0.28 0.15 0.21
  16368. @headitem Default
  16369. @tab Alternative 1
  16370. @tab Speed key
  16371. @tab Alternative 2
  16372. @item @kbd{S-@key{TAB}}
  16373. @tab @kbd{C-u @key{TAB}}
  16374. @tab @kbd{C}
  16375. @tab
  16376. @item @kbd{M-@key{LEFT}}
  16377. @tab @kbd{C-c C-x l}
  16378. @tab @kbd{l}
  16379. @tab @kbd{Esc @key{LEFT}}
  16380. @item @kbd{M-S-@key{LEFT}}
  16381. @tab @kbd{C-c C-x L}
  16382. @tab @kbd{L}
  16383. @tab
  16384. @item @kbd{M-@key{RIGHT}}
  16385. @tab @kbd{C-c C-x r}
  16386. @tab @kbd{r}
  16387. @tab @kbd{Esc @key{RIGHT}}
  16388. @item @kbd{M-S-@key{RIGHT}}
  16389. @tab @kbd{C-c C-x R}
  16390. @tab @kbd{R}
  16391. @tab
  16392. @item @kbd{M-@key{UP}}
  16393. @tab @kbd{C-c C-x u}
  16394. @tab
  16395. @tab @kbd{Esc @key{UP}}
  16396. @item @kbd{M-S-@key{UP}}
  16397. @tab @kbd{C-c C-x U}
  16398. @tab @kbd{U}
  16399. @tab
  16400. @item @kbd{M-@key{DOWN}}
  16401. @tab @kbd{C-c C-x d}
  16402. @tab
  16403. @tab @kbd{Esc @key{DOWN}}
  16404. @item @kbd{M-S-@key{DOWN}}
  16405. @tab @kbd{C-c C-x D}
  16406. @tab @kbd{D}
  16407. @tab
  16408. @item @kbd{S-@key{RET}}
  16409. @tab @kbd{C-c C-x c}
  16410. @tab
  16411. @tab
  16412. @item @kbd{M-@key{RET}}
  16413. @tab @kbd{C-c C-x m}
  16414. @tab
  16415. @tab @kbd{Esc @key{RET}}
  16416. @item @kbd{M-S-@key{RET}}
  16417. @tab @kbd{C-c C-x M}
  16418. @tab
  16419. @tab
  16420. @item @kbd{S-@key{LEFT}}
  16421. @tab @kbd{C-c @key{LEFT}}
  16422. @tab
  16423. @tab
  16424. @item @kbd{S-@key{RIGHT}}
  16425. @tab @kbd{C-c @key{RIGHT}}
  16426. @tab
  16427. @tab
  16428. @item @kbd{S-@key{UP}}
  16429. @tab @kbd{C-c @key{UP}}
  16430. @tab
  16431. @tab
  16432. @item @kbd{S-@key{DOWN}}
  16433. @tab @kbd{C-c @key{DOWN}}
  16434. @tab
  16435. @tab
  16436. @item @kbd{C-S-@key{LEFT}}
  16437. @tab @kbd{C-c C-x @key{LEFT}}
  16438. @tab
  16439. @tab
  16440. @item @kbd{C-S-@key{RIGHT}}
  16441. @tab @kbd{C-c C-x @key{RIGHT}}
  16442. @tab
  16443. @tab
  16444. @end multitable
  16445. @node Interaction
  16446. @section Interaction with Other Packages
  16447. @cindex packages, interaction with other
  16448. Org's compatibility and the level of interaction with other Emacs
  16449. packages are documented here.
  16450. @menu
  16451. * Cooperation:: Packages Org cooperates with.
  16452. * Conflicts:: Packages that lead to conflicts.
  16453. @end menu
  16454. @node Cooperation
  16455. @subsection Packages that Org cooperates with
  16456. @table @asis
  16457. @item @samp{calc.el} by Dave Gillespie
  16458. @cindex @file{calc.el}
  16459. Org uses the Calc package for implementing spreadsheet
  16460. functionality in its tables (see @ref{The spreadsheet}). Org also
  16461. uses Calc for embedded calculations. See @ref{Embedded Mode,GNU Emacs Calc Manual,,calc,}.
  16462. @item @samp{constants.el} by Carsten Dominik
  16463. @cindex @file{constants.el}
  16464. @vindex org-table-formula-constants
  16465. Org can use names for constants in formulas in tables. Org can
  16466. also use calculation suffixes for units, such as @samp{M} for @samp{Mega}.
  16467. For a standard collection of such constants, install the
  16468. @samp{constants} package. Install version 2.0 of this package,
  16469. available at @uref{http://www.astro.uva.nl/~dominik/Tools}. Org checks
  16470. if the function @code{constants-get} has been autoloaded.
  16471. Installation instructions are in the file @samp{constants.el}.
  16472. @item @samp{cdlatex.el} by Carsten Dominik
  16473. @cindex @file{cdlatex.el}
  16474. Org mode can make use of the CD@LaTeX{} package to efficiently enter
  16475. @LaTeX{} fragments into Org files. See @ref{CD@LaTeX{} mode}.
  16476. @item @samp{imenu.el} by Ake Stenhoff and Lars Lindberg
  16477. @cindex @file{imenu.el}
  16478. Imenu creates dynamic menus based on an index of items in a file.
  16479. Org mode supports Imenu menus. Enable it with a mode hook as
  16480. follows:
  16481. @lisp
  16482. (add-hook 'org-mode-hook
  16483. (lambda () (imenu-add-to-menubar "Imenu")))
  16484. @end lisp
  16485. @vindex org-imenu-depth
  16486. By default the index is two levels deep---you can modify the
  16487. depth using the option @code{org-imenu-depth}.
  16488. @item @samp{speedbar.el} by Eric M. Ludlam
  16489. @cindex @file{speedbar.el}
  16490. Speedbar package creates a special Emacs frame for displaying
  16491. files and index items in files. Org mode supports Speedbar;
  16492. users can drill into Org files directly from the Speedbar. The
  16493. @kbd{<} in the Speedbar frame tweaks the agenda commands to
  16494. that file or to a subtree.
  16495. @item @samp{table.el} by Takaaki Ota
  16496. @cindex table editor, @file{table.el}
  16497. @cindex @file{table.el}
  16498. Complex ASCII tables with automatic line wrapping, column- and
  16499. row-spanning, and alignment can be created using the Emacs table
  16500. package by Takaaki Ota. Org mode recognizes such tables and
  16501. exports them properly. @kbd{C-c '} to edit these tables in
  16502. a special buffer, much like Org's code blocks. Because of
  16503. interference with other Org mode functionality, Takaaki Ota
  16504. tables cannot be edited directly in the Org buffer.
  16505. @table @asis
  16506. @item @kbd{C-c '} (@code{org-edit-special})
  16507. @kindex C-c '
  16508. @findex org-edit-special
  16509. Edit a @samp{table.el} table. Works when the cursor is in
  16510. a @samp{table.el} table.
  16511. @item @kbd{C-c ~​} (@code{org-table-create-with-table.el})
  16512. @kindex C-c ~
  16513. @findex org-table-create-with-table.el
  16514. Insert a @samp{table.el} table. If there is already a table at
  16515. point, this command converts it between the @samp{table.el}
  16516. format and the Org mode format. See the documentation
  16517. string of the command @code{org-convert-table} for the
  16518. restrictions under which this is possible.
  16519. @end table
  16520. @end table
  16521. @node Conflicts
  16522. @subsection Packages that conflict with Org mode
  16523. @cindex shift-selection-mode
  16524. @vindex org-support-shift-select
  16525. In Emacs, @code{shift-selection-mode} combines cursor motions with shift
  16526. key to enlarge regions. Emacs sets this mode by default. This
  16527. conflicts with Org's use of @kbd{S-<cursor>} commands to change
  16528. timestamps, TODO keywords, priorities, and item bullet types, etc.
  16529. Since @kbd{S-<cursor>} commands outside of specific contexts do
  16530. not do anything, Org offers the variable @code{org-support-shift-select}
  16531. for customization. Org mode accommodates shift selection by (i)
  16532. making it available outside of the special contexts where special
  16533. commands apply, and (ii) extending an existing active region even if
  16534. the cursor moves across a special context.
  16535. @table @asis
  16536. @item @samp{cua.el} by Kim. F. Storm
  16537. @cindex @file{cua.el}
  16538. @vindex org-replace-disputed-keys
  16539. Org key bindings conflict with @kbd{S-<cursor>} keys used by
  16540. CUA mode. For Org to relinquish these bindings to CUA mode,
  16541. configure the variable @code{org-replace-disputed-keys}. When set,
  16542. Org moves the following key bindings in Org files, and in the
  16543. agenda buffer---but not during date selection.
  16544. @multitable @columnfractions 0.4 0.4
  16545. @item @kbd{S-@key{UP}} @result{} @kbd{M-p}
  16546. @tab @kbd{S-@key{DOWN}} @result{} @kbd{M-n}
  16547. @item @kbd{S-@key{LEFT}} @result{} @kbd{M--}
  16548. @tab @kbd{S-@key{RIGHT}} @result{} @kbd{M-+}
  16549. @item @kbd{C-S-@key{LEFT}} @result{} @kbd{M-S--}
  16550. @tab @kbd{C-S-@key{RIGHT}} @result{} @kbd{M-S-+}
  16551. @end multitable
  16552. @vindex org-disputed-keys
  16553. Yes, these are unfortunately more difficult to remember. If you
  16554. want to have other replacement keys, look at the variable
  16555. @code{org-disputed-keys}.
  16556. @item @samp{ecomplete.el} by Lars Magne Ingebrigtsen
  16557. @cindex @file{ecomplete.el}
  16558. Ecomplete provides ``electric'' address completion in address
  16559. header lines in message buffers. Sadly Orgtbl mode cuts
  16560. Ecomplete's power supply: no completion happens when Orgtbl mode
  16561. is enabled in message buffers while entering text in address
  16562. header lines. If one wants to use ecomplete one should @emph{not}
  16563. follow the advice to automagically turn on Orgtbl mode in message
  16564. buffers (see @ref{Orgtbl Mode}), but instead---after
  16565. filling in the message headers---turn on Orgtbl mode manually
  16566. when needed in the messages body.
  16567. @item @samp{filladapt.el} by Kyle Jones
  16568. @cindex @file{filladapt.el}
  16569. Org mode tries to do the right thing when filling paragraphs,
  16570. list items and other elements. Many users reported problems
  16571. using both @samp{filladapt.el} and Org mode, so a safe thing to do is
  16572. to disable filladapt like this:
  16573. @lisp
  16574. (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
  16575. @end lisp
  16576. @item @samp{viper.el} by Michael Kifer
  16577. @cindex @file{viper.el}
  16578. @kindex C-c /
  16579. Viper uses @kbd{C-c /} and therefore makes this key not
  16580. access the corresponding Org mode command @code{org-sparse-tree}. You
  16581. need to find another key for this command, or override the key in
  16582. @code{viper-vi-global-user-map} with
  16583. @lisp
  16584. (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
  16585. @end lisp
  16586. @item @samp{windmove.el} by Hovav Shacham
  16587. @cindex @file{windmove.el}
  16588. This package also uses the @kbd{S-<cursor>} keys, so
  16589. everything written in the paragraph above about CUA mode also
  16590. applies here. If you want to make the windmove function active
  16591. in locations where Org mode does not have special functionality
  16592. on @kbd{S-<cursor>}, add this to your configuration:
  16593. @lisp
  16594. ;; Make windmove work in Org mode:
  16595. (add-hook 'org-shiftup-final-hook 'windmove-up)
  16596. (add-hook 'org-shiftleft-final-hook 'windmove-left)
  16597. (add-hook 'org-shiftdown-final-hook 'windmove-down)
  16598. (add-hook 'org-shiftright-final-hook 'windmove-right)
  16599. @end lisp
  16600. @item @samp{yasnippet.el}
  16601. @cindex @file{yasnippet.el}
  16602. The way Org mode binds the @kbd{@key{TAB}} key (binding to @code{[tab]}
  16603. instead of @code{"\t"}) overrules YASnippet's access to this key. The
  16604. following code fixed this problem:
  16605. @lisp
  16606. (add-hook 'org-mode-hook
  16607. (lambda ()
  16608. (setq-local yas/trigger-key [tab])
  16609. (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
  16610. @end lisp
  16611. The latest version of YASnippet does not play well with Org mode.
  16612. If the above code does not fix the conflict, start by defining
  16613. the following function:
  16614. @lisp
  16615. (defun yas/org-very-safe-expand ()
  16616. (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
  16617. @end lisp
  16618. Then, tell Org mode to use that function:
  16619. @lisp
  16620. (add-hook 'org-mode-hook
  16621. (lambda ()
  16622. (make-variable-buffer-local 'yas/trigger-key)
  16623. (setq yas/trigger-key [tab])
  16624. (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
  16625. (define-key yas/keymap [tab] 'yas/next-field)))
  16626. @end lisp
  16627. @end table
  16628. @node Org Crypt
  16629. @section Org Crypt
  16630. Org Crypt encrypts the text of an entry, but not the headline, or
  16631. properties. Behind the scene, it uses the Emacs EasyPG library to
  16632. encrypt and decrypt files.
  16633. @vindex org-crypt-tag-matcher
  16634. Any text below a headline that has a @samp{crypt} tag is automatically
  16635. encrypted when the file is saved. To use a different tag, customize
  16636. the @code{org-crypt-tag-matcher} setting.
  16637. Here is a suggestion for Org Crypt settings in Emacs init file:
  16638. @lisp
  16639. (require 'org-crypt)
  16640. (org-crypt-use-before-save-magic)
  16641. (setq org-tags-exclude-from-inheritance '("crypt"))
  16642. (setq org-crypt-key nil)
  16643. ;; GPG key to use for encryption
  16644. ;; Either the Key ID or set to nil to use symmetric encryption.
  16645. (setq auto-save-default nil)
  16646. ;; Auto-saving does not cooperate with org-crypt.el: so you need to
  16647. ;; turn it off if you plan to use org-crypt.el quite often. Otherwise,
  16648. ;; you'll get an (annoying) message each time you start Org.
  16649. ;; To turn it off only locally, you can insert this:
  16650. ;;
  16651. ;; # -*- buffer-auto-save-file-name: nil; -*-
  16652. @end lisp
  16653. Excluding the @samp{crypt} tag from inheritance prevents already encrypted
  16654. text from being encrypted again.
  16655. @node Hacking
  16656. @appendix Hacking
  16657. @cindex hacking
  16658. This appendix describes some ways a user can extend the functionality
  16659. of Org.
  16660. @menu
  16661. * Hooks: Hooks (2). How to reach into Org's internals.
  16662. * Add-on Packages:: Available extensions.
  16663. * Adding Hyperlink Types:: New custom link types.
  16664. * Adding Export Back-ends:: How to write new export back-ends.
  16665. * Tables in Arbitrary Syntax:: Orgtbl for LaTeX and other programs.
  16666. * Dynamic Blocks:: Automatically filled blocks.
  16667. * Special Agenda Views:: Customized views.
  16668. * Speeding Up Your Agendas:: Tips on how to speed up your agendas.
  16669. * Extracting Agenda Information:: Post-processing agenda information.
  16670. * Using the Property API:: Writing programs that use entry properties.
  16671. * Using the Mapping API:: Mapping over all or selected entries.
  16672. @end menu
  16673. @node Hooks (2)
  16674. @appendixsec Hooks
  16675. @cindex hooks
  16676. Org has a large number of hook variables for adding functionality.
  16677. This appendix illustrates using a few. A complete list of hooks with
  16678. documentation is maintained by the Worg project at
  16679. @uref{https://orgmode.org/worg/doc.html#hooks}.
  16680. @node Add-on Packages
  16681. @appendixsec Add-on Packages
  16682. @cindex add-on packages
  16683. Various authors wrote a large number of add-on packages for Org.
  16684. These packages are not part of Emacs, but they are distributed as
  16685. contributed packages with the separate release available at
  16686. @uref{https://orgmode.org}. See the @samp{contrib/README} file in the source code
  16687. directory for a list of contributed files. Worg page with more
  16688. information is at: @uref{https://orgmode.org/worg/org-contrib/}.
  16689. @node Adding Hyperlink Types
  16690. @appendixsec Adding Hyperlink Types
  16691. @cindex hyperlinks, adding new types
  16692. Org has many built-in hyperlink types (see @ref{Hyperlinks}), and an
  16693. interface for adding new link types. The following example shows the
  16694. process of adding Org links to Unix man pages, which look like this
  16695. @example
  16696. [[man:printf][The printf manual]]
  16697. @end example
  16698. @noindent
  16699. The following @samp{org-man.el} file implements it
  16700. @lisp
  16701. ;;; org-man.el - Support for links to man pages in Org mode
  16702. (require 'org)
  16703. (org-link-set-parameters "man"
  16704. :follow org-man-command
  16705. :export #'org-man-export
  16706. :store #'org-man-store-link)
  16707. (defcustom org-man-command 'man
  16708. "The Emacs command to be used to display a man page."
  16709. :group 'org-link
  16710. :type '(choice (const man) (const woman)))
  16711. (defun org-man-store-link ()
  16712. "Store a link to a man page."
  16713. (when (memq major-mode '(Man-mode woman-mode))
  16714. ;; This is a man page, we do make this link.
  16715. (let* ((page (org-man-get-page-name))
  16716. (link (concat "man:" page))
  16717. (description (format "Man page for %s" page)))
  16718. (org-store-link-props
  16719. :type "man"
  16720. :link link
  16721. :description description))))
  16722. (defun org-man-get-page-name ()
  16723. "Extract the page name from the buffer name."
  16724. ;; This works for both `Man-mode' and `woman-mode'.
  16725. (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  16726. (match-string 1 (buffer-name))
  16727. (error "Cannot create link to this man page")))
  16728. (defun org-man-export (link description format)
  16729. "Export a man page link from Org files."
  16730. (let ((path (format "http://man.he.net/?topic=%s&section=all" link))
  16731. (desc (or description link)))
  16732. (pcase format
  16733. (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
  16734. (`latex (format "\\href@{%s@}@{%s@}" path desc))
  16735. (`texinfo (format "@@uref@{%s,%s@}" path desc))
  16736. (`ascii (format "%s (%s)" desc path))
  16737. (t path))))
  16738. (provide 'org-man)
  16739. ;;; org-man.el ends here
  16740. @end lisp
  16741. @noindent
  16742. To activate links to man pages in Org, enter this in the Emacs init
  16743. file:
  16744. @lisp
  16745. (require 'org-man)
  16746. @end lisp
  16747. @noindent
  16748. A review of @samp{org-man.el}:
  16749. @enumerate
  16750. @item
  16751. First, @code{(require 'org)} ensures @samp{org.el} is loaded.
  16752. @item
  16753. @findex org-link-set-parameters
  16754. @vindex org-link-parameters
  16755. Then @code{org-link-set-parameters} defines a new link type with @samp{man}
  16756. prefix and associates functions for following, exporting and
  16757. storing such links. See the variable @code{org-link-parameters} for
  16758. a complete list of possible associations.
  16759. @item
  16760. The rest of the file implements necessary variables and functions.
  16761. For example, @code{org-man-store-link} is responsible for storing a link
  16762. when @code{org-store-link} (see @ref{Handling Links}) is called from a buffer
  16763. displaying a man page. It first checks if the @code{major-mode} is
  16764. appropriate. If check fails, the function returns @code{nil}, which
  16765. means it isn't responsible for creating a link to the current
  16766. buffer. Otherwise the function makes a link string by combining
  16767. the @samp{man:} prefix with the man topic. It also provides a default
  16768. description. The function @code{org-insert-link} can insert it back
  16769. into an Org buffer later on.
  16770. @end enumerate
  16771. @node Adding Export Back-ends
  16772. @appendixsec Adding Export Back-ends
  16773. @cindex Export, writing back-ends
  16774. Org's export engine makes it easy for writing new back-ends. The
  16775. framework on which the engine was built makes it easy to derive new
  16776. back-ends from existing ones.
  16777. @findex org-export-define-backend
  16778. @findex org-export-define-derived-backend
  16779. The two main entry points to the export engine are:
  16780. @code{org-export-define-backend} and @code{org-export-define-derived-backend}.
  16781. To grok these functions, see @samp{ox-latex.el} for an example of defining
  16782. a new back-end from scratch, and @samp{ox-beamer.el} for an example of
  16783. deriving from an existing engine.
  16784. For creating a new back-end from scratch, first set its name as
  16785. a symbol in an alist consisting of elements and export functions. To
  16786. make the back-end visible to the export dispatcher, set @code{:menu-entry}
  16787. keyword. For export options specific to this back-end, set the
  16788. @code{:options-alist}.
  16789. For creating a new back-end from an existing one, set
  16790. @code{:translate-alist} to an alist of export functions. This alist
  16791. replaces the parent back-end functions.
  16792. For complete documentation, see @uref{https://orgmode.org/worg/dev/org-export-reference.html, the Org Export Reference on Worg}.
  16793. @node Tables in Arbitrary Syntax
  16794. @appendixsec Tables in Arbitrary Syntax
  16795. @cindex tables, in other modes
  16796. @cindex lists, in other modes
  16797. @cindex Orgtbl mode
  16798. Due to Org's success in handling tables with Orgtbl, a frequently
  16799. requested feature is the use of Org's table functions in other modes,
  16800. e.g., @LaTeX{}. This would be hard to do in a general way without
  16801. complicated customization nightmares. Moreover, that would take Org
  16802. away from its simplicity roots that Orgtbl has proven. There is,
  16803. however, an alternate approach to accomplishing the same.
  16804. This approach involves implementing a custom @emph{translate} function that
  16805. operates on a native Org @emph{source table} to produce a table in another
  16806. format. This strategy would keep the excellently working Orgtbl
  16807. simple and isolate complications, if any, confined to the translate
  16808. function. To add more alien table formats, we just add more translate
  16809. functions. Also the burden of developing custom translate functions
  16810. for new table formats is in the hands of those who know those formats
  16811. best.
  16812. @menu
  16813. * Radio tables:: Sending and receiving radio tables.
  16814. * A @LaTeX{} example:: Step by step, almost a tutorial.
  16815. * Translator functions:: Copy and modify.
  16816. @end menu
  16817. @node Radio tables
  16818. @appendixsubsec Radio tables
  16819. @cindex radio tables
  16820. Radio tables are target locations for translated tables that are not near
  16821. their source. Org finds the target location and inserts the translated
  16822. table.
  16823. The key to finding the target location is the magic words @samp{BEGIN/END
  16824. RECEIVE ORGTBL}. They have to appear as comments in the current mode.
  16825. If the mode is C, then:
  16826. @example
  16827. /* BEGIN RECEIVE ORGTBL table_name */
  16828. /* END RECEIVE ORGTBL table_name */
  16829. @end example
  16830. @noindent
  16831. At the location of source, Org needs a special line to direct Orgtbl
  16832. to translate and to find the target for inserting the translated
  16833. table. For example:
  16834. @cindex @samp{ORGTBL}, keyword
  16835. @example
  16836. #+ORGTBL: SEND table_name translation_function arguments ...
  16837. @end example
  16838. @noindent
  16839. @samp{table_name} is the table's reference name, which is also used in the
  16840. receiver lines, and the @samp{translation_function} is the Lisp function
  16841. that translates. This line, in addition, may also contain alternating
  16842. key and value arguments at the end. The translation function gets
  16843. these values as a property list. A few standard parameters are
  16844. already recognized and acted upon before the translation function is
  16845. called:
  16846. @table @asis
  16847. @item @samp{:skip N}
  16848. Skip the first N lines of the table. Hlines do count; include
  16849. them if they are to be skipped.
  16850. @item @samp{:skipcols (n1 n2 ...)}
  16851. List of columns to be skipped. First Org automatically discards
  16852. columns with calculation marks and then sends the table to the
  16853. translator function, which then skips columns as specified in
  16854. @samp{skipcols}.
  16855. @end table
  16856. @noindent
  16857. To keep the source table intact in the buffer without being disturbed
  16858. when the source file is compiled or otherwise being worked on, use one
  16859. of these strategies:
  16860. @itemize
  16861. @item
  16862. Place the table in a block comment. For example, in C mode you
  16863. could wrap the table between @samp{/*} and @samp{*/} lines.
  16864. @item
  16865. Put the table after an ``end'' statement. For example @code{\bye} in @TeX{}
  16866. and @code{\end@{document@}} in @LaTeX{}.
  16867. @item
  16868. Comment and un-comment each line of the table during edits. The
  16869. @kbd{M-x orgtbl-toggle-comment} command makes toggling easy.
  16870. @end itemize
  16871. @node A @LaTeX{} example
  16872. @appendixsubsec A @LaTeX{} example of radio tables
  16873. @cindex @LaTeX{}, and Orgtbl mode
  16874. To wrap a source table in @LaTeX{}, use the @samp{comment} environment
  16875. provided by @samp{comment.sty}@footnote{@uref{https://ctan.org/tex-archive/macros/latex/contrib/comment?lang=en}}. To activate it, put
  16876. @code{\usepackage@{comment@}} in the document header. Orgtbl mode inserts
  16877. a radio table skeleton@footnote{Because @samp{LEVEL=2} has 3 stars, @samp{LEVEL=3} has 4 stars, and so
  16878. on.} with the command @kbd{M-x orgtbl-insert-radio-table}, which prompts for a table name. For
  16879. example, if @samp{salesfigures} is the name, the template inserts:
  16880. @example
  16881. % BEGIN RECEIVE ORGTBL salesfigures
  16882. % END RECEIVE ORGTBL salesfigures
  16883. \begin@{comment@}
  16884. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  16885. | | |
  16886. \end@{comment@}
  16887. @end example
  16888. @vindex LaTeX-verbatim-environments
  16889. @noindent
  16890. The line @samp{#+ORGTBL: SEND} tells Orgtbl mode to use the function
  16891. @code{orgtbl-to-latex} to convert the table to @LaTeX{} format, then insert
  16892. the table at the target (receive) location named @samp{salesfigures}. Now
  16893. the table is ready for data entry. It can even use spreadsheet
  16894. features@footnote{If the @samp{TBLFM} keyword contains an odd number of dollar
  16895. characters, this may cause problems with Font Lock in @LaTeX{} mode. As
  16896. shown in the example you can fix this by adding an extra line inside
  16897. the @samp{comment} environment that is used to balance the dollar
  16898. expressions. If you are using AUC@TeX{} with the font-latex library,
  16899. a much better solution is to add the @samp{comment} environment to the
  16900. variable @code{LaTeX-verbatim-environments}.}:
  16901. @example
  16902. % BEGIN RECEIVE ORGTBL salesfigures
  16903. % END RECEIVE ORGTBL salesfigures
  16904. \begin@{comment@}
  16905. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  16906. | Month | Days | Nr sold | per day |
  16907. |-------+------+---------+---------|
  16908. | Jan | 23 | 55 | 2.4 |
  16909. | Feb | 21 | 16 | 0.8 |
  16910. | March | 22 | 278 | 12.6 |
  16911. #+TBLFM: $4=$3/$2;%.1f
  16912. % $ (optional extra dollar to keep Font Lock happy, see footnote)
  16913. \end@{comment@}
  16914. @end example
  16915. @noindent
  16916. After editing, @kbd{C-c C-c} inserts the translated table at the
  16917. target location, between the two marker lines.
  16918. For hand-made custom tables, note that the translator needs to skip
  16919. the first two lines of the source table. Also the command has to
  16920. @emph{splice} out the target table without the header and footer.
  16921. @example
  16922. \begin@{tabular@}@{lrrr@}
  16923. Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
  16924. % BEGIN RECEIVE ORGTBL salesfigures
  16925. % END RECEIVE ORGTBL salesfigures
  16926. \end@{tabular@}
  16927. %
  16928. \begin@{comment@}
  16929. #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  16930. | Month | Days | Nr sold | per day |
  16931. |-------+------+---------+---------|
  16932. | Jan | 23 | 55 | 2.4 |
  16933. | Feb | 21 | 16 | 0.8 |
  16934. | March | 22 | 278 | 12.6 |
  16935. #+TBLFM: $4=$3/$2;%.1f
  16936. \end@{comment@}
  16937. @end example
  16938. The @LaTeX{} translator function @code{orgtbl-to-latex} is already part of
  16939. Orgtbl mode and uses a @samp{tabular} environment to typeset the table and
  16940. marks horizontal lines with @code{\hline}. For additional parameters to
  16941. control output, see @ref{Translator functions}:
  16942. @table @asis
  16943. @item @code{:splice nil/t}
  16944. When non-@code{nil}, return only table body lines; not wrapped in
  16945. tabular environment. Default is @code{nil}.
  16946. @item @code{:fmt FMT}
  16947. Format to warp each field. It should contain @samp{%s} for the
  16948. original field value. For example, to wrap each field value in
  16949. dollar symbol, you could use @samp{:fmt "$%s$"}. Format can also wrap
  16950. a property list with column numbers and formats, for example
  16951. @samp{:fmt (2 "$%s$" 4 "%s\\%%")}. In place of a string, a function
  16952. of one argument can be used; the function must return a formatted
  16953. string.
  16954. @item @code{:efmt EFMT}
  16955. Format numbers as exponentials. The spec should have @samp{%s} twice
  16956. for inserting mantissa and exponent, for example
  16957. @samp{"%s\\times10^@{%s@}"}. This may also be a property list with
  16958. column numbers and formats, for example @samp{:efmt (2
  16959. "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
  16960. @var{EFMT} has been applied to a value, @var{FMT}---see
  16961. above---is also be applied. Functions with two arguments can be
  16962. supplied instead of strings. By default, no special formatting
  16963. is applied.
  16964. @end table
  16965. @node Translator functions
  16966. @appendixsubsec Translator functions
  16967. @cindex HTML, and Orgtbl mode
  16968. @cindex translator function
  16969. @findex orgtbl-to-csv
  16970. @findex orgtbl-to-tsv
  16971. @findex orgtbl-to-latex
  16972. @findex orgtbl-to-html
  16973. @findex orgtbl-to-texinfo
  16974. @findex orgtbl-to-unicode
  16975. @findex orgtbl-to-orgtbl
  16976. @findex orgtbl-to-generic
  16977. Orgtbl mode has built-in translator functions: @code{orgtbl-to-csv}
  16978. (comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values),
  16979. @code{orgtbl-to-latex}, @code{orgtbl-to-html}, @code{orgtbl-to-texinfo},
  16980. @code{orgtbl-to-unicode} and @code{orgtbl-to-orgtbl}. They use the generic
  16981. translator, @code{orgtbl-to-generic}, which delegates translations to
  16982. various export back-ends.
  16983. Properties passed to the function through the @samp{ORGTBL SEND} line take
  16984. precedence over properties defined inside the function. For example,
  16985. this overrides the default @LaTeX{} line endings, @code{\\}, with @code{\\[2mm]}:
  16986. @example
  16987. #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  16988. @end example
  16989. For a new language translator, define a converter function. It can be
  16990. a generic function, such as shown in this example. It marks
  16991. a beginning and ending of a table with @samp{!BTBL!} and @samp{!ETBL!};
  16992. a beginning and ending of lines with @samp{!BL!} and @samp{!EL!}; and uses a TAB
  16993. for a field separator:
  16994. @lisp
  16995. (defun orgtbl-to-language (table params)
  16996. "Convert the orgtbl-mode TABLE to language."
  16997. (orgtbl-to-generic
  16998. table
  16999. (org-combine-plists
  17000. '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")
  17001. params)))
  17002. @end lisp
  17003. @noindent
  17004. The documentation for the @code{orgtbl-to-generic} function shows
  17005. a complete list of parameters, each of which can be passed through to
  17006. @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function using
  17007. that generic function.
  17008. For complicated translations the generic translator function could be
  17009. replaced by a custom translator function. Such a custom function must
  17010. take two arguments and return a single string containing the formatted
  17011. table. The first argument is the table whose lines are a list of
  17012. fields or the symbol @code{hline}. The second argument is the property
  17013. list consisting of parameters specified in the @samp{#+ORGTBL: SEND} line.
  17014. Please share your translator functions by posting them to the Org
  17015. users mailing list, at @email{emacs-orgmode@@gnu.org}.
  17016. @node Dynamic Blocks
  17017. @appendixsec Dynamic Blocks
  17018. @cindex dynamic blocks
  17019. Org supports @emph{dynamic blocks} in Org documents. They are inserted
  17020. with begin and end markers like any other code block, but the contents
  17021. 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
  17022. @ref{Clocking Work Time}).
  17023. Dynamic blocks can have names and function parameters. The syntax is
  17024. similar to source code block specifications:
  17025. @example
  17026. #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  17027. ...
  17028. #+END:
  17029. @end example
  17030. These commands update dynamic blocks:
  17031. @table @asis
  17032. @item @kbd{C-c C-x C-u} (@code{org-dblock-update})
  17033. @kindex C-c C-x C-u
  17034. @findex org-dblock-update
  17035. Update dynamic block at point.
  17036. @item @kbd{C-u C-c C-x C-u}
  17037. @kindex C-u C-c C-x C-u
  17038. Update all dynamic blocks in the current file.
  17039. @end table
  17040. Before updating a dynamic block, Org removes content between the
  17041. @samp{BEGIN} and @samp{END} markers. Org then reads the parameters on the
  17042. @samp{BEGIN} line for passing to the writer function. If the function
  17043. expects to access the removed content, then Org expects an extra
  17044. parameter, @samp{:content}, on the @samp{BEGIN} line.
  17045. The syntax for naming a writer function with a dynamic block labelled
  17046. @samp{myblock} is: @code{org-dblock-write:myblock}. Parameters come from the
  17047. @samp{BEGIN} line.
  17048. The following is an example of a dynamic block and a block writer function
  17049. that updates the time when the function was last run:
  17050. @example
  17051. #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  17052. ...
  17053. #+END:
  17054. @end example
  17055. @noindent
  17056. The dynamic block's writer function:
  17057. @lisp
  17058. (defun org-dblock-write:block-update-time (params)
  17059. (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  17060. (insert "Last block update at: "
  17061. (format-time-string fmt))))
  17062. @end lisp
  17063. To keep dynamic blocks up-to-date in an Org file, use the function,
  17064. @code{org-update-all-dblocks} in hook, such as @code{before-save-hook}. The
  17065. @code{org-update-all-dblocks} function does not run if the file is not in
  17066. Org mode.
  17067. @findex org-narrow-to-block
  17068. Dynamic blocks, like any other block, can be narrowed with
  17069. @code{org-narrow-to-block}.
  17070. @node Special Agenda Views
  17071. @appendixsec Special Agenda Views
  17072. @cindex agenda views, user-defined
  17073. @vindex org-agenda-skip-function
  17074. @vindex org-agenda-skip-function-global
  17075. Org provides a special hook to further limit items in agenda views:
  17076. @code{agenda}, @code{agenda*}@footnote{The @code{agenda*} view is the same as @code{agenda} except that it
  17077. only considers @emph{appointments}, i.e., scheduled and deadline items that
  17078. have a time specification @samp{[h]h:mm} in their time-stamps.}, @code{todo}, @code{alltodo}, @code{tags}, @code{tags-todo},
  17079. @code{tags-tree}. Specify a custom function that tests inclusion of every
  17080. matched item in the view. This function can also skip as much as is
  17081. needed.
  17082. For a global condition applicable to agenda views, use the
  17083. @code{org-agenda-skip-function-global} variable. Org uses a global
  17084. condition with @code{org-agenda-skip-function} for custom searching.
  17085. This example defines a function for a custom view showing TODO items
  17086. with @samp{waiting} status. Manually this is a multi-step search process,
  17087. but with a custom view, this can be automated as follows:
  17088. The custom function searches the subtree for the @samp{waiting} tag and
  17089. returns @code{nil} on match. Otherwise it gives the location from where
  17090. the search continues.
  17091. @lisp
  17092. (defun my-skip-unless-waiting ()
  17093. "Skip trees that are not waiting"
  17094. (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  17095. (if (re-search-forward ":waiting:" subtree-end t)
  17096. nil ; tag found, do not skip
  17097. subtree-end))) ; tag not found, continue after end of subtree
  17098. @end lisp
  17099. To use this custom function in a custom agenda command:
  17100. @lisp
  17101. (org-add-agenda-custom-command
  17102. '("b" todo "PROJECT"
  17103. ((org-agenda-skip-function 'my-skip-unless-waiting)
  17104. (org-agenda-overriding-header "Projects waiting for something: "))))
  17105. @end lisp
  17106. @vindex org-agenda-overriding-header
  17107. Note that this also binds @code{org-agenda-overriding-header} to a more
  17108. meaningful string suitable for the agenda view.
  17109. @vindex org-odd-levels-only
  17110. @vindex org-agenda-skip-function
  17111. Search for entries with a limit set on levels for the custom search.
  17112. This is a general approach to creating custom searches in Org. To
  17113. include all levels, use @samp{LEVEL>0}@footnote{Note that, for @code{org-odd-levels-only}, a level number
  17114. corresponds to order in the hierarchy, not to the number of stars.}. Then to selectively pick
  17115. the matched entries, use @code{org-agenda-skip-function}, which also
  17116. accepts Lisp forms, such as @code{org-agenda-skip-entry-if} and
  17117. @code{org-agenda-skip-subtree-if}. For example:
  17118. @table @asis
  17119. @item @code{(org-agenda-skip-entry-if 'scheduled)}
  17120. Skip current entry if it has been scheduled.
  17121. @item @code{(org-agenda-skip-entry-if 'notscheduled)}
  17122. Skip current entry if it has not been scheduled.
  17123. @item @code{(org-agenda-skip-entry-if 'deadline)}
  17124. Skip current entry if it has a deadline.
  17125. @item @code{(org-agenda-skip-entry-if 'scheduled 'deadline)}
  17126. Skip current entry if it has a deadline, or if it is scheduled.
  17127. @item @code{(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))}
  17128. Skip current entry if the TODO keyword is TODO or WAITING.
  17129. @item @code{(org-agenda-skip-entry-if 'todo 'done)}
  17130. Skip current entry if the TODO keyword marks a DONE state.
  17131. @item @code{(org-agenda-skip-entry-if 'timestamp)}
  17132. Skip current entry if it has any timestamp, may also be deadline
  17133. or scheduled.
  17134. @item @code{(org-agenda-skip-entry-if 'regexp "regular expression")}
  17135. Skip current entry if the regular expression matches in the
  17136. entry.
  17137. @item @code{(org-agenda-skip-entry-if 'notregexp "regular expression")}
  17138. Skip current entry unless the regular expression matches.
  17139. @item @code{(org-agenda-skip-subtree-if 'regexp "regular expression")}
  17140. Same as above, but check and skip the entire subtree.
  17141. @end table
  17142. The following is an example of a search for @samp{waiting} without the
  17143. special function:
  17144. @lisp
  17145. (org-add-agenda-custom-command
  17146. '("b" todo "PROJECT"
  17147. ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  17148. 'regexp ":waiting:"))
  17149. (org-agenda-overriding-header "Projects waiting for something: "))))
  17150. @end lisp
  17151. @node Speeding Up Your Agendas
  17152. @appendixsec Speeding Up Your Agendas
  17153. @cindex agenda views, optimization
  17154. Some agenda commands slow down when the Org files grow in size or
  17155. number. Here are tips to speed up:
  17156. @itemize
  17157. @item
  17158. Reduce the number of Org agenda files to avoid slowdowns due to hard drive
  17159. accesses.
  17160. @item
  17161. Reduce the number of DONE and archived headlines so agenda
  17162. operations that skip over these can finish faster.
  17163. @item
  17164. Do not dim blocked tasks:
  17165. @vindex org-agenda-dim-blocked-tasks
  17166. @lisp
  17167. (setq org-agenda-dim-blocked-tasks nil)
  17168. @end lisp
  17169. @item
  17170. Stop preparing agenda buffers on startup:
  17171. @vindex org-startup-folded
  17172. @vindex org-agenda-inhibit-startup
  17173. @lisp
  17174. (setq org-agenda-inhibit-startup nil)
  17175. @end lisp
  17176. @item
  17177. Disable tag inheritance for agendas:
  17178. @vindex org-agenda-show-inherited-tags
  17179. @vindex org-agenda-use-tag-inheritance
  17180. @lisp
  17181. (setq org-agenda-use-tag-inheritance nil)
  17182. @end lisp
  17183. @end itemize
  17184. These options can be applied to selected agenda views. For more
  17185. details about generation of agenda views, see the docstrings for the
  17186. relevant variables, and this @uref{https://orgmode.org/worg/agenda-optimization.html, dedicated Worg page} for agenda
  17187. optimization.
  17188. @node Extracting Agenda Information
  17189. @appendixsec Extracting Agenda Information
  17190. @cindex agenda, pipe
  17191. @cindex scripts, for agenda processing
  17192. Org provides commands to access agendas through Emacs batch mode.
  17193. Through this command-line interface, agendas are automated for further
  17194. processing or printing.
  17195. @vindex org-agenda-custom-commands
  17196. @findex org-batch-agenda
  17197. @code{org-batch-agenda} creates an agenda view in ASCII and outputs to
  17198. standard output. This command takes one string parameter. When
  17199. string consists of a single character, Org uses it as a key to
  17200. @code{org-agenda-custom-commands}. These are the same ones available
  17201. through the agenda dispatcher (see @ref{Agenda Dispatcher}).
  17202. This example command line directly prints the TODO list to the printer:
  17203. @example
  17204. emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  17205. @end example
  17206. When the string parameter length is two or more characters, Org
  17207. matches it with tags/TODO strings. For example, this example command
  17208. line prints items tagged with @samp{shop}, but excludes items tagged with
  17209. @samp{NewYork}:
  17210. @example
  17211. emacs -batch -l ~/.emacs \
  17212. -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  17213. @end example
  17214. @noindent
  17215. An example showing on-the-fly parameter modifications:
  17216. @example
  17217. emacs -batch -l ~/.emacs \
  17218. -eval '(org-batch-agenda "a" \
  17219. org-agenda-span (quote month) \
  17220. org-agenda-include-diary nil \
  17221. org-agenda-files (quote ("~/org/project.org")))' \
  17222. | lpr
  17223. @end example
  17224. @noindent
  17225. which produces an agenda for the next 30 days from just the
  17226. @samp{~/org/projects.org} file.
  17227. @findex org-batch-agenda-csv
  17228. For structured processing of agenda output, use @code{org-batch-agenda-csv}
  17229. with the following fields:
  17230. @table @asis
  17231. @item category
  17232. The category of the item
  17233. @item head
  17234. The headline, without TODO keyword, TAGS and PRIORITY
  17235. @item type
  17236. The type of the agenda entry, can be
  17237. @multitable {aaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  17238. @item @code{todo}
  17239. @tab selected in TODO match
  17240. @item @code{tagsmatch}
  17241. @tab selected in tags match
  17242. @item @code{diary}
  17243. @tab imported from diary
  17244. @item @code{deadline}
  17245. @tab a deadline
  17246. @item @code{scheduled}
  17247. @tab scheduled
  17248. @item @code{timestamp}
  17249. @tab appointment, selected by timestamp
  17250. @item @code{closed}
  17251. @tab entry was closed on date
  17252. @item @code{upcoming-deadline}
  17253. @tab warning about nearing deadline
  17254. @item @code{past-scheduled}
  17255. @tab forwarded scheduled item
  17256. @item @code{block}
  17257. @tab entry has date block including date
  17258. @end multitable
  17259. @item todo
  17260. The TODO keyword, if any
  17261. @item tags
  17262. All tags including inherited ones, separated by colons
  17263. @item date
  17264. The relevant date, like @samp{2007-2-14}
  17265. @item time
  17266. The time, like @samp{15:00-16:50}
  17267. @item extra
  17268. String with extra planning info
  17269. @item priority-l
  17270. The priority letter if any was given
  17271. @item priority-n
  17272. The computed numerical priority
  17273. @end table
  17274. @noindent
  17275. If the selection of the agenda item was based on a timestamp,
  17276. including those items with @samp{DEADLINE} and @samp{SCHEDULED} keywords, then
  17277. Org includes date and time in the output.
  17278. If the selection of the agenda item was based on a timestamp (or
  17279. deadline/scheduled), then Org includes date and time in the output.
  17280. Here is an example of a post-processing script in Perl. It takes the
  17281. CSV output from Emacs and prints with a checkbox:
  17282. @example
  17283. #!/usr/bin/perl
  17284. # define the Emacs command to run
  17285. $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  17286. # run it and capture the output
  17287. $agenda = qx@{$cmd 2>/dev/null@};
  17288. # loop over all lines
  17289. foreach $line (split(/\n/,$agenda)) @{
  17290. # get the individual values
  17291. ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  17292. $priority_l,$priority_n) = split(/,/,$line);
  17293. # process and print
  17294. print "[ ] $head\n";
  17295. @}
  17296. @end example
  17297. @node Using the Property API
  17298. @appendixsec Using the Property API
  17299. @cindex API, for properties
  17300. @cindex properties, API
  17301. Here is a description of the functions that can be used to work with
  17302. properties.
  17303. @defun org-entry-properties &optional pom which
  17304. Get all properties of the entry at point-or-marker @var{POM}.
  17305. This includes the TODO keyword, the tags, time strings for deadline,
  17306. scheduled, and clocking, and any additional properties defined in the
  17307. entry. The return value is an alist. Keys may occur multiple times
  17308. if the property key was used several times. @var{POM} may also
  17309. be @code{nil}, in which case the current entry is used. If
  17310. @var{WHICH} is @code{nil} or @code{all}, get all properties. If
  17311. @var{WHICH} is @code{special} or @code{standard}, only get that subclass.
  17312. @end defun
  17313. @vindex org-use-property-inheritance
  17314. @findex org-insert-property-drawer
  17315. @defun org-entry-get pom property &optional inherit
  17316. Get value of @var{PROPERTY} for entry at point-or-marker
  17317. @var{POM}. By default, this only looks at properties defined
  17318. locally in the entry. If @var{INHERIT} is non-@code{nil} and the
  17319. entry does not have the property, then also check higher levels of the
  17320. hierarchy. If @var{INHERIT} is the symbol @code{selective}, use
  17321. inheritance if and only if the setting of
  17322. @code{org-use-property-inheritance} selects @var{PROPERTY} for
  17323. inheritance.
  17324. @end defun
  17325. @defun org-entry-delete pom property
  17326. Delete the property @var{PROPERTY} from entry at point-or-marker
  17327. @var{POM}.
  17328. @end defun
  17329. @defun org-entry-put pom property value
  17330. Set @var{PROPERTY} to @var{VALUES} for entry at
  17331. point-or-marker POM.
  17332. @end defun
  17333. @defun org-buffer-property-keys &optional include-specials
  17334. Get all property keys in the current buffer.
  17335. @end defun
  17336. @defun org-insert-property-drawer
  17337. Insert a property drawer for the current entry. Also
  17338. @end defun
  17339. @defun org-entry-put-multivalued-property pom property &rest values
  17340. Set @var{PROPERTY} at point-or-marker @var{POM} to
  17341. @var{VALUES}. @var{VALUES} should be a list of strings.
  17342. They are concatenated, with spaces as separators.
  17343. @end defun
  17344. @defun org-entry-get-multivalued-property pom property
  17345. Treat the value of the property @var{PROPERTY} as
  17346. a whitespace-separated list of values and return the values as a list
  17347. of strings.
  17348. @end defun
  17349. @defun org-entry-add-to-multivalued-property pom property value
  17350. Treat the value of the property @var{PROPERTY} as
  17351. a whitespace-separated list of values and make sure that
  17352. @var{VALUE} is in this list.
  17353. @end defun
  17354. @defun org-entry-remove-from-multivalued-property pom property value
  17355. Treat the value of the property @var{PROPERTY} as
  17356. a whitespace-separated list of values and make sure that
  17357. @var{VALUE} is @emph{not} in this list.
  17358. @end defun
  17359. @defun org-entry-member-in-multivalued-property pom property value
  17360. Treat the value of the property @var{PROPERTY} as
  17361. a whitespace-separated list of values and check if @var{VALUE} is
  17362. in this list.
  17363. @end defun
  17364. @defopt org-property-allowed-value-functions
  17365. Hook for functions supplying allowed values for a specific property.
  17366. The functions must take a single argument, the name of the property,
  17367. and return a flat list of allowed values. If @samp{:ETC} is one of the
  17368. values, use the values as completion help, but allow also other values
  17369. to be entered. The functions must return @code{nil} if they are not
  17370. responsible for this property.
  17371. @end defopt
  17372. @node Using the Mapping API
  17373. @appendixsec Using the Mapping API
  17374. @cindex API, for mapping
  17375. @cindex mapping entries, API
  17376. Org has sophisticated mapping capabilities to find all entries
  17377. satisfying certain criteria. Internally, this functionality is used
  17378. to produce agenda views, but there is also an API that can be used to
  17379. execute arbitrary functions for each or selected entries. The main
  17380. entry point for this API is:
  17381. @defun org-map-entries func &optional match scope &rest skip
  17382. Call @{@{@{(var(FUNC))@}@}@} at each headline selected by @var{MATCH}
  17383. in @var{SCOPE}.
  17384. @var{FUNC} is a function or a Lisp form. With the cursor
  17385. positioned at the beginning of the headline, call the function without
  17386. arguments. Org returns an alist of return values of calls to the
  17387. function.
  17388. To avoid preserving point, Org wraps the call to @var{FUNC} in
  17389. save-excursion form. After evaluation, Org moves the cursor to the
  17390. end of the line that was just processed. Search continues from that
  17391. point forward. This may not always work as expected under some
  17392. conditions, such as if the current sub-tree was removed by a previous
  17393. archiving operation. In such rare circumstances, Org skips the next
  17394. entry entirely when it should not. To stop Org from such skips, make
  17395. @var{FUNC} set the variable @code{org-map-continue-from} to a specific
  17396. buffer position.
  17397. @var{MATCH} is a tags/property/TODO match. Org iterates only
  17398. matched headlines. Org iterates over all headlines when
  17399. @var{MATCH} is @code{nil} or @code{t}.
  17400. @var{SCOPE} determines the scope of this command. It can be any
  17401. of:
  17402. @table @asis
  17403. @item @code{nil}
  17404. The current buffer, respecting the restriction, if any.
  17405. @item @code{tree}
  17406. The subtree started with the entry at point.
  17407. @item @code{region}
  17408. The entries within the active region, if any.
  17409. @item @code{file}
  17410. The current buffer, without restriction.
  17411. @item @code{file-with-archives}
  17412. The current buffer, and any archives associated with it.
  17413. @item @code{agenda}
  17414. All agenda files.
  17415. @item @code{agenda-with-archives}
  17416. All agenda files with any archive files associated with them.
  17417. @item @code{(file1 file2 ...)}
  17418. If this is a list, all files in the list are scanned.
  17419. @end table
  17420. @noindent
  17421. The remaining arguments are treated as settings for the scanner's
  17422. skipping facilities. Valid arguments are:
  17423. @table @asis
  17424. @item @code{archive}
  17425. Skip trees with the archive tag.
  17426. @item @code{comment}
  17427. Skip trees with the COMMENT keyword.
  17428. @item function or Lisp form
  17429. @vindex org-agenda-skip-function
  17430. Used as value for @code{org-agenda-skip-function}, so whenever the
  17431. function returns @code{t}, @var{FUNC} is called for that entry
  17432. and search continues from the point where the function leaves it.
  17433. @end table
  17434. @end defun
  17435. The mapping routine can call any arbitrary function, even functions
  17436. that change meta data or query the property API (see @ref{Using the Property API}). Here are some handy functions:
  17437. @defun org-todo &optional arg
  17438. Change the TODO state of the entry. See the docstring of the
  17439. functions for the many possible values for the argument
  17440. @var{ARG}.
  17441. @end defun
  17442. @defun org-priority &optional action
  17443. Change the priority of the entry. See the docstring of this function
  17444. for the possible values for @var{ACTION}.
  17445. @end defun
  17446. @defun org-toggle-tag tag &optional onoff
  17447. Toggle the tag @var{TAG} in the current entry. Setting
  17448. @var{ONOFF} to either @code{on} or @code{off} does not toggle tag, but
  17449. ensure that it is either on or off.
  17450. @end defun
  17451. @defun org-promote
  17452. Promote the current entry.
  17453. @end defun
  17454. @defun org-demote
  17455. Demote the current entry.
  17456. @end defun
  17457. This example turns all entries tagged with @samp{TOMORROW} into TODO
  17458. entries with keyword @samp{UPCOMING}. Org ignores entries in comment trees
  17459. and archive trees.
  17460. @lisp
  17461. (org-map-entries '(org-todo "UPCOMING")
  17462. "+TOMORROW" 'file 'archive 'comment)
  17463. @end lisp
  17464. The following example counts the number of entries with TODO keyword
  17465. @samp{WAITING}, in all agenda files.
  17466. @lisp
  17467. (length (org-map-entries t "/+WAITING" 'agenda))
  17468. @end lisp
  17469. @node MobileOrg
  17470. @appendix MobileOrg
  17471. @cindex iPhone
  17472. @cindex smartphone
  17473. @cindex android
  17474. @cindex MobileOrg
  17475. MobileOrg is a companion mobile app that runs on iOS and Android
  17476. devices. MobileOrg enables offline-views and capture support for an
  17477. Org mode system that is rooted on a ``real'' computer. MobileOrg can
  17478. record changes to existing entries.
  17479. The @uref{https://github.com/MobileOrg/, iOS implementation} for the @emph{iPhone/iPod Touch/iPad} series of
  17480. devices, was started by Richard Moreland and is now in the hands of
  17481. Sean Escriva. Android users should check out @uref{http://wiki.github.com/matburt/mobileorg-android/, MobileOrg Android} by
  17482. Matt Jones. Though the two implementations are not identical, they
  17483. offer similar features.
  17484. This appendix describes Org's support for agenda view formats
  17485. compatible with MobileOrg. It also describes synchronizing changes,
  17486. such as to notes, between MobileOrg and the computer.
  17487. To change tags and TODO states in MobileOrg, first customize the
  17488. variables @code{org-todo-keywords} and @code{org-tag-alist}. These should cover
  17489. all the important tags and TODO keywords, even if Org files use only
  17490. some of them. Though MobileOrg has in-buffer settings, it understands
  17491. TODO states @emph{sets} (see @ref{Per-file keywords}) and
  17492. @emph{mutually exclusive} tags (see @ref{Setting Tags}) only for those set in
  17493. these variables.
  17494. @menu
  17495. * Setting Up the Staging Area:: For the mobile device.
  17496. * Pushing to MobileOrg:: Uploading Org files and agendas.
  17497. * Pulling from MobileOrg:: Integrating captured and flagged items.
  17498. @end menu
  17499. @node Setting Up the Staging Area
  17500. @appendixsec Setting Up the Staging Area
  17501. MobileOrg needs access to a file directory on a server to interact
  17502. with Emacs. With a public server, consider encrypting the files.
  17503. MobileOrg version 1.5 supports encryption for the iPhone. Org also
  17504. requires @samp{openssl} installed on the local computer. To turn on
  17505. encryption, set the same password in MobileOrg and in Emacs. Set the
  17506. password in the variable @code{org-mobile-use-encryption}@footnote{If Emacs is configured for safe storing of passwords, then
  17507. configure the variable, @code{org-mobile-encryption-password}; please read
  17508. the docstring of that variable.}. Note
  17509. that even after MobileOrg encrypts the file contents, the file name
  17510. remains visible on the file systems of the local computer, the server,
  17511. and the mobile device.
  17512. For a server to host files, consider options like @uref{http://dropbox.com, Dropbox.com}
  17513. account@footnote{An alternative is to use a WebDAV server. MobileOrg
  17514. documentation has details of WebDAV server configuration. Additional
  17515. help is at this @uref{https://orgmode.org/worg/org-faq.html#mobileorg_webdav, FAQ entry}.}. On first connection, MobileOrg creates a directory
  17516. @samp{MobileOrg} on Dropbox. Pass its location to Emacs through an
  17517. initialisation file variable as follows:
  17518. @lisp
  17519. (setq org-mobile-directory "~/Dropbox/MobileOrg")
  17520. @end lisp
  17521. Org copies files to the above directory for MobileOrg. Org also uses
  17522. the same directory for sharing notes between Org and MobileOrg.
  17523. @node Pushing to MobileOrg
  17524. @appendixsec Pushing to MobileOrg
  17525. @vindex org-mobile-files
  17526. @vindex org-directory
  17527. Org pushes files listed in @code{org-mobile-files} to
  17528. @code{org-mobile-directory}. Files include agenda files (as listed in
  17529. @code{org-agenda-files}). Customize @code{org-mobile-files} to add other files.
  17530. File names are staged with paths relative to @code{org-directory}, so all
  17531. files should be inside this directory@footnote{Symbolic links in @code{org-directory} need to have the same name
  17532. as their targets.}.
  17533. Push creates a special Org file @samp{agendas.org} with custom agenda views
  17534. defined by the user@footnote{While creating the agendas, Org mode forces ID properties on
  17535. all referenced entries, so that these entries can be uniquely
  17536. identified if MobileOrg flags them for further action. To avoid
  17537. setting properties configure the variable
  17538. @code{org-mobile-force-id-on-agenda-items} to @code{nil}. Org mode then relies
  17539. on outline paths, assuming they are unique.}.
  17540. Finally, Org writes the file @samp{index.org}, containing links to other
  17541. files. MobileOrg reads this file first from the server to determine
  17542. what other files to download for agendas. For faster downloads,
  17543. MobileOrg only reads files whose checksums@footnote{Checksums are stored automatically in the file
  17544. @samp{checksums.dat}.} have changed.
  17545. @node Pulling from MobileOrg
  17546. @appendixsec Pulling from MobileOrg
  17547. When MobileOrg synchronizes with the server, it pulls the Org files
  17548. for viewing. It then appends to the file @samp{mobileorg.org} on the
  17549. server the captured entries, pointers to flagged and changed entries.
  17550. Org integrates its data in an inbox file format.
  17551. @enumerate
  17552. @item
  17553. @vindex org-mobile-inbox-for-pull
  17554. Org moves all entries found in @samp{mobileorg.org}@footnote{The file will be empty after this operation.} and appends
  17555. them to the file pointed to by the variable
  17556. @code{org-mobile-inbox-for-pull}. Each captured entry and each editing
  17557. event is a top-level entry in the inbox file.
  17558. @item
  17559. After moving the entries, Org attempts changes to MobileOrg. Some
  17560. changes are applied directly and without user interaction.
  17561. Examples include changes to tags, TODO state, headline and body
  17562. text. Entries for further action are tagged as @samp{FLAGGED}. Org
  17563. marks entries with problems with an error message in the inbox.
  17564. They have to be resolved manually.
  17565. @item
  17566. Org generates an agenda view for flagged entries for user
  17567. intervention to clean up. For notes stored in flagged entries,
  17568. MobileOrg displays them in the echo area when the cursor is on the
  17569. corresponding agenda item.
  17570. @table @asis
  17571. @item @kbd{?}
  17572. @kindex ?
  17573. Pressing @kbd{?} displays the entire flagged note in
  17574. another window. Org also pushes it to the kill ring. To
  17575. store flagged note as a normal note, use @kbd{? z C-y C-c C-c}. Pressing@kbd{?} twice does these things: first
  17576. it removes the @samp{FLAGGED} tag; second, it removes the flagged
  17577. note from the property drawer; third, it signals that manual
  17578. editing of the flagged entry is now finished.
  17579. @end table
  17580. @end enumerate
  17581. @kindex ? @r{(Agenda dispatcher)}
  17582. From the agenda dispatcher, @kbd{?} returns to the view to finish
  17583. processing flagged entries. Note that these entries may not be the
  17584. most recent since MobileOrg searches files that were last pulled. To
  17585. get an updated agenda view with changes since the last pull, pull
  17586. again.
  17587. @node History and Acknowledgments
  17588. @appendix History and Acknowledgments
  17589. @anchor{From Carsten}
  17590. @appendixsec From Carsten
  17591. Org was born in 2003, out of frustration over the user interface of
  17592. the Emacs Outline mode. I was trying to organize my notes and
  17593. projects, and using Emacs seemed to be the natural way to go.
  17594. However, having to remember eleven different commands with two or
  17595. three keys per command, only to hide and show parts of the outline
  17596. tree, that seemed entirely unacceptable to me. Also, when using
  17597. outlines to take notes, I constantly wanted to restructure the tree,
  17598. organizing it parallel to my thoughts and plans. @emph{Visibility cycling}
  17599. and @emph{structure editing} were originally implemented in the package
  17600. @samp{outline-magic.el}, but quickly moved to the more general @samp{org.el}.
  17601. As this environment became comfortable for project planning, the next
  17602. step was adding @emph{TODO entries}, basic @emph{timestamps}, and @emph{table
  17603. support}. These areas highlighted the two main goals that Org still
  17604. has today: to be a new, outline-based, plain text mode with innovative
  17605. and intuitive editing features, and to incorporate project planning
  17606. functionality directly into a notes file.
  17607. Since the first release, literally thousands of emails to me or to the
  17608. @email{emacs-orgmode@@gnu.org, mailing list} have provided a constant stream of bug reports, feedback,
  17609. new ideas, and sometimes patches and add-on code. Many thanks to
  17610. everyone who has helped to improve this package. I am trying to keep
  17611. here a list of the people who had significant influence in shaping one
  17612. or more aspects of Org. The list may not be complete, if I have
  17613. forgotten someone, please accept my apologies and let me know.
  17614. Before I get to this list, a few special mentions are in order:
  17615. @table @asis
  17616. @item Bastien Guerry
  17617. Bastien has written a large number of extensions to Org (most of
  17618. them integrated into the core by now), including the @LaTeX{}
  17619. exporter and the plain list parser. His support during the early
  17620. days was central to the success of this project. Bastien also
  17621. invented Worg, helped establishing the Web presence of Org, and
  17622. sponsored hosting costs for the orgmode.org website. Bastien
  17623. stepped in as maintainer of Org between 2011 and 2013, at a time
  17624. when I desperately needed a break.
  17625. @item Eric Schulte and Dan Davison
  17626. Eric and Dan are jointly responsible for the Org Babel system,
  17627. which turns Org into a multi-language environment for evaluating
  17628. code and doing literate programming and reproducible research.
  17629. This has become one of Org's killer features that define what Org
  17630. is today.
  17631. @item John Wiegley
  17632. John has contributed a number of great ideas and patches directly
  17633. to Org, including the attachment system (@samp{org-attach.el}),
  17634. integration with Apple Mail (@samp{org-mac-message.el}), hierarchical
  17635. dependencies of TODO items, habit tracking (@samp{org-habits.el}), and
  17636. encryption (@samp{org-crypt.el}). Also, the capture system is really
  17637. an extended copy of his great @samp{remember.el}.
  17638. @item Sebastian Rose
  17639. Without Sebastian, the HTML/XHTML publishing of Org would be the
  17640. pitiful work of an ignorant amateur. Sebastian has pushed this
  17641. part of Org onto a much higher level. He also wrote
  17642. @samp{org-info.js}, a Java script for displaying webpages derived from
  17643. Org using an Info-like or a folding interface with single-key
  17644. navigation.
  17645. @end table
  17646. @noindent
  17647. See below for the full list of contributions! Again, please let me
  17648. know what I am missing here!
  17649. @anchor{From Bastien}
  17650. @appendixsec From Bastien
  17651. I (Bastien) have been maintaining Org between 2011 and 2013. This
  17652. appendix would not be complete without adding a few more
  17653. acknowledgments and thanks.
  17654. I am first grateful to Carsten for his trust while handing me over the
  17655. maintainership of Org. His unremitting support is what really helped
  17656. me getting more confident over time, with both the community and the
  17657. code.
  17658. When I took over maintainership, I knew I would have to make Org more
  17659. collaborative than ever, as I would have to rely on people that are
  17660. more knowledgeable than I am on many parts of the code. Here is
  17661. a list of the persons I could rely on, they should really be
  17662. considered co-maintainers, either of the code or the community:
  17663. @table @asis
  17664. @item Eric Schulte
  17665. Eric is maintaining the Babel parts of Org. His reactivity here
  17666. kept me away from worrying about possible bugs here and let me
  17667. focus on other parts.
  17668. @item Nicolas Goaziou
  17669. Nicolas is maintaining the consistency of the deepest parts of
  17670. Org. His work on @samp{org-element.el} and @samp{ox.el} has been
  17671. outstanding, and it opened the doors for many new ideas and
  17672. features. He rewrote many of the old exporters to use the new
  17673. export engine, and helped with documenting this major change.
  17674. More importantly (if that's possible), he has been more than
  17675. reliable during all the work done for Org 8.0, and always very
  17676. reactive on the mailing list.
  17677. @item Achim Gratz
  17678. Achim rewrote the building process of Org, turning some @emph{ad hoc}
  17679. tools into a flexible and conceptually clean process. He
  17680. patiently coped with the many hiccups that such a change can
  17681. create for users.
  17682. @item Nick Dokos
  17683. The Org mode mailing list would not be such a nice place without
  17684. Nick, who patiently helped users so many times. It is impossible
  17685. to overestimate such a great help, and the list would not be so
  17686. active without him.
  17687. @end table
  17688. I received support from so many users that it is clearly impossible to
  17689. be fair when shortlisting a few of them, but Org's history would not
  17690. be complete if the ones above were not mentioned in this manual.
  17691. @anchor{List of Contributions}
  17692. @appendixsec List of Contributions
  17693. @itemize
  17694. @item
  17695. Russel Adams came up with the idea for drawers.
  17696. @item
  17697. Thomas Baumann wrote @samp{org-bbdb.el} and @samp{org-mhe.el}.
  17698. @item
  17699. Christophe Bataillon created the great unicorn logo that we use on
  17700. the Org mode website.
  17701. @item
  17702. Alex Bochannek provided a patch for rounding timestamps.
  17703. @item
  17704. Jan Böcker wrote @samp{org-docview.el}.
  17705. @item
  17706. Brad Bozarth showed how to pull RSS feed data into Org files.
  17707. @item
  17708. Tom Breton wrote @samp{org-choose.el}.
  17709. @item
  17710. Charles Cave's suggestion sparked the implementation of templates
  17711. for Remember, which are now templates for capture.
  17712. @item
  17713. Pavel Chalmoviansky influenced the agenda treatment of items with
  17714. specified time.
  17715. @item
  17716. Gregory Chernov patched support for Lisp forms into table
  17717. calculations and improved XEmacs compatibility, in particular by
  17718. porting @samp{nouline.el} to XEmacs.
  17719. @item
  17720. Sacha Chua suggested copying some linking code from Planner.
  17721. @item
  17722. Baoqiu Cui contributed the DocBook exporter.
  17723. @item
  17724. Eddward DeVilla proposed and tested checkbox statistics. He also
  17725. came up with the idea of properties, and that there should be an API
  17726. for them.
  17727. @item
  17728. Nick Dokos tracked down several nasty bugs.
  17729. @item
  17730. Kees Dullemond used to edit projects lists directly in HTML and so
  17731. inspired some of the early development, including HTML export. He
  17732. also asked for a way to narrow wide table columns.
  17733. @item
  17734. Thomas S. Dye contributed documentation on Worg and helped
  17735. integrating the Org Babel documentation into the manual.
  17736. @item
  17737. Christian Egli converted the documentation into Texinfo format,
  17738. inspired the agenda, patched CSS formatting into the HTML exporter,
  17739. and wrote @samp{org-taskjuggler.el}.
  17740. @item
  17741. David Emery provided a patch for custom CSS support in exported HTML
  17742. agendas.
  17743. @item
  17744. Nic Ferrier contributed mailcap and XOXO support.
  17745. @item
  17746. Miguel A. Figueroa-Villanueva implemented hierarchical checkboxes.
  17747. @item
  17748. John Foerch figured out how to make incremental search show context
  17749. around a match in a hidden outline tree.
  17750. @item
  17751. Raimar Finken wrote @samp{org-git-line.el}.
  17752. @item
  17753. Mikael Fornius works as a mailing list moderator.
  17754. @item
  17755. Austin Frank works as a mailing list moderator.
  17756. @item
  17757. Eric Fraga drove the development of Beamer export with ideas and
  17758. testing.
  17759. @item
  17760. Barry Gidden did proofreading the manual in preparation for the book
  17761. publication through Network Theory Ltd.
  17762. @item
  17763. Niels Giesen had the idea to automatically archive DONE trees.
  17764. @item
  17765. Nicolas Goaziou rewrote much of the plain list code.
  17766. @item
  17767. Kai Grossjohann pointed out key-binding conflicts with other
  17768. packages.
  17769. @item
  17770. Brian Gough of Network Theory Ltd publishes the Org mode manual as
  17771. a book.
  17772. @item
  17773. Bernt Hansen has driven much of the support for auto-repeating
  17774. tasks, task state change logging, and the clocktable. His clear
  17775. explanations have been critical when we started to adopt the Git
  17776. version control system.
  17777. @item
  17778. Manuel Hermenegildo has contributed various ideas, small fixes and
  17779. patches.
  17780. @item
  17781. Phil Jackson wrote @samp{org-irc.el}.
  17782. @item
  17783. Scott Jaderholm proposed footnotes, control over whitespace between
  17784. folded entries, and column view for properties.
  17785. @item
  17786. Matt Jones wrote MobileOrg Android.
  17787. @item
  17788. Tokuya Kameshima wrote @samp{org-wl.el} and @samp{org-mew.el}.
  17789. @item
  17790. Shidai Liu (``Leo'') asked for embedded @LaTeX{} and tested it. He also
  17791. provided frequent feedback and some patches.
  17792. @item
  17793. Matt Lundin has proposed last-row references for table formulas and
  17794. named invisible anchors. He has also worked a lot on the FAQ.
  17795. @item
  17796. David Maus wrote @samp{org-atom.el}, maintains the issues file for Org,
  17797. and is a prolific contributor on the mailing list with competent
  17798. replies, small fixes and patches.
  17799. @item
  17800. Jason F. McBrayer suggested agenda export to CSV format.
  17801. @item
  17802. Max Mikhanosha came up with the idea of refiling.
  17803. @item
  17804. Dmitri Minaev sent a patch to set priority limits on a per-file
  17805. basis.
  17806. @item
  17807. Stefan Monnier provided a patch to keep the Emacs Lisp compiler
  17808. happy.
  17809. @item
  17810. Richard Moreland wrote MobileOrg for the iPhone.
  17811. @item
  17812. Rick Moynihan proposed allowing multiple TODO sequences in a file
  17813. and being able to quickly restrict the agenda to a subtree.
  17814. @item
  17815. Todd Neal provided patches for links to Info files and Elisp forms.
  17816. @item
  17817. Greg Newman refreshed the unicorn logo into its current form.
  17818. @item
  17819. Tim O'Callaghan suggested in-file links, search options for general
  17820. file links, and tags.
  17821. @item
  17822. Osamu Okano wrote @samp{orgcard2ref.pl}, a Perl program to create a text
  17823. version of the reference card.
  17824. @item
  17825. Takeshi Okano translated the manual and David O'Toole's tutorial
  17826. into Japanese.
  17827. @item
  17828. Oliver Oppitz suggested multi-state TODO items.
  17829. @item
  17830. Scott Otterson sparked the introduction of descriptive text for
  17831. links, among other things.
  17832. @item
  17833. Pete Phillips helped during the development of the TAGS feature,
  17834. and provided frequent feedback.
  17835. @item
  17836. Martin Pohlack provided the code snippet to bundle character
  17837. insertion into bundles of 20 for undo.
  17838. @item
  17839. T.V. Raman reported bugs and suggested improvements.
  17840. @item
  17841. Matthias Rempe (Oelde) provided ideas, Windows support, and quality
  17842. control.
  17843. @item
  17844. Paul Rivier provided the basic implementation of named footnotes.
  17845. He also acted as mailing list moderator for some time.
  17846. @item
  17847. Kevin Rogers contributed code to access VM files on remote hosts.
  17848. @item
  17849. Frank Ruell solved the mystery of the @samp{keymapp nil} bug, a conflict
  17850. with @samp{allout.el}.
  17851. @item
  17852. Jason Riedy generalized the send-receive mechanism for Orgtbl
  17853. tables with extensive patches.
  17854. @item
  17855. Philip Rooke created the Org reference card, provided lots of
  17856. feedback, developed and applied standards to the Org documentation.
  17857. @item
  17858. Christian Schlauer proposed angular brackets around links, among
  17859. other things.
  17860. @item
  17861. Paul Sexton wrote @samp{org-ctags.el}.
  17862. @item
  17863. Tom Shannon's @samp{organizer-mode.el} inspired linking to VM/BBDB/Gnus.
  17864. @item
  17865. Ilya Shlyakhter proposed the Archive Sibling, line numbering in
  17866. literal examples, and remote highlighting for referenced code lines.
  17867. @item
  17868. Stathis Sideris wrote the @samp{ditaa.jar} ASCII to PNG converter that is
  17869. now packaged into Org's @samp{contrib/} directory.
  17870. @item
  17871. Daniel Sinder came up with the idea of internal archiving by locking
  17872. subtrees.
  17873. @item
  17874. Dale Smith proposed link abbreviations.
  17875. @item
  17876. James TD Smith has contributed a large number of patches for
  17877. useful tweaks and features.
  17878. @item
  17879. Adam Spiers asked for global linking commands, inspired the link
  17880. extension system, added support for Mairix, and proposed the mapping
  17881. API.
  17882. @item
  17883. Ulf Stegemann created the table to translate special symbols to
  17884. HTML, @LaTeX{}, UTF-8, Latin-1 and ASCII.
  17885. @item
  17886. Andy Stewart contributed code to @samp{org-w3m.el}, to copy
  17887. HTML content with links transformation to Org syntax.
  17888. @item
  17889. David O'Toole wrote @samp{org-publish.el} and drafted the
  17890. manual chapter about publishing.
  17891. @item
  17892. Jambunathan K. contributed the ODT exporter.
  17893. @item
  17894. Sebastien Vauban reported many issues with @LaTeX{} and Beamer export
  17895. and enabled source code highlighting in Gnus.
  17896. @item
  17897. Stefan Vollmar organized a video-recorded talk at the
  17898. Max-Planck-Institute for Neurology. He also inspired the creation
  17899. of a concept index for HTML export.
  17900. @item
  17901. Jürgen Vollmer contributed code generating the table of contents in
  17902. HTML output.
  17903. @item
  17904. Samuel Wales has provided important feedback and bug reports.
  17905. @item
  17906. Chris Wallace provided a patch implementing the @samp{QUOTE} block.
  17907. @item
  17908. David Wainberg suggested archiving, and improvements to the
  17909. linking system.
  17910. @item
  17911. Carsten Wimmer suggested some changes and helped fix a bug in
  17912. linking to Gnus.
  17913. @item
  17914. Roland Winkler requested additional key bindings to make Org work on
  17915. a TTY.
  17916. @item
  17917. Piotr Zielinski wrote @samp{org-mouse.el}, proposed agenda
  17918. blocks and contributed various ideas and code snippets.
  17919. @item
  17920. Marco Wahl wrote @samp{org-eww.el}.
  17921. @end itemize
  17922. @node GNU Free Documentation License
  17923. @appendix GNU Free Documentation License
  17924. @include doclicense.texi
  17925. @node Main Index
  17926. @chapter Main Index
  17927. @printindex cp
  17928. @node Key Index
  17929. @chapter Key Index
  17930. @printindex ky
  17931. @node Command and Function Index
  17932. @chapter Command and Function Index
  17933. @printindex fn
  17934. @node Variable Index
  17935. @chapter Variable Index
  17936. This is not a complete index of variables and faces, only the ones
  17937. that are mentioned in the manual. For a more complete list, use
  17938. @kbd{M-x org-customize} and then click yourself through the tree.
  17939. @printindex vr
  17940. @bye