org.texi 763 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786
  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. $ cd org-mode/
  493. $ make autoloads
  494. @end example
  495. Note that in this case, @code{make autoloads} is mandatory: it defines
  496. Org's version in @samp{org-version.el} and Org's autoloads in
  497. @samp{org-loaddefs.el}.
  498. Remember to add the correct load-path as described in the method
  499. above.
  500. You can also compile with @samp{make}, generate the documentation with
  501. @samp{make doc}, create a local configuration with @samp{make config} and
  502. install Org with @samp{make install}. Please run @samp{make help} to get the
  503. list of compilation/installation options.
  504. For more detailed explanations on Org's build system, please check the
  505. Org Build System page on @uref{https://orgmode.org/worg/dev/org-build-system.html, Worg}.
  506. @node Activation
  507. @section Activation
  508. @cindex activation
  509. @cindex autoload
  510. @cindex ELPA
  511. @cindex global key bindings
  512. @cindex key bindings, global
  513. Org mode buffers need Font Lock to be turned on: this is the default
  514. in Emacs@footnote{If you do not use Font Lock globally turn it on in Org buffer
  515. with @code{(add-hook 'org-mode-hook 'turn-on-font-lock)}.}.
  516. There are compatibility issues between Org mode and some other Elisp
  517. packages (see @ref{Conflicts}). Please take the
  518. time to check the list.
  519. @findex org-agenda
  520. @findex org-capture
  521. @findex org-store-link
  522. For a better experience, the three Org commands @code{org-store-link},
  523. @code{org-capture} and @code{org-agenda} ought to be accessible anywhere in
  524. Emacs, not just in Org buffers. To that effect, you need to bind them
  525. to globally available keys, like the ones reserved for users (see
  526. @ref{Key Binding Conventions,,,elisp,}). Here are suggested
  527. bindings, please modify the keys to your own liking.
  528. @lisp
  529. (global-set-key "\C-cl" 'org-store-link)
  530. (global-set-key "\C-ca" 'org-agenda)
  531. (global-set-key "\C-cc" 'org-capture)
  532. @end lisp
  533. @cindex Org mode, turning on
  534. Files with the @samp{.org} extension use Org mode by default. To turn on
  535. Org mode in a file that does not have the extension @samp{.org}, make the
  536. first line of a file look like this:
  537. @example
  538. MY PROJECTS -*- mode: org; -*-
  539. @end example
  540. @vindex org-insert-mode-line-in-empty-file
  541. @noindent
  542. which selects Org mode for this buffer no matter what the file's name
  543. is. See also the variable @code{org-insert-mode-line-in-empty-file}.
  544. Many commands in Org work on the region if the region is @emph{active}. To
  545. make use of this, you need to have @code{transient-mark-mode} turned on,
  546. which is the default. If you do not like @code{transient-mark-mode}, you
  547. can create an active region by using the mouse to select a region, or
  548. pressing @kbd{C-@key{SPC}} twice before moving the cursor.
  549. @node Feedback
  550. @section Feedback
  551. @cindex feedback
  552. @cindex bug reports
  553. @cindex reporting a bug
  554. @cindex maintainer
  555. @cindex author
  556. If you find problems with Org, or if you have questions, remarks, or
  557. ideas about it, please mail to the Org mailing list
  558. @email{emacs-orgmode@@gnu.org}. You can subscribe to the list @uref{https://lists.gnu.org/mailman/listinfo/emacs-orgmode, on this
  559. web page}. If you are not a member of the mailing list, your mail will
  560. be passed to the list after a moderator has approved it@footnote{Please consider subscribing to the mailing list in order to
  561. minimize the work the mailing list moderators have to do.}.
  562. @findex org-version
  563. @findex org-submit-bug-report
  564. For bug reports, please first try to reproduce the bug with the latest
  565. version of Org available---if you are running an outdated version, it
  566. is quite possible that the bug has been fixed already. If the bug
  567. persists, prepare a report and provide as much information as
  568. possible, including the version information of Emacs (@kbd{M-x emacs-version}) and Org (@kbd{M-x org-version}), as well as
  569. the Org related setup in the Emacs init file. The easiest way to do
  570. this is to use the command
  571. @example
  572. M-x org-submit-bug-report <RET>
  573. @end example
  574. @noindent
  575. which puts all this information into an Emacs mail buffer so that you
  576. only need to add your description. If you are not sending the Email
  577. from within Emacs, please copy and paste the content into your Email
  578. program.
  579. Sometimes you might face a problem due to an error in your Emacs or
  580. Org mode setup. Before reporting a bug, it is very helpful to start
  581. Emacs with minimal customizations and reproduce the problem. Doing so
  582. often helps you determine if the problem is with your customization or
  583. with Org mode itself. You can start a typical minimal session with
  584. a command like the example below.
  585. @example
  586. $ emacs -Q -l /path/to/minimal-org.el
  587. @end example
  588. However if you are using Org mode as distributed with Emacs, a minimal
  589. setup is not necessary. In that case it is sufficient to start Emacs
  590. as @samp{emacs -Q}. The @samp{minimal-org.el} setup file can have contents as
  591. shown below.
  592. @lisp
  593. ;;; Minimal setup to load latest `org-mode'.
  594. ;; Activate debugging.
  595. (setq debug-on-error t
  596. debug-on-signal nil
  597. debug-on-quit nil)
  598. ;; Add latest Org mode to load path.
  599. (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
  600. (add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp" t))
  601. @end lisp
  602. If an error occurs, a ``backtrace'' can be very useful---see below on
  603. how to create one. Often a small example file helps, along with clear
  604. information about:
  605. @enumerate
  606. @item
  607. What exactly did you do?
  608. @item
  609. What did you expect to happen?
  610. @item
  611. What happened instead?
  612. @end enumerate
  613. @noindent
  614. Thank you for helping to improve this program.
  615. @anchor{How to create a useful backtrace}
  616. @subheading How to create a useful backtrace
  617. @cindex backtrace of an error
  618. If working with Org produces an error with a message you do not
  619. understand, you may have hit a bug. The best way to report this is by
  620. providing, in addition to what was mentioned above, a backtrace. This
  621. is information from the built-in debugger about where and how the
  622. error occurred. Here is how to produce a useful backtrace:
  623. @enumerate
  624. @item
  625. Reload uncompiled versions of all Org mode Lisp files. The
  626. backtrace contains much more information if it is produced with
  627. uncompiled code. To do this, use
  628. @example
  629. C-u M-x org-reload <RET>
  630. @end example
  631. @noindent
  632. or, from the menu: Org @arrow{} Refresh/Reload @arrow{} Reload Org uncompiled.
  633. @item
  634. Then, activate the debugger:
  635. @example
  636. M-x toggle-debug-or-error <RET>
  637. @end example
  638. @noindent
  639. or, from the menu: Options @arrow{} Enter Debugger on Error.
  640. @item
  641. Do whatever you have to do to hit the error. Do not forget to
  642. document the steps you take.
  643. @item
  644. When you hit the error, a @samp{*Backtrace*} buffer appears on the
  645. screen. Save this buffer to a file---for example using @kbd{C-x C-w}---and attach it to your bug report.
  646. @end enumerate
  647. @node Conventions
  648. @section Typesetting Conventions Used in this Manual
  649. @anchor{TODO keywords tags properties etc}
  650. @subheading TODO keywords, tags, properties, etc.
  651. Org uses various syntactical elements: TODO keywords, tags, property
  652. names, keywords, blocks, etc. In this manual we use the following
  653. conventions:
  654. @table @asis
  655. @item @samp{TODO}
  656. @itemx @samp{WAITING}
  657. TODO keywords are written with all capitals, even if they are
  658. user-defined.
  659. @item @samp{boss}
  660. @itemx @samp{ARCHIVE}
  661. User-defined tags are written in lowercase; built-in tags with
  662. special meaning are written with all capitals.
  663. @item @samp{Release}
  664. @itemx @samp{PRIORITY}
  665. User-defined properties are capitalized; built-in properties with
  666. special meaning are written with all capitals.
  667. @item @samp{TITLE}
  668. @itemx @samp{BEGIN} @dots{} @samp{END}
  669. Keywords and blocks are written in uppercase to enhance their
  670. readability, but you can use lowercase in your Org files.
  671. @end table
  672. @anchor{Key bindings and commands}
  673. @subheading Key bindings and commands
  674. The manual lists both the keys and the corresponding commands for
  675. accessing a functionality. Org mode often uses the same key for
  676. different functions, depending on context. The command that is bound
  677. to such keys has a generic name, like @code{org-metaright}. In the manual
  678. we will, wherever possible, give the function that is internally
  679. called by the generic command. For example, in the chapter on
  680. document structure, @kbd{M-@key{RIGHT}} will be listed to call
  681. @code{org-do-demote}, while in the chapter on tables, it will be listed to
  682. call @code{org-table-move-column-right}.
  683. @node Document Structure
  684. @chapter Document Structure
  685. @cindex document structure
  686. @cindex structure of document
  687. Org is based on Outline mode and provides flexible commands to
  688. edit the structure of the document.
  689. @menu
  690. * Outlines:: Org is based on Outline mode.
  691. * Headlines:: How to typeset Org tree headlines.
  692. * Visibility Cycling:: Show and hide, much simplified.
  693. * Motion:: Jumping to other headlines.
  694. * Structure Editing:: Changing sequence and level of headlines.
  695. * Sparse Trees:: Matches embedded in context.
  696. * Plain Lists:: Additional structure within an entry.
  697. * Drawers:: Tucking stuff away.
  698. * Blocks:: Folding blocks.
  699. * Creating Footnotes:: How footnotes are defined in Org's syntax.
  700. * Org Syntax:: Formal description of Org's syntax.
  701. @end menu
  702. @node Outlines
  703. @section Outlines
  704. @cindex outlines
  705. @cindex Outline mode
  706. Org is implemented on top of Outline mode. Outlines allow a document
  707. to be organized in a hierarchical structure, which, least for me, is
  708. the best representation of notes and thoughts. An overview of this
  709. structure is achieved by folding, i.e., hiding large parts of the
  710. document to show only the general document structure and the parts
  711. currently being worked on. Org greatly simplifies the use of outlines
  712. by compressing the entire show and hide functionalities into a single
  713. command, @code{org-cycle}, which is bound to the @kbd{@key{TAB}} key.
  714. @node Headlines
  715. @section Headlines
  716. @cindex headlines
  717. @cindex outline tree
  718. @vindex org-special-ctrl-a/e
  719. @vindex org-special-ctrl-k
  720. @vindex org-ctrl-k-protect-subtree
  721. Headlines define the structure of an outline tree. The headlines in
  722. 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},
  723. and @code{org-ctrl-k-protect-subtree} to configure special behavior of
  724. @kbd{C-a}, @kbd{C-e}, and @kbd{C-k} in headlines. Note
  725. also that clocking only works with headings indented less than 30
  726. stars.}. For
  727. example:
  728. @example
  729. * Top level headline
  730. ** Second level
  731. *** Third level
  732. some text
  733. *** Third level
  734. more text
  735. * Another top level headline
  736. @end example
  737. @vindex org-footnote-section
  738. @noindent
  739. Note that the name defined in @code{org-footnote-section} is reserved. Do
  740. not use it as a title for your own headings.
  741. Some people find the many stars too noisy and would prefer an outline
  742. that has whitespace followed by a single star as headline starters.
  743. See @ref{Clean View}.
  744. @vindex org-cycle-separator-lines
  745. An empty line after the end of a subtree is considered part of it and
  746. is hidden when the subtree is folded. However, if you leave at least
  747. two empty lines, one empty line remains visible after folding the
  748. subtree, in order to structure the collapsed view. See the variable
  749. @code{org-cycle-separator-lines} to modify this behavior.
  750. @node Visibility Cycling
  751. @section Visibility Cycling
  752. @cindex cycling, visibility
  753. @cindex visibility cycling
  754. @cindex trees, visibility
  755. @cindex show hidden text
  756. @cindex hide text
  757. @menu
  758. * Global and local cycling:: Cycling through various visibility states.
  759. * Initial visibility:: Setting the initial visibility state.
  760. * Catching invisible edits:: Preventing mistakes when editing invisible parts.
  761. @end menu
  762. @node Global and local cycling
  763. @subsection Global and local cycling
  764. @cindex subtree visibility states
  765. @cindex subtree cycling
  766. @cindex folded, subtree visibility state
  767. @cindex children, subtree visibility state
  768. @cindex subtree, subtree visibility state
  769. Outlines make it possible to hide parts of the text in the buffer.
  770. Org uses just two commands, bound to @kbd{@key{TAB}} and
  771. @kbd{S-@key{TAB}} to change the visibility in the buffer.
  772. @table @asis
  773. @item @kbd{@key{TAB}} (@code{org-cycle})
  774. @kindex TAB
  775. @findex org-cycle
  776. @emph{Subtree cycling}: Rotate current subtree among the states
  777. @example
  778. ,-> FOLDED -> CHILDREN -> SUBTREE --.
  779. '-----------------------------------'
  780. @end example
  781. @vindex org-cycle-emulate-tab
  782. The cursor must be on a headline for this to work@footnote{See, however, the option @code{org-cycle-emulate-tab}.}.
  783. @item @kbd{S-@key{TAB}} (@code{org-global-cycle})
  784. @itemx @kbd{C-u @key{TAB}}
  785. @cindex global visibility states
  786. @cindex global cycling
  787. @cindex overview, global visibility state
  788. @cindex contents, global visibility state
  789. @cindex show all, global visibility state
  790. @kindex C-u TAB
  791. @kindex S-TAB
  792. @findex org-global-cycle
  793. @emph{Global cycling}: Rotate the entire buffer among the states
  794. @example
  795. ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
  796. '--------------------------------------'
  797. @end example
  798. When @kbd{S-@key{TAB}} is called with a numeric prefix argument N,
  799. the CONTENTS view up to headlines of level N are shown. Note
  800. that inside tables (see @ref{Tables}), @kbd{S-@key{TAB}} jumps to the
  801. previous field instead.
  802. @vindex org-cycle-global-at-bob
  803. You can run global cycling using @kbd{@key{TAB}} only if point is
  804. at the very beginning of the buffer, but not on a headline, and
  805. @code{org-cycle-global-at-bob} is set to a non-@code{nil} value.
  806. @item @kbd{C-u C-u @key{TAB}} (@code{org-set-startup-visibility})
  807. @cindex startup visibility
  808. @kindex C-u C-u TAB
  809. @findex org-set-startup-visibility
  810. Switch back to the startup visibility of the buffer (see @ref{Initial visibility}).
  811. @item @kbd{C-u C-u C-u @key{TAB}} (@code{outline-show-all})
  812. @cindex show all, command
  813. @kindex C-u C-u C-u TAB
  814. @findex outline-show-all
  815. Show all, including drawers.
  816. @item @kbd{C-c C-r} (@code{org-reveal})
  817. @cindex revealing context
  818. @kindex C-c C-r
  819. @findex org-reveal
  820. Reveal context around point, showing the current entry, the
  821. following heading and the hierarchy above. Useful for working
  822. near a location that has been exposed by a sparse tree command
  823. (see @ref{Sparse Trees}) or an agenda command (see @ref{Agenda Commands}). With a prefix argument show, on each level, all
  824. sibling headings. With a double prefix argument, also show the
  825. entire subtree of the parent.
  826. @item @kbd{C-c C-k} (@code{outline-show-branches})
  827. @cindex show branches, command
  828. @kindex C-c C-k
  829. @findex outline-show-branches
  830. Expose all the headings of the subtree, CONTENTS view for just
  831. one subtree.
  832. @item @kbd{C-c @key{TAB}} (@code{outline-show-children})
  833. @cindex show children, command
  834. @kindex C-c TAB
  835. @findex outline-show-children
  836. Expose all direct children of the subtree. With a numeric prefix
  837. argument N, expose all children down to level N.
  838. @item @kbd{C-c C-x b} (@code{org-tree-to-indirect-buffer})
  839. @kindex C-c C-x b
  840. @findex org-tree-to-indirect-buffer
  841. Show the current subtree in an indirect buffer@footnote{The indirect buffer contains the entire buffer, but is narrowed
  842. to the current tree. Editing the indirect buffer also changes the
  843. original buffer, but without affecting visibility in that buffer. For
  844. more information about indirect buffers, see @ref{Indirect Buffers,GNU Emacs Manual,,emacs,}.}. With
  845. a numeric prefix argument, N, go up to level N and then take that
  846. tree. If N is negative then go up that many levels. With
  847. a @kbd{C-u} prefix, do not remove the previously used
  848. indirect buffer.
  849. @item @kbd{C-c C-x v} (@code{org-copy-visible})
  850. @kindex C-c C-x v
  851. @findex org-copy-visible
  852. Copy the @emph{visible} text in the region into the kill ring.
  853. @end table
  854. @node Initial visibility
  855. @subsection Initial visibility
  856. @vindex org-startup-folded
  857. When Emacs first visits an Org file, the global state is set to
  858. OVERVIEW, i.e., only the top level headlines are visible@footnote{When @code{org-agenda-inhibit-startup} is non-@code{nil}, Org does not
  859. honor the default visibility state when first opening a file for the
  860. agenda (see @ref{Speeding Up Your Agendas}).}. This
  861. can be configured through the variable @code{org-startup-folded}, or on
  862. a per-file basis by adding one of the following lines anywhere in the
  863. buffer:
  864. @cindex STARTUP, keyword
  865. @example
  866. #+STARTUP: overview
  867. #+STARTUP: content
  868. #+STARTUP: showall
  869. #+STARTUP: showeverything
  870. @end example
  871. @cindex @samp{VISIBILITY}, property
  872. @noindent
  873. Furthermore, any entries with a @samp{VISIBILITY} property (see @ref{Properties and Columns}) get their visibility adapted accordingly. Allowed values
  874. for this property are @samp{folded}, @samp{children}, @samp{content}, and @code{all}.
  875. @table @asis
  876. @item @kbd{C-u C-u @key{TAB}} (@code{org-set-startup-visibility})
  877. @kindex C-u C-u TAB
  878. @findex org-set-startup-visibility
  879. Switch back to the startup visibility of the buffer, i.e.,
  880. whatever is requested by startup options and @samp{VISIBILITY}
  881. properties in individual entries.
  882. @end table
  883. @node Catching invisible edits
  884. @subsection Catching invisible edits
  885. @cindex edits, catching invisible
  886. @vindex org-catch-invisible-edits
  887. Sometimes you may inadvertently edit an invisible part of the buffer
  888. and be confused on what has been edited and how to undo the mistake.
  889. Setting @code{org-catch-invisible-edits} to non-@code{nil} helps preventing
  890. this. See the docstring of this option on how Org should catch
  891. invisible edits and process them.
  892. @node Motion
  893. @section Motion
  894. @cindex motion, between headlines
  895. @cindex jumping, to headlines
  896. @cindex headline navigation
  897. The following commands jump to other headlines in the buffer.
  898. @table @asis
  899. @item @kbd{C-c C-n} (@code{outline-next-visible-heading})
  900. @kindex C-c C-n
  901. @findex outline-next-visible-heading
  902. Next heading.
  903. @item @kbd{C-c C-p} (@code{outline-previous-visible-heading})
  904. @kindex C-c C-p
  905. @findex outline-previous-visible-heading
  906. Previous heading.
  907. @item @kbd{C-c C-f} (@code{org-forward-same-level})
  908. @kindex C-c C-f
  909. @findex org-forward-same-level
  910. Next heading same level.
  911. @item @kbd{C-c C-b} (@code{org-backward-same-level})
  912. @kindex C-c C-b
  913. @findex org-backward-same-level
  914. Previous heading same level.
  915. @item @kbd{C-c C-u} (@code{outline-up-heading})
  916. @kindex C-c C-u
  917. @findex outline-up-heading
  918. Backward to higher level heading.
  919. @item @kbd{C-c C-j} (@code{org-goto})
  920. @kindex C-c C-j
  921. @findex org-goto
  922. @vindex org-goto-auto-isearch
  923. Jump to a different place without changing the current outline
  924. visibility. Shows the document structure in a temporary buffer,
  925. where you can use the following keys to find your destination:
  926. @multitable @columnfractions 0.3 0.7
  927. @item @kbd{@key{TAB}}
  928. @tab Cycle visibility.
  929. @item @kbd{@key{DOWN}} / @kbd{@key{UP}}
  930. @tab Next/previous visible headline.
  931. @item @kbd{@key{RET}}
  932. @tab Select this location.
  933. @item @kbd{/}
  934. @tab Do a Sparse-tree search
  935. @end multitable
  936. @noindent
  937. The following keys work if you turn off @code{org-goto-auto-isearch}
  938. @multitable @columnfractions 0.3 0.7
  939. @item @kbd{n} / @kbd{p}
  940. @tab Next/previous visible headline.
  941. @item @kbd{f} / @kbd{b}
  942. @tab Next/previous headline same level.
  943. @item @kbd{u}
  944. @tab One level up.
  945. @item @kbd{0} @dots{} @kbd{9}
  946. @tab Digit argument.
  947. @item @kbd{q}
  948. @tab Quit.
  949. @end multitable
  950. @vindex org-goto-interface
  951. @noindent
  952. See also the variable @code{org-goto-interface}.
  953. @end table
  954. @node Structure Editing
  955. @section Structure Editing
  956. @cindex structure editing
  957. @cindex headline, promotion and demotion
  958. @cindex promotion, of subtrees
  959. @cindex demotion, of subtrees
  960. @cindex subtree, cut and paste
  961. @cindex pasting, of subtrees
  962. @cindex cutting, of subtrees
  963. @cindex copying, of subtrees
  964. @cindex sorting, of subtrees
  965. @cindex subtrees, cut and paste
  966. @table @asis
  967. @item @kbd{M-@key{RET}} (@code{org-meta-return})
  968. @kindex M-RET
  969. @findex org-meta-return
  970. @vindex org-M-RET-may-split-line
  971. Insert a new heading, item or row.
  972. If the command is used at the @emph{beginning} of a line, and if there
  973. is a heading or a plain list item (see @ref{Plain Lists}) at point,
  974. the new heading/item is created @emph{before} the current line. When
  975. used at the beginning of a regular line of text, turn that line
  976. into a heading.
  977. When this command is used in the middle of a line, the line is
  978. split and the rest of the line becomes the new item or headline.
  979. If you do not want the line to be split, customize
  980. @code{org-M-RET-may-split-line}.
  981. Calling the command with a @kbd{C-u} prefix unconditionally
  982. inserts a new heading at the end of the current subtree, thus
  983. preserving its contents. With a double @kbd{C-u C-u}
  984. prefix, the new heading is created at the end of the parent
  985. subtree instead.
  986. @item @kbd{C-@key{RET}} (@code{org-insert-heading-respect-content})
  987. @kindex C-RET
  988. @findex org-insert-heading-respect-content
  989. Insert a new heading at the end of the current subtree.
  990. @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading})
  991. @kindex M-S-RET
  992. @findex org-insert-todo-heading
  993. @vindex org-treat-insert-todo-heading-as-state-change
  994. Insert new TODO entry with same level as current heading. See
  995. also the variable
  996. @code{org-treat-insert-todo-heading-as-state-change}.
  997. @item @kbd{C-S-@key{RET}} (@code{org-insert-todo-heading-respect-content})
  998. @kindex C-S-RET
  999. @findex org-insert-todo-heading-respect-content
  1000. Insert new TODO entry with same level as current heading. Like
  1001. @kbd{C-@key{RET}}, the new headline is inserted after the current
  1002. subtree.
  1003. @item @kbd{@key{TAB}} (@code{org-cycle})
  1004. @kindex TAB
  1005. @findex org-cycle
  1006. In a new entry with no text yet, the first @kbd{@key{TAB}} demotes
  1007. the entry to become a child of the previous one. The next
  1008. @kbd{@key{TAB}} makes it a parent, and so on, all the way to top
  1009. level. Yet another @kbd{@key{TAB}}, and you are back to the
  1010. initial level.
  1011. @item @kbd{M-@key{LEFT}} (@code{org-do-promote})
  1012. @kindex M-LEFT
  1013. @findex org-do-promote
  1014. Promote current heading by one level.
  1015. @item @kbd{M-@key{RIGHT}} (@code{org-do-demote})
  1016. @kindex M-RIGHT
  1017. @findex org-do-demote
  1018. Demote current heading by one level.
  1019. @item @kbd{M-S-@key{LEFT}} (@code{org-promote-subtree})
  1020. @kindex M-S-LEFT
  1021. @findex org-promote-subtree
  1022. Promote the current subtree by one level.
  1023. @item @kbd{M-S-@key{RIGHT}} (@code{org-demote-subtree})
  1024. @kindex M-S-RIGHT
  1025. @findex org-demote-subtree
  1026. Demote the current subtree by one level.
  1027. @item @kbd{M-@key{UP}} (@code{org-move-subtree-up})
  1028. @kindex M-UP
  1029. @findex org-move-subtree-up
  1030. Move subtree up, i.e., swap with previous subtree of same level.
  1031. @item @kbd{M-@key{DOWN}} (@code{org-move-subtree-down})
  1032. @kindex M-DOWN
  1033. @findex org-move-subtree-down
  1034. Move subtree down, i.e., swap with next subtree of same level.
  1035. @item @kbd{C-c @@} (@code{org-mark-subtree})
  1036. @kindex C-c @@
  1037. @findex org-mark-subtree
  1038. Mark the subtree at point. Hitting repeatedly marks subsequent
  1039. subtrees of the same level as the marked subtree.
  1040. @item @kbd{C-c C-x C-w} (@code{org-cut-subtree})
  1041. @kindex C-c C-x C-w
  1042. @findex org-cut-subtree
  1043. Kill subtree, i.e., remove it from buffer but save in kill ring.
  1044. With a numeric prefix argument N, kill N sequential subtrees.
  1045. @item @kbd{C-c C-x M-w} (@code{org-copy-subtree})
  1046. @kindex C-c C-x M-w
  1047. @findex org-copy-subtree
  1048. Copy subtree to kill ring. With a numeric prefix argument N,
  1049. copy the N sequential subtrees.
  1050. @item @kbd{C-c C-x C-y} (@code{org-paste-subtree})
  1051. @kindex C-c C-x C-y
  1052. @findex org-paste-subtree
  1053. Yank subtree from kill ring. This does modify the level of the
  1054. subtree to make sure the tree fits in nicely at the yank
  1055. position. The yank level can also be specified with a numeric
  1056. prefix argument, or by yanking after a headline marker like
  1057. @samp{****}.
  1058. @item @kbd{C-y} (@code{org-yank})
  1059. @kindex C-y
  1060. @findex org-yank
  1061. @vindex org-yank-adjusted-subtrees
  1062. @vindex org-yank-folded-subtrees
  1063. Depending on the variables @code{org-yank-adjusted-subtrees} and
  1064. @code{org-yank-folded-subtrees}, Org's internal @code{yank} command pastes
  1065. subtrees folded and in a clever way, using the same command as
  1066. @kbd{C-c C-x C-y}. With the default settings, no level
  1067. adjustment takes place, but the yanked tree is folded unless
  1068. doing so would swallow text previously visible. Any prefix
  1069. argument to this command forces a normal @code{yank} to be executed,
  1070. with the prefix passed along. A good way to force a normal yank
  1071. is @kbd{C-u C-y}. If you use @code{yank-pop} after a yank, it
  1072. yanks previous kill items plainly, without adjustment and
  1073. folding.
  1074. @item @kbd{C-c C-x c} (@code{org-clone-subtree-with-time-shift})
  1075. @kindex C-c C-x c
  1076. @findex org-clone-subtree-with-time-shift
  1077. Clone a subtree by making a number of sibling copies of it. You
  1078. are prompted for the number of copies to make, and you can also
  1079. specify if any timestamps in the entry should be shifted. This
  1080. can be useful, for example, to create a number of tasks related
  1081. to a series of lectures to prepare. For more details, see the
  1082. docstring of the command @code{org-clone-subtree-with-time-shift}.
  1083. @item @kbd{C-c C-w} (@code{org-refile})
  1084. @kindex C-c C-w
  1085. @findex org-refile
  1086. Refile entry or region to a different location. See @ref{Refile and Copy}.
  1087. @item @kbd{C-c ^} (@code{org-sort})
  1088. @kindex C-c ^
  1089. @findex org-sort
  1090. Sort same-level entries. When there is an active region, all
  1091. entries in the region are sorted. Otherwise the children of the
  1092. current headline are sorted. The command prompts for the sorting
  1093. method, which can be alphabetically, numerically, by time---first
  1094. timestamp with active preferred, creation time, scheduled time,
  1095. deadline time---by priority, by TODO keyword---in the sequence
  1096. the keywords have been defined in the setup---or by the value of
  1097. a property. Reverse sorting is possible as well. You can also
  1098. supply your own function to extract the sorting key. With
  1099. a @kbd{C-u} prefix, sorting is case-sensitive.
  1100. @item @kbd{C-x n s} (@code{org-narrow-to-subtree})
  1101. @kindex C-x n s
  1102. @findex org-narrow-to-subtree
  1103. Narrow buffer to current subtree.
  1104. @item @kbd{C-x n b} (@code{org-narrow-to-block})
  1105. @kindex C-x n b
  1106. @findex org-narrow-to-block
  1107. Narrow buffer to current block.
  1108. @item @kbd{C-x n w} (@code{widen})
  1109. @kindex C-x n w
  1110. @findex widen
  1111. Widen buffer to remove narrowing.
  1112. @item @kbd{C-c *} (@code{org-toggle-heading})
  1113. @kindex C-c *
  1114. @findex org-toggle-heading
  1115. Turn a normal line or plain list item into a headline---so that
  1116. it becomes a subheading at its location. Also turn a headline
  1117. into a normal line by removing the stars. If there is an active
  1118. region, turn all lines in the region into headlines. If the
  1119. first line in the region was an item, turn only the item lines
  1120. into headlines. Finally, if the first line is a headline, remove
  1121. the stars from all headlines in the region.
  1122. @end table
  1123. @cindex region, active
  1124. @cindex active region
  1125. @cindex transient mark mode
  1126. When there is an active region---i.e., when Transient Mark mode is
  1127. active---promotion and demotion work on all headlines in the region.
  1128. To select a region of headlines, it is best to place both point and
  1129. mark at the beginning of a line, mark at the beginning of the first
  1130. headline, and point at the line just after the last headline to
  1131. change. Note that when the cursor is inside a table (see @ref{Tables}),
  1132. the Meta-Cursor keys have different functionality.
  1133. @node Sparse Trees
  1134. @section Sparse Trees
  1135. @cindex sparse trees
  1136. @cindex trees, sparse
  1137. @cindex folding, sparse trees
  1138. @cindex occur, command
  1139. @vindex org-show-context-detail
  1140. An important feature of Org mode is the ability to construct @emph{sparse
  1141. trees} for selected information in an outline tree, so that the entire
  1142. document is folded as much as possible, but the selected information
  1143. is made visible along with the headline structure above it@footnote{See also the variable @code{org-show-context-detail} to decide how
  1144. much context is shown around each match.}.
  1145. Just try it out and you will see immediately how it works.
  1146. Org mode contains several commands creating such trees, all these
  1147. commands can be accessed through a dispatcher:
  1148. @table @asis
  1149. @item @kbd{C-c /} (@code{org-sparse-tree})
  1150. @kindex C-c /
  1151. @findex org-sparse-tree
  1152. This prompts for an extra key to select a sparse-tree creating
  1153. command.
  1154. @item @kbd{C-c / r} or @kbd{C-c / /} (@code{org-occur})
  1155. @kindex C-c / r
  1156. @kindex C-c / /
  1157. @findex org-occur
  1158. @vindex org-remove-highlights-with-change
  1159. Prompts for a regexp and shows a sparse tree with all matches.
  1160. If the match is in a headline, the headline is made visible. If
  1161. the match is in the body of an entry, headline and body are made
  1162. visible. In order to provide minimal context, also the full
  1163. hierarchy of headlines above the match is shown, as well as the
  1164. headline following the match. Each match is also highlighted;
  1165. the highlights disappear when the buffer is changed by an editing
  1166. command, or by pressing @kbd{C-c C-c}@footnote{This depends on the option @code{org-remove-highlights-with-change}.}. When called
  1167. with a @kbd{C-u} prefix argument, previous highlights are
  1168. kept, so several calls to this command can be stacked.
  1169. @item @kbd{M-g n} or @kbd{M-g M-n} (@code{next-error})
  1170. @kindex M-g n
  1171. @kindex M-g M-n
  1172. @findex next-error
  1173. Jump to the next sparse tree match in this buffer.
  1174. @item @kbd{M-g p} or @kbd{M-g M-p} (@code{previous-error})
  1175. @kindex M-g p
  1176. @kindex M-g M-p
  1177. @findex previous-error
  1178. Jump to the previous sparse tree match in this buffer.
  1179. @end table
  1180. @vindex org-agenda-custom-commands
  1181. @noindent
  1182. For frequently used sparse trees of specific search strings, you can
  1183. use the variable @code{org-agenda-custom-commands} to define fast keyboard
  1184. access to specific sparse trees. These commands will then be
  1185. accessible through the agenda dispatcher (see @ref{Agenda Dispatcher}).
  1186. For example:
  1187. @lisp
  1188. (setq org-agenda-custom-commands
  1189. '(("f" occur-tree "FIXME")))
  1190. @end lisp
  1191. @noindent
  1192. defines the key @kbd{f} as a shortcut for creating a sparse tree
  1193. matching the string @samp{FIXME}.
  1194. The other sparse tree commands select headings based on TODO keywords,
  1195. tags, or properties and are discussed later in this manual.
  1196. @kindex C-c C-e v
  1197. @cindex printing sparse trees
  1198. @cindex visible text, printing
  1199. To print a sparse tree, you can use the Emacs command
  1200. @code{ps-print-buffer-with-faces} which does not print invisible parts of
  1201. the document. Or you can use the command @kbd{C-c C-e v} to
  1202. export only the visible part of the document and print the resulting
  1203. file.
  1204. @node Plain Lists
  1205. @section Plain Lists
  1206. @cindex plain lists
  1207. @cindex lists, plain
  1208. @cindex lists, ordered
  1209. @cindex ordered lists
  1210. Within an entry of the outline tree, hand-formatted lists can provide
  1211. additional structure. They also provide a way to create lists of
  1212. checkboxes (see @ref{Checkboxes}). Org supports editing such lists, and
  1213. every exporter (see @ref{Exporting}) can parse and format them.
  1214. Org knows ordered lists, unordered lists, and description lists.
  1215. @itemize
  1216. @item
  1217. @emph{Unordered} list items start with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a bullet, lines must be indented so that they
  1218. are not interpreted as headlines. Also, when you are hiding leading
  1219. stars to get a clean outline view, plain list items starting with
  1220. a star may be hard to distinguish from true headlines. In short: even
  1221. though @samp{*} is supported, it may be better to not use it for plain list
  1222. items.} as bullets.
  1223. @item
  1224. @vindex org-plain-list-ordered-item-terminator
  1225. @vindex org-alphabetical-lists
  1226. @emph{Ordered} list items start with a numeral followed by either
  1227. a period or a right parenthesis@footnote{You can filter out any of them by configuring
  1228. @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
  1229. @code{org-list-allow-alphabetical}. To minimize confusion with normal
  1230. text, those are limited to one character only. Beyond that limit,
  1231. bullets automatically become numbers.}
  1232. If you want a list to start with a different value---e.g.,
  1233. 20---start the text of the item with @samp{[@@20]}@footnote{If there's a checkbox in the item, the cookie must be put
  1234. @emph{before} the checkbox. If you have activated alphabetical lists, you
  1235. can also use counters like @samp{[@@b]}.}. Those
  1236. constructs can be used in any item of the list in order to enforce
  1237. a particular numbering.
  1238. @item
  1239. @emph{Description} list items are unordered list items, and contain the
  1240. separator @samp{::} to distinguish the description @emph{term} from the
  1241. description.
  1242. @end itemize
  1243. Items belonging to the same list must have the same indentation on the
  1244. first line. In particular, if an ordered list reaches number @samp{10.},
  1245. then the 2-digit numbers must be written left-aligned with the other
  1246. numbers in the list. An item ends before the next line that is less
  1247. or equally indented than its bullet/number.
  1248. A list ends whenever every item has ended, which means before any line
  1249. less or equally indented than items at top level. It also ends before
  1250. two blank lines. In that case, all items are closed. Here is an
  1251. example:
  1252. @example
  1253. * Lord of the Rings
  1254. My favorite scenes are (in this order)
  1255. 1. The attack of the Rohirrim
  1256. 2. Eowyn's fight with the witch king
  1257. + this was already my favorite scene in the book
  1258. + I really like Miranda Otto.
  1259. 3. Peter Jackson being shot by Legolas
  1260. - on DVD only
  1261. He makes a really funny face when it happens.
  1262. But in the end, no individual scenes matter but the film as a whole.
  1263. Important actors in this film are:
  1264. - Elijah Wood :: He plays Frodo
  1265. - Sean Astin :: He plays Sam, Frodo's friend. I still remember him
  1266. very well from his role as Mikey Walsh in /The Goonies/.
  1267. @end example
  1268. Org supports these lists by tuning filling and wrapping commands to
  1269. deal with them correctly, and by exporting them properly (see
  1270. @ref{Exporting}). Since indentation is what governs the structure of these
  1271. lists, many structural constructs like @samp{#+BEGIN_} blocks can be
  1272. indented to signal that they belong to a particular item.
  1273. @vindex org-list-demote-modify-bullet
  1274. @vindex org-list-indent-offset
  1275. If you find that using a different bullet for a sub-list---than that
  1276. used for the current list-level---improves readability, customize the
  1277. variable @code{org-list-demote-modify-bullet}. To get a greater difference
  1278. of indentation between items and theirs sub-items, customize
  1279. @code{org-list-indent-offset}.
  1280. @vindex org-list-automatic-rules
  1281. The following commands act on items when the cursor is in the first
  1282. line of an item---the line with the bullet or number. Some of them
  1283. imply the application of automatic rules to keep list structure
  1284. intact. If some of these actions get in your way, configure
  1285. @code{org-list-automatic-rules} to disable them individually.
  1286. @table @asis
  1287. @item @kbd{@key{TAB}} (@code{org-cycle})
  1288. @cindex cycling, in plain lists
  1289. @kindex TAB
  1290. @findex org-cycle
  1291. @vindex org-cycle-include-plain-lists
  1292. Items can be folded just like headline levels. Normally this
  1293. works only if the cursor is on a plain list item. For more
  1294. details, see the variable @code{org-cycle-include-plain-lists}. If
  1295. this variable is set to @code{integrate}, plain list items are treated
  1296. like low-level headlines. The level of an item is then given by
  1297. the indentation of the bullet/number. Items are always
  1298. subordinate to real headlines, however; the hierarchies remain
  1299. completely separated. In a new item with no text yet, the first
  1300. @kbd{@key{TAB}} demotes the item to become a child of the previous
  1301. one. Subsequent @kbd{@key{TAB}}s move the item to meaningful
  1302. levels in the list and eventually get it back to its initial
  1303. position.
  1304. @item @kbd{M-@key{RET}} (@code{org-insert-heading})
  1305. @kindex M-RET
  1306. @findex org-insert-heading
  1307. @vindex org-M-RET-may-split-line
  1308. Insert new item at current level. With a prefix argument, force
  1309. a new heading (see @ref{Structure Editing}). If this command is used
  1310. in the middle of an item, that item is @emph{split} in two, and the
  1311. second part becomes the new item@footnote{If you do not want the item to be split, customize the
  1312. variable @code{org-M-RET-may-split-line}.}. If this command is
  1313. executed @emph{before item's body}, the new item is created @emph{before}
  1314. the current one.
  1315. @item @kbd{M-S-@key{RET}}
  1316. @kindex M-S-RET
  1317. Insert a new item with a checkbox (see @ref{Checkboxes}).
  1318. @item @kbd{S-@key{UP}}
  1319. @itemx @kbd{S-@key{DOWN}}
  1320. @kindex S-UP
  1321. @kindex S-DOWN
  1322. @cindex shift-selection-mode
  1323. @vindex org-support-shift-select
  1324. @vindex org-list-use-circular-motion
  1325. Jump to the previous/next item in the current list, but only if
  1326. @code{org-support-shift-select} is off@footnote{If you want to cycle around items that way, you may customize
  1327. @code{org-list-use-circular-motion}.}. If not, you can
  1328. still use paragraph jumping commands like @kbd{C-@key{UP}}
  1329. and @kbd{C-@key{DOWN}} to quite similar effect.
  1330. @item @kbd{M-@key{UP}}
  1331. @itemx @kbd{M-@key{DOWN}}
  1332. @kindex M-UP
  1333. @kindex M-DOWN
  1334. Move the item including subitems up/down@footnote{See @code{org-list-use-circular-motion} for a cyclic behavior.}, i.e., swap with
  1335. previous/next item of same indentation. If the list is ordered,
  1336. renumbering is automatic.
  1337. @item @kbd{M-@key{LEFT}}
  1338. @itemx @kbd{M-@key{RIGHT}}
  1339. @kindex M-LEFT
  1340. @kindex M-RIGHT
  1341. Decrease/increase the indentation of an item, leaving children
  1342. alone.
  1343. @item @kbd{M-S-@key{LEFT}}
  1344. @itemx @kbd{M-S-@key{RIGHT}}
  1345. @kindex M-S-LEFT
  1346. @kindex M-S-RIGHT
  1347. Decrease/increase the indentation of the item, including
  1348. subitems. Initially, the item tree is selected based on current
  1349. indentation. When these commands are executed several times in
  1350. direct succession, the initially selected region is used, even if
  1351. the new indentation would imply a different hierarchy. To use
  1352. the new hierarchy, break the command chain with a cursor motion
  1353. or so.
  1354. As a special case, using this command on the very first item of
  1355. a list moves the whole list. This behavior can be disabled by
  1356. configuring @code{org-list-automatic-rules}. The global indentation
  1357. of a list has no influence on the text @emph{after} the list.
  1358. @item @kbd{C-c C-c}
  1359. @kindex C-c C-c
  1360. If there is a checkbox (see @ref{Checkboxes}) in the item line, toggle
  1361. the state of the checkbox. In any case, verify bullets and
  1362. indentation consistency in the whole list.
  1363. @item @kbd{C-c -}
  1364. @kindex C-c -
  1365. @vindex org-plain-list-ordered-item-terminator
  1366. Cycle the entire list level through the different
  1367. itemize/enumerate bullets (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}) or a subset
  1368. of them, depending on @code{org-plain-list-ordered-item-terminator},
  1369. the type of list, and its indentation. With a numeric prefix
  1370. argument N, select the Nth bullet from this list. If there is an
  1371. active region when calling this, selected text is changed into an
  1372. item. With a prefix argument, all lines are converted to list
  1373. items. If the first line already was a list item, any item
  1374. marker is removed from the list. Finally, even without an active
  1375. region, a normal line is converted into a list item.
  1376. @item @kbd{C-c *}
  1377. @kindex C-c *
  1378. Turn a plain list item into a headline---so that it becomes
  1379. a subheading at its location. See @ref{Structure Editing}, for
  1380. a detailed explanation.
  1381. @item @kbd{C-c C-*}
  1382. @kindex C-c C-*
  1383. Turn the whole plain list into a subtree of the current heading.
  1384. Checkboxes (see @ref{Checkboxes}) become TODO, respectively DONE,
  1385. keywords when unchecked, respectively checked.
  1386. @item @kbd{S-@key{LEFT}}
  1387. @itemx @kbd{S-@key{RIGHT}}
  1388. @vindex org-support-shift-select
  1389. @kindex S-LEFT
  1390. @kindex S-RIGHT
  1391. This command also cycles bullet styles when the cursor in on the
  1392. bullet or anywhere in an item line, details depending on
  1393. @code{org-support-shift-select}.
  1394. @item @kbd{C-c ^}
  1395. @kindex C-c ^
  1396. @cindex sorting, of plain list
  1397. Sort the plain list. Prompt for the sorting method: numerically,
  1398. alphabetically, by time, or by custom function.
  1399. @end table
  1400. @node Drawers
  1401. @section Drawers
  1402. @cindex drawers
  1403. @cindex visibility cycling, drawers
  1404. Sometimes you want to keep information associated with an entry, but
  1405. you normally do not want to see it. For this, Org mode has @emph{drawers}.
  1406. They can contain anything but a headline and another drawer. Drawers
  1407. look like this:
  1408. @example
  1409. ** This is a headline
  1410. Still outside the drawer
  1411. :DRAWERNAME:
  1412. This is inside the drawer.
  1413. :END:
  1414. After the drawer.
  1415. @end example
  1416. @kindex C-c C-x d
  1417. @findex org-insert-drawer
  1418. You can interactively insert a drawer at point by calling
  1419. @code{org-insert-drawer}, which is bound to @kbd{C-c C-x d}. With an
  1420. active region, this command puts the region inside the drawer. With
  1421. a prefix argument, this command calls @code{org-insert-property-drawer},
  1422. which creates a @samp{PROPERTIES} drawer right below the current headline.
  1423. Org mode uses this special drawer for storing properties (see
  1424. @ref{Properties and Columns}). You cannot use it for anything else.
  1425. Completion over drawer keywords is also possible using
  1426. @kbd{M-@key{TAB}}@footnote{Many desktops intercept @kbd{M-@key{TAB}} to switch windows.
  1427. Use @kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} instead.}.
  1428. Visibility cycling (see @ref{Visibility Cycling}) on the headline hides and
  1429. shows the entry, but keep the drawer collapsed to a single line. In
  1430. order to look inside the drawer, you need to move the cursor to the
  1431. drawer line and press @kbd{@key{TAB}} there.
  1432. 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
  1433. a @samp{LOGBOOK} drawer. If you want to store a quick note there, in
  1434. a similar way to state changes, use
  1435. @table @asis
  1436. @item @kbd{C-c C-z}
  1437. @kindex C-c C-z
  1438. Add a time-stamped note to the @samp{LOGBOOK} drawer.
  1439. @end table
  1440. @node Blocks
  1441. @section Blocks
  1442. @vindex org-hide-block-startup
  1443. @cindex blocks, folding
  1444. Org mode uses @samp{#+BEGIN} @dots{} @samp{#+END} blocks for various purposes from
  1445. including source code examples (see @ref{Literal Examples}) to capturing
  1446. time logging information (see @ref{Clocking Work Time}). These blocks can
  1447. be folded and unfolded by pressing @kbd{@key{TAB}} in the @samp{#+BEGIN}
  1448. line. You can also get all blocks folded at startup by configuring
  1449. the variable @code{org-hide-block-startup} or on a per-file basis by using
  1450. @cindex STARTUP, keyword
  1451. @example
  1452. #+STARTUP: hideblocks
  1453. #+STARTUP: nohideblocks
  1454. @end example
  1455. @node Creating Footnotes
  1456. @section Creating Footnotes
  1457. @cindex footnotes
  1458. Org mode supports the creation of footnotes.
  1459. A footnote is started by a footnote marker in square brackets in
  1460. column 0, no indentation allowed. It ends at the next footnote
  1461. definition, headline, or after two consecutive empty lines. The
  1462. footnote reference is simply the marker in square brackets, inside
  1463. text. Markers always start with @samp{fn:}. For example:
  1464. @example
  1465. The Org homepage[fn:1] now looks a lot better than it used to.
  1466. ...
  1467. [fn:1] The link is: https://orgmode.org
  1468. @end example
  1469. Org mode extends the number-based syntax to @emph{named} footnotes and
  1470. optional inline definition. Here are the valid references:
  1471. @table @asis
  1472. @item @samp{[fn:NAME]}
  1473. A named footnote reference, where @var{NAME} is a unique
  1474. label word, or, for simplicity of automatic creation, a number.
  1475. @item @samp{[fn:: This is the inline definition of this footnote]}
  1476. A @LaTeX{}-like anonymous footnote where the definition is given
  1477. directly at the reference point.
  1478. @item @samp{[fn:NAME: a definition]}
  1479. An inline definition of a footnote, which also specifies a name
  1480. for the note. Since Org allows multiple references to the same
  1481. note, you can then use @samp{[fn:NAME]} to create additional
  1482. references.
  1483. @end table
  1484. @vindex org-footnote-auto-label
  1485. Footnote labels can be created automatically, or you can create names
  1486. yourself. This is handled by the variable @code{org-footnote-auto-label}
  1487. and its corresponding @samp{STARTUP} keywords. See the docstring of that
  1488. variable for details.
  1489. @noindent
  1490. The following command handles footnotes:
  1491. @table @asis
  1492. @item @kbd{C-c C-x f}
  1493. The footnote action command.
  1494. @kindex C-c C-x f
  1495. When the cursor is on a footnote reference, jump to the
  1496. definition. When it is at a definition, jump to
  1497. the---first---reference.
  1498. @vindex org-footnote-define-inline
  1499. @vindex org-footnote-section
  1500. Otherwise, create a new footnote. Depending on the variable
  1501. @code{org-footnote-define-inline}@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP: fninline}
  1502. or @samp{#+STARTUP: nofninline}.}, the definition is placed
  1503. right into the text as part of the reference, or separately into
  1504. the location determined by the variable @code{org-footnote-section}.
  1505. When this command is called with a prefix argument, a menu of
  1506. additional options is offered:
  1507. @multitable @columnfractions 0.1 0.9
  1508. @item @kbd{s}
  1509. @tab Sort the footnote definitions by reference sequence.
  1510. @item @kbd{r}
  1511. @tab Renumber the simple @samp{fn:N} footnotes.
  1512. @item @kbd{S}
  1513. @tab Short for first @kbd{r}, then @kbd{s} action.
  1514. @item @kbd{n}
  1515. @tab Rename all footnotes into a @samp{fn:1} @dots{} @samp{fn:n} sequence.
  1516. @item @kbd{d}
  1517. @tab Delete the footnote at point, including definition and references.
  1518. @end multitable
  1519. @vindex org-footnote-auto-adjust
  1520. Depending on the variable @code{org-footnote-auto-adjust}@footnote{The corresponding in-buffer options are @samp{#+STARTUP: fnadjust}
  1521. and @samp{#+STARTUP: nofnadjust}.},
  1522. renumbering and sorting footnotes can be automatic after each
  1523. insertion or deletion.
  1524. @item @kbd{C-c C-c}
  1525. @kindex C-c C-c
  1526. If the cursor is on a footnote reference, jump to the definition.
  1527. If it is at the definition, jump back to the reference. When
  1528. called at a footnote location with a prefix argument, offer the
  1529. same menu as @kbd{C-c C-x f}.
  1530. @item @kbd{C-c C-o} or @kbd{mouse-1/2}
  1531. @kindex C-c C-o
  1532. @kindex mouse-1
  1533. @kindex mouse-2
  1534. Footnote labels are also links to the corresponding definition or
  1535. reference, and you can use the usual commands to follow these
  1536. links.
  1537. @end table
  1538. @node Org Syntax
  1539. @section Org Syntax
  1540. A reference document providing a formal description of Org's syntax is
  1541. available as @uref{https://orgmode.org/worg/dev/org-syntax.html, a draft on Worg}, written and maintained by Nicolas
  1542. Goaziou. It defines Org's core internal concepts such as @samp{headlines},
  1543. @samp{sections}, @samp{affiliated keywords}, @samp{(greater) elements} and @samp{objects}.
  1544. Each part of an Org file falls into one of the categories above.
  1545. To explore the abstract structure of an Org buffer, run this in
  1546. a buffer:
  1547. @example
  1548. M-: (org-element-parse-buffer) <RET>
  1549. @end example
  1550. @noindent
  1551. It outputs a list containing the buffer's content represented as an
  1552. abstract structure. The export engine relies on the information
  1553. stored in this list. Most interactive commands---e.g., for structure
  1554. editing---also rely on the syntactic meaning of the surrounding
  1555. context.
  1556. @cindex syntax checker
  1557. @cindex linter
  1558. @findex org-lint
  1559. You can check syntax in your documents using @code{org-lint} command.
  1560. @node Tables
  1561. @chapter Tables
  1562. @cindex tables
  1563. @cindex editing tables
  1564. Org comes with a fast and intuitive table editor. Spreadsheet-like
  1565. calculations are supported using the Emacs Calc package (see @ref{Top,GNU Emacs
  1566. Calculator Manual,,calc,}).
  1567. @menu
  1568. * Built-in Table Editor:: Simple tables.
  1569. * Column Width and Alignment:: Overrule the automatic settings.
  1570. * Column Groups:: Grouping to trigger vertical lines.
  1571. * Orgtbl Mode:: The table editor as minor mode.
  1572. * The spreadsheet:: The table editor has spreadsheet capabilities.
  1573. * Org Plot:: Plotting from Org tables.
  1574. @end menu
  1575. @node Built-in Table Editor
  1576. @section Built-in Table Editor
  1577. @cindex table editor, built-in
  1578. Org makes it easy to format tables in plain ASCII. Any line with @samp{|}
  1579. as the first non-whitespace character is considered part of a table.
  1580. @samp{|} is also the column separator@footnote{To insert a vertical bar into a table field, use @samp{\vert} or,
  1581. inside a word @samp{abc\vert@{@}def}.}. A table might look like
  1582. this:
  1583. @example
  1584. | Name | Phone | Age |
  1585. |-------+-------+-----|
  1586. | Peter | 1234 | 17 |
  1587. | Anna | 4321 | 25 |
  1588. @end example
  1589. A table is re-aligned automatically each time you press
  1590. @kbd{@key{TAB}}, @kbd{@key{RET}} or @kbd{C-c C-c} inside the table.
  1591. @kbd{@key{TAB}} also moves to the next field---@kbd{@key{RET}} to the
  1592. next row---and creates new table rows at the end of the table or
  1593. before horizontal lines. The indentation of the table is set by the
  1594. first line. Any line starting with @samp{|-} is considered as a horizontal
  1595. separator line and will be expanded on the next re-align to span the
  1596. whole table width. So, to create the above table, you would only type
  1597. @example
  1598. |Name|Phone|Age|
  1599. |-
  1600. @end example
  1601. @noindent
  1602. and then press @kbd{@key{TAB}} to align the table and start filling in
  1603. fields. Even faster would be to type @samp{|Name|Phone|Age} followed by
  1604. @kbd{C-c @key{RET}}.
  1605. When typing text into a field, Org treats @kbd{DEL},
  1606. @kbd{Backspace}, and all character keys in a special way, so that
  1607. inserting and deleting avoids shifting other fields. Also, when
  1608. typing @emph{immediately} after the cursor was moved into a new field with
  1609. @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}, the field is
  1610. automatically made blank. If this behavior is too unpredictable for
  1611. you, configure the option @code{org-table-auto-blank-field}.
  1612. @anchor{Creation and conversion}
  1613. @subheading Creation and conversion
  1614. @table @asis
  1615. @item @kbd{C-c |} (@code{org-table-create-or-convert-from-region})
  1616. @kindex C-c |
  1617. @findex org-table-create-or-convert-from-region
  1618. Convert the active region to table. If every line contains at
  1619. least one @kbd{@key{TAB}} character, the function assumes that the
  1620. material is tab separated. If every line contains a comma,
  1621. comma-separated values (CSV) are assumed. If not, lines are
  1622. split at whitespace into fields. You can use a prefix argument
  1623. to force a specific separator: @kbd{C-u} forces CSV,
  1624. @kbd{C-u C-u} forces @kbd{@key{TAB}}, @kbd{C-u C-u C-u}
  1625. prompts for a regular expression to match the separator, and
  1626. a numeric argument N indicates that at least N consecutive
  1627. spaces, or alternatively a @kbd{@key{TAB}} will be the separator.
  1628. If there is no active region, this command creates an empty Org
  1629. 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}}.
  1630. @end table
  1631. @anchor{Re-aligning and field motion}
  1632. @subheading Re-aligning and field motion
  1633. @table @asis
  1634. @item @kbd{C-c C-c} (@code{org-table-align})
  1635. @kindex C-c C-c
  1636. @findex org-table-align
  1637. Re-align the table without moving the cursor.
  1638. @item @kbd{@key{TAB}} (@code{org-table-next-field})
  1639. @kindex TAB
  1640. @findex org-table-next-field
  1641. Re-align the table, move to the next field. Creates a new row if
  1642. necessary.
  1643. @item @kbd{C-c @key{SPC}} (@code{org-table-blank-field})
  1644. @kindex C-c SPC
  1645. @findex org-table-blank-field
  1646. Blank the field at point.
  1647. @item @kbd{S-@key{TAB}} (@code{org-table-previous-field})
  1648. @kindex S-TAB
  1649. @findex org-table-previous-field
  1650. Re-align, move to previous field.
  1651. @item @kbd{@key{RET}} (@code{org-table-next-row})
  1652. @kindex RET
  1653. @findex org-table-next-row
  1654. Re-align the table and move down to next row. Creates a new row
  1655. if necessary. At the beginning or end of a line, @kbd{@key{RET}}
  1656. still inserts a new line, so it can be used to split a table.
  1657. @item @kbd{M-a} (@code{org-table-beginning-of-field})
  1658. @kindex M-a
  1659. @findex org-table-beginning-of-field
  1660. Move to beginning of the current table field, or on to the
  1661. previous field.
  1662. @item @kbd{M-e} (@code{org-table-end-of-field})
  1663. @kindex M-e
  1664. @findex org-table-end-of-field
  1665. Move to end of the current table field, or on to the next field.
  1666. @end table
  1667. @anchor{Column and row editing}
  1668. @subheading Column and row editing
  1669. @table @asis
  1670. @item @kbd{M-@key{LEFT}} (@code{org-table-move-column-left})
  1671. @kindex M-LEFT
  1672. @findex org-table-move-column-left
  1673. Move the current column left.
  1674. @item @kbd{M-@key{RIGHT}} (@code{org-table-move-column-right})
  1675. @kindex M-RIGHT
  1676. @findex org-table-move-column-right
  1677. Move the current column right.
  1678. @item @kbd{M-S-@key{LEFT}} (@code{org-table-delete-column})
  1679. @kindex M-S-LEFT
  1680. @findex org-table-delete-column
  1681. Kill the current column.
  1682. @item @kbd{M-S-@key{RIGHT}} (@code{org-table-insert-column})
  1683. @kindex M-S-RIGHT
  1684. @findex org-table-insert-column
  1685. Insert a new column to the left of the cursor position.
  1686. @item @kbd{M-@key{UP}} (@code{org-table-move-row-up})
  1687. @kindex M-UP
  1688. @findex org-table-move-row-up
  1689. Move the current row up.
  1690. @item @kbd{M-@key{DOWN}} (@code{org-table-move-row-down})
  1691. @kindex M-DOWN
  1692. @findex org-table-move-row-down
  1693. Move the current row down.
  1694. @item @kbd{M-S-@key{UP}} (@code{org-table-kill-row})
  1695. @kindex M-S-UP
  1696. @findex org-table-kill-row
  1697. Kill the current row or horizontal line.
  1698. @item @kbd{M-S-@key{DOWN}} (@code{org-table-insert-row})
  1699. @kindex M-S-DOWN
  1700. @findex org-table-insert-row
  1701. Insert a new row above the current row. With a prefix argument,
  1702. the line is created below the current one.
  1703. @item @kbd{C-c -} (@code{org-table-insert-hline})
  1704. @kindex C-c -
  1705. @findex org-table-insert-hline
  1706. Insert a horizontal line below current row. With a prefix
  1707. argument, the line is created above the current line.
  1708. @item @kbd{C-c @key{RET}} (@code{org-table-hline-and-move})
  1709. @kindex C-c RET
  1710. @findex org-table-hline-and-move
  1711. Insert a horizontal line below current row, and move the cursor
  1712. into the row below that line.
  1713. @item @kbd{C-c ^} (@code{org-table-sort-lines})
  1714. @kindex C-c ^
  1715. @findex org-table-sort-lines
  1716. Sort the table lines in the region. The position of point
  1717. indicates the column to be used for sorting, and the range of
  1718. lines is the range between the nearest horizontal separator
  1719. lines, or the entire table. If point is before the first column,
  1720. you are prompted for the sorting column. If there is an active
  1721. region, the mark specifies the first line and the sorting column,
  1722. while point should be in the last line to be included into the
  1723. sorting. The command prompts for the sorting type,
  1724. alphabetically, numerically, or by time. You can sort in normal
  1725. or reverse order. You can also supply your own key extraction
  1726. and comparison functions. When called with a prefix argument,
  1727. alphabetic sorting is case-sensitive.
  1728. @end table
  1729. @anchor{Regions}
  1730. @subheading Regions
  1731. @table @asis
  1732. @item @kbd{C-c C-x M-w} (@code{org-table-copy-region})
  1733. @kindex C-c C-x M-w
  1734. @findex org-table-copy-region
  1735. Copy a rectangular region from a table to a special clipboard.
  1736. Point and mark determine edge fields of the rectangle. If there
  1737. is no active region, copy just the current field. The process
  1738. ignores horizontal separator lines.
  1739. @item @kbd{C-c C-x C-w} (@code{org-table-cut-region})
  1740. @kindex C-c C-x C-w
  1741. @findex org-table-cut-region
  1742. Copy a rectangular region from a table to a special clipboard,
  1743. and blank all fields in the rectangle. So this is the ``cut''
  1744. operation.
  1745. @item @kbd{C-c C-x C-y} (@code{org-table-paste-rectangle})
  1746. @kindex C-c C-x C-y
  1747. @findex org-table-paste-rectangle
  1748. Paste a rectangular region into a table. The upper left corner
  1749. ends up in the current field. All involved fields are
  1750. overwritten. If the rectangle does not fit into the present
  1751. table, the table is enlarged as needed. The process ignores
  1752. horizontal separator lines.
  1753. @item @kbd{M-@key{RET}} (@code{org-table-wrap-region})
  1754. @kindex M-RET
  1755. @findex org-table-wrap-region
  1756. Split the current field at the cursor position and move the rest
  1757. to the line below. If there is an active region, and both point
  1758. and mark are in the same column, the text in the column is
  1759. wrapped to minimum width for the given number of lines.
  1760. A numeric prefix argument may be used to change the number of
  1761. desired lines. If there is no region, but you specify a prefix
  1762. argument, the current field is made blank, and the content is
  1763. appended to the field above.
  1764. @end table
  1765. @anchor{Calculations}
  1766. @subheading Calculations
  1767. @cindex formula, in tables
  1768. @cindex calculations, in tables
  1769. @table @asis
  1770. @item @kbd{C-c +} (@code{org-table-sum})
  1771. @kindex C-c +
  1772. @findex org-table-sum
  1773. Sum the numbers in the current column, or in the rectangle
  1774. defined by the active region. The result is shown in the echo
  1775. area and can be inserted with @kbd{C-y}.
  1776. @item @kbd{S-@key{RET}} (@code{org-table-copy-down})
  1777. @kindex S-RET
  1778. @findex org-table-copy-down
  1779. @vindex org-table-copy-increment
  1780. When current field is empty, copy from first non-empty field
  1781. above. When not empty, copy current field down to next row and
  1782. move cursor along with it. Depending on the variable
  1783. @code{org-table-copy-increment}, integer field values can be
  1784. incremented during copy. Integers that are too large are not
  1785. incremented, however. Also, a @code{0} prefix argument temporarily
  1786. disables the increment. This key is also used by shift-selection
  1787. and related modes (see @ref{Conflicts}).
  1788. @end table
  1789. @anchor{Miscellaneous (1)}
  1790. @subheading Miscellaneous
  1791. @table @asis
  1792. @item @kbd{C-c `} (@code{org-table-edit-field})
  1793. @kindex C-c `
  1794. @findex org-table-edit-field
  1795. Edit the current field in a separate window. This is useful for
  1796. fields that are not fully visible (see @ref{Column Width and Alignment}). When called with a @kbd{C-u} prefix, just make
  1797. the full field visible, so that it can be edited in place. When
  1798. called with two @kbd{C-u} prefixes, make the editor window
  1799. follow the cursor through the table and always show the current
  1800. field. The follow mode exits automatically when the cursor
  1801. leaves the table, or when you repeat this command with @kbd{C-u C-u C-c `}.
  1802. @item @kbd{M-x org-table-import}
  1803. @findex org-table-import
  1804. Import a file as a table. The table should be TAB or whitespace
  1805. separated. Use, for example, to import a spreadsheet table or
  1806. data from a database, because these programs generally can write
  1807. TAB-separated text files. This command works by inserting the
  1808. file into the buffer and then converting the region to a table.
  1809. Any prefix argument is passed on to the converter, which uses it
  1810. to determine the separator.
  1811. @item @kbd{C-c |} (@code{org-table-create-or-convert-from-region})
  1812. @kindex C-c |
  1813. @findex org-table-create-or-convert-from-region
  1814. Tables can also be imported by pasting tabular text into the Org
  1815. buffer, selecting the pasted text with @kbd{C-x C-x} and
  1816. then using the @kbd{C-c |} command (see @ref{Creation and conversion}).
  1817. @item @kbd{M-x org-table-export}
  1818. @findex org-table-export
  1819. @vindex org-table-export-default-format
  1820. Export the table, by default as a TAB-separated file. Use for
  1821. data exchange with, for example, spreadsheet or database
  1822. programs. The format used to export the file can be configured
  1823. in the variable @code{org-table-export-default-format}. You may also
  1824. use properties @samp{TABLE_EXPORT_FILE} and @samp{TABLE_EXPORT_FORMAT} to
  1825. specify the file name and the format for table export in
  1826. a subtree. Org supports quite general formats for exported
  1827. tables. The exporter format is the same as the format used by
  1828. Orgtbl radio tables, see @ref{Translator functions}, for a detailed
  1829. description.
  1830. @end table
  1831. @node Column Width and Alignment
  1832. @section Column Width and Alignment
  1833. @cindex narrow columns in tables
  1834. @cindex alignment in tables
  1835. The width of columns is automatically determined by the table editor.
  1836. The alignment of a column is determined automatically from the
  1837. fraction of number-like versus non-number fields in the column.
  1838. @vindex org-table-automatic-realign
  1839. Editing a field may modify alignment of the table. Moving
  1840. a contiguous row or column---i.e., using @kbd{@key{TAB}} or
  1841. @kbd{@key{RET}}---automatically re-aligns it. If you want to disable
  1842. this behavior, set @code{org-table-automatic-realign} to @code{nil}. In any
  1843. case, you can always align manually a table:
  1844. @table @asis
  1845. @item @kbd{C-c C-c} (@code{org-table-align})
  1846. @kindex C-c C-c
  1847. @findex org-table-align
  1848. Align the current table.
  1849. @end table
  1850. @noindent
  1851. @vindex org-startup-align-all-tables
  1852. Setting the option @code{org-startup-align-all-tables} re-aligns all tables
  1853. in a file upon visiting it. You can also set this option on
  1854. a per-file basis with:
  1855. @example
  1856. #+STARTUP: align
  1857. #+STARTUP: noalign
  1858. @end example
  1859. Sometimes a single field or a few fields need to carry more text,
  1860. leading to inconveniently wide columns. Maybe you want to hide away
  1861. several columns or display them with a fixed width, regardless of
  1862. content, as shown in the following example.
  1863. @example
  1864. |---+---------------------+--------| |---+-------…|…|
  1865. | | <6> | | | | <6> …|…|
  1866. | 1 | one | some | ----\ | 1 | one …|…|
  1867. | 2 | two | boring | ----/ | 2 | two …|…|
  1868. | 3 | This is a long text | column | | 3 | This i…|…|
  1869. |---+---------------------+--------| |---+-------…|…|
  1870. @end example
  1871. To set the width of a column, one field anywhere in the column may
  1872. contain just the string @samp{<N>} where @var{N} specifies the width
  1873. as a number of characters. You control displayed width of columns
  1874. with the following tools:
  1875. @table @asis
  1876. @item @kbd{C-c @key{TAB}} (@code{org-table-toggle-column-width})
  1877. @kindex C-c TAB
  1878. @findex org-table-toggle-column-width
  1879. Shrink or expand current column.
  1880. If a width cookie specifies a width W for the column, shrinking
  1881. it displays the first W visible characters only. Otherwise, the
  1882. column is shrunk to a single character.
  1883. When called before the first column or after the last one, ask
  1884. for a list of column ranges to operate on.
  1885. @item @kbd{C-u C-c @key{TAB}} (@code{org-table-shrink})
  1886. @kindex C-u C-c TAB
  1887. @findex org-table-shrink
  1888. Shrink all columns with a column width. Expand the others.
  1889. @item @kbd{C-u C-u C-c @key{TAB}} (@code{org-table-expand})
  1890. @kindex C-u C-u C-c TAB
  1891. @findex org-table-expand
  1892. Expand all columns.
  1893. @end table
  1894. To see the full text of a shrunk field, hold the mouse over it---a
  1895. tool-tip window then shows the full content. Alternatively @kbd{C-h .} (@code{display-local-help}) reveals the full content. For
  1896. convenience, any change to a shrunk column expands it.
  1897. @vindex org-startup-shrink-all-tables
  1898. Setting the option @code{org-startup-shrink-all-tables} shrinks all columns
  1899. containing a width cookie in a file the moment it is visited. You can
  1900. also set this option on a per-file basis with:
  1901. @example
  1902. #+STARTUP: shrink
  1903. @end example
  1904. If you would like to overrule the automatic alignment of number-rich
  1905. columns to the right and of string-rich columns to the left, you can
  1906. use @samp{<r>}, @samp{<c>} or @samp{<l>} in a similar fashion. You may also combine
  1907. alignment and field width like this: @samp{<r10>}.
  1908. Lines which only contain these formatting cookies are removed
  1909. automatically upon exporting the document.
  1910. @node Column Groups
  1911. @section Column Groups
  1912. @cindex grouping columns in tables
  1913. When Org exports tables, it does so by default without vertical lines
  1914. because that is visually more satisfying in general. Occasionally
  1915. however, vertical lines can be useful to structure a table into groups
  1916. of columns, much like horizontal lines can do for groups of rows. In
  1917. order to specify column groups, you can use a special row where the
  1918. first field contains only @samp{/}. The further fields can either contain
  1919. @samp{<} to indicate that this column should start a group, @samp{>} to indicate
  1920. the end of a column, or @samp{<>} (no space between @samp{<} and @samp{>}) to make
  1921. a column a group of its own. Upon export, boundaries between column
  1922. groups are marked with vertical lines. Here is an example:
  1923. @example
  1924. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1925. |---+-----+-----+-----+---------+------------|
  1926. | / | < | | > | < | > |
  1927. | 1 | 1 | 1 | 1 | 1 | 1 |
  1928. | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
  1929. | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
  1930. |---+-----+-----+-----+---------+------------|
  1931. #+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
  1932. @end example
  1933. It is also sufficient to just insert the column group starters after
  1934. every vertical line you would like to have:
  1935. @example
  1936. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1937. |---+-----+-----+-----+---------+------------|
  1938. | / | < | | | < | |
  1939. @end example
  1940. @node Orgtbl Mode
  1941. @section The Orgtbl Minor Mode
  1942. @cindex Orgtbl mode
  1943. @cindex minor mode for tables
  1944. @findex orgtbl-mode
  1945. If you like the intuitive way the Org table editor works, you might
  1946. also want to use it in other modes like Text mode or Mail mode. The
  1947. minor mode Orgtbl mode makes this possible. You can always toggle the
  1948. mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
  1949. example in Message mode, use
  1950. @lisp
  1951. (add-hook 'message-mode-hook 'turn-on-orgtbl)
  1952. @end lisp
  1953. Furthermore, with some special setup, it is possible to maintain
  1954. tables in arbitrary syntax with Orgtbl mode. For example, it is
  1955. possible to construct @LaTeX{} tables with the underlying ease and power
  1956. of Orgtbl mode, including spreadsheet capabilities. For details, see
  1957. @ref{Tables in Arbitrary Syntax}.
  1958. @node The spreadsheet
  1959. @section The spreadsheet
  1960. @cindex calculations, in tables
  1961. @cindex spreadsheet capabilities
  1962. @cindex Calc package
  1963. The table editor makes use of the Emacs Calc package to implement
  1964. spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms
  1965. to derive fields from other fields. While fully featured, Org's
  1966. implementation is not identical to other spreadsheets. For example,
  1967. Org knows the concept of a @emph{column formula} that will be applied to
  1968. all non-header fields in a column without having to copy the formula
  1969. to each relevant field. There is also a formula debugger, and
  1970. a formula editor with features for highlighting fields in the table
  1971. corresponding to the references at the point in the formula, moving
  1972. these references by arrow keys.
  1973. @menu
  1974. * References:: How to refer to another field or range.
  1975. * Formula syntax for Calc:: Using Calc to compute stuff.
  1976. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp.
  1977. * Durations and time values:: How to compute durations and time values.
  1978. * Field and range formulas:: Formula for specific (ranges of) fields.
  1979. * Column formulas:: Formulas valid for an entire column.
  1980. * Lookup functions:: Lookup functions for searching tables.
  1981. * Editing and debugging formulas:: Fixing formulas.
  1982. * Updating the table:: Recomputing all dependent fields.
  1983. * Advanced features:: Field and column names, automatic recalculation...
  1984. @end menu
  1985. @node References
  1986. @subsection References
  1987. @cindex references
  1988. To compute fields in the table from other fields, formulas must
  1989. reference other fields or ranges. In Org, fields can be referenced by
  1990. name, by absolute coordinates, and by relative coordinates. To find
  1991. out what the coordinates of a field are, press @kbd{C-c ?} in
  1992. that field, or press @kbd{C-c @}} to toggle the display of a grid.
  1993. @anchor{Field references}
  1994. @subsubheading Field references
  1995. @cindex field references
  1996. @cindex references, to fields
  1997. Formulas can reference the value of another field in two ways. Like
  1998. in any other spreadsheet, you may reference fields with
  1999. a letter/number combination like @samp{B3}, meaning the second field in the
  2000. third row. However, Org prefers to use another, more general
  2001. representation that looks like this:@footnote{Org understands references typed by the user as @samp{B4}, but it
  2002. does not use this syntax when offering a formula for editing. You can
  2003. customize this behavior using the variable
  2004. @code{org-table-use-standard-references}.}
  2005. @example
  2006. @@ROW$COLUMN
  2007. @end example
  2008. Column specifications can be absolute like @samp{$1}, @samp{$2}, @dots{}, @samp{$N}, or
  2009. relative to the current column, i.e., the column of the field which is
  2010. being computed, like @samp{$+1} or @samp{$-2}. @samp{$<} and @samp{$>} are immutable
  2011. references to the first and last column, respectively, and you can use
  2012. @samp{$>>>} to indicate the third column from the right.
  2013. The row specification only counts data lines and ignores horizontal
  2014. separator lines, or ``hlines''. Like with columns, you can use absolute
  2015. row numbers @samp{@@1}, @samp{@@2}, @dots{}, @samp{@@N}, and row numbers relative to the
  2016. current row like @samp{@@+3} or @samp{@@-1}. @samp{@@<} and @samp{@@>} are immutable
  2017. references the first and last row in the table, respectively. You may
  2018. also specify the row relative to one of the hlines: @samp{@@I} refers to the
  2019. first hline, @samp{@@II} to the second, etc. @samp{@@-I} refers to the first such
  2020. line above the current line, @samp{@@+I} to the first such line below the
  2021. current line. You can also write @samp{@@III+2} which is the second data
  2022. line after the third hline in the table.
  2023. @samp{@@0} and @samp{$0} refer to the current row and column, respectively, i.e.,
  2024. to the row/column for the field being computed. Also, if you omit
  2025. either the column or the row part of the reference, the current
  2026. row/column is implied.
  2027. Org's references with @emph{unsigned} numbers are fixed references in the
  2028. sense that if you use the same reference in the formula for two
  2029. different fields, the same field is referenced each time. Org's
  2030. references with @emph{signed} numbers are floating references because the
  2031. same reference operator can reference different fields depending on
  2032. the field being calculated by the formula.
  2033. Here are a few examples:
  2034. @multitable @columnfractions 0.2 0.8
  2035. @item @samp{@@2$3}
  2036. @tab 2nd row, 3rd column (same as @samp{C2})
  2037. @item @samp{$5}
  2038. @tab column 5 in the current row (same as @samp{E&})
  2039. @item @samp{@@2}
  2040. @tab current column, row 2
  2041. @item @samp{@@-1$-3}
  2042. @tab field one row up, three columns to the left
  2043. @item @samp{@@-I$2}
  2044. @tab field just under hline above current row, column 2
  2045. @item @samp{@@>$5}
  2046. @tab field in the last row, in column 5
  2047. @end multitable
  2048. @anchor{Range references}
  2049. @subsubheading Range references
  2050. @cindex range references
  2051. @cindex references, to ranges
  2052. You may reference a rectangular range of fields by specifying two
  2053. field references connected by two dots @samp{..}. If both fields are in
  2054. the current row, you may simply use @samp{$2..$7}, but if at least one
  2055. field is in a different row, you need to use the general @samp{@@ROW$COLUMN}
  2056. format at least for the first field, i.e., the reference must start
  2057. with @samp{@@} in order to be interpreted correctly. Examples:
  2058. @multitable @columnfractions 0.2 0.8
  2059. @item @samp{$1..$3}
  2060. @tab first three fields in the current row
  2061. @item @samp{$P..$Q}
  2062. @tab range, using column names (see @ref{Advanced features})
  2063. @item @samp{$<<<..$>>}
  2064. @tab start in third column, continue to the last but one
  2065. @item @samp{@@2$1..@@4$3}
  2066. @tab six fields between these two fields (same as @samp{A2..C4})
  2067. @item @samp{@@-1$-2..@@-1}
  2068. @tab 3 fields in the row above, starting from 2 columns on the left
  2069. @item @samp{@@I..II}
  2070. @tab between first and second hline, short for @samp{@@I..@@II}
  2071. @end multitable
  2072. @noindent
  2073. Range references return a vector of values that can be fed into Calc
  2074. vector functions. Empty fields in ranges are normally suppressed, so
  2075. that the vector contains only the non-empty fields. For other options
  2076. with the mode switches @samp{E}, @samp{N} and examples, see @ref{Formula syntax for Calc}.
  2077. @anchor{Field coordinates in formulas}
  2078. @subsubheading Field coordinates in formulas
  2079. @cindex field coordinates
  2080. @cindex coordinates, of field
  2081. @cindex row, of field coordinates
  2082. @cindex column, of field coordinates
  2083. @vindex org-table-current-column
  2084. @vindex org-table-current-dline
  2085. One of the very first actions during evaluation of Calc formulas and
  2086. Lisp formulas is to substitute @samp{@@#} and @samp{$#} in the formula with the
  2087. row or column number of the field where the current result will go to.
  2088. The traditional Lisp formula equivalents are @code{org-table-current-dline}
  2089. and @code{org-table-current-column}. Examples:
  2090. @table @asis
  2091. @item @samp{if(@@# % 2, $#, string(""))}
  2092. Insert column number on odd rows, set field to empty on even
  2093. rows.
  2094. @item @samp{$2 = '(identity remote(FOO, @@@@#$1))}
  2095. Copy text or values of each row of column 1 of the table named
  2096. @var{FOO} into column 2 of the current table.
  2097. @item @samp{@@3 = 2 * remote(FOO, @@@@1$$#)}
  2098. Insert the doubled value of each column of row 1 of the table
  2099. named @var{FOO} into row 3 of the current table.
  2100. @end table
  2101. @noindent
  2102. For the second and third examples, table @var{FOO} must have at
  2103. least as many rows or columns as the current table. Note that this is
  2104. inefficient@footnote{The computation time scales as O(N^2) because table
  2105. @var{FOO} is parsed for each field to be copied.} for large number of rows.
  2106. @anchor{Named references}
  2107. @subsubheading Named references
  2108. @cindex named references
  2109. @cindex references, named
  2110. @cindex name, of column or field
  2111. @cindex constants, in calculations
  2112. @cindex @samp{CONSTANTS}, keyword
  2113. @vindex org-table-formula-constants
  2114. @samp{$name} is interpreted as the name of a column, parameter or constant.
  2115. Constants are defined globally through the variable
  2116. @code{org-table-formula-constants}, and locally---for the file---through
  2117. a line like this example:
  2118. @example
  2119. #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
  2120. @end example
  2121. @noindent
  2122. @vindex constants-unit-system
  2123. @pindex constants.el
  2124. Also, properties (see @ref{Properties and Columns}) can be used as
  2125. constants in table formulas: for a property @samp{Xyz} use the name
  2126. @samp{$PROP_Xyz}, and the property will be searched in the current outline
  2127. entry and in the hierarchy above it. If you have the @samp{constants.el}
  2128. package, it will also be used to resolve constants, including natural
  2129. constants like @samp{$h} for Planck's constant, and units like @samp{$km} for
  2130. kilometers@footnote{The file @samp{constants.el} can supply the values of constants in
  2131. two different unit systems, @samp{SI} and @samp{cgs}. Which one is used depends
  2132. on the value of the variable @code{constants-unit-system}. You can use the
  2133. @samp{STARTUP} options @samp{constSI} and @samp{constcgs} to set this value for the
  2134. current buffer.}. Column names and parameters can be specified in
  2135. special table lines. These are described below, see @ref{Advanced features}. All names must start with a letter, and further consist
  2136. of letters and numbers.
  2137. @anchor{Remote references}
  2138. @subsubheading Remote references
  2139. @cindex remote references
  2140. @cindex references, remote
  2141. @cindex references, to a different table
  2142. @cindex name, of column or field
  2143. @cindex @samp{NAME}, keyword
  2144. You may also reference constants, fields and ranges from a different
  2145. table, either in the current file or even in a different file. The
  2146. syntax is
  2147. @example
  2148. remote(NAME,REF)
  2149. @end example
  2150. @noindent
  2151. where @var{NAME} can be the name of a table in the current file
  2152. as set by a @samp{#+NAME:} line before the table. It can also be the ID of
  2153. an entry, even in a different file, and the reference then refers to
  2154. the first table in that entry. @var{REF} is an absolute field or
  2155. range reference as described above for example @samp{@@3$3} or @samp{$somename},
  2156. valid in the referenced table.
  2157. @cindex table indirection
  2158. When @var{NAME} has the format @samp{@@ROW$COLUMN}, it is substituted
  2159. with the name or ID found in this field of the current table. For
  2160. example @samp{remote($1, @@@@>$2)} @result{} @samp{remote(year_2013, @@@@>$1)}. The format
  2161. @samp{B3} is not supported because it can not be distinguished from a plain
  2162. table name or ID.
  2163. @node Formula syntax for Calc
  2164. @subsection Formula syntax for Calc
  2165. @cindex formula syntax, Calc
  2166. @cindex syntax, of formulas
  2167. A formula can be any algebraic expression understood by the Emacs Calc
  2168. package. Note that Calc has the non-standard convention that @samp{/} has
  2169. lower precedence than @samp{*}, so that @samp{a/b*c} is interpreted as
  2170. @samp{(a/(b*c))}. Before evaluation by @code{calc-eval} (see @ref{Calling Calc from Your Programs,Calling Calc from
  2171. Your Lisp Programs,,calc,}), variable substitution takes place according to
  2172. the rules described above.
  2173. @cindex vectors, in table calculations
  2174. The range vectors can be directly fed into the Calc vector functions
  2175. like @code{vmean} and @code{vsum}.
  2176. @cindex format specifier, in spreadsheet
  2177. @cindex mode, for Calc
  2178. @vindex org-calc-default-modes
  2179. A formula can contain an optional mode string after a semicolon. This
  2180. string consists of flags to influence Calc and other modes during
  2181. execution. By default, Org uses the standard Calc modes (precision
  2182. 12, angular units degrees, fraction and symbolic modes off). The
  2183. display format, however, has been changed to @code{(float 8)} to keep
  2184. tables compact. The default settings can be configured using the
  2185. variable @code{org-calc-default-modes}.
  2186. @table @asis
  2187. @item @samp{p20}
  2188. Set the internal Calc calculation precision to 20 digits.
  2189. @item @samp{n3}, @samp{s3}, @samp{e2}, @samp{f4}
  2190. Normal, scientific, engineering or fixed format of the result of
  2191. Calc passed back to Org. Calc formatting is unlimited in
  2192. precision as long as the Calc calculation precision is greater.
  2193. @item @samp{D}, @samp{R}
  2194. Degree and radian angle modes of Calc.
  2195. @item @samp{F}, @samp{S}
  2196. Fraction and symbolic modes of Calc.
  2197. @item @samp{T}, @samp{t}, @samp{U}
  2198. Duration computations in Calc or Lisp, @ref{Durations and time values}.
  2199. @item @samp{E}
  2200. If and how to consider empty fields. Without @samp{E} empty fields in
  2201. range references are suppressed so that the Calc vector or Lisp
  2202. list contains only the non-empty fields. With @samp{E} the empty
  2203. fields are kept. For empty fields in ranges or empty field
  2204. references the value @samp{nan} (not a number) is used in Calc
  2205. formulas and the empty string is used for Lisp formulas. Add @samp{N}
  2206. to use 0 instead for both formula types. For the value of
  2207. a field the mode @samp{N} has higher precedence than @samp{E}.
  2208. @item @samp{N}
  2209. Interpret all fields as numbers, use 0 for non-numbers. See the
  2210. next section to see how this is essential for computations with
  2211. Lisp formulas. In Calc formulas it is used only occasionally
  2212. because there number strings are already interpreted as numbers
  2213. without @samp{N}.
  2214. @item @samp{L}
  2215. Literal, for Lisp formulas only. See the next section.
  2216. @end table
  2217. @noindent
  2218. Unless you use large integer numbers or high-precision calculation and
  2219. display for floating point numbers you may alternatively provide
  2220. a @code{printf} format specifier to reformat the Calc result after it has
  2221. been passed back to Org instead of letting Calc already do the
  2222. formatting@footnote{The printf reformatting is limited in precision because the
  2223. value passed to it is converted into an ``integer'' or ``double''. The
  2224. ``integer'' is limited in size by truncating the signed value to 32
  2225. bits. The ``double'' is limited in precision to 64 bits overall which
  2226. leaves approximately 16 significant decimal digits.}. A few examples:
  2227. @multitable {aaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  2228. @item @samp{$1+$2}
  2229. @tab Sum of first and second field
  2230. @item @samp{$1+$2;%.2f}
  2231. @tab Same, format result to two decimals
  2232. @item @samp{exp($2)+exp($1)}
  2233. @tab Math functions can be used
  2234. @item @samp{$0;%.1f}
  2235. @tab Reformat current cell to 1 decimal
  2236. @item @samp{($3-32)*5/9}
  2237. @tab Degrees F @arrow{} C conversion
  2238. @item @samp{$c/$1/$cm}
  2239. @tab Hz @arrow{} cm conversion, using @samp{constants.el}
  2240. @item @samp{tan($1);Dp3s1}
  2241. @tab Compute in degrees, precision 3, display SCI 1
  2242. @item @samp{sin($1);Dp3%.1e}
  2243. @tab Same, but use @code{printf} specifier for display
  2244. @item @samp{vmean($2..$7)}
  2245. @tab Compute column range mean, using vector function
  2246. @item @samp{vmean($2..$7);EN}
  2247. @tab Same, but treat empty fields as 0
  2248. @item @samp{taylor($3,x=7,2)}
  2249. @tab Taylor series of $3, at x=7, second degree
  2250. @end multitable
  2251. Calc also contains a complete set of logical operations (see @ref{Logical Operations,Logical
  2252. Operations,,calc,}). For example
  2253. @table @asis
  2254. @item @samp{if($1 < 20, teen, string(""))}
  2255. @samp{"teen"} if age @samp{$1} is less than 20, else the Org table result
  2256. field is set to empty with the empty string.
  2257. @item @samp{if("$1" =} ``nan'' || ``$2'' @samp{= "nan", string(""), $1 + $2); E f-1}
  2258. Sum of the first two columns. When at least one of the input
  2259. fields is empty the Org table result field is set to empty. @samp{E}
  2260. is required to not convert empty fields to 0. @samp{f-1} is an
  2261. optional Calc format string similar to @samp{%.1f} but leaves empty
  2262. results empty.
  2263. @item @samp{if(typeof(vmean($1..$7)) =} 12, string(``''), vmean($1..$7); E=
  2264. Mean value of a range unless there is any empty field. Every
  2265. field in the range that is empty is replaced by @samp{nan} which lets
  2266. @samp{vmean} result in @samp{nan}. Then @samp{typeof =} 12= detects the @samp{nan}
  2267. from @code{vmean} and the Org table result field is set to empty. Use
  2268. this when the sample set is expected to never have missing
  2269. values.
  2270. @item @samp{if("$1..$7" =} ``[]'', string(``''), vmean($1..$7))=
  2271. Mean value of a range with empty fields skipped. Every field in
  2272. the range that is empty is skipped. When all fields in the range
  2273. are empty the mean value is not defined and the Org table result
  2274. field is set to empty. Use this when the sample set can have
  2275. a variable size.
  2276. @item @samp{vmean($1..$7); EN}
  2277. To complete the example before: Mean value of a range with empty
  2278. fields counting as samples with value 0. Use this only when
  2279. incomplete sample sets should be padded with 0 to the full size.
  2280. @end table
  2281. You can add your own Calc functions defined in Emacs Lisp with
  2282. @code{defmath} and use them in formula syntax for Calc.
  2283. @node Formula syntax for Lisp
  2284. @subsection Emacs Lisp forms as formulas
  2285. @cindex Lisp forms, as table formulas
  2286. It is also possible to write a formula in Emacs Lisp. This can be
  2287. useful for string manipulation and control structures, if Calc's
  2288. functionality is not enough.
  2289. If a formula starts with a single-quote followed by an opening
  2290. parenthesis, then it is evaluated as a Lisp form. The evaluation
  2291. should return either a string or a number. Just as with Calc
  2292. formulas, you can specify modes and a @code{printf} format after
  2293. a semicolon.
  2294. With Emacs Lisp forms, you need to be conscious about the way field
  2295. references are interpolated into the form. By default, a reference is
  2296. interpolated as a Lisp string (in double-quotes) containing the field.
  2297. If you provide the @samp{N} mode switch, all referenced elements are
  2298. numbers---non-number fields will be zero---and interpolated as Lisp
  2299. numbers, without quotes. If you provide the @samp{L} flag, all fields are
  2300. interpolated literally, without quotes. I.e., if you want a reference
  2301. to be interpreted as a string by the Lisp form, enclose the reference
  2302. operator itself in double-quotes, like @samp{"$3"}. Ranges are inserted as
  2303. space-separated fields, so you can embed them in list or vector
  2304. syntax.
  2305. Here are a few examples---note how the @samp{N} mode is used when we do
  2306. computations in Lisp:
  2307. @table @asis
  2308. @item @samp{'(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))}
  2309. Swap the first two characters of the content of column 1.
  2310. @item @samp{'(+ $1 $2);N}
  2311. Add columns 1 and 2, equivalent to Calc's @samp{$1+$2}.
  2312. @item @samp{'(apply '+ '($1..$4));N}
  2313. Compute the sum of columns 1 to 4, like Calc's @samp{vsum($1..$4)}.
  2314. @end table
  2315. @node Durations and time values
  2316. @subsection Durations and time values
  2317. @cindex Duration, computing
  2318. @cindex Time, computing
  2319. @vindex org-table-duration-custom-format
  2320. If you want to compute time values use the @samp{T}, @samp{t}, or @samp{U} flag,
  2321. either in Calc formulas or Elisp formulas:
  2322. @example
  2323. | Task 1 | Task 2 | Total |
  2324. |---------+----------+----------|
  2325. | 2:12 | 1:47 | 03:59:00 |
  2326. | 2:12 | 1:47 | 03:59 |
  2327. | 3:02:20 | -2:07:00 | 0.92 |
  2328. #+TBLFM: @@2$3=$1+$2;T::@@3$3=$1+$2;U::@@4$3=$1+$2;t
  2329. @end example
  2330. Input duration values must be of the form @samp{HH:MM[:SS]}, where seconds
  2331. are optional. With the @samp{T} flag, computed durations are displayed as
  2332. @samp{HH:MM:SS} (see the first formula above). With the @samp{U} flag, seconds
  2333. are omitted so that the result is only @samp{HH:MM} (see second formula
  2334. above). Zero-padding of the hours field depends upon the value of the
  2335. variable @code{org-table-duration-hour-zero-padding}.
  2336. With the @samp{t} flag, computed durations are displayed according to the
  2337. value of the option @code{org-table-duration-custom-format}, which defaults
  2338. to @code{hours} and displays the result as a fraction of hours (see the
  2339. third formula in the example above).
  2340. Negative duration values can be manipulated as well, and integers are
  2341. considered as seconds in addition and subtraction.
  2342. @node Field and range formulas
  2343. @subsection Field and range formulas
  2344. @cindex field formula
  2345. @cindex range formula
  2346. @cindex formula, for individual table field
  2347. @cindex formula, for range of fields
  2348. To assign a formula to a particular field, type it directly into the
  2349. field, preceded by @samp{:=}, for example @samp{vsum(@@II..III)}. When you press
  2350. @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{C-c C-c} with the cursor
  2351. still in the field, the formula is stored as the formula for this
  2352. field, evaluated, and the current field is replaced with the result.
  2353. @cindex @samp{TBLFM}, keyword
  2354. Formulas are stored in a special @samp{TBLFM} keyword located directly
  2355. below the table. If you type the equation in the fourth field of the
  2356. third data line in the table, the formula looks like @samp{@@3$4=$1+$2}.
  2357. When inserting/deleting/swapping column and rows with the appropriate
  2358. commands, @emph{absolute references} (but not relative ones) in stored
  2359. formulas are modified in order to still reference the same field. To
  2360. avoid this from happening, in particular in range references, anchor
  2361. ranges at the table borders (using @samp{@@<}, @samp{@@>}, @samp{$<}, @samp{$>}), or at
  2362. hlines using the @samp{@@I} notation. Automatic adaptation of field
  2363. references does of course not happen if you edit the table structure
  2364. with normal editing commands---then you must fix the equations
  2365. yourself.
  2366. Instead of typing an equation into the field, you may also use the
  2367. following command
  2368. @table @asis
  2369. @item @kbd{C-u C-c =} (@code{org-table-eval-formula})
  2370. @kindex C-u C-c =
  2371. @findex org-table-eval-formula
  2372. Install a new formula for the current field. The command prompts
  2373. for a formula with default taken from the @samp{TBLFM} keyword,
  2374. applies it to the current field, and stores it.
  2375. @end table
  2376. The left-hand side of a formula can also be a special expression in
  2377. order to assign the formula to a number of different fields. There is
  2378. no keyboard shortcut to enter such range formulas. To add them, use
  2379. the formula editor (see @ref{Editing and debugging formulas}) or edit the
  2380. @samp{TBLFM} keyword directly.
  2381. @table @asis
  2382. @item @samp{$2=}
  2383. Column formula, valid for the entire column. This is so common
  2384. that Org treats these formulas in a special way, see @ref{Column formulas}.
  2385. @item @code{@@3=}
  2386. Row formula, applies to all fields in the specified row. @samp{@@>=}
  2387. means the last row.
  2388. @item @samp{@@1$2..@@4$3=}
  2389. Range formula, applies to all fields in the given rectangular
  2390. range. This can also be used to assign a formula to some but not
  2391. all fields in a row.
  2392. @item @samp{$NAME=}
  2393. Named field, see @ref{Advanced features}.
  2394. @end table
  2395. @node Column formulas
  2396. @subsection Column formulas
  2397. @cindex column formula
  2398. @cindex formula, for table column
  2399. When you assign a formula to a simple column reference like @samp{$3=}, the
  2400. same formula is used in all fields of that column, with the following
  2401. very convenient exceptions: (i) If the table contains horizontal
  2402. separator hlines with rows above and below, everything before the
  2403. first such hline is considered part of the table @emph{header} and is not
  2404. modified by column formulas. Therefore a header is mandatory when you
  2405. use column formulas and want to add hlines to group rows, like for
  2406. example to separate a total row at the bottom from the summand rows
  2407. above. (ii) Fields that already get a value from a field/range
  2408. formula are left alone by column formulas. These conditions make
  2409. column formulas very easy to use.
  2410. To assign a formula to a column, type it directly into any field in
  2411. the column, preceded by an equal sign, like @samp{=$1+$2}. When you press
  2412. @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{C-c C-c} with the cursor
  2413. still in the field, the formula is stored as the formula for the
  2414. current column, evaluated and the current field replaced with the
  2415. result. If the field contains only @samp{=}, the previously stored formula
  2416. for this column is used. For each column, Org only remembers the most
  2417. recently used formula. In the @samp{TBLFM} keyword, column formulas look
  2418. like @samp{$4=$1+$2}. The left-hand side of a column formula can not be
  2419. the name of column, it must be the numeric column reference or @samp{$>}.
  2420. Instead of typing an equation into the field, you may also use the
  2421. following command:
  2422. @table @asis
  2423. @item @kbd{C-c =} (@code{org-table-eval-formula})
  2424. @kindex C-c =
  2425. @findex org-table-eval-formula
  2426. Install a new formula for the current column and replace current
  2427. field with the result of the formula. The command prompts for
  2428. a formula, with default taken from the @samp{TBLFM} keyword, applies
  2429. it to the current field and stores it. With a numeric prefix
  2430. argument, e.g., @kbd{C-5 C-c =}, the command applies it to
  2431. that many consecutive fields in the current column.
  2432. @end table
  2433. @node Lookup functions
  2434. @subsection Lookup functions
  2435. @cindex lookup functions in tables
  2436. @cindex table lookup functions
  2437. Org has three predefined Emacs Lisp functions for lookups in tables.
  2438. @table @asis
  2439. @item @code{(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)}
  2440. @findex org-lookup-first
  2441. Searches for the first element @var{S} in list
  2442. @var{S-LIST} for which
  2443. @lisp
  2444. (PREDICATE VAL S)
  2445. @end lisp
  2446. is non-@code{nil}; returns the value from the corresponding position
  2447. in list @var{R-LIST}. The default @var{PREDICATE} is
  2448. @code{equal}. Note that the parameters @var{VAL} and
  2449. @var{S} are passed to @var{PREDICATE} in the same order
  2450. as the corresponding parameters are in the call to
  2451. @code{org-lookup-first}, where @var{VAL} precedes
  2452. @var{S-LIST}. If @var{R-LIST} is @code{nil}, the matching
  2453. element @var{S} of @var{S-LIST} is returned.
  2454. @item @code{(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)}
  2455. @findex org-lookup-last
  2456. Similar to @code{org-lookup-first} above, but searches for the @emph{last}
  2457. element for which @var{PREDICATE} is non-@code{nil}.
  2458. @item @code{(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)}
  2459. @findex org-lookup-all
  2460. Similar to @code{org-lookup-first}, but searches for @emph{all} elements
  2461. for which @var{PREDICATE} is non-@code{nil}, and returns @emph{all}
  2462. corresponding values. This function can not be used by itself in
  2463. a formula, because it returns a list of values. However,
  2464. powerful lookups can be built when this function is combined with
  2465. other Emacs Lisp functions.
  2466. @end table
  2467. If the ranges used in these functions contain empty fields, the @samp{E}
  2468. mode for the formula should usually be specified: otherwise empty
  2469. fields are not included in @var{S-LIST} and/or @var{R-LIST}
  2470. which can, for example, result in an incorrect mapping from an element
  2471. of @var{S-LIST} to the corresponding element of
  2472. @var{R-LIST}.
  2473. These three functions can be used to implement associative arrays,
  2474. count matching cells, rank results, group data, etc. For practical
  2475. examples see @uref{https://orgmode.org/worg/org-tutorials/org-lookups.html, this tutorial on Worg}.
  2476. @node Editing and debugging formulas
  2477. @subsection Editing and debugging formulas
  2478. @cindex formula editing
  2479. @cindex editing, of table formulas
  2480. @vindex org-table-use-standard-references
  2481. You can edit individual formulas in the minibuffer or directly in the
  2482. field. Org can also prepare a special buffer with all active formulas
  2483. of a table. When offering a formula for editing, Org converts
  2484. references to the standard format (like @samp{B3} or @samp{D&}) if possible. If
  2485. you prefer to only work with the internal format (like @samp{@@3$2} or
  2486. @samp{$4}), configure the variable @code{org-table-use-standard-references}.
  2487. @table @asis
  2488. @item @kbd{C-c =} or @kbd{C-u C-c =} (@code{org-table-eval-formula})
  2489. @kindex C-c =
  2490. @kindex C-u C-c =
  2491. @findex org-table-eval-formula
  2492. Edit the formula associated with the current column/field in the
  2493. minibuffer. See @ref{Column formulas}, and @ref{Field and range formulas}.
  2494. @item @kbd{C-u C-u C-c =} (@code{org-table-eval-formula})
  2495. @kindex C-u C-u C-c =
  2496. @findex org-table-eval-formula
  2497. Re-insert the active formula (either a field formula, or a column
  2498. formula) into the current field, so that you can edit it directly
  2499. in the field. The advantage over editing in the minibuffer is
  2500. that you can use the command @kbd{C-c ?}.
  2501. @item @kbd{C-c ?} (@code{org-table-field-info})
  2502. @kindex C-c ?
  2503. @findex org-table-field-info
  2504. While editing a formula in a table field, highlight the field(s)
  2505. referenced by the reference at the cursor position in the
  2506. formula.
  2507. @item @kbd{C-c @}} (@code{org-table-toggle-coordinate-overlays})
  2508. @kindex C-c @}
  2509. @findex org-table-toggle-coordinate-overlays
  2510. Toggle the display of row and column numbers for a table, using
  2511. overlays. These are updated each time the table is aligned; you
  2512. can force it with @kbd{C-c C-c}.
  2513. @item @kbd{C-c @{} (@code{org-table-toggle-formula-debugger})
  2514. @kindex C-c @{
  2515. @findex org-table-toggle-formula-debugger
  2516. Toggle the formula debugger on and off. See below.
  2517. @item @kbd{C-c '} (@code{org-table-edit-formulas})
  2518. @kindex C-c '
  2519. @findex org-table-edit-formulas
  2520. Edit all formulas for the current table in a special buffer,
  2521. where the formulas are displayed one per line. If the current
  2522. field has an active formula, the cursor in the formula editor
  2523. marks it. While inside the special buffer, Org automatically
  2524. highlights any field or range reference at the cursor position.
  2525. You may edit, remove and add formulas, and use the following
  2526. commands:
  2527. @table @asis
  2528. @item @kbd{C-c C-c} or @kbd{C-x C-s} (@code{org-table-fedit-finish})
  2529. @kindex C-x C-s
  2530. @kindex C-c C-c
  2531. @findex org-table-fedit-finish
  2532. Exit the formula editor and store the modified formulas. With
  2533. @kbd{C-u} prefix, also apply the new formulas to the
  2534. entire table.
  2535. @item @kbd{C-c C-q} (@code{org-table-fedit-abort})
  2536. @kindex C-c C-q
  2537. @findex org-table-fedit-abort
  2538. Exit the formula editor without installing changes.
  2539. @item @kbd{C-c C-r} (@code{org-table-fedit-toggle-ref-type})
  2540. @kindex C-c C-r
  2541. @findex org-table-fedit-toggle-ref-type
  2542. Toggle all references in the formula editor between standard
  2543. (like @samp{B3}) and internal (like @samp{@@3$2}).
  2544. @item @kbd{@key{TAB}} (@code{org-table-fedit-lisp-indent})
  2545. @kindex TAB
  2546. @findex org-table-fedit-lisp-indent
  2547. Pretty-print or indent Lisp formula at point. When in a line
  2548. containing a Lisp formula, format the formula according to
  2549. Emacs Lisp rules. Another @kbd{@key{TAB}} collapses the formula
  2550. back again. In the open formula, @kbd{@key{TAB}} re-indents
  2551. just like in Emacs Lisp mode.
  2552. @item @kbd{M-@key{TAB}} (@code{lisp-complete-symbol})
  2553. @kindex M-TAB
  2554. @findex lisp-complete-symbol
  2555. Complete Lisp symbols, just like in Emacs Lisp mode.
  2556. @item @kbd{S-@key{UP}}, @kbd{S-@key{DOWN}}, @kbd{S-@key{LEFT}}, @kbd{S-@key{RIGHT}}
  2557. @kindex S-UP
  2558. @kindex S-DOWN
  2559. @kindex S-LEFT
  2560. @kindex S-RIGHT
  2561. @findex org-table-fedit-ref-up
  2562. @findex org-table-fedit-ref-down
  2563. @findex org-table-fedit-ref-left
  2564. @findex org-table-fedit-ref-right
  2565. Shift the reference at point. For example, if the reference
  2566. is @samp{B3} and you press @kbd{S-@key{RIGHT}}, it becomes @samp{C3}.
  2567. This also works for relative references and for hline
  2568. references.
  2569. @item @kbd{M-S-@key{UP}} (@code{org-table-fedit-line-up})
  2570. @kindex M-S-UP
  2571. @findex org-table-fedit-line-up
  2572. Move the test line for column formulas up in the Org buffer.
  2573. @item @kbd{M-S-@key{DOWN}} (@code{org-table-fedit-line-down})
  2574. @kindex M-S-DOWN
  2575. @findex org-table-fedit-line-down
  2576. Move the test line for column formulas down in the Org buffer.
  2577. @item @kbd{M-@key{UP}} (@code{org-table-fedit-scroll-up})
  2578. @kindex M-UP
  2579. @findex org-table-fedit-scroll-up
  2580. Scroll up the window displaying the table.
  2581. @item @kbd{M-@key{DOWN}} (@code{org-table-fedit-scroll-down})
  2582. @kindex M-DOWN
  2583. @findex org-table-fedit-scroll-down
  2584. Scroll down the window displaying the table.
  2585. @item @kbd{C-c @}}
  2586. @kindex C-c @}
  2587. @findex org-table-toggle-coordinate-overlays
  2588. Turn the coordinate grid in the table on and off.
  2589. @end table
  2590. @end table
  2591. Making a table field blank does not remove the formula associated with
  2592. the field, because that is stored in a different line---the @samp{TBLFM}
  2593. keyword line. During the next recalculation, the field will be filled
  2594. again. To remove a formula from a field, you have to give an empty
  2595. reply when prompted for the formula, or to edit the @samp{TBLFM} keyword.
  2596. @kindex C-c C-c
  2597. You may edit the @samp{TBLFM} keyword directly and re-apply the changed
  2598. equations with @kbd{C-c C-c} in that line or with the normal
  2599. recalculation commands in the table.
  2600. @anchor{Using multiple @samp{TBLFM} lines}
  2601. @subsubheading Using multiple @samp{TBLFM} lines
  2602. @cindex multiple formula lines
  2603. @cindex @samp{TBLFM} keywords, multiple
  2604. @cindex @samp{TBLFM}, switching
  2605. @kindex C-c C-c
  2606. You may apply the formula temporarily. This is useful when you switch
  2607. the formula. Place multiple @samp{TBLFM} keywords right after the table,
  2608. and then press @kbd{C-c C-c} on the formula to apply. Here is an
  2609. example:
  2610. @example
  2611. | x | y |
  2612. |---+---|
  2613. | 1 | |
  2614. | 2 | |
  2615. #+TBLFM: $2=$1*1
  2616. #+TBLFM: $2=$1*2
  2617. @end example
  2618. @noindent
  2619. Pressing @kbd{C-c C-c} in the line of @samp{#+TBLFM: $2=$1*2} yields:
  2620. @example
  2621. | x | y |
  2622. |---+---|
  2623. | 1 | 2 |
  2624. | 2 | 4 |
  2625. #+TBLFM: $2=$1*1
  2626. #+TBLFM: $2=$1*2
  2627. @end example
  2628. @noindent
  2629. Note: If you recalculate this table, with @kbd{C-u C-c *}, for
  2630. example, you get the following result of applying only the first
  2631. @samp{TBLFM} keyword.
  2632. @example
  2633. | x | y |
  2634. |---+---|
  2635. | 1 | 1 |
  2636. | 2 | 2 |
  2637. #+TBLFM: $2=$1*1
  2638. #+TBLFM: $2=$1*2
  2639. @end example
  2640. @anchor{Debugging formulas}
  2641. @subsubheading Debugging formulas
  2642. @cindex formula debugging
  2643. @cindex debugging, of table formulas
  2644. When the evaluation of a formula leads to an error, the field content
  2645. becomes the string @samp{#ERROR}. If you would like to see what is going
  2646. on during variable substitution and calculation in order to find
  2647. a bug, turn on formula debugging in the Tbl menu and repeat the
  2648. calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in
  2649. a field. Detailed information are displayed.
  2650. @node Updating the table
  2651. @subsection Updating the table
  2652. @cindex recomputing table fields
  2653. @cindex updating, table
  2654. Recalculation of a table is normally not automatic, but needs to be
  2655. triggered by a command. To make recalculation at least
  2656. semi-automatic, see @ref{Advanced features}.
  2657. In order to recalculate a line of a table or the entire table, use the
  2658. following commands:
  2659. @table @asis
  2660. @item @kbd{C-c *} (@code{org-table-recalculate})
  2661. @kindex C-c *
  2662. @findex org-table-recalculate
  2663. Recalculate the current row by first applying the stored column
  2664. formulas from left to right, and all field/range formulas in the
  2665. current row.
  2666. @item @kbd{C-u C-c *} or @kbd{C-u C-c C-c}
  2667. @kindex C-u C-c *
  2668. @kindex C-u C-c C-c
  2669. Recompute the entire table, line by line. Any lines before the
  2670. first hline are left alone, assuming that these are part of the
  2671. table header.
  2672. @item @kbd{C-u C-u C-c *} or @kbd{C-u C-u C-c C-c} (@code{org-table-iterate})
  2673. @kindex C-u C-u C-c *
  2674. @kindex C-u C-u C-c C-c
  2675. @findex org-table-iterate
  2676. Iterate the table by recomputing it until no further changes
  2677. occur. This may be necessary if some computed fields use the
  2678. value of other fields that are computed @emph{later} in the
  2679. calculation sequence.
  2680. @item @kbd{M-x org-table-recalculate-buffer-tables}
  2681. @findex org-table-recalculate-buffer-tables
  2682. Recompute all tables in the current buffer.
  2683. @item @kbd{M-x org-table-iterate-buffer-tables}
  2684. @findex org-table-iterate-buffer-tables
  2685. Iterate all tables in the current buffer, in order to converge
  2686. table-to-table dependencies.
  2687. @end table
  2688. @node Advanced features
  2689. @subsection Advanced features
  2690. If you want the recalculation of fields to happen automatically, or if
  2691. you want to be able to assign @emph{names}@footnote{Such names must start with an alphabetic character and use
  2692. only alphanumeric/underscore characters.} to fields and columns,
  2693. you need to reserve the first column of the table for special marking
  2694. characters.
  2695. @table @asis
  2696. @item @kbd{C-#} (@code{org-table-rotate-recalc-marks})
  2697. @kindex C-#
  2698. @findex org-table-rotate-recalc-marks
  2699. Rotate the calculation mark in first column through the states
  2700. @samp{#}, @samp{*}, @samp{!}, @samp{$}. When there is an active region, change all
  2701. marks in the region.
  2702. @end table
  2703. Here is an example of a table that collects exam results of students
  2704. and makes use of these features:
  2705. @example
  2706. |---+---------+--------+--------+--------+-------+------|
  2707. | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
  2708. |---+---------+--------+--------+--------+-------+------|
  2709. | ! | | P1 | P2 | P3 | Tot | |
  2710. | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
  2711. | ^ | | m1 | m2 | m3 | mt | |
  2712. |---+---------+--------+--------+--------+-------+------|
  2713. | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
  2714. | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
  2715. |---+---------+--------+--------+--------+-------+------|
  2716. | | Average | | | | 25.0 | |
  2717. | ^ | | | | | at | |
  2718. | $ | max=50 | | | | | |
  2719. |---+---------+--------+--------+--------+-------+------|
  2720. #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
  2721. @end example
  2722. @noindent
  2723. @strong{Important}: please note that for these special tables, recalculating
  2724. the table with @kbd{C-u C-c *} only affects rows that are marked
  2725. @samp{#} or @samp{*}, and fields that have a formula assigned to the field
  2726. itself. The column formulas are not applied in rows with empty first
  2727. field.
  2728. @cindex marking characters, tables
  2729. The marking characters have the following meaning:
  2730. @table @asis
  2731. @item @samp{!}
  2732. The fields in this line define names for the columns, so that you
  2733. may refer to a column as @samp{$Tot} instead of @samp{$6}.
  2734. @item @samp{^}
  2735. This row defines names for the fields @emph{above} the row. With such
  2736. a definition, any formula in the table may use @samp{$m1} to refer to
  2737. the value @samp{10}. Also, if you assign a formula to a names field,
  2738. it is stored as @samp{$name = ...}.
  2739. @item @samp{_}
  2740. Similar to @samp{^}, but defines names for the fields in the row
  2741. @emph{below}.
  2742. @item @samp{$}
  2743. Fields in this row can define @emph{parameters} for formulas. For
  2744. example, if a field in a @samp{$} row contains @samp{max=50}, then formulas
  2745. in this table can refer to the value 50 using @samp{$max}. Parameters
  2746. work exactly like constants, only that they can be defined on
  2747. a per-table basis.
  2748. @item @samp{#}
  2749. Fields in this row are automatically recalculated when pressing
  2750. @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{S-@key{TAB}} in this row.
  2751. Also, this row is selected for a global recalculation with
  2752. @kbd{C-u C-c *}. Unmarked lines are left alone by this
  2753. command.
  2754. @item @samp{*}
  2755. Selects this line for global recalculation with @kbd{C-u C-c *}, but not for automatic recalculation. Use this when
  2756. automatic recalculation slows down editing too much.
  2757. @item @samp{/}
  2758. Do not export this line. Useful for lines that contain the
  2759. narrowing @samp{<N>} markers or column group markers.
  2760. @end table
  2761. Finally, just to whet your appetite for what can be done with the
  2762. fantastic Calc package, here is a table that computes the Taylor
  2763. series of degree n at location x for a couple of functions.
  2764. @example
  2765. |---+-------------+---+-----+--------------------------------------|
  2766. | | Func | n | x | Result |
  2767. |---+-------------+---+-----+--------------------------------------|
  2768. | # | exp(x) | 1 | x | 1 + x |
  2769. | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
  2770. | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
  2771. | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
  2772. | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
  2773. | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
  2774. |---+-------------+---+-----+--------------------------------------|
  2775. #+TBLFM: $5=taylor($2,$4,$3);n3
  2776. @end example
  2777. @node Org Plot
  2778. @section Org Plot
  2779. @cindex graph, in tables
  2780. @cindex plot tables using Gnuplot
  2781. Org Plot can produce graphs of information stored in Org tables,
  2782. either graphically or in ASCII art.
  2783. @anchor{Graphical plots using Gnuplot}
  2784. @subheading Graphical plots using Gnuplot
  2785. @cindex @samp{PLOT}, keyword
  2786. Org Plot can produce 2D and 3D graphs of information stored in Org
  2787. 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
  2788. that you have both Gnuplot and Gnuplot mode installed on your system,
  2789. then call @kbd{C-c " g} or @kbd{M-x org-plot/gnuplot} on the
  2790. following table.
  2791. @example
  2792. #+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
  2793. | Sede | Max cites | H-index |
  2794. |-----------+-----------+---------|
  2795. | Chile | 257.72 | 21.39 |
  2796. | Leeds | 165.77 | 19.68 |
  2797. | Sao Paolo | 71.00 | 11.50 |
  2798. | Stockholm | 134.19 | 14.33 |
  2799. | Morelia | 257.56 | 17.67 |
  2800. @end example
  2801. Notice that Org Plot is smart enough to apply the table's headers as
  2802. labels. Further control over the labels, type, content, and
  2803. appearance of plots can be exercised through the @samp{PLOT} keyword
  2804. preceding a table. See below for a complete list of Org Plot options.
  2805. For more information and examples see the @uref{https://orgmode.org/worg/org-tutorials/org-plot.html, Org Plot tutorial}.
  2806. @anchor{Plot options}
  2807. @subsubheading Plot options
  2808. @table @asis
  2809. @item @samp{set}
  2810. Specify any Gnuplot option to be set when graphing.
  2811. @item @samp{title}
  2812. Specify the title of the plot.
  2813. @item @samp{ind}
  2814. Specify which column of the table to use as the @samp{x} axis.
  2815. @item @samp{deps}
  2816. Specify the columns to graph as a Lisp style list, surrounded by
  2817. parentheses and separated by spaces for example @samp{dep:(3 4)} to
  2818. graph the third and fourth columns. Defaults to graphing all
  2819. other columns aside from the @samp{ind} column.
  2820. @item @samp{type}
  2821. Specify whether the plot is @samp{2d}, @samp{3d}, or @samp{grid}.
  2822. @item @samp{with}
  2823. Specify a @samp{with} option to be inserted for every column being
  2824. plotted, e.g., @samp{lines}, @samp{points}, @samp{boxes}, @samp{impulses}. Defaults
  2825. to @samp{lines}.
  2826. @item @samp{file}
  2827. If you want to plot to a file, specify
  2828. @samp{"path/to/desired/output-file"}.
  2829. @item @samp{labels}
  2830. List of labels to be used for the @samp{deps}. Defaults to the column
  2831. headers if they exist.
  2832. @item @samp{line}
  2833. Specify an entire line to be inserted in the Gnuplot script.
  2834. @item @samp{map}
  2835. When plotting @samp{3d} or @samp{grid} types, set this to @samp{t} to graph
  2836. a flat mapping rather than a @samp{3d} slope.
  2837. @item @samp{timefmt}
  2838. Specify format of Org mode timestamps as they will be parsed by
  2839. Gnuplot. Defaults to @samp{%Y-%m-%d-%H:%M:%S}.
  2840. @item @samp{script}
  2841. If you want total control, you can specify a script file---place
  2842. the file name between double-quotes---which will be used to plot.
  2843. Before plotting, every instance of @samp{$datafile} in the specified
  2844. script will be replaced with the path to the generated data file.
  2845. Note: even if you set this option, you may still want to specify
  2846. the plot type, as that can impact the content of the data file.
  2847. @end table
  2848. @anchor{ASCII bar plots}
  2849. @subheading ASCII bar plots
  2850. While the cursor is on a column, typing @kbd{C-c `` a} or
  2851. @kbd{M-x orgtbl-ascii-plot} create a new column containing an
  2852. ASCII-art bars plot. The plot is implemented through a regular column
  2853. formula. When the source column changes, the bar plot may be updated
  2854. by refreshing the table, for example typing @kbd{C-u C-c *}.
  2855. @example
  2856. | Sede | Max cites | |
  2857. |---------------+-----------+--------------|
  2858. | Chile | 257.72 | WWWWWWWWWWWW |
  2859. | Leeds | 165.77 | WWWWWWWh |
  2860. | Sao Paolo | 71.00 | WWW; |
  2861. | Stockholm | 134.19 | WWWWWW: |
  2862. | Morelia | 257.56 | WWWWWWWWWWWH |
  2863. | Rochefourchat | 0.00 | |
  2864. #+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)
  2865. @end example
  2866. The formula is an Elisp call.
  2867. @defun orgtbl-ascii-draw value min max &optional width
  2868. Draw an ASCII bar in a table.
  2869. @var{VALUE} is the value to plot.
  2870. @var{MIN} is the value displayed as an empty bar. @var{MAX}
  2871. is the value filling all the @var{WIDTH}. Sources values outside
  2872. this range are displayed as @samp{too small} or @samp{too large}.
  2873. @var{WIDTH} is the number of characters of the bar plot. It
  2874. defaults to @samp{12}.
  2875. @end defun
  2876. @node Hyperlinks
  2877. @chapter Hyperlinks
  2878. @cindex hyperlinks
  2879. Like HTML, Org provides links inside a file, external links to
  2880. other files, Usenet articles, emails, and much more.
  2881. @menu
  2882. * Link Format:: How links in Org are formatted.
  2883. * Internal Links:: Links to other places in the current file.
  2884. * Radio Targets:: Make targets trigger links in plain text.
  2885. * External Links:: URL-like links to the world.
  2886. * Handling Links:: Creating, inserting and following.
  2887. * Using Links Outside Org:: Linking from my C source code?
  2888. * Link Abbreviations:: Shortcuts for writing complex links.
  2889. * Search Options:: Linking to a specific location.
  2890. * Custom Searches:: When the default search is not enough.
  2891. @end menu
  2892. @node Link Format
  2893. @section Link Format
  2894. @cindex link format
  2895. @cindex format, of links
  2896. Org recognizes plain URL-like links and activate them as clickable
  2897. links. The general link format, however, looks like this:
  2898. @example
  2899. [[LINK][DESCRIPTION]]
  2900. @end example
  2901. @noindent
  2902. or alternatively
  2903. @example
  2904. [[LINK]]
  2905. @end example
  2906. @noindent
  2907. Once a link in the buffer is complete (all brackets present), Org
  2908. changes the display so that @samp{DESCRIPTION} is displayed instead of
  2909. @samp{[[LINK][DESCRIPTION]]} and @samp{LINK} is displayed instead of @samp{[[LINK]]}. Links are be
  2910. highlighted in the face @code{org-link}, which by default is an underlined
  2911. face. You can directly edit the visible part of a link. Note that
  2912. this can be either the LINK part, if there is no description, or the
  2913. @var{DESCRIPTION} part. To edit also the invisible
  2914. @var{LINK} part, use @kbd{C-c C-l} with the cursor on the
  2915. link.
  2916. If you place the cursor at the beginning or just behind the end of the
  2917. displayed text and press @kbd{@key{BS}}, you remove
  2918. the---invisible---bracket at that location. This makes the link
  2919. incomplete and the internals are again displayed as plain text.
  2920. Inserting the missing bracket hides the link internals again. To show
  2921. the internal structure of all links, use the menu: Org @arrow{} Hyperlinks @arrow{}
  2922. Literal links.
  2923. @node Internal Links
  2924. @section Internal Links
  2925. @cindex internal links
  2926. @cindex links, internal
  2927. @cindex targets, for links
  2928. @cindex @samp{CUSTOM_ID}, property
  2929. If the link does not look like a URL, it is considered to be internal
  2930. in the current file. The most important case is a link like
  2931. @samp{[[#my-custom-id]]} which links to the entry with the @samp{CUSTOM_ID} property
  2932. @samp{my-custom-id}. You are responsible yourself to make sure these
  2933. custom IDs are unique in a file.
  2934. Links such as @samp{[[My Target]]} or @samp{[[My Target][Find my target]]} lead to a text search in
  2935. the current file.
  2936. The link can be followed with @kbd{C-c C-o} when the cursor is on
  2937. the link, or with a mouse click (see @ref{Handling Links}). Links to
  2938. custom IDs point to the corresponding headline. The preferred match
  2939. for a text link is a @emph{dedicated target}: the same string in double
  2940. angular brackets, like @samp{<<My Target>>}.
  2941. @cindex @samp{NAME}, keyword
  2942. If no dedicated target exists, the link tries to match the exact name
  2943. of an element within the buffer. Naming is done with the @samp{NAME}
  2944. keyword, which has to be put in the line before the element it refers
  2945. to, as in the following example
  2946. @example
  2947. #+NAME: My Target
  2948. | a | table |
  2949. |----+------------|
  2950. | of | four cells |
  2951. @end example
  2952. If none of the above succeeds, Org searches for a headline that is
  2953. exactly the link text but may also include a TODO keyword and
  2954. tags@footnote{To insert a link targeting a headline, in-buffer completion
  2955. can be used. Just type a star followed by a few optional letters into
  2956. the buffer and press @kbd{M-@key{TAB}}. All headlines in the current
  2957. buffer are offered as completions.}.
  2958. During export, internal links are used to mark objects and assign them
  2959. a number. Marked objects are then referenced by links pointing to
  2960. them. In particular, links without a description appear as the number
  2961. assigned to the marked object@footnote{When targeting a @samp{NAME} keyword, @samp{CAPTION} keyword is
  2962. mandatory in order to get proper numbering (see @ref{Images and Tables}).}. In the following excerpt from
  2963. an Org buffer
  2964. @example
  2965. 1. one item
  2966. 2. <<target>>another item
  2967. Here we refer to item [[target]].
  2968. @end example
  2969. @noindent
  2970. The last sentence will appear as @samp{Here we refer to item 2} when
  2971. exported.
  2972. In non-Org files, the search looks for the words in the link text. In
  2973. the above example the search would be for @samp{target}.
  2974. Following a link pushes a mark onto Org's own mark ring. You can
  2975. return to the previous position with @kbd{C-c &}. Using this
  2976. command several times in direct succession goes back to positions
  2977. recorded earlier.
  2978. @node Radio Targets
  2979. @section Radio Targets
  2980. @cindex radio targets
  2981. @cindex targets, radio
  2982. @cindex links, radio targets
  2983. Org can automatically turn any occurrences of certain target names in
  2984. normal text into a link. So without explicitly creating a link, the
  2985. text connects to the target radioing its position. Radio targets are
  2986. enclosed by triple angular brackets. For example, a target @samp{<<<My
  2987. Target>>>} causes each occurrence of @samp{my target} in normal text to
  2988. become activated as a link. The Org file is scanned automatically for
  2989. radio targets only when the file is first loaded into Emacs. To
  2990. update the target list during editing, press @kbd{C-c C-c} with
  2991. the cursor on or at a target.
  2992. @node External Links
  2993. @section External Links
  2994. @cindex links, external
  2995. @cindex external links
  2996. @cindex Gnus links
  2997. @cindex BBDB links
  2998. @cindex irc links
  2999. @cindex URL links
  3000. @cindex file links
  3001. @cindex Rmail links
  3002. @cindex MH-E links
  3003. @cindex Usenet links
  3004. @cindex shell links
  3005. @cindex Info links
  3006. @cindex Elisp links
  3007. Org supports links to files, websites, Usenet and email messages, BBDB
  3008. database entries and links to both IRC conversations and their logs.
  3009. External links are URL-like locators. They start with a short
  3010. identifying string followed by a colon. There can be no space after
  3011. the colon. The following list shows examples for each link type.
  3012. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  3013. @item @samp{http://www.astro.uva.nl/=dominik}
  3014. @tab on the web
  3015. @item @samp{doi:10.1000/182}
  3016. @tab DOI for an electronic resource
  3017. @item @samp{file:/home/dominik/images/jupiter.jpg}
  3018. @tab file, absolute path
  3019. @item @samp{/home/dominik/images/jupiter.jpg}
  3020. @tab same as above
  3021. @item @samp{file:papers/last.pdf}
  3022. @tab file, relative path
  3023. @item @samp{./papers/last.pdf}
  3024. @tab same as above
  3025. @item @samp{file:/ssh:me@@some.where:papers/last.pdf}
  3026. @tab file, path on remote machine
  3027. @item @samp{/ssh:me@@some.where:papers/last.pdf}
  3028. @tab same as above
  3029. @item @samp{file:sometextfile::NNN}
  3030. @tab file, jump to line number
  3031. @item @samp{file:projects.org}
  3032. @tab another Org file
  3033. @item @samp{file:projects.org::some words}
  3034. @tab text search in Org file@footnote{The actual behavior of the search depends on the value of the
  3035. variable @code{org-link-search-must-match-exact-headline}. If its value is
  3036. @code{nil}, then a fuzzy text search is done. If it is @code{t}, then only the
  3037. exact headline is matched, ignoring spaces and statistic cookies. If
  3038. the value is @code{query-to-create}, then an exact headline is searched; if
  3039. it is not found, then the user is queried to create it.}
  3040. @item @samp{file:projects.org::*task title}
  3041. @tab heading search in Org file
  3042. @item @samp{file+sys:/path/to/file}
  3043. @tab open via OS, like double-click
  3044. @item @samp{file+emacs:/path/to/file}
  3045. @tab force opening by Emacs
  3046. @item @samp{docview:papers/last.pdf::NNN}
  3047. @tab open in doc-view mode at page
  3048. @item @samp{id:B7423F4D-2E8A-471B-8810-C40F074717E9}
  3049. @tab Link to heading by ID
  3050. @item @samp{news:comp.emacs}
  3051. @tab Usenet link
  3052. @item @samp{mailto:adent@@galaxy.net}
  3053. @tab Mail link
  3054. @item @samp{mhe:folder}
  3055. @tab MH-E folder link
  3056. @item @samp{mhe:folder#id}
  3057. @tab MH-E message link
  3058. @item @samp{rmail:folder}
  3059. @tab Rmail folder link
  3060. @item @samp{rmail:folder#id}
  3061. @tab Rmail message link
  3062. @item @samp{gnus:group}
  3063. @tab Gnus group link
  3064. @item @samp{gnus:group#id}
  3065. @tab Gnus article link
  3066. @item @samp{bbdb:R.*Stallman}
  3067. @tab BBDB link (with regexp)
  3068. @item @samp{irc:/irc.com/#emacs/bob}
  3069. @tab IRC link
  3070. @item @samp{info:org#External links}
  3071. @tab Info node link
  3072. @item @samp{shell:ls *.org}
  3073. @tab A shell command
  3074. @item @samp{elisp:org-agenda}
  3075. @tab Interactive Elisp command
  3076. @item @samp{elisp:(find-file-other-frame "Elisp.org")}
  3077. @tab Elisp form to evaluate
  3078. @end multitable
  3079. @cindex VM links
  3080. @cindex Wanderlust links
  3081. On top of these built-in link types, some are available through the
  3082. @samp{contrib/} directory (see @ref{Installation}). For example, these links to
  3083. VM or Wanderlust messages are available when you load the
  3084. corresponding libraries from the @samp{contrib/} directory:
  3085. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaa}
  3086. @item @samp{vm:folder}
  3087. @tab VM folder link
  3088. @item @samp{vm:folder#id}
  3089. @tab VM message link
  3090. @item @samp{vm://myself@@some.where.org/folder#id}
  3091. @tab VM on remote machine
  3092. @item @samp{vm-imap:account:folder}
  3093. @tab VM IMAP folder link
  3094. @item @samp{vm-imap:account:folder#id}
  3095. @tab VM IMAP message link
  3096. @item @samp{wl:folder}
  3097. @tab Wanderlust folder link
  3098. @item @samp{wl:folder#id}
  3099. @tab Wanderlust message link
  3100. @end multitable
  3101. For customizing Org to add new link types, see @ref{Adding Hyperlink Types}.
  3102. A link should be enclosed in double brackets and may contain
  3103. a descriptive text to be displayed instead of the URL (see @ref{Link Format}), for example:
  3104. @example
  3105. [[http://www.gnu.org/software/emacs/][GNU Emacs]]
  3106. @end example
  3107. @noindent
  3108. If the description is a file name or URL that points to an image, HTML
  3109. export (see @ref{HTML Export}) inlines the image as a clickable button. If
  3110. there is no description at all and the link points to an image, that
  3111. image is inlined into the exported HTML file.
  3112. @cindex square brackets, around links
  3113. @cindex angular brackets, around links
  3114. @cindex plain text external links
  3115. Org also finds external links in the normal text and activates them as
  3116. links. If spaces must be part of the link (for example in
  3117. @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities about
  3118. the end of the link, enclose them in square or angular brackets.
  3119. @node Handling Links
  3120. @section Handling Links
  3121. @cindex links, handling
  3122. Org provides methods to create a link in the correct syntax, to insert
  3123. it into an Org file, and to follow the link.
  3124. @findex org-store-link
  3125. @cindex storing links
  3126. 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
  3127. to a widely available key (see @ref{Activation}). It stores a link to the
  3128. current location. The link is stored for later insertion into an Org
  3129. buffer---see below. What kind of link is created depends on the
  3130. current buffer:
  3131. @table @asis
  3132. @item @emph{Org mode buffers}
  3133. For Org files, if there is a @samp{<<target>>} at the cursor, the link
  3134. points to the target. Otherwise it points to the current
  3135. headline, which is also the description@footnote{If the headline contains a timestamp, it is removed from the
  3136. link, which results in a wrong link---you should avoid putting
  3137. a timestamp in the headline.}.
  3138. @vindex org-link-to-org-use-id
  3139. @cindex @samp{CUSTOM_ID}, property
  3140. @cindex @samp{ID}, property
  3141. If the headline has a @samp{CUSTOM_ID} property, store a link to this
  3142. custom ID. In addition or alternatively, depending on the value
  3143. of @code{org-link-to-org-use-id}, create and/or use a globally unique
  3144. ID property for the link@footnote{The Org Id library must first be loaded, either through
  3145. @code{org-customize}, by enabling @code{id} in @code{org-modules}, or by adding
  3146. @code{(require 'org-id)} in your Emacs init file.}. So using this command in Org
  3147. buffers potentially creates two links: a human-readable link from
  3148. the custom ID, and one that is globally unique and works even if
  3149. the entry is moved from file to file. Later, when inserting the
  3150. link, you need to decide which one to use.
  3151. @item @emph{Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus}
  3152. Pretty much all Emacs mail clients are supported. The link
  3153. points to the current article, or, in some Gnus buffers, to the
  3154. group. The description is constructed from the author and the
  3155. subject.
  3156. @item @emph{Web browsers: W3, W3M and EWW}
  3157. Here the link is the current URL, with the page title as
  3158. description.
  3159. @item @emph{Contacts: BBDB}
  3160. Links created in a BBDB buffer point to the current entry.
  3161. @item @emph{Chat: IRC}
  3162. @vindex org-irc-links-to-logs
  3163. For IRC links, if the variable @code{org-irc-link-to-logs} is
  3164. non-@code{nil}, create a @samp{file} style link to the relevant point in
  3165. the logs for the current conversation. Otherwise store an @samp{irc}
  3166. style link to the user/channel/server under the point.
  3167. @item @emph{Other files}
  3168. For any other file, the link points to the file, with a search
  3169. string (see @ref{Search Options}) pointing to the
  3170. contents of the current line. If there is an active region, the
  3171. selected words form the basis of the search string. If the
  3172. automatically created link is not working correctly or accurately
  3173. enough, you can write custom functions to select the search
  3174. string and to do the search for particular file types (see
  3175. @ref{Custom Searches}).
  3176. You can also define dedicated links to other files. See @ref{Adding Hyperlink Types}.
  3177. @item @emph{Agenda view}
  3178. When the cursor is in an agenda view, the created link points to
  3179. the entry referenced by the current line.
  3180. @end table
  3181. From an Org buffer, the following commands create, navigate or, more
  3182. generally, act on links.
  3183. @table @asis
  3184. @item @kbd{C-c C-l} (@code{org-insert-link})
  3185. @kindex C-c C-l
  3186. @findex org-insert-link
  3187. @cindex link completion
  3188. @cindex completion, of links
  3189. @cindex inserting links
  3190. @vindex org-keep-stored-link-after-insertion
  3191. Insert a link@footnote{Note that you do not have to use this command to insert
  3192. a link. Links in Org are plain text, and you can type or paste them
  3193. straight into the buffer. By using this command, the links are
  3194. automatically enclosed in double brackets, and you will be asked for
  3195. the optional descriptive text.}. This prompts for a link to be inserted
  3196. into the buffer. You can just type a link, using text for an
  3197. internal link, or one of the link type prefixes mentioned in the
  3198. examples above. The link is inserted into the buffer, along with
  3199. a descriptive text@footnote{After insertion of a stored link, the link will be removed
  3200. from the list of stored links. To keep it in the list later use, use
  3201. a triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or
  3202. configure the option @code{org-keep-stored-link-after-insertion}.}. If some text was selected at this
  3203. time, it becomes the default description.
  3204. @table @asis
  3205. @item @emph{Inserting stored links}
  3206. All links stored during the current session are part of the
  3207. history for this prompt, so you can access them with
  3208. @kbd{@key{UP}} and @kbd{@key{DOWN}} (or @kbd{M-p},
  3209. @kbd{M-n}).
  3210. @item @emph{Completion support}
  3211. Completion with @kbd{@key{TAB}} helps you to insert valid link
  3212. prefixes like @samp{http} or @samp{ftp}, including the prefixes defined
  3213. through link abbreviations (see @ref{Link Abbreviations}). If you
  3214. press @kbd{@key{RET}} after inserting only the prefix, Org
  3215. offers specific completion support for some link types@footnote{This works if a function has been defined in the @code{:complete}
  3216. property of a link in @code{org-link-parameters}.}.
  3217. For example, if you type @kbd{f i l e @key{RET}}---alternative
  3218. access: @kbd{C-u C-c C-l}, see below---Org offers file
  3219. name completion, and after @kbd{b b d b @key{RET}} you can
  3220. complete contact names.
  3221. @end table
  3222. @item @kbd{C-u C-c C-l}
  3223. @cindex file name completion
  3224. @cindex completion, of file names
  3225. @kindex C-u C-c C-l
  3226. When @kbd{C-c C-l} is called with a @kbd{C-u} prefix
  3227. argument, insert a link to a file. You may use file name
  3228. completion to select the name of the file. The path to the file
  3229. is inserted relative to the directory of the current Org file, if
  3230. the linked file is in the current directory or in a sub-directory
  3231. of it, or if the path is written relative to the current
  3232. directory using @samp{../}. Otherwise an absolute path is used, if
  3233. possible with @samp{~/} for your home directory. You can force an
  3234. absolute path with two @kbd{C-u} prefixes.
  3235. @item @kbd{C-c C-l} (with cursor on existing link)
  3236. @cindex following links
  3237. When the cursor is on an existing link, @kbd{C-c C-l} allows
  3238. you to edit the link and description parts of the link.
  3239. @item @kbd{C-c C-o} (@code{org-open-at-point})
  3240. @kindex C-c C-o
  3241. @findex org-open-at-point
  3242. @vindex org-file-apps
  3243. Open link at point. This launches a web browser for URL (using
  3244. @code{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
  3245. for the corresponding links, and execute the command in a shell
  3246. link. When the cursor is on an internal link, this command runs
  3247. the corresponding search. When the cursor is on a TAG list in
  3248. a headline, it creates the corresponding TAGS view. If the
  3249. cursor is on a timestamp, it compiles the agenda for that date.
  3250. Furthermore, it visits text and remote files in @samp{file} links with
  3251. Emacs and select a suitable application for local non-text files.
  3252. Classification of files is based on file extension only. See
  3253. option @code{org-file-apps}. If you want to override the default
  3254. application and visit the file with Emacs, use a @kbd{C-u}
  3255. prefix. If you want to avoid opening in Emacs, use a @kbd{C-u C-u} prefix.
  3256. @vindex org-link-frame-setup
  3257. If the cursor is on a headline, but not on a link, offer all
  3258. links in the headline and entry text. If you want to setup the
  3259. frame configuration for following links, customize
  3260. @code{org-link-frame-setup}.
  3261. @item @kbd{@key{RET}}
  3262. @vindex org-return-follows-link
  3263. @kindex RET
  3264. When @code{org-return-follows-link} is set, @kbd{@key{RET}} also
  3265. follows the link at point.
  3266. @item @kbd{mouse-2} or @kbd{mouse-1}
  3267. @kindex mouse-2
  3268. @kindex mouse-1
  3269. On links, @kbd{mouse-1} and @kbd{mouse-2} opens the
  3270. link just as @kbd{C-c C-o} does.
  3271. @item @kbd{mouse-3}
  3272. @vindex org-display-internal-link-with-indirect-buffer
  3273. @kindex mouse-3
  3274. Like @kbd{mouse-2}, but force file links to be opened with
  3275. Emacs, and internal links to be displayed in another
  3276. window@footnote{See the variable @code{org-display-internal-link-with-indirect-buffer}.}.
  3277. @item @kbd{C-c C-x C-v} (@code{org-toggle-inline-images})
  3278. @cindex inlining images
  3279. @cindex images, inlining
  3280. @vindex org-startup-with-inline-images
  3281. @kindex C-c C-x C-v
  3282. @findex org-toggle-inline-images
  3283. Toggle the inline display of linked images. Normally this only
  3284. inlines images that have no description part in the link, i.e.,
  3285. images that are inlined during export. When called with a prefix
  3286. argument, also display images that do have a link description.
  3287. You can ask for inline images to be displayed at startup by
  3288. configuring the variable @code{org-startup-with-inline-images}@footnote{The variable @code{org-startup-with-inline-images} can be set
  3289. within a buffer with the @samp{STARTUP} options @samp{inlineimages} and
  3290. @samp{noinlineimages}.}.
  3291. @item @kbd{C-c %} (@code{org-mark-ring-push})
  3292. @kindex C-c %
  3293. @findex org-mark-ring-push
  3294. @cindex mark ring
  3295. Push the current position onto the mark ring, to be able to
  3296. return easily. Commands following an internal link do this
  3297. automatically.
  3298. @item @kbd{C-c &} (@code{org-mark-ring-goto})
  3299. @kindex C-c &
  3300. @findex org-mark-ring-goto
  3301. @cindex links, returning to
  3302. Jump back to a recorded position. A position is recorded by the
  3303. commands following internal links, and by @kbd{C-c %}.
  3304. Using this command several times in direct succession moves
  3305. through a ring of previously recorded positions.
  3306. @item @kbd{C-c C-x C-n} (@code{org-next-link})
  3307. @itemx @kbd{C-c C-x C-p} (@code{org-previous-link})
  3308. @kindex C-c C-x C-p
  3309. @findex org-previous-link
  3310. @kindex C-c C-x C-n
  3311. @findex org-next-link
  3312. @cindex links, finding next/previous
  3313. Move forward/backward to the next link in the buffer. At the
  3314. limit of the buffer, the search fails once, and then wraps
  3315. around. The key bindings for this are really too long; you might
  3316. want to bind this also to @kbd{M-n} and @kbd{M-p}.
  3317. @lisp
  3318. (add-hook 'org-load-hook
  3319. (lambda ()
  3320. (define-key org-mode-map "\M-n" 'org-next-link)
  3321. (define-key org-mode-map "\M-p" 'org-previous-link)))
  3322. @end lisp
  3323. @end table
  3324. @node Using Links Outside Org
  3325. @section Using Links Outside Org
  3326. @findex org-insert-link-global
  3327. @findex org-open-at-point-global
  3328. You can insert and follow links that have Org syntax not only in Org,
  3329. but in any Emacs buffer. For this, Org provides two functions:
  3330. @code{org-insert-link-global} and @code{org-open-at-point-global}.
  3331. You might want to bind them to globally available keys. See
  3332. @ref{Activation} for some advice.
  3333. @node Link Abbreviations
  3334. @section Link Abbreviations
  3335. @cindex link abbreviations
  3336. @cindex abbreviation, links
  3337. Long URL can be cumbersome to type, and often many similar links are
  3338. needed in a document. For this you can use link abbreviations. An
  3339. abbreviated link looks like this
  3340. @example
  3341. [[linkword:tag][description]]
  3342. @end example
  3343. @noindent
  3344. @vindex org-link-abbrev-alist
  3345. where the tag is optional. The @emph{linkword} must be a word, starting
  3346. with a letter, followed by letters, numbers, @samp{-}, and @samp{_}.
  3347. Abbreviations are resolved according to the information in the
  3348. variable @code{org-link-abbrev-alist} that relates the linkwords to
  3349. replacement text. Here is an example:
  3350. @lisp
  3351. (setq org-link-abbrev-alist
  3352. '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
  3353. ("url-to-ja" . "http://translate.google.fr/translate?sl=en&tl=ja&u=%h")
  3354. ("google" . "http://www.google.com/search?q=")
  3355. ("gmap" . "http://maps.google.com/maps?q=%s")
  3356. ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
  3357. ("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")))
  3358. @end lisp
  3359. If the replacement text contains the string @samp{%s}, it is replaced with
  3360. the tag. Using @samp{%h} instead of @samp{%s} percent-encodes the tag (see the
  3361. example above, where we need to encode the URL parameter). Using
  3362. @samp{%(my-function)} passes the tag to a custom function, and replace it
  3363. by the resulting string.
  3364. If the replacement text do not contain any specifier, it is simply
  3365. appended to the string in order to create the link.
  3366. Instead of a string, you may also specify a function that will be
  3367. called with the tag as the only argument to create the link.
  3368. With the above setting, you could link to a specific bug with
  3369. @samp{[[bugzilla:129]]}, search the web for @samp{OrgMode} with @samp{[[google:OrgMode]]},
  3370. show the map location of the Free Software Foundation @samp{[[gmap:51
  3371. Franklin Street, Boston]]} or of Carsten office @samp{[[omap:Science Park 904,
  3372. Amsterdam, The Netherlands]]} and find out what the Org author is doing
  3373. besides Emacs hacking with @samp{[[ads:Dominik,C]]}.
  3374. If you need special abbreviations just for a single Org buffer, you
  3375. can define them in the file with
  3376. @cindex @samp{LINK}, keyword
  3377. @example
  3378. #+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
  3379. #+LINK: google http://www.google.com/search?q=%s
  3380. @end example
  3381. @noindent
  3382. In-buffer completion (see @ref{Completion}) can be used after @samp{[} to
  3383. complete link abbreviations. You may also define a function that
  3384. implements special (e.g., completion) support for inserting such
  3385. a link with @kbd{C-c C-l}. Such a function should not accept any
  3386. arguments, and return the full link with prefix. You can set the link
  3387. completion function like this:
  3388. @lisp
  3389. (org-link-set-parameter "type" :complete #'some-completion-function)
  3390. @end lisp
  3391. @node Search Options
  3392. @section Search Options in File Links
  3393. @cindex search option in file links
  3394. @cindex file links, searching
  3395. File links can contain additional information to make Emacs jump to
  3396. a particular location in the file when following a link. This can be
  3397. a line number or a search option after a double colon@footnote{For backward compatibility, line numbers can also follow a
  3398. single colon.}. For
  3399. example, when the command @code{org-store-link} creates a link (see
  3400. @ref{Handling Links}) to a file, it encodes the words in the current line
  3401. as a search string that can be used to find this line back later when
  3402. following the link with @kbd{C-c C-o}.
  3403. Here is the syntax of the different ways to attach a search to a file
  3404. link, together with an explanation:
  3405. @example
  3406. [[file:~/code/main.c::255]]
  3407. [[file:~/xx.org::My Target]]
  3408. [[file:~/xx.org::*My Target]]
  3409. [[file:~/xx.org::#my-custom-id]]
  3410. [[file:~/xx.org::/regexp/]]
  3411. @end example
  3412. @table @asis
  3413. @item @samp{255}
  3414. Jump to line 255.
  3415. @item @samp{My Target}
  3416. Search for a link target @samp{<<My Target>>}, or do a text search for
  3417. @samp{my target}, similar to the search in internal links, see
  3418. @ref{Internal Links}. In HTML export (see @ref{HTML Export}), such a file
  3419. link becomes a HTML reference to the corresponding named anchor
  3420. in the linked file.
  3421. @item @samp{*My Target}
  3422. In an Org file, restrict search to headlines.
  3423. @item @samp{#my-custom-id}
  3424. Link to a heading with a @samp{CUSTOM_ID} property
  3425. @item @samp{/REGEXP/}
  3426. Do a regular expression search for @var{REGEXP}. This uses
  3427. the Emacs command @code{occur} to list all matches in a separate
  3428. window. If the target file is in Org mode, @code{org-occur} is used
  3429. to create a sparse tree with the matches.
  3430. @end table
  3431. As a degenerate case, a file link with an empty file name can be used
  3432. to search the current file. For example, @samp{[[file:::find me]]} does
  3433. a search for @samp{find me} in the current file, just as @samp{[[find me]]} would.
  3434. @node Custom Searches
  3435. @section Custom Searches
  3436. @cindex custom search strings
  3437. @cindex search strings, custom
  3438. The default mechanism for creating search strings and for doing the
  3439. actual search related to a file link may not work correctly in all
  3440. cases. For example, Bib@TeX{} database files have many entries like
  3441. @code{year="1993"} which would not result in good search strings, because
  3442. the only unique identification for a Bib@TeX{} entry is the citation key.
  3443. @vindex org-create-file-search-functions
  3444. @vindex org-execute-file-search-functions
  3445. If you come across such a problem, you can write custom functions to
  3446. set the right search string for a particular file type, and to do the
  3447. search for the string in the file. Using @code{add-hook}, these functions
  3448. need to be added to the hook variables
  3449. @code{org-create-file-search-functions} and
  3450. @code{org-execute-file-search-functions}. See the docstring for these
  3451. variables for more information. Org actually uses this mechanism for
  3452. Bib@TeX{} database files, and you can use the corresponding code as an
  3453. implementation example. See the file @samp{org-bibtex.el}.
  3454. @node TODO Items
  3455. @chapter TODO Items
  3456. @cindex TODO items
  3457. Org mode does not maintain TODO lists as separate documents@footnote{Of course, you can make a document that contains only long
  3458. lists of TODO items, but this is not required.}.
  3459. Instead, TODO items are an integral part of the notes file, because
  3460. TODO items usually come up while taking notes! With Org mode, simply
  3461. mark any entry in a tree as being a TODO item. In this way,
  3462. information is not duplicated, and the entire context from which the
  3463. TODO item emerged is always present.
  3464. Of course, this technique for managing TODO items scatters them
  3465. throughout your notes file. Org mode compensates for this by
  3466. providing methods to give you an overview of all the things that you
  3467. have to do.
  3468. @menu
  3469. * TODO Basics:: Marking and displaying TODO entries.
  3470. * TODO Extensions:: Workflow and assignments.
  3471. * Progress Logging:: Dates and notes for progress.
  3472. * Priorities:: Some things are more important than others.
  3473. * Breaking Down Tasks:: Splitting a task into manageable pieces.
  3474. * Checkboxes:: Tick-off lists.
  3475. @end menu
  3476. @node TODO Basics
  3477. @section Basic TODO Functionality
  3478. Any headline becomes a TODO item when it starts with the word @samp{TODO},
  3479. for example:
  3480. @example
  3481. *** TODO Write letter to Sam Fortune
  3482. @end example
  3483. @noindent
  3484. The most important commands to work with TODO entries are:
  3485. @table @asis
  3486. @item @kbd{C-c C-t} (@code{org-todo})
  3487. @kindex C-c C-t
  3488. @cindex cycling, of TODO states
  3489. Rotate the TODO state of the current item among
  3490. @example
  3491. ,-> (unmarked) -> TODO -> DONE --.
  3492. '--------------------------------'
  3493. @end example
  3494. If TODO keywords have fast access keys (see @ref{Fast access to TODO states}), prompt for a TODO keyword through the fast
  3495. selection interface; this is the default behavior when
  3496. @code{org-use-fast-todo-selection} is non-@code{nil}.
  3497. The same rotation can also be done ``remotely'' from the timeline
  3498. and agenda buffers with the @kbd{t} command key (see
  3499. @ref{Agenda Commands}).
  3500. @item @kbd{C-u C-c C-t}
  3501. @kindex C-u C-c C-t
  3502. When TODO keywords have no selection keys, select a specific
  3503. keyword using completion; otherwise force cycling through TODO
  3504. states with no prompt. When @code{org-use-fast-todo-selection} is set
  3505. to @code{prefix}, use the fast selection interface.
  3506. @item @kbd{S-@key{RIGHT}} @kbd{S-@key{LEFT}}
  3507. @kindex S-RIGHT
  3508. @kindex S-LEFT
  3509. @vindex org-treat-S-cursor-todo-selection-as-state-change
  3510. Select the following/preceding TODO state, similar to cycling.
  3511. Useful mostly if more than two TODO states are possible (see
  3512. @ref{TODO Extensions}). See also @ref{Conflicts}, for a discussion of the interaction with
  3513. @code{shift-selection-mode}. See also the variable
  3514. @code{org-treat-S-cursor-todo-selection-as-state-change}.
  3515. @item @kbd{C-c / t} (@code{org-show-todo-tree})
  3516. @kindex C-c / t
  3517. @cindex sparse tree, for TODO
  3518. @vindex org-todo-keywords
  3519. @findex org-show-todo-tree
  3520. View TODO items in a @emph{sparse tree} (see @ref{Sparse Trees}). Folds
  3521. the entire buffer, but shows all TODO items---with not-DONE
  3522. state---and the headings hierarchy above them. With a prefix
  3523. argument, or by using @kbd{C-c / T}, search for a specific
  3524. TODO. You are prompted for the keyword, and you can also give
  3525. a list of keywords like @samp{KWD1|KWD2|...} to list entries that
  3526. match any one of these keywords. With a numeric prefix argument
  3527. N, show the tree for the Nth keyword in the variable
  3528. @code{org-todo-keywords}. With two prefix arguments, find all TODO
  3529. states, both un-done and done.
  3530. @item @kbd{C-c a t} (@code{org-todo-list})
  3531. @kindex C-c a t
  3532. Show the global TODO list. Collects the TODO items (with
  3533. not-DONE states) from all agenda files (see @ref{Agenda Views}) into
  3534. a single buffer. The new buffer is in Org Agenda mode, which
  3535. provides commands to examine and manipulate the TODO entries from
  3536. the new buffer (see @ref{Agenda Commands}). See @ref{Global TODO list}, for more information.
  3537. @item @kbd{S-M-@key{RET}} (@code{org-insert-todo-heading})
  3538. @kindex S-M-RET
  3539. @findex org-insert-todo-heading
  3540. Insert a new TODO entry below the current one.
  3541. @end table
  3542. @vindex org-todo-state-tags-triggers
  3543. @noindent
  3544. Changing a TODO state can also trigger tag changes. See the docstring
  3545. of the option @code{org-todo-state-tags-triggers} for details.
  3546. @node TODO Extensions
  3547. @section Extended Use of TODO Keywords
  3548. @cindex extended TODO keywords
  3549. @vindex org-todo-keywords
  3550. By default, marked TODO entries have one of only two states: TODO and
  3551. DONE. Org mode allows you to classify TODO items in more complex ways
  3552. with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With special
  3553. setup, the TODO keyword system can work differently in different
  3554. files.
  3555. Note that @emph{tags} are another way to classify headlines in general and
  3556. TODO items in particular (see @ref{Tags}).
  3557. @menu
  3558. * Workflow states:: From TODO to DONE in steps.
  3559. * TODO types:: I do this, Fred does the rest.
  3560. * Multiple sets in one file:: Mixing it all, still finding your way.
  3561. * Fast access to TODO states:: Single letter selection of state.
  3562. * Per-file keywords:: Different files, different requirements.
  3563. * Faces for TODO keywords:: Highlighting states.
  3564. * TODO dependencies:: When one task needs to wait for others.
  3565. @end menu
  3566. @node Workflow states
  3567. @subsection TODO keywords as workflow states
  3568. @cindex TODO workflow
  3569. @cindex workflow states as TODO keywords
  3570. You can use TODO keywords to indicate different @emph{sequential} states in
  3571. the process of working on an item, for example@footnote{Changing the variable @code{org-todo-keywords} only becomes
  3572. effective after restarting Org mode in a buffer.}:
  3573. @lisp
  3574. (setq org-todo-keywords
  3575. '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
  3576. @end lisp
  3577. The vertical bar separates the TODO keywords (states that @emph{need
  3578. action}) from the DONE states (which need @emph{no further action}). If
  3579. you do not provide the separator bar, the last state is used as the
  3580. DONE state.
  3581. @cindex completion, of TODO keywords
  3582. With this setup, the command @kbd{C-c C-t} cycles an entry from
  3583. @samp{TODO} to @samp{FEEDBACK}, then to @samp{VERIFY}, and finally to @samp{DONE} and
  3584. @samp{DELEGATED}. You may also use a numeric prefix argument to quickly
  3585. select a specific state. For example @kbd{C-3 C-c C-t} changes
  3586. the state immediately to @samp{VERIFY}. Or you can use @kbd{S-@key{LEFT}}
  3587. to go backward through the sequence. If you define many keywords, you
  3588. can use in-buffer completion (see @ref{Completion}) or even a special
  3589. one-key selection scheme (see @ref{Fast access to TODO states}) to insert
  3590. these words into the buffer. Changing a TODO state can be logged with
  3591. a timestamp, see @ref{Tracking TODO state changes}, for more information.
  3592. @node TODO types
  3593. @subsection TODO keywords as types
  3594. @cindex TODO types
  3595. @cindex names as TODO keywords
  3596. @cindex types as TODO keywords
  3597. The second possibility is to use TODO keywords to indicate different
  3598. @emph{types} of action items. For example, you might want to indicate that
  3599. items are for ``work'' or ``home''. Or, when you work with several people
  3600. on a single project, you might want to assign action items directly to
  3601. persons, by using their names as TODO keywords. This would be set up
  3602. like this:
  3603. @lisp
  3604. (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
  3605. @end lisp
  3606. In this case, different keywords do not indicate a sequence, but
  3607. rather different types. So the normal work flow would be to assign
  3608. a task to a person, and later to mark it DONE. Org mode supports this
  3609. 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
  3610. and agenda buffers.}. When used several times in succession, it still
  3611. cycles through all names, in order to first select the right type for
  3612. a task. But when you return to the item after some time and execute
  3613. @kbd{C-c C-t} again, it will switch from any name directly to
  3614. @samp{DONE}. Use prefix arguments or completion to quickly select
  3615. a specific name. You can also review the items of a specific TODO
  3616. type in a sparse tree by using a numeric prefix to @kbd{C-c / t}.
  3617. For example, to see all things Lucy has to do, you would use
  3618. @kbd{C-3 C-c / t}. To collect Lucy's items from all agenda files
  3619. into a single buffer, you would use the numeric prefix argument as
  3620. well when creating the global TODO list: @kbd{C-3 C-c a t}.
  3621. @node Multiple sets in one file
  3622. @subsection Multiple keyword sets in one file
  3623. @cindex TODO keyword sets
  3624. Sometimes you may want to use different sets of TODO keywords in
  3625. parallel. For example, you may want to have the basic TODO/DONE, but
  3626. also a workflow for bug fixing, and a separate state indicating that
  3627. an item has been canceled---so it is not DONE, but also does not
  3628. require action. Your setup would then look like this:
  3629. @lisp
  3630. (setq org-todo-keywords
  3631. '((sequence "TODO" "|" "DONE")
  3632. (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
  3633. (sequence "|" "CANCELED")))
  3634. @end lisp
  3635. The keywords should all be different, this helps Org mode to keep
  3636. track of which subsequence should be used for a given entry. In this
  3637. setup, @kbd{C-c C-t} only operates within a subsequence, so it
  3638. switches from @samp{DONE} to (nothing) to @samp{TODO}, and from @samp{FIXED} to
  3639. (nothing) to @samp{REPORT}. Therefore you need a mechanism to initially
  3640. select the correct sequence. Besides the obvious ways like typing
  3641. a keyword or using completion, you may also apply the following
  3642. commands:
  3643. @table @asis
  3644. @item @kbd{C-u C-u C-c C-t}
  3645. @itemx @kbd{C-S-@key{RIGHT}}
  3646. @itemx @kbd{C-S-@key{LEFT}}
  3647. @kindex C-S-RIGHT
  3648. @kindex C-S-LEFT
  3649. @kindex C-u C-u C-c C-t
  3650. These keys jump from one TODO subset to the next. In the above
  3651. example, @kbd{C-u C-u C-c C-t} or @kbd{C-S-@key{RIGHT}} would
  3652. jump from @samp{TODO} or @samp{DONE} to @samp{REPORT}, and any of the words in
  3653. the second row to @samp{CANCELED}. Note that the @kbd{C-S-} key
  3654. binding conflict with @code{shift-selection-mode} (see @ref{Conflicts}).
  3655. @item @kbd{S-@key{RIGHT}}
  3656. @itemx @kbd{S-@key{LEFT}}
  3657. @kindex S-RIGHT
  3658. @kindex S-LEFT
  3659. @kbd{S-@key{LEFT}} and @kbd{S-@key{RIGHT}} walk through @emph{all}
  3660. keywords from all sets, so for example @kbd{S-@key{RIGHT}} would
  3661. switch from @samp{DONE} to @samp{REPORT} in the example above. For
  3662. a discussion of the interaction with @code{shift-selection-mode}, see
  3663. @ref{Conflicts}.
  3664. @end table
  3665. @node Fast access to TODO states
  3666. @subsection Fast access to TODO states
  3667. If you would like to quickly change an entry to an arbitrary TODO
  3668. state instead of cycling through the states, you can set up keys for
  3669. single-letter access to the states. This is done by adding the
  3670. selection character after each keyword, in parentheses@footnote{All characters are allowed except @samp{@@}, @samp{^} and @samp{!}, which have
  3671. a special meaning here.}. For
  3672. example:
  3673. @lisp
  3674. (setq org-todo-keywords
  3675. '((sequence "TODO(t)" "|" "DONE(d)")
  3676. (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
  3677. (sequence "|" "CANCELED(c)")))
  3678. @end lisp
  3679. @vindex org-fast-tag-selection-include-todo
  3680. If you then press @kbd{C-c C-t} followed by the selection key,
  3681. the entry is switched to this state. @kbd{@key{SPC}} can be used to
  3682. remove any TODO keyword from an entry@footnote{Check also the variable @code{org-fast-tag-selection-include-todo},
  3683. it allows you to change the TODO state through the tags interface
  3684. (@ref{Setting Tags}), in case you like to mingle the two concepts. Note
  3685. that this means you need to come up with unique keys across both sets
  3686. of keywords.}.
  3687. @node Per-file keywords
  3688. @subsection Setting up keywords for individual files
  3689. @cindex keyword options
  3690. @cindex per-file keywords
  3691. @cindex @samp{TODO}, keyword
  3692. @cindex @samp{TYP_TODO}, keyword
  3693. @cindex @samp{SEQ_TODO}, keyword
  3694. It can be very useful to use different aspects of the TODO mechanism
  3695. in different files. For file-local settings, you need to add special
  3696. lines to the file which set the keywords and interpretation for that
  3697. file only. For example, to set one of the two examples discussed
  3698. above, you need one of the following lines, starting in column zero
  3699. anywhere in the file:
  3700. @example
  3701. #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
  3702. @end example
  3703. @noindent
  3704. you may also write @samp{#+SEQ_TODO} to be explicit about the
  3705. interpretation, but it means the same as @samp{#+TODO}, or
  3706. @example
  3707. #+TYP_TODO: Fred Sara Lucy Mike | DONE
  3708. @end example
  3709. A setup for using several sets in parallel would be:
  3710. @example
  3711. #+TODO: TODO | DONE
  3712. #+TODO: REPORT BUG KNOWNCAUSE | FIXED
  3713. #+TODO: | CANCELED
  3714. @end example
  3715. @cindex completion, of option keywords
  3716. @kindex M-TAB
  3717. @noindent
  3718. To make sure you are using the correct keyword, type @samp{#+} into the
  3719. buffer and then use @kbd{M-@key{TAB}} completion.
  3720. @cindex DONE, final TODO keyword
  3721. Remember that the keywords after the vertical bar---or the last
  3722. keyword if no bar is there---must always mean that the item is DONE,
  3723. although you may use a different word. After changing one of these
  3724. lines, use @kbd{C-c C-c} with the cursor still in the line to
  3725. make the changes known to Org mode@footnote{Org mode parses these lines only when Org mode is activated
  3726. after visiting a file. @kbd{C-c C-c} with the cursor in a line
  3727. starting with @samp{#+} is simply restarting Org mode for the current
  3728. buffer.}.
  3729. @node Faces for TODO keywords
  3730. @subsection Faces for TODO keywords
  3731. @cindex faces, for TODO keywords
  3732. @vindex org-todo, face
  3733. @vindex org-done, face
  3734. @vindex org-todo-keyword-faces
  3735. Org mode highlights TODO keywords with special faces: @code{org-todo} for
  3736. keywords indicating that an item still has to be acted upon, and
  3737. @code{org-done} for keywords indicating that an item is finished. If you
  3738. are using more than two different states, you might want to use
  3739. special faces for some of them. This can be done using the variable
  3740. @code{org-todo-keyword-faces}. For example:
  3741. @lisp
  3742. (setq org-todo-keyword-faces
  3743. '(("TODO" . org-warning) ("STARTED" . "yellow")
  3744. ("CANCELED" . (:foreground "blue" :weight bold))))
  3745. @end lisp
  3746. @vindex org-faces-easy-properties
  3747. While using a list with face properties as shown for @samp{CANCELED}
  3748. @emph{should} work, this does not always seem to be the case. If
  3749. necessary, define a special face and use that. A string is
  3750. interpreted as a color. The variable @code{org-faces-easy-properties}
  3751. determines if that color is interpreted as a foreground or
  3752. a background color.
  3753. @node TODO dependencies
  3754. @subsection TODO dependencies
  3755. @cindex TODO dependencies
  3756. @cindex dependencies, of TODO states
  3757. @vindex org-enforce-todo-dependencies
  3758. @cindex @samp{ORDERED}, property
  3759. The structure of Org files---hierarchy and lists---makes it easy to
  3760. define TODO dependencies. Usually, a parent TODO task should not be
  3761. marked DONE until all subtasks, defined as children tasks, are marked
  3762. as DONE. And sometimes there is a logical sequence to a number of
  3763. (sub)tasks, so that one task cannot be acted upon before all siblings
  3764. above it are done. If you customize the variable
  3765. @code{org-enforce-todo-dependencies}, Org blocks entries from changing
  3766. state to DONE while they have children that are not DONE.
  3767. Furthermore, if an entry has a property @samp{ORDERED}, each of its
  3768. children is blocked until all earlier siblings are marked DONE. Here
  3769. is an example:
  3770. @example
  3771. * TODO Blocked until (two) is done
  3772. ** DONE one
  3773. ** TODO two
  3774. * Parent
  3775. :PROPERTIES:
  3776. :ORDERED: t
  3777. :END:
  3778. ** TODO a
  3779. ** TODO b, needs to wait for (a)
  3780. ** TODO c, needs to wait for (a) and (b)
  3781. @end example
  3782. @cindex TODO dependencies, NOBLOCKING
  3783. @cindex NOBLOCKING, property
  3784. You can ensure an entry is never blocked by using the @samp{NOBLOCKING}
  3785. property:
  3786. @example
  3787. * This entry is never blocked
  3788. :PROPERTIES:
  3789. :NOBLOCKING: t
  3790. :END:
  3791. @end example
  3792. @table @asis
  3793. @item @kbd{C-c C-x o} (@code{org-toggle-ordered-property})
  3794. @kindex C-c C-x o
  3795. @findex org-toggle-ordered-property
  3796. @vindex org-track-ordered-property-with-tag
  3797. Toggle the @samp{ORDERED} property of the current entry. A property
  3798. is used for this behavior because this should be local to the
  3799. current entry, not inherited like a tag. However, if you would
  3800. like to @emph{track} the value of this property with a tag for better
  3801. visibility, customize the variable
  3802. @code{org-track-ordered-property-with-tag}.
  3803. @item @kbd{C-u C-u C-u C-c C-t}
  3804. @kindex C-u C-u C-u C-c C-t
  3805. Change TODO state, circumventing any state blocking.
  3806. @end table
  3807. @vindex org-agenda-dim-blocked-tasks
  3808. If you set the variable @code{org-agenda-dim-blocked-tasks}, TODO entries
  3809. that cannot be closed because of such dependencies are shown in
  3810. a dimmed font or even made invisible in agenda views (see @ref{Agenda Views}).
  3811. @cindex checkboxes and TODO dependencies
  3812. @vindex org-enforce-todo-dependencies
  3813. You can also block changes of TODO states by looking at checkboxes
  3814. (see @ref{Checkboxes}). If you set the variable
  3815. @code{org-enforce-todo-checkbox-dependencies}, an entry that has unchecked
  3816. checkboxes is blocked from switching to DONE.
  3817. If you need more complex dependency structures, for example
  3818. dependencies between entries in different trees or files, check out
  3819. the contributed module @samp{org-depend.el}.
  3820. @node Progress Logging
  3821. @section Progress Logging
  3822. @cindex progress logging
  3823. @cindex logging, of progress
  3824. Org mode can automatically record a timestamp and possibly a note when
  3825. you mark a TODO item as DONE, or even each time you change the state
  3826. of a TODO item. This system is highly configurable, settings can be
  3827. on a per-keyword basis and can be localized to a file or even
  3828. a subtree. For information on how to clock working time for a task,
  3829. see @ref{Clocking Work Time}.
  3830. @menu
  3831. * Closing items:: When was this entry marked DONE?
  3832. * Tracking TODO state changes:: When did the status change?
  3833. * Tracking your habits:: How consistent have you been?
  3834. @end menu
  3835. @node Closing items
  3836. @subsection Closing items
  3837. The most basic logging is to keep track of @emph{when} a certain TODO item
  3838. was finished. This is achieved with@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP: logdone}.}
  3839. @lisp
  3840. (setq org-log-done 'time)
  3841. @end lisp
  3842. @vindex org-closed-keep-when-no-todo
  3843. @noindent
  3844. Then each time you turn an entry from a TODO (not-done) state into any
  3845. of the DONE states, a line @samp{CLOSED: [timestamp]} is inserted just
  3846. after the headline. If you turn the entry back into a TODO item
  3847. through further state cycling, that line is removed again. If you
  3848. 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
  3849. @code{org-closed-keep-when-no-todo} to non-@code{nil}. If you want to record
  3850. a note along with the timestamp, use@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP:
  3851. lognotedone}.}
  3852. @lisp
  3853. (setq org-log-done 'note)
  3854. @end lisp
  3855. @noindent
  3856. You are then be prompted for a note, and that note is stored below the
  3857. entry with a @samp{Closing Note} heading.
  3858. @node Tracking TODO state changes
  3859. @subsection Tracking TODO state changes
  3860. @cindex drawer, for state change recording
  3861. @vindex org-log-states-order-reversed
  3862. @vindex org-log-into-drawer
  3863. @cindex @samp{LOG_INTO_DRAWER}, property
  3864. When TODO keywords are used as workflow states (see @ref{Workflow states, , *Workflow states}),
  3865. you might want to keep track of when a state change occurred and maybe
  3866. take a note about this change. You can either record just
  3867. a timestamp, or a time-stamped note for a change. These records are
  3868. inserted after the headline as an itemized list, newest first@footnote{See the variable @code{org-log-states-order-reversed}.}.
  3869. When taking a lot of notes, you might want to get the notes out of the
  3870. way into a drawer (see @ref{Drawers}). Customize the variable
  3871. @code{org-log-into-drawer} to get this behavior---the recommended drawer
  3872. for this is called @samp{LOGBOOK}@footnote{Note that the @samp{LOGBOOK} drawer is unfolded when pressing
  3873. @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
  3874. setting of this variable for a subtree by setting a @samp{LOG_INTO_DRAWER}
  3875. property.
  3876. Since it is normally too much to record a note for every state, Org
  3877. mode expects configuration on a per-keyword basis for this. This is
  3878. achieved by adding special markers @samp{!} (for a timestamp) or @samp{@@} (for
  3879. a note with timestamp) in parentheses after each keyword. For
  3880. example, with the setting
  3881. @lisp
  3882. (setq org-todo-keywords
  3883. '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
  3884. @end lisp
  3885. @noindent
  3886. to record a timestamp without a note for TODO keywords configured with
  3887. @samp{@@}, just type @kbd{C-c C-c} to enter a blank note when prompted.
  3888. @vindex org-log-done
  3889. @noindent
  3890. You not only define global TODO keywords and fast access keys, but
  3891. also request that a time is recorded when the entry is set to @samp{DONE},
  3892. and that a note is recorded when switching to @samp{WAIT} or
  3893. @samp{CANCELED}@footnote{It is possible that Org mode records two timestamps when you
  3894. are using both @code{org-log-done} and state change logging. However, it
  3895. never prompts for two notes: if you have configured both, the state
  3896. change recording note takes precedence and cancel the closing note.}. The setting for @samp{WAIT} is even more special: the
  3897. @samp{!} after the slash means that in addition to the note taken when
  3898. entering the state, a timestamp should be recorded when @emph{leaving} the
  3899. @samp{WAIT} state, if and only if the @emph{target} state does not configure
  3900. logging for entering it. So it has no effect when switching from
  3901. @samp{WAIT} to @samp{DONE}, because @samp{DONE} is configured to record a timestamp
  3902. only. But when switching from @samp{WAIT} back to @samp{TODO}, the @samp{/!} in the
  3903. @samp{WAIT} setting now triggers a timestamp even though @samp{TODO} has no
  3904. logging configured.
  3905. You can use the exact same syntax for setting logging preferences local
  3906. to a buffer:
  3907. @example
  3908. #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
  3909. @end example
  3910. @cindex @samp{LOGGING}, property
  3911. In order to define logging settings that are local to a subtree or
  3912. a single item, define a @samp{LOGGING} property in this entry. Any
  3913. non-empty @samp{LOGGING} property resets all logging settings to @code{nil}.
  3914. You may then turn on logging for this specific tree using @samp{STARTUP}
  3915. keywords like @samp{lognotedone} or @samp{logrepeat}, as well as adding state
  3916. specific settings like @samp{TODO(!)}. For example:
  3917. @example
  3918. * TODO Log each state with only a time
  3919. :PROPERTIES:
  3920. :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
  3921. :END:
  3922. * TODO Only log when switching to WAIT, and when repeating
  3923. :PROPERTIES:
  3924. :LOGGING: WAIT(@@) logrepeat
  3925. :END:
  3926. * TODO No logging at all
  3927. :PROPERTIES:
  3928. :LOGGING: nil
  3929. :END:
  3930. @end example
  3931. @node Tracking your habits
  3932. @subsection Tracking your habits
  3933. @cindex habits
  3934. @cindex STYLE, property
  3935. Org has the ability to track the consistency of a special category of
  3936. TODO, called ``habits.'' A habit has the following properties:
  3937. @enumerate
  3938. @item
  3939. You have enabled the @code{habits} module by customizing the variable
  3940. @code{org-modules}.
  3941. @item
  3942. The habit is a TODO item, with a TODO keyword representing an open
  3943. state.
  3944. @item
  3945. The property @samp{STYLE} is set to the value @samp{habit}.
  3946. @item
  3947. The TODO has a scheduled date, usually with a @samp{.+} style repeat
  3948. interval. A @samp{++} style may be appropriate for habits with time
  3949. constraints, e.g., must be done on weekends, or a @samp{+} style for an
  3950. unusual habit that can have a backlog, e.g., weekly reports.
  3951. @item
  3952. The TODO may also have minimum and maximum ranges specified by
  3953. using the syntax @samp{.+2d/3d}, which says that you want to do the task
  3954. at least every three days, but at most every two days.
  3955. @item
  3956. You must also have state logging for the DONE state enabled (see
  3957. @ref{Tracking TODO state changes}), in order for historical data to be
  3958. represented in the consistency graph. If it is not enabled it is
  3959. not an error, but the consistency graphs are largely meaningless.
  3960. @end enumerate
  3961. To give you an idea of what the above rules look like in action, here's an
  3962. actual habit with some history:
  3963. @example
  3964. ** TODO Shave
  3965. SCHEDULED: <2009-10-17 Sat .+2d/4d>
  3966. :PROPERTIES:
  3967. :STYLE: habit
  3968. :LAST_REPEAT: [2009-10-19 Mon 00:36]
  3969. :END:
  3970. - State "DONE" from "TODO" [2009-10-15 Thu]
  3971. - State "DONE" from "TODO" [2009-10-12 Mon]
  3972. - State "DONE" from "TODO" [2009-10-10 Sat]
  3973. - State "DONE" from "TODO" [2009-10-04 Sun]
  3974. - State "DONE" from "TODO" [2009-10-02 Fri]
  3975. - State "DONE" from "TODO" [2009-09-29 Tue]
  3976. - State "DONE" from "TODO" [2009-09-25 Fri]
  3977. - State "DONE" from "TODO" [2009-09-19 Sat]
  3978. - State "DONE" from "TODO" [2009-09-16 Wed]
  3979. - State "DONE" from "TODO" [2009-09-12 Sat]
  3980. @end example
  3981. What this habit says is: I want to shave at most every 2 days---given
  3982. by the @samp{SCHEDULED} date and repeat interval---and at least every
  3983. 4 days. If today is the 15th, then the habit first appears in the
  3984. agenda on Oct 17, after the minimum of 2 days has elapsed, and will
  3985. appear overdue on Oct 19, after four days have elapsed.
  3986. What's really useful about habits is that they are displayed along
  3987. with a consistency graph, to show how consistent you've been at
  3988. getting that task done in the past. This graph shows every day that
  3989. the task was done over the past three weeks, with colors for each day.
  3990. The colors used are:
  3991. @table @asis
  3992. @item Blue
  3993. If the task was not to be done yet on that day.
  3994. @item Green
  3995. If the task could have been done on that day.
  3996. @item Yellow
  3997. If the task was going to be overdue the next day.
  3998. @item Red
  3999. If the task was overdue on that day.
  4000. @end table
  4001. In addition to coloring each day, the day is also marked with an
  4002. asterisk if the task was actually done that day, and an exclamation
  4003. mark to show where the current day falls in the graph.
  4004. There are several configuration variables that can be used to change
  4005. the way habits are displayed in the agenda.
  4006. @table @asis
  4007. @item @code{org-habit-graph-column}
  4008. @vindex org-habit-graph-column
  4009. The buffer column at which the consistency graph should be drawn.
  4010. This overwrites any text in that column, so it is a good idea to
  4011. keep your habits' titles brief and to the point.
  4012. @item @code{org-habit-preceding-days}
  4013. @vindex org-habit-preceding-days
  4014. The amount of history, in days before today, to appear in
  4015. consistency graphs.
  4016. @item @code{org-habit-following-days}
  4017. @vindex org-habit-following-days
  4018. The number of days after today that appear in consistency graphs.
  4019. @item @code{org-habit-show-habits-only-for-today}
  4020. @vindex org-habit-show-habits-only-for-today
  4021. If non-@code{nil}, only show habits in today's agenda view. This is
  4022. set to true by default.
  4023. @end table
  4024. Lastly, pressing @kbd{K} in the agenda buffer causes habits to
  4025. temporarily be disabled and do not appear at all. Press @kbd{K}
  4026. again to bring them back. They are also subject to tag filtering, if
  4027. you have habits which should only be done in certain contexts, for
  4028. example.
  4029. @node Priorities
  4030. @section Priorities
  4031. @cindex priorities
  4032. @cindex priority cookie
  4033. If you use Org mode extensively, you may end up with enough TODO items
  4034. that it starts to make sense to prioritize them. Prioritizing can be
  4035. done by placing a @emph{priority cookie} into the headline of a TODO item,
  4036. like this
  4037. @example
  4038. *** TODO [#A] Write letter to Sam Fortune
  4039. @end example
  4040. @vindex org-priority-faces
  4041. @noindent
  4042. By default, Org mode supports three priorities: @samp{A}, @samp{B}, and @samp{C}.
  4043. @samp{A} is the highest priority. An entry without a cookie is treated
  4044. just like priority @samp{B}. Priorities make a difference only for sorting
  4045. in the agenda (see @ref{Weekly/daily agenda}); outside the agenda, they
  4046. have no inherent meaning to Org mode. The cookies can be highlighted
  4047. with special faces by customizing the variable @code{org-priority-faces}.
  4048. Priorities can be attached to any outline node; they do not need to be
  4049. TODO items.
  4050. @table @asis
  4051. @item @kbd{C-c ,} (@code{org-priority})
  4052. @kindex C-c ,
  4053. @findex org-priority
  4054. Set the priority of the current headline. The command prompts
  4055. for a priority character @samp{A}, @samp{B} or @samp{C}. When you press
  4056. @kbd{@key{SPC}} instead, the priority cookie is removed from the
  4057. headline. The priorities can also be changed ``remotely'' from the
  4058. timeline and agenda buffer with the @kbd{,} command (see
  4059. @ref{Agenda Commands}).
  4060. @item @kbd{S-@key{UP}} (@code{org-priority-up})
  4061. @itemx @kbd{S-@key{DOWN}} (@code{org-priority-down})
  4062. @kindex S-UP
  4063. @kindex S-DOWN
  4064. @findex org-priority-up
  4065. @findex org-priority-down
  4066. @vindex org-priority-start-cycle-with-default
  4067. Increase/decrease priority of current headline@footnote{See also the option @code{org-priority-start-cycle-with-default}.}. Note that
  4068. these keys are also used to modify timestamps (see @ref{Creating Timestamps}). See also @ref{Conflicts}, for
  4069. a discussion of the interaction with @code{shift-selection-mode}.
  4070. @end table
  4071. @vindex org-highest-priority
  4072. @vindex org-lowest-priority
  4073. @vindex org-default-priority
  4074. You can change the range of allowed priorities by setting the
  4075. variables @code{org-highest-priority}, @code{org-lowest-priority}, and
  4076. @code{org-default-priority}. For an individual buffer, you may set these
  4077. values (highest, lowest, default) like this (please make sure that the
  4078. highest priority is earlier in the alphabet than the lowest priority):
  4079. @cindex @samp{PRIORITIES}, keyword
  4080. @example
  4081. #+PRIORITIES: A C B
  4082. @end example
  4083. @node Breaking Down Tasks
  4084. @section Breaking Down Tasks into Subtasks
  4085. @cindex tasks, breaking down
  4086. @cindex statistics, for TODO items
  4087. @vindex org-agenda-todo-list-sublevels
  4088. It is often advisable to break down large tasks into smaller,
  4089. manageable subtasks. You can do this by creating an outline tree
  4090. below a TODO item, with detailed subtasks on the tree@footnote{To keep subtasks out of the global TODO list, see the
  4091. @code{org-agenda-todo-list-sublevels}.}. To keep
  4092. the overview over the fraction of subtasks that are already completed,
  4093. insert either @samp{[/]} or @samp{[%]} anywhere in the headline. These cookies
  4094. are updated each time the TODO status of a child changes, or when
  4095. pressing @kbd{C-c C-c} on the cookie. For example:
  4096. @example
  4097. * Organize Party [33%]
  4098. ** TODO Call people [1/2]
  4099. *** TODO Peter
  4100. *** DONE Sarah
  4101. ** TODO Buy food
  4102. ** DONE Talk to neighbor
  4103. @end example
  4104. @cindex @samp{COOKIE_DATA}, property
  4105. If a heading has both checkboxes and TODO children below it, the
  4106. meaning of the statistics cookie become ambiguous. Set the property
  4107. @samp{COOKIE_DATA} to either @samp{checkbox} or @samp{todo} to resolve this issue.
  4108. @vindex org-hierarchical-todo-statistics
  4109. If you would like to have the statistics cookie count any TODO entries
  4110. in the subtree (not just direct children), configure the variable
  4111. @code{org-hierarchical-todo-statistics}. To do this for a single subtree,
  4112. include the word @samp{recursive} into the value of the @samp{COOKIE_DATA}
  4113. property.
  4114. @example
  4115. * Parent capturing statistics [2/20]
  4116. :PROPERTIES:
  4117. :COOKIE_DATA: todo recursive
  4118. :END:
  4119. @end example
  4120. If you would like a TODO entry to automatically change to DONE when
  4121. all children are done, you can use the following setup:
  4122. @lisp
  4123. (defun org-summary-todo (n-done n-not-done)
  4124. "Switch entry to DONE when all subentries are done, to TODO otherwise."
  4125. (let (org-log-done org-log-states) ; turn off logging
  4126. (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
  4127. (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
  4128. @end lisp
  4129. Another possibility is the use of checkboxes to identify (a hierarchy
  4130. of) a large number of subtasks (see @ref{Checkboxes}).
  4131. @node Checkboxes
  4132. @section Checkboxes
  4133. @cindex checkboxes
  4134. @vindex org-list-automatic-rules
  4135. Every item in a plain list@footnote{With the exception of description lists. But you can allow it
  4136. by modifying @code{org-list-automatic-rules} accordingly.} (see @ref{Plain Lists}) can be made into
  4137. a checkbox by starting it with the string @samp{[ ]}. This feature is
  4138. similar to TODO items (see @ref{TODO Items}), but is more lightweight.
  4139. Checkboxes are not included into the global TODO list, so they are
  4140. often great to split a task into a number of simple steps. Or you can
  4141. 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
  4142. @samp{org-mouse.el}).
  4143. Here is an example of a checkbox list.
  4144. @example
  4145. * TODO Organize party [2/4]
  4146. - [-] call people [1/3]
  4147. - [ ] Peter
  4148. - [X] Sarah
  4149. - [ ] Sam
  4150. - [X] order food
  4151. - [ ] think about what music to play
  4152. - [X] talk to the neighbors
  4153. @end example
  4154. Checkboxes work hierarchically, so if a checkbox item has children
  4155. that are checkboxes, toggling one of the children checkboxes makes the
  4156. parent checkbox reflect if none, some, or all of the children are
  4157. checked.
  4158. @cindex statistics, for checkboxes
  4159. @cindex checkbox statistics
  4160. @cindex @samp{COOKIE_DATA}, property
  4161. @vindex org-hierarchical-checkbox-statistics
  4162. The @samp{[2/4]} and @samp{[1/3]} in the first and second line are cookies
  4163. indicating how many checkboxes present in this entry have been checked
  4164. off, and the total number of checkboxes present. This can give you an
  4165. idea on how many checkboxes remain, even without opening a folded
  4166. entry. The cookies can be placed into a headline or into (the first
  4167. line of) a plain list item. Each cookie covers checkboxes of direct
  4168. children structurally below the headline/item on which the cookie
  4169. appears@footnote{Set the variable @code{org-hierarchical-checkbox-statistics} if you
  4170. want such cookies to count all checkboxes below the cookie, not just
  4171. those belonging to direct children.}. You have to insert the cookie yourself by typing
  4172. either @samp{[/]} or @samp{[%]}. With @samp{[/]} you get an @samp{n out of m} result, as
  4173. in the examples above. With @samp{[%]} you get information about the
  4174. percentage of checkboxes checked (in the above example, this would be
  4175. @samp{[50%]} and @samp{[33%]}, respectively). In a headline, a cookie can count
  4176. either checkboxes below the heading or TODO states of children, and it
  4177. displays whatever was changed last. Set the property @samp{COOKIE_DATA} to
  4178. either @samp{checkbox} or @samp{todo} to resolve this issue.
  4179. @cindex blocking, of checkboxes
  4180. @cindex checkbox blocking
  4181. @cindex @samp{ORDERED}, property
  4182. If the current outline node has an @samp{ORDERED} property, checkboxes must
  4183. be checked off in sequence, and an error is thrown if you try to check
  4184. off a box while there are unchecked boxes above it.
  4185. @noindent
  4186. The following commands work with checkboxes:
  4187. @table @asis
  4188. @item @kbd{C-c C-c} (@code{org-toggle-checkbox})
  4189. @kindex C-c C-c
  4190. @findex org-toggle-checkbox
  4191. Toggle checkbox status or---with prefix argument---checkbox
  4192. presence at point. With a single prefix argument, add an empty
  4193. checkbox or remove the current one@footnote{@kbd{C-u C-c C-c} on the @emph{first} item of a list with no
  4194. checkbox adds checkboxes to the rest of the list.}. With a double prefix
  4195. argument, set it to @samp{[-]}, which is considered to be an
  4196. intermediate state.
  4197. @item @kbd{C-c C-x C-b} (@code{org-toggle-checkbox})
  4198. @kindex C-c C-x C-b
  4199. Toggle checkbox status or---with prefix argument---checkbox
  4200. presence at point. With double prefix argument, set it to @samp{[-]},
  4201. which is considered to be an intermediate state.
  4202. @itemize
  4203. @item
  4204. If there is an active region, toggle the first checkbox in the
  4205. region and set all remaining boxes to the same status as the
  4206. first. With a prefix argument, add or remove the checkbox for
  4207. all items in the region.
  4208. @item
  4209. If the cursor is in a headline, toggle checkboxes in the region
  4210. between this headline and the next---so @emph{not} the entire
  4211. subtree.
  4212. @item
  4213. If there is no active region, just toggle the checkbox at
  4214. point.
  4215. @end itemize
  4216. @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading})
  4217. @kindex M-S-RET
  4218. @findex org-insert-todo-heading
  4219. Insert a new item with a checkbox. This works only if the cursor
  4220. is already in a plain list item (see @ref{Plain Lists}).
  4221. @item @kbd{C-c C-x o} (@code{org-toggle-ordered-property})
  4222. @kindex C-c C-x o
  4223. @findex org-toggle-ordered-property
  4224. @vindex org-track-ordered-property-with-tag
  4225. Toggle the @samp{ORDERED} property of the entry, to toggle if
  4226. checkboxes must be checked off in sequence. A property is used
  4227. for this behavior because this should be local to the current
  4228. entry, not inherited like a tag. However, if you would like to
  4229. @emph{track} the value of this property with a tag for better
  4230. visibility, customize @code{org-track-ordered-property-with-tag}.
  4231. @item @kbd{C-c #} (@code{org-update-statistics-cookies})
  4232. @kindex C-c #
  4233. @findex org-update-statistics-cookies
  4234. Update the statistics cookie in the current outline entry. When
  4235. called with a @kbd{C-u} prefix, update the entire file.
  4236. Checkbox statistic cookies are updated automatically if you
  4237. toggle checkboxes with @kbd{C-c C-c} and make new ones with
  4238. @kbd{M-S-@key{RET}}. TODO statistics cookies update when changing
  4239. TODO states. If you delete boxes/entries or add/change them by
  4240. hand, use this command to get things back into sync.
  4241. @end table
  4242. @node Tags
  4243. @chapter Tags
  4244. @cindex tags
  4245. @cindex headline tagging
  4246. @cindex matching, tags
  4247. @cindex sparse tree, tag based
  4248. An excellent way to implement labels and contexts for
  4249. cross-correlating information is to assign @emph{tags} to headlines. Org
  4250. mode has extensive support for tags.
  4251. @vindex org-tag-faces
  4252. Every headline can contain a list of tags; they occur at the end of
  4253. the headline. Tags are normal words containing letters, numbers, @samp{_},
  4254. and @samp{@@}. Tags must be preceded and followed by a single colon, e.g.,
  4255. @samp{:work:}. Several tags can be specified, as in @samp{:work:urgent:}. Tags
  4256. by default are in bold face with the same color as the headline. You
  4257. may specify special faces for specific tags using the variable
  4258. @code{org-tag-faces}, in much the same way as you can for TODO keywords
  4259. (see @ref{Faces for TODO keywords}).
  4260. @menu
  4261. * Tag Inheritance:: Tags use the tree structure of an outline.
  4262. * Setting Tags:: How to assign tags to a headline.
  4263. * Tag Hierarchy:: Create a hierarchy of tags.
  4264. * Tag Searches:: Searching for combinations of tags.
  4265. @end menu
  4266. @node Tag Inheritance
  4267. @section Tag Inheritance
  4268. @cindex tag inheritance
  4269. @cindex inheritance, of tags
  4270. @cindex sublevels, inclusion into tags match
  4271. @emph{Tags} make use of the hierarchical structure of outline trees. If
  4272. a heading has a certain tag, all subheadings inherit the tag as well.
  4273. For example, in the list
  4274. @example
  4275. * Meeting with the French group :work:
  4276. ** Summary by Frank :boss:notes:
  4277. *** TODO Prepare slides for him :action:
  4278. @end example
  4279. @noindent
  4280. the final heading has the tags @samp{work}, @samp{boss}, @samp{notes}, and @samp{action}
  4281. even though the final heading is not explicitly marked with those
  4282. tags. You can also set tags that all entries in a file should inherit
  4283. just as if these tags were defined in a hypothetical level zero that
  4284. 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.}
  4285. @cindex @samp{FILETAGS}, keyword
  4286. @example
  4287. #+FILETAGS: :Peter:Boss:Secret:
  4288. @end example
  4289. @vindex org-use-tag-inheritance
  4290. @vindex org-tags-exclude-from-inheritance
  4291. @noindent
  4292. To limit tag inheritance to specific tags, or to turn it off entirely,
  4293. use the variables @code{org-use-tag-inheritance} and
  4294. @code{org-tags-exclude-from-inheritance}.
  4295. @vindex org-tags-match-list-sublevels
  4296. When a headline matches during a tags search while tag inheritance is
  4297. turned on, all the sublevels in the same tree---for a simple match
  4298. form---match as well@footnote{This is only true if the search does not involve more complex
  4299. tests including properties (see @ref{Property Searches}).}. The list of matches may then become
  4300. very long. If you only want to see the first tags match in a subtree,
  4301. configure the variable @code{org-tags-match-list-sublevels} (not
  4302. recommended).
  4303. @vindex org-agenda-use-tag-inheritance
  4304. Tag inheritance is relevant when the agenda search tries to match
  4305. a tag, either in the @code{tags} or @code{tags-todo} agenda types. In other
  4306. agenda types, @code{org-use-tag-inheritance} has no effect. Still, you may
  4307. want to have your tags correctly set in the agenda, so that tag
  4308. filtering works fine, with inherited tags. Set
  4309. @code{org-agenda-use-tag-inheritance} to control this: the default value
  4310. includes all agenda types, but setting this to @code{nil} can really speed
  4311. up agenda generation.
  4312. @node Setting Tags
  4313. @section Setting Tags
  4314. @cindex setting tags
  4315. @cindex tags, setting
  4316. @kindex M-TAB
  4317. Tags can simply be typed into the buffer at the end of a headline.
  4318. After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
  4319. also a special command for inserting tags:
  4320. @table @asis
  4321. @item @kbd{C-c C-q} (@code{org-set-tags-command})
  4322. @kindex C-c C-q
  4323. @findex org-set-tags-command
  4324. @cindex completion, of tags
  4325. @vindex org-tags-column
  4326. Enter new tags for the current headline. Org mode either offers
  4327. completion or a special single-key interface for setting tags,
  4328. see below. After pressing @kbd{@key{RET}}, the tags are inserted
  4329. and aligned to @code{org-tags-column}. When called with
  4330. a @kbd{C-u} prefix, all tags in the current buffer are
  4331. aligned to that column, just to make things look nice. Tags are
  4332. automatically realigned after promotion, demotion, and TODO state
  4333. changes (see @ref{TODO Basics}).
  4334. @item @kbd{C-c C-c} (@code{org-set-tags-command})
  4335. @kindex C-c C-c
  4336. When the cursor is in a headline, this does the same as
  4337. @kbd{C-c C-q}.
  4338. @end table
  4339. @vindex org-tag-alist
  4340. Org supports tag insertion based on a @emph{list of tags}. By default this
  4341. list is constructed dynamically, containing all tags currently used in
  4342. the buffer. You may also globally specify a hard list of tags with
  4343. the variable @code{org-tag-alist}. Finally you can set the default tags
  4344. for a given file with lines like
  4345. @cindex @samp{TAGS}, keyword
  4346. @example
  4347. #+TAGS: @@work @@home @@tennisclub
  4348. #+TAGS: laptop car pc sailboat
  4349. @end example
  4350. If you have globally defined your preferred set of tags using the
  4351. variable @code{org-tag-alist}, but would like to use a dynamic tag list in
  4352. a specific file, add an empty @samp{TAGS} keyword to that file:
  4353. @example
  4354. #+TAGS:
  4355. @end example
  4356. @vindex org-tag-persistent-alist
  4357. If you have a preferred set of tags that you would like to use in
  4358. every file, in addition to those defined on a per-file basis by @samp{TAGS}
  4359. keyword, then you may specify a list of tags with the variable
  4360. @code{org-tag-persistent-alist}. You may turn this off on a per-file basis
  4361. by adding a @samp{STARTUP} keyword to that file:
  4362. @example
  4363. #+STARTUP: noptag
  4364. @end example
  4365. By default Org mode uses the standard minibuffer completion facilities
  4366. for entering tags. However, it also implements another, quicker, tag
  4367. selection method called @emph{fast tag selection}. This allows you to
  4368. select and deselect tags with just a single key press. For this to
  4369. work well you should assign unique letters to most of your commonly
  4370. used tags. You can do this globally by configuring the variable
  4371. @code{org-tag-alist} in your Emacs init file. For example, you may find
  4372. the need to tag many items in different files with @samp{@@home}. In this
  4373. case you can set something like:
  4374. @lisp
  4375. (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
  4376. @end lisp
  4377. @noindent
  4378. If the tag is only relevant to the file you are working on, then you
  4379. can instead set the @samp{TAGS} keyword as:
  4380. @example
  4381. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
  4382. @end example
  4383. @noindent
  4384. The tags interface shows the available tags in a splash window. If
  4385. you want to start a new line after a specific tag, insert @samp{\n} into
  4386. the tag list
  4387. @example
  4388. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) \n laptop(l) pc(p)
  4389. @end example
  4390. @noindent
  4391. or write them in two lines:
  4392. @example
  4393. #+TAGS: @@work(w) @@home(h) @@tennisclub(t)
  4394. #+TAGS: laptop(l) pc(p)
  4395. @end example
  4396. @noindent
  4397. You can also group together tags that are mutually exclusive by using
  4398. braces, as in:
  4399. @example
  4400. #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
  4401. @end example
  4402. @noindent
  4403. you indicate that at most one of @samp{@@work}, @samp{@@home}, and @samp{@@tennisclub}
  4404. should be selected. Multiple such groups are allowed.
  4405. @noindent
  4406. Do not forget to press @kbd{C-c C-c} with the cursor in one of
  4407. these lines to activate any changes.
  4408. @noindent
  4409. To set these mutually exclusive groups in the variable
  4410. @code{org-tags-alist}, you must use the dummy tags @code{:startgroup} and
  4411. @code{:endgroup} instead of the braces. Similarly, you can use @code{:newline}
  4412. to indicate a line break. The previous example would be set globally
  4413. by the following configuration:
  4414. @lisp
  4415. (setq org-tag-alist '((:startgroup . nil)
  4416. ("@@work" . ?w) ("@@home" . ?h)
  4417. ("@@tennisclub" . ?t)
  4418. (:endgroup . nil)
  4419. ("laptop" . ?l) ("pc" . ?p)))
  4420. @end lisp
  4421. If at least one tag has a selection key then pressing @kbd{C-c C-c} automatically presents you with a special interface, listing
  4422. inherited tags, the tags of the current headline, and a list of all
  4423. valid tags with corresponding keys@footnote{Keys are automatically assigned to tags that have no
  4424. configured keys.}.
  4425. Pressing keys assigned to tags adds or removes them from the list of
  4426. tags in the current line. Selecting a tag in a group of mutually
  4427. exclusive tags turns off any other tag from that group.
  4428. In this interface, you can also use the following special keys:
  4429. @table @asis
  4430. @item @kbd{@key{TAB}}
  4431. @kindex TAB
  4432. Enter a tag in the minibuffer, even if the tag is not in the
  4433. predefined list. You can complete on all tags present in the
  4434. buffer. You can also add several tags: just separate them with
  4435. a comma.
  4436. @item @kbd{@key{SPC}}
  4437. @kindex SPC
  4438. Clear all tags for this line.
  4439. @item @kbd{@key{RET}}
  4440. @kindex RET
  4441. Accept the modified set.
  4442. @item @kbd{C-g}
  4443. @kindex C-g
  4444. Abort without installing changes.
  4445. @item @kbd{q}
  4446. @kindex q
  4447. If @kbd{q} is not assigned to a tag, it aborts like
  4448. @kbd{C-g}.
  4449. @item @kbd{!}
  4450. @kindex !
  4451. Turn off groups of mutually exclusive tags. Use this to (as an
  4452. exception) assign several tags from such a group.
  4453. @item @kbd{C-c}
  4454. @kindex C-c C-c
  4455. Toggle auto-exit after the next change (see below). If you are
  4456. using expert mode, the first @kbd{C-c} displays the
  4457. selection window.
  4458. @end table
  4459. @noindent
  4460. This method lets you assign tags to a headline with very few keys.
  4461. With the above setup, you could clear the current tags and set
  4462. @samp{@@home}, @samp{laptop} and @samp{pc} tags with just the following keys:
  4463. @kbd{C-c C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to @samp{@@work}
  4464. would be done with @kbd{C-c C-c w @key{RET}} or alternatively with
  4465. @kbd{C-c C-c C-c w}. Adding the non-predefined tag @samp{Sarah} could
  4466. be done with @kbd{C-c C-c @key{TAB} S a r a h @key{RET}}.
  4467. @vindex org-fast-tag-selection-single-key
  4468. If you find that most of the time you need only a single key press to
  4469. modify your list of tags, set the variable
  4470. @code{org-fast-tag-selection-single-key}. Then you no longer have to press
  4471. @kbd{@key{RET}} to exit fast tag selection---it exits after the first
  4472. change. If you then occasionally need more keys, press @kbd{C-c}
  4473. to turn off auto-exit for the current tag selection process (in
  4474. effect: start selection with @kbd{C-c C-c C-c} instead of
  4475. @kbd{C-c C-c}). If you set the variable to the value @code{expert},
  4476. the special window is not even shown for single-key tag selection, it
  4477. comes up only when you press an extra @kbd{C-c}.
  4478. @node Tag Hierarchy
  4479. @section Tag Hierarchy
  4480. @cindex group tags
  4481. @cindex tags, groups
  4482. @cindex tags hierarchy
  4483. Tags can be defined in hierarchies. A tag can be defined as a @emph{group
  4484. tag} for a set of other tags. The group tag can be seen as the
  4485. ``broader term'' for its set of tags. Defining multiple group tags and
  4486. nesting them creates a tag hierarchy.
  4487. One use-case is to create a taxonomy of terms (tags) that can be used
  4488. to classify nodes in a document or set of documents.
  4489. When you search for a group tag, it return matches for all members in
  4490. the group and its subgroups. In an agenda view, filtering by a group
  4491. tag displays or hide headlines tagged with at least one of the members
  4492. of the group or any of its subgroups. This makes tag searches and
  4493. filters even more flexible.
  4494. You can set group tags by using brackets and inserting a colon between
  4495. the group tag and its related tags---beware that all whitespaces are
  4496. mandatory so that Org can parse this line correctly:
  4497. @example
  4498. #+TAGS: [ GTD : Control Persp ]
  4499. @end example
  4500. In this example, @samp{GTD} is the group tag and it is related to two other
  4501. tags: @samp{Control}, @samp{Persp}. Defining @samp{Control} and @samp{Persp} as group
  4502. tags creates an hierarchy of tags:
  4503. @example
  4504. #+TAGS: [ Control : Context Task ]
  4505. #+TAGS: [ Persp : Vision Goal AOF Project ]
  4506. @end example
  4507. That can conceptually be seen as a hierarchy of tags:
  4508. @itemize
  4509. @item
  4510. @samp{GTD}
  4511. @itemize
  4512. @item
  4513. @samp{Persp}
  4514. @itemize
  4515. @item
  4516. @samp{Vision}
  4517. @item
  4518. @samp{Goal}
  4519. @item
  4520. @samp{AOF}
  4521. @item
  4522. @samp{Project}
  4523. @end itemize
  4524. @item
  4525. @samp{Control}
  4526. @itemize
  4527. @item
  4528. @samp{Context}
  4529. @item
  4530. @samp{Task}
  4531. @end itemize
  4532. @end itemize
  4533. @end itemize
  4534. You can use the @code{:startgrouptag}, @code{:grouptags} and @code{:endgrouptag}
  4535. keyword directly when setting @code{org-tag-alist} directly:
  4536. @lisp
  4537. (setq org-tag-alist '((:startgrouptag)
  4538. ("GTD")
  4539. (:grouptags)
  4540. ("Control")
  4541. ("Persp")
  4542. (:endgrouptag)
  4543. (:startgrouptag)
  4544. ("Control")
  4545. (:grouptags)
  4546. ("Context")
  4547. ("Task")
  4548. (:endgrouptag)))
  4549. @end lisp
  4550. The tags in a group can be mutually exclusive if using the same group
  4551. syntax as is used for grouping mutually exclusive tags together; using
  4552. curly brackets.
  4553. @example
  4554. #+TAGS: @{ Context : @@Home @@Work @@Call @}
  4555. @end example
  4556. When setting @code{org-tag-alist} you can use @code{:startgroup} and @code{:endgroup}
  4557. instead of @code{:startgrouptag} and @code{:endgrouptag} to make the tags
  4558. mutually exclusive.
  4559. Furthermore, the members of a group tag can also be regular
  4560. expressions, creating the possibility of a more dynamic and rule-based
  4561. tag structure. The regular expressions in the group must be specified
  4562. within curly brackets. Here is an expanded example:
  4563. @example
  4564. #+TAGS: [ Vision : @{V@@.+@} ]
  4565. #+TAGS: [ Goal : @{G@@.+@} ]
  4566. #+TAGS: [ AOF : @{AOF@@.+@} ]
  4567. #+TAGS: [ Project : @{P@@.+@} ]
  4568. @end example
  4569. Searching for the tag @samp{Project} now lists all tags also including
  4570. regular expression matches for @samp{P@@.+}, and similarly for tag searches
  4571. on @samp{Vision}, @samp{Goal} and @samp{AOF}. For example, this would work well for
  4572. a project tagged with a common project-identifier,
  4573. e.g. @samp{P@@2014_OrgTags}.
  4574. @kindex C-c C-x q
  4575. @findex org-toggle-tags-groups
  4576. @vindex org-group-tags
  4577. If you want to ignore group tags temporarily, toggle group tags
  4578. support with @code{org-toggle-tags-groups}, bound to @kbd{C-c C-x q}.
  4579. If you want to disable tag groups completely, set @code{org-group-tags} to
  4580. @code{nil}.
  4581. @node Tag Searches
  4582. @section Tag Searches
  4583. @cindex tag searches
  4584. @cindex searching for tags
  4585. Once a system of tags has been set up, it can be used to collect
  4586. related information into special lists.
  4587. @table @asis
  4588. @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree})
  4589. @kindex C-c / m
  4590. @kindex C-c \
  4591. @findex org-match-sparse-tree
  4592. Create a sparse tree with all headlines matching a tags search.
  4593. With a @kbd{C-u} prefix argument, ignore headlines that are
  4594. not a TODO line.
  4595. @item @kbd{C-c a m} (@code{org-tags-view})
  4596. @kindex C-c a m
  4597. @findex org-tags-view
  4598. Create a global list of tag matches from all agenda files. See
  4599. @ref{Matching tags and properties}.
  4600. @item @kbd{C-c a M} (@code{org-tags-view})
  4601. @kindex C-c a M
  4602. @vindex org-tags-match-list-sublevels
  4603. Create a global list of tag matches from all agenda files, but
  4604. check only TODO items and force checking subitems (see the option
  4605. @code{org-tags-match-list-sublevels}).
  4606. @end table
  4607. These commands all prompt for a match string which allows basic
  4608. Boolean logic like @samp{+boss+urgent-project1}, to find entries with tags
  4609. @samp{boss} and @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find
  4610. entries which are tagged, like @samp{Kathy} or @samp{Sally}. The full syntax of
  4611. the search string is rich and allows also matching against TODO
  4612. keywords, entry levels and properties. For a complete description
  4613. with many examples, see @ref{Matching tags and properties}.
  4614. @node Properties and Columns
  4615. @chapter Properties and Columns
  4616. @cindex properties
  4617. A property is a key-value pair associated with an entry. Properties
  4618. can be set so they are associated with a single entry, with every
  4619. entry in a tree, or with every entry in an Org file.
  4620. There are two main applications for properties in Org mode. First,
  4621. properties are like tags, but with a value. Imagine maintaining
  4622. a file where you document bugs and plan releases for a piece of
  4623. software. Instead of using tags like @samp{release_1}, @samp{release_2}, you
  4624. can use a property, say @samp{Release}, that in different subtrees has
  4625. different values, such as @samp{1.0} or @samp{2.0}. Second, you can use
  4626. properties to implement (very basic) database capabilities in an Org
  4627. buffer. Imagine keeping track of your music CDs, where properties
  4628. could be things such as the album, artist, date of release, number of
  4629. tracks, and so on.
  4630. Properties can be conveniently edited and viewed in column view (see
  4631. @ref{Column View}).
  4632. @menu
  4633. * Property Syntax:: How properties are spelled out.
  4634. * Special Properties:: Access to other Org mode features.
  4635. * Property Searches:: Matching property values.
  4636. * Property Inheritance:: Passing values down a tree.
  4637. * Column View:: Tabular viewing and editing.
  4638. @end menu
  4639. @node Property Syntax
  4640. @section Property Syntax
  4641. @cindex property syntax
  4642. @cindex drawer, for properties
  4643. Properties are key--value pairs. When they are associated with
  4644. a single entry or with a tree they need to be inserted into a special
  4645. drawer (see @ref{Drawers}) with the name @samp{PROPERTIES}, which has to be
  4646. located right below a headline, and its planning line (see @ref{Deadlines and Scheduling}) when applicable. Each property is specified on
  4647. a single line, with the key---surrounded by colons---first, and the
  4648. value after it. Keys are case-insensitive. Here is an example:
  4649. @example
  4650. * CD collection
  4651. ** Classic
  4652. *** Goldberg Variations
  4653. :PROPERTIES:
  4654. :Title: Goldberg Variations
  4655. :Composer: J.S. Bach
  4656. :Artist: Glen Gould
  4657. :Publisher: Deutsche Grammophon
  4658. :NDisks: 1
  4659. :END:
  4660. @end example
  4661. Depending on the value of @code{org-use-property-inheritance}, a property
  4662. set this way is associated either with a single entry, or with the
  4663. sub-tree defined by the entry, see @ref{Property Inheritance}.
  4664. You may define the allowed values for a particular property @samp{Xyz} by
  4665. setting a property @samp{Xyz_ALL}. This special property is @emph{inherited},
  4666. so if you set it in a level 1 entry, it applies to the entire tree.
  4667. When allowed values are defined, setting the corresponding property
  4668. becomes easier and is less prone to typing errors. For the example
  4669. with the CD collection, we can pre-define publishers and the number of
  4670. disks in a box like this:
  4671. @example
  4672. * CD collection
  4673. :PROPERTIES:
  4674. :NDisks_ALL: 1 2 3 4
  4675. :Publisher_ALL: "Deutsche Grammophon" Philips EMI
  4676. :END:
  4677. @end example
  4678. If you want to set properties that can be inherited by any entry in
  4679. a file, use a line like:
  4680. @cindex @samp{_ALL} suffix, in properties
  4681. @cindex @samp{PROPERTY}, keyword
  4682. @example
  4683. #+PROPERTY: NDisks_ALL 1 2 3 4
  4684. @end example
  4685. @cindex @samp{+} suffix, in properties
  4686. If you want to add to the value of an existing property, append a @samp{+}
  4687. to the property name. The following results in the property @samp{var}
  4688. having the value @samp{foo=1 bar=2}.
  4689. @example
  4690. #+PROPERTY: var foo=1
  4691. #+PROPERTY: var+ bar=2
  4692. @end example
  4693. It is also possible to add to the values of inherited properties. The
  4694. following results in the @samp{Genres} property having the value @samp{Classic
  4695. Baroque} under the @samp{Goldberg Variations} subtree.
  4696. @example
  4697. * CD collection
  4698. ** Classic
  4699. :PROPERTIES:
  4700. :Genres: Classic
  4701. :END:
  4702. *** Goldberg Variations
  4703. :PROPERTIES:
  4704. :Title: Goldberg Variations
  4705. :Composer: J.S. Bach
  4706. :Artist: Glen Gould
  4707. :Publisher: Deutsche Grammophon
  4708. :NDisks: 1
  4709. :Genres+: Baroque
  4710. :END:
  4711. @end example
  4712. Note that a property can only have one entry per drawer.
  4713. @vindex org-global-properties
  4714. Property values set with the global variable @code{org-global-properties}
  4715. can be inherited by all entries in all Org files.
  4716. @noindent
  4717. The following commands help to work with properties:
  4718. @table @asis
  4719. @item @kbd{M-@key{TAB}} (@code{pcomplete})
  4720. @kindex M-TAB
  4721. @findex pcomplete
  4722. After an initial colon in a line, complete property keys. All
  4723. keys used in the current file are offered as possible
  4724. completions.
  4725. @item @kbd{C-c C-x p} (@code{org-set-property})
  4726. @kindex C-c C-x p
  4727. @findex org-set-property
  4728. Set a property. This prompts for a property name and a value.
  4729. If necessary, the property drawer is created as well.
  4730. @item @kbd{C-u M-x org-insert-drawer}
  4731. @findex org-insert-drawer
  4732. Insert a property drawer into the current entry. The drawer is
  4733. inserted early in the entry, but after the lines with planning
  4734. information like deadlines.
  4735. @item @kbd{C-c C-c} (@code{org-property-action})
  4736. @kindex C-c C-c
  4737. @findex org-property-action
  4738. With the cursor in a property drawer, this executes property
  4739. commands.
  4740. @item @kbd{C-c C-c s} (@code{org-set-property})
  4741. @kindex C-c C-c s
  4742. @findex org-set-property
  4743. Set a property in the current entry. Both the property and the value
  4744. can be inserted using completion.
  4745. @item @kbd{S-@key{RIGHT}} (@code{org-property-next-allowed-values})
  4746. @itemx @kbd{S-@key{LEFT}} (@code{org-property-previous-allowed-value})
  4747. @kindex S-RIGHT
  4748. @kindex S-LEFT
  4749. Switch property at point to the next/previous allowed value.
  4750. @item @kbd{C-c C-c d} (@code{org-delete-property})
  4751. @kindex C-c C-c d
  4752. @findex org-delete-property
  4753. Remove a property from the current entry.
  4754. @item @kbd{C-c C-c D} (@code{org-delete-property-globally})
  4755. @kindex C-c C-c D
  4756. @findex org-delete-property-globally
  4757. Globally remove a property, from all entries in the current file.
  4758. @item @kbd{C-c C-c c} (@code{org-compute-property-at-point})
  4759. @kindex C-c C-c c
  4760. @findex org-compute-property-at-point
  4761. Compute the property at point, using the operator and scope from
  4762. the nearest column format definition.
  4763. @end table
  4764. @node Special Properties
  4765. @section Special Properties
  4766. @cindex properties, special
  4767. Special properties provide an alternative access method to Org mode
  4768. features, like the TODO state or the priority of an entry, discussed
  4769. in the previous chapters. This interface exists so that you can
  4770. include these states in a column view (see @ref{Column View}), or to use
  4771. them in queries. The following property names are special and should
  4772. not be used as keys in the properties drawer:
  4773. @cindex @samp{ALLTAGS}, special property
  4774. @cindex @samp{BLOCKED}, special property
  4775. @cindex @samp{CLOCKSUM}, special property
  4776. @cindex @samp{CLOCKSUM_T}, special property
  4777. @cindex @samp{CLOSED}, special property
  4778. @cindex @samp{DEADLINE}, special property
  4779. @cindex @samp{FILE}, special property
  4780. @cindex @samp{ITEM}, special property
  4781. @cindex @samp{PRIORITY}, special property
  4782. @cindex @samp{SCHEDULED}, special property
  4783. @cindex @samp{TAGS}, special property
  4784. @cindex @samp{TIMESTAMP}, special property
  4785. @cindex @samp{TIMESTAMP_IA}, special property
  4786. @cindex @samp{TODO}, special property
  4787. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  4788. @item @samp{ALLTAGS}
  4789. @tab All tags, including inherited ones.
  4790. @item @samp{BLOCKED}
  4791. @tab @code{t} if task is currently blocked by children or siblings.
  4792. @item @samp{CATEGORY}
  4793. @tab The category of an entry.
  4794. @item @samp{CLOCKSUM}
  4795. @tab The sum of CLOCK intervals in the subtree. @code{org-clock-sum}
  4796. @item
  4797. @tab must be run first to compute the values in the current buffer.
  4798. @item @samp{CLOCKSUM_T}
  4799. @tab The sum of CLOCK intervals in the subtree for today.
  4800. @item
  4801. @tab @code{org-clock-sum-today} must be run first to compute the
  4802. @item
  4803. @tab values in the current buffer.
  4804. @item @samp{CLOSED}
  4805. @tab When was this entry closed?
  4806. @item @samp{DEADLINE}
  4807. @tab The deadline time string, without the angular brackets.
  4808. @item @samp{FILE}
  4809. @tab The filename the entry is located in.
  4810. @item @samp{ITEM}
  4811. @tab The headline of the entry.
  4812. @item @samp{PRIORITY}
  4813. @tab The priority of the entry, a string with a single letter.
  4814. @item @samp{SCHEDULED}
  4815. @tab The scheduling timestamp, without the angular brackets.
  4816. @item @samp{TAGS}
  4817. @tab The tags defined directly in the headline.
  4818. @item @samp{TIMESTAMP}
  4819. @tab The first keyword-less timestamp in the entry.
  4820. @item @samp{TIMESTAMP_IA}
  4821. @tab The first inactive timestamp in the entry.
  4822. @item @samp{TODO}
  4823. @tab The TODO keyword of the entry.
  4824. @end multitable
  4825. @node Property Searches
  4826. @section Property Searches
  4827. @cindex properties, searching
  4828. @cindex searching, of properties
  4829. To create sparse trees and special lists with selection based on
  4830. properties, the same commands are used as for tag searches (see @ref{Tag Searches}).
  4831. @table @asis
  4832. @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree})
  4833. @kindex C-c / m
  4834. @kindex C-c \
  4835. @findex org-match-sparse-tree
  4836. Create a sparse tree with all matching entries. With
  4837. a @kbd{C-u} prefix argument, ignore headlines that are not
  4838. a TODO line.
  4839. @item @kbd{C-c a m}, @code{org-tags-view}
  4840. @kindex C-c a m
  4841. Create a global list of tag/property matches from all agenda
  4842. files.
  4843. @item @kbd{C-c a M} (@code{org-tags-view})
  4844. @kindex C-c a M
  4845. @findex org-tags-view
  4846. @vindex org-tags-match-list-sublevels
  4847. Create a global list of tag matches from all agenda files, but
  4848. check only TODO items and force checking of subitems (see the
  4849. option @code{org-tags-match-list-sublevels}).
  4850. @end table
  4851. The syntax for the search string is described in @ref{Matching tags and properties}.
  4852. There is also a special command for creating sparse trees based on a
  4853. single property:
  4854. @table @asis
  4855. @item @kbd{C-c / p}
  4856. @kindex C-c / p
  4857. Create a sparse tree based on the value of a property. This
  4858. first prompts for the name of a property, and then for a value.
  4859. A sparse tree is created with all entries that define this
  4860. property with the given value. If you enclose the value in curly
  4861. braces, it is interpreted as a regular expression and matched
  4862. against the property values.
  4863. @end table
  4864. @node Property Inheritance
  4865. @section Property Inheritance
  4866. @cindex properties, inheritance
  4867. @cindex inheritance, of properties
  4868. @vindex org-use-property-inheritance
  4869. The outline structure of Org documents lends itself to an inheritance
  4870. model of properties: if the parent in a tree has a certain property,
  4871. the children can inherit this property. Org mode does not turn this
  4872. on by default, because it can slow down property searches
  4873. significantly and is often not needed. However, if you find
  4874. inheritance useful, you can turn it on by setting the variable
  4875. @code{org-use-property-inheritance}. It may be set to @code{t} to make all
  4876. properties inherited from the parent, to a list of properties that
  4877. should be inherited, or to a regular expression that matches inherited
  4878. properties. If a property has the value @code{nil}, this is interpreted as
  4879. an explicit un-define of the property, so that inheritance search
  4880. stops at this value and returns @code{nil}.
  4881. Org mode has a few properties for which inheritance is hard-coded, at
  4882. least for the special applications for which they are used:
  4883. @table @asis
  4884. @item @code{COLUMNS}
  4885. @cindex @samp{COLUMNS}, property
  4886. The @samp{COLUMNS} property defines the format of column view (see
  4887. @ref{Column View}). It is inherited in the sense that the level where
  4888. a @samp{COLUMNS} property is defined is used as the starting point for
  4889. a column view table, independently of the location in the subtree
  4890. from where columns view is turned on.
  4891. @item @code{CATEGORY}
  4892. @cindex @samp{CATEGORY}, property
  4893. For agenda view, a category set through a @samp{CATEGORY} property
  4894. applies to the entire subtree.
  4895. @item @code{ARCHIVE}
  4896. @cindex @samp{ARCHIVE}, property
  4897. For archiving, the @samp{ARCHIVE} property may define the archive
  4898. location for the entire subtree (see @ref{Moving subtrees}).
  4899. @item @code{LOGGING}
  4900. @cindex @samp{LOGGING}, property
  4901. The @samp{LOGGING} property may define logging settings for an entry
  4902. or a subtree (see @ref{Tracking TODO state changes}).
  4903. @end table
  4904. @node Column View
  4905. @section Column View
  4906. A great way to view and edit properties in an outline tree is @emph{column
  4907. view}. In column view, each outline node is turned into a table row.
  4908. Columns in this table provide access to properties of the entries.
  4909. Org mode implements columns by overlaying a tabular structure over the
  4910. headline of each item. While the headlines have been turned into
  4911. a table row, you can still change the visibility of the outline tree.
  4912. For example, you get a compact table by switching to ``contents''
  4913. view---@kbd{S-@key{TAB}} @kbd{S-@key{TAB}}, or simply @kbd{c}
  4914. while column view is active---but you can still open, read, and edit
  4915. the entry below each headline. Or, you can switch to column view
  4916. after executing a sparse tree command and in this way get a table only
  4917. for the selected items. Column view also works in agenda buffers (see
  4918. @ref{Agenda Views}) where queries have collected selected items, possibly
  4919. from a number of files.
  4920. @menu
  4921. * Defining columns:: The COLUMNS format property.
  4922. * Using column view:: How to create and use column view.
  4923. * Capturing column view:: A dynamic block for column view.
  4924. @end menu
  4925. @node Defining columns
  4926. @subsection Defining columns
  4927. @cindex column view, for properties
  4928. @cindex properties, column view
  4929. Setting up a column view first requires defining the columns. This is
  4930. done by defining a column format line.
  4931. @menu
  4932. * Scope of column definitions:: Where defined, where valid?
  4933. * Column attributes:: Appearance and content of a column.
  4934. @end menu
  4935. @node Scope of column definitions
  4936. @subsubsection Scope of column definitions
  4937. To define a column format for an entire file, use a line like:
  4938. @cindex @samp{COLUMNS}, keyword
  4939. @example
  4940. #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  4941. @end example
  4942. To specify a format that only applies to a specific tree, add
  4943. a @samp{COLUMNS} property to the top node of that tree, for example:
  4944. @example
  4945. ** Top node for columns view
  4946. :PROPERTIES:
  4947. :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  4948. :END:
  4949. @end example
  4950. If a @samp{COLUMNS} property is present in an entry, it defines columns for
  4951. the entry itself, and for the entire subtree below it. Since the
  4952. column definition is part of the hierarchical structure of the
  4953. document, you can define columns on level 1 that are general enough
  4954. for all sublevels, and more specific columns further down, when you
  4955. edit a deeper part of the tree.
  4956. @node Column attributes
  4957. @subsubsection Column attributes
  4958. A column definition sets the attributes of a column. The general
  4959. definition looks like this:
  4960. @example
  4961. %[WIDTH]PROPERTY[(TITLE)][@{SUMMARY-TYPE@}]
  4962. @end example
  4963. @noindent
  4964. Except for the percent sign and the property name, all items are
  4965. optional. The individual parts have the following meaning:
  4966. @table @asis
  4967. @item @var{WIDTH}
  4968. An integer specifying the width of the column in characters. If
  4969. omitted, the width is determined automatically.
  4970. @item @var{PROPERTY}
  4971. The property that should be edited in this column. Special
  4972. properties representing meta data are allowed here as well (see
  4973. @ref{Special Properties}).
  4974. @item @var{TITLE}
  4975. The header text for the column. If omitted, the property name is
  4976. used.
  4977. @item @var{SUMMARY-TYPE}
  4978. The summary type. If specified, the column values for parent
  4979. nodes are computed from the children@footnote{If more than one summary type applies to the same property,
  4980. the parent values are computed according to the first of them.}.
  4981. Supported summary types are:
  4982. @multitable {aaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  4983. @item @samp{+}
  4984. @tab Sum numbers in this column.
  4985. @item @samp{+;%.1f}
  4986. @tab Like @samp{+}, but format result with @samp{%.1f}.
  4987. @item @samp{$}
  4988. @tab Currency, short for @samp{+;%.2f}.
  4989. @item @samp{min}
  4990. @tab Smallest number in column.
  4991. @item @samp{max}
  4992. @tab Largest number.
  4993. @item @samp{mean}
  4994. @tab Arithmetic mean of numbers.
  4995. @item @samp{X}
  4996. @tab Checkbox status, @samp{[X]} if all children are @samp{[X]}.
  4997. @item @samp{X/}
  4998. @tab Checkbox status, @samp{[n/m]}.
  4999. @item @samp{X%}
  5000. @tab Checkbox status, @samp{[n%]}.
  5001. @item @samp{:}
  5002. @tab Sum times, HH:MM, plain numbers are hours.
  5003. @item @samp{:min}
  5004. @tab Smallest time value in column.
  5005. @item @samp{:max}
  5006. @tab Largest time value.
  5007. @item @samp{:mean}
  5008. @tab Arithmetic mean of time values.
  5009. @item @samp{@@min}
  5010. @tab Minimum age@footnote{An age is defined as a duration, using effort modifiers
  5011. defined in @code{org-effort-durations}, e.g., @samp{3d 1h}. If any value in the
  5012. column is as such, the summary is also an effort duration.} (in days/hours/mins/seconds).
  5013. @item @samp{@@max}
  5014. @tab Maximum age (in days/hours/mins/seconds).
  5015. @item @samp{@@mean}
  5016. @tab Arithmetic mean of ages (in days/hours/mins/seconds).
  5017. @item @samp{est+}
  5018. @tab Add low-high estimates.
  5019. @end multitable
  5020. @noindent
  5021. @vindex org-columns-summary-types
  5022. You can also define custom summary types by setting
  5023. @code{org-columns-summary-types}.
  5024. @end table
  5025. The @samp{est+} summary type requires further explanation. It is used for
  5026. combining estimates, expressed as low-high ranges. For example,
  5027. instead of estimating a particular task will take 5 days, you might
  5028. estimate it as 5--6 days if you're fairly confident you know how much
  5029. work is required, or 1--10 days if you do not really know what needs
  5030. to be done. Both ranges average at 5.5 days, but the first represents
  5031. a more predictable delivery.
  5032. When combining a set of such estimates, simply adding the lows and
  5033. highs produces an unrealistically wide result. Instead, @samp{est+} adds
  5034. the statistical mean and variance of the sub-tasks, generating a final
  5035. estimate from the sum. For example, suppose you had ten tasks, each
  5036. of which was estimated at 0.5 to 2 days of work. Straight addition
  5037. produces an estimate of 5 to 20 days, representing what to expect if
  5038. everything goes either extremely well or extremely poorly. In
  5039. contrast, @samp{est+} estimates the full job more realistically, at 10--15
  5040. days.
  5041. Here is an example for a complete columns definition, along with
  5042. allowed values@footnote{Please note that the @samp{COLUMNS} definition must be on a single
  5043. line; it is wrapped here only because of formatting constraints.}.
  5044. @example
  5045. :COLUMNS: %25ITEM %9Approved(Approved?)@{X@} %Owner %11Status \
  5046. %10Time_Estimate@{:@} %CLOCKSUM %CLOCKSUM_T
  5047. :Owner_ALL: Tammy Mark Karl Lisa Don
  5048. :Status_ALL: "In progress" "Not started yet" "Finished" ""
  5049. :Approved_ALL: "[ ]" "[X]"
  5050. @end example
  5051. @noindent
  5052. The first column, @samp{%25ITEM}, means the first 25 characters of the item
  5053. itself, i.e., of the headline. You probably always should start the
  5054. column definition with the @samp{ITEM} specifier. The other specifiers
  5055. create columns @samp{Owner} with a list of names as allowed values, for
  5056. @samp{Status} with four different possible values, and for a checkbox field
  5057. @samp{Approved}. When no width is given after the @samp{%} character, the
  5058. column is exactly as wide as it needs to be in order to fully display
  5059. all values. The @samp{Approved} column does have a modified title
  5060. (@samp{Approved?}, with a question mark). Summaries are created for the
  5061. @samp{Time_Estimate} column by adding time duration expressions like HH:MM,
  5062. and for the @samp{Approved} column, by providing an @samp{[X]} status if all
  5063. children have been checked. The @samp{CLOCKSUM} and @samp{CLOCKSUM_T} columns
  5064. are special, they lists the sums of CLOCK intervals in the subtree,
  5065. either for all clocks or just for today.
  5066. @node Using column view
  5067. @subsection Using column view
  5068. @anchor{Turning column view on or off}
  5069. @subsubheading Turning column view on or off
  5070. @table @asis
  5071. @item @kbd{C-c C-x C-c} (@code{org-columns})
  5072. @kindex C-c C-x C-c
  5073. @vindex org-columns
  5074. @vindex org-columns-default-format
  5075. Turn on column view. If the cursor is before the first headline
  5076. in the file, column view is turned on for the entire file, using
  5077. the @samp{#+COLUMNS} definition. If the cursor is somewhere inside
  5078. the outline, this command searches the hierarchy, up from point,
  5079. for a @samp{COLUMNS} property that defines a format. When one is
  5080. found, the column view table is established for the tree starting
  5081. at the entry that contains the @samp{COLUMNS} property. If no such
  5082. property is found, the format is taken from the @samp{#+COLUMNS} line
  5083. or from the variable @code{org-columns-default-format}, and column
  5084. view is established for the current entry and its subtree.
  5085. @item @kbd{r} or @kbd{g} (@code{org-columns-redo})
  5086. @kindex r
  5087. @kindex g
  5088. @findex org-columns-redo
  5089. Recreate the column view, to include recent changes made in the
  5090. buffer.
  5091. @item @kbd{q} (@code{org-columns-quit})
  5092. @kindex q
  5093. @findex org-columns-quit
  5094. Exit column view.
  5095. @end table
  5096. @anchor{Editing values}
  5097. @subsubheading Editing values
  5098. @table @asis
  5099. @item @kbd{@key{LEFT}}, @kbd{@key{RIGHT}}, @kbd{@key{UP}}, @kbd{@key{DOWN}}
  5100. Move through the column view from field to field.
  5101. @item @kbd{1..9,0}
  5102. @kindex 1..9,0
  5103. Directly select the Nth allowed value, @kbd{0} selects the
  5104. 10th value.
  5105. @item @kbd{n} or @kbd{S-@key{RIGHT}} (@code{org-columns-next-allowed-value})
  5106. @itemx @kbd{p} or @kbd{S-@key{LEFT}} (@code{org-columns-previous-allowed-value})
  5107. @kindex n
  5108. @kindex S-RIGHT
  5109. @kindex p
  5110. @kindex S-LEFT
  5111. @findex org-columns-next-allowed-value
  5112. @findex org-columns-previous-allowed-value
  5113. Switch to the next/previous allowed value of the field. For
  5114. this, you have to have specified allowed values for a property.
  5115. @item @kbd{e} (@code{org-columns-edit-value})
  5116. @kindex e
  5117. @findex org-columns-edit-value
  5118. Edit the property at point. For the special properties, this
  5119. invokes the same interface that you normally use to change that
  5120. property. For example, the tag completion or fast selection
  5121. interface pops up when editing a @samp{TAGS} property.
  5122. @item @kbd{C-c C-c} (@code{org-columns-set-tags-or-toggle})
  5123. @kindex C-c C-c
  5124. @findex org-columns-set-tags-or-toggle
  5125. When there is a checkbox at point, toggle it.
  5126. @item @kbd{v} (@code{org-columns-show-value})
  5127. @kindex v
  5128. @findex org-columns-show-value
  5129. View the full value of this property. This is useful if the
  5130. width of the column is smaller than that of the value.
  5131. @item @kbd{a} (@code{org-columns-edit-allowed})
  5132. @kindex a
  5133. @findex org-columns-edit-allowed
  5134. Edit the list of allowed values for this property. If the list
  5135. is found in the hierarchy, the modified values is stored there.
  5136. If no list is found, the new value is stored in the first entry
  5137. that is part of the current column view.
  5138. @end table
  5139. @anchor{Modifying column view on-the-fly}
  5140. @subsubheading Modifying column view on-the-fly:
  5141. @table @asis
  5142. @item @kbd{<} (@code{org-columns-narrow})
  5143. @itemx @kbd{>} (@code{org-columns-widen})
  5144. @kindex <
  5145. @kindex >
  5146. @findex org-columns-narrow
  5147. @findex org-columns-widen
  5148. Make the column narrower/wider by one character.
  5149. @item @kbd{S-M-@key{RIGHT}} (@code{org-columns-new})
  5150. @kindex S-M-RIGHT
  5151. @findex org-columns-new
  5152. Insert a new column, to the left of the current column.
  5153. @item @kbd{S-M-@key{LEFT}} (@code{org-columns-delete})
  5154. @kindex S-M-LEFT
  5155. @findex org-columns-delete
  5156. Delete the current column.
  5157. @end table
  5158. @node Capturing column view
  5159. @subsection Capturing column view
  5160. Since column view is just an overlay over a buffer, it cannot be
  5161. exported or printed directly. If you want to capture a column view,
  5162. use a @samp{columnview} dynamic block (see @ref{Dynamic Blocks}). The frame of
  5163. this block looks like this:
  5164. @cindex @samp{BEGIN columnview}
  5165. @example
  5166. * The column view
  5167. #+BEGIN: columnview :hlines 1 :id "label"
  5168. #+END:
  5169. @end example
  5170. @noindent
  5171. This dynamic block has the following parameters:
  5172. @table @asis
  5173. @item @samp{:id}
  5174. This is the most important parameter. Column view is a feature
  5175. that is often localized to a certain (sub)tree, and the capture
  5176. block might be at a different location in the file. To identify
  5177. the tree whose view to capture, you can use four values:
  5178. @table @asis
  5179. @item @samp{local}
  5180. Use the tree in which the capture block is located.
  5181. @item @samp{global}
  5182. Make a global view, including all headings in the file.
  5183. @item @samp{file:FILENAME}
  5184. Run column view at the top of the @var{FILENAME} file
  5185. @item @samp{LABEL}
  5186. @cindex @samp{ID}, property
  5187. Call column view in the tree that has an @samp{ID} property with
  5188. the value @var{LABEL}. You can use @kbd{M-x org-id-copy} to create a globally unique ID for the
  5189. current entry and copy it to the kill-ring.
  5190. @end table
  5191. @item @samp{:hlines}
  5192. When @code{t}, insert an hline after every line. When a number N,
  5193. insert an hline before each headline with level @code{<= N}.
  5194. @item @samp{:vlines}
  5195. When non-@code{nil}, force column groups to get vertical lines.
  5196. @item @samp{:maxlevel}
  5197. When set to a number, do not capture entries below this level.
  5198. @item @samp{:skip-empty-rows}
  5199. When non-@code{nil}, skip rows where the only non-empty specifier of
  5200. the column view is @samp{ITEM}.
  5201. @item @samp{:indent}
  5202. When non-@code{nil}, indent each @samp{ITEM} field according to its level.
  5203. @end table
  5204. @noindent
  5205. The following commands insert or update the dynamic block:
  5206. @table @asis
  5207. @item @kbd{C-c C-x i} (@code{org-insert-columns-dblock})
  5208. @kindex C-c C-x i
  5209. @findex org-insert-columns-dblock
  5210. Insert a dynamic block capturing a column view. Prompt for the
  5211. scope or ID of the view.
  5212. @item @kbd{C-c C-c} @kbd{C-c C-x C-u} (@code{org-dblock-update})
  5213. @kindex C-c C-c
  5214. @kindex C-c C-x C-u
  5215. @findex org-dblock-update
  5216. Update dynamic block at point. The cursor needs to be in the
  5217. @samp{#+BEGIN} line of the dynamic block.
  5218. @item @kbd{C-u C-c C-x C-u} (@code{org-update-all-dblocks})
  5219. @kindex C-u C-c C-x C-u
  5220. Update all dynamic blocks (see @ref{Dynamic Blocks}). This is useful
  5221. if you have several clock table blocks, column-capturing blocks
  5222. or other dynamic blocks in a buffer.
  5223. @end table
  5224. You can add formulas to the column view table and you may add plotting
  5225. instructions in front of the table---these survive an update of the
  5226. block. If there is a @samp{TBLFM} keyword after the table, the table is
  5227. recalculated automatically after an update.
  5228. An alternative way to capture and process property values into a table
  5229. is provided by Eric Schulte's @samp{org-collector.el} which is
  5230. a contributed package@footnote{Contributed packages are not part of Emacs, but are
  5231. distributed with the main distribution of Org---visit
  5232. @uref{https://orgmode.org}.}. It provides a general API to collect
  5233. properties from entries in a certain scope, and arbitrary Lisp
  5234. expressions to process these values before inserting them into a table
  5235. or a dynamic block.
  5236. @node Dates and Times
  5237. @chapter Dates and Times
  5238. @cindex dates
  5239. @cindex times
  5240. @cindex timestamp
  5241. @cindex date stamp
  5242. To assist project planning, TODO items can be labeled with a date
  5243. and/or a time. The specially formatted string carrying the date and
  5244. time information is called a @emph{timestamp} in Org mode. This may be
  5245. a little confusing because timestamp is often used as indicating when
  5246. something was created or last changed. However, in Org mode this term
  5247. is used in a much wider sense.
  5248. @menu
  5249. * Timestamps:: Assigning a time to a tree entry.
  5250. * Creating Timestamps:: Commands to insert timestamps.
  5251. * Deadlines and Scheduling:: Planning your work.
  5252. * Clocking Work Time:: Tracking how long you spend on a task.
  5253. * Effort Estimates:: Planning work effort in advance.
  5254. * Timers:: Notes with a running timer.
  5255. @end menu
  5256. @node Timestamps
  5257. @section Timestamps, Deadlines and Scheduling
  5258. @cindex timestamps
  5259. @cindex ranges, time
  5260. @cindex date stamps
  5261. @cindex deadlines
  5262. @cindex scheduling
  5263. A timestamp is a specification of a date (possibly with a time or
  5264. a range of times) in a special format, either @samp{<2003-09-16 Tue>} or
  5265. @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
  5266. date/time format. To use an alternative format, see @ref{Custom time format}. The day name is optional when you type the date yourself.
  5267. However, any date inserted or modified by Org adds that day name, for
  5268. reading convenience.}.
  5269. A timestamp can appear anywhere in the headline or body of an Org tree
  5270. entry. Its presence causes entries to be shown on specific dates in
  5271. the agenda (see @ref{Weekly/daily agenda}). We distinguish:
  5272. @table @asis
  5273. @item Plain timestamp; Event; Appointment
  5274. @cindex timestamp
  5275. @cindex appointment
  5276. A simple timestamp just assigns a date/time to an item. This is
  5277. just like writing down an appointment or event in a paper agenda.
  5278. In the timeline and agenda displays, the headline of an entry
  5279. associated with a plain timestamp is shown exactly on that date.
  5280. @example
  5281. * Meet Peter at the movies
  5282. <2006-11-01 Wed 19:15>
  5283. * Discussion on climate change
  5284. <2006-11-02 Thu 20:00-22:00>
  5285. @end example
  5286. @item Timestamp with repeater interval
  5287. @cindex timestamp, with repeater interval
  5288. A timestamp may contain a @emph{repeater interval}, indicating that it
  5289. applies not only on the given date, but again and again after
  5290. a certain interval of N days (d), weeks (w), months (m), or years
  5291. (y). The following shows up in the agenda every Wednesday:
  5292. @example
  5293. * Pick up Sam at school
  5294. <2007-05-16 Wed 12:30 +1w>
  5295. @end example
  5296. @item Diary-style sexp entries
  5297. @cindex diary style timestamps
  5298. @cindex sexp timestamps
  5299. For more complex date specifications, Org mode supports using the
  5300. special sexp diary entries implemented in the Emacs
  5301. calendar/diary package@footnote{When working with the standard diary sexp functions, you need
  5302. to be very careful with the order of the arguments. That order
  5303. depends evilly on the variable @code{calendar-date-style}. For example, to
  5304. specify a date December 12, 2005, the call might look like
  5305. @samp{(diary-date 12 1 2005)} or @samp{(diary-date 1 12 2005)} or @samp{(diary-date
  5306. 2005 12 1)}, depending on the settings. This has been the source of
  5307. much confusion. Org mode users can resort to special versions of
  5308. these functions like @code{org-date} or @code{org-anniversary}. These work just
  5309. like the corresponding @code{diary-} functions, but with stable ISO order
  5310. of arguments (year, month, day) wherever applicable, independent of
  5311. the value of @code{calendar-date-style}.}. For example, with optional time:
  5312. @example
  5313. * 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
  5314. <%%(org-float t 4 2)>
  5315. @end example
  5316. @item Time/Date range
  5317. @cindex timerange
  5318. @cindex date range
  5319. Two timestamps connected by @samp{--} denote a range. The headline is
  5320. shown on the first and last day of the range, and on any dates
  5321. that are displayed and fall in the range. Here is an example:
  5322. @example
  5323. ** Meeting in Amsterdam
  5324. <2004-08-23 Mon>--<2004-08-26 Thu>
  5325. @end example
  5326. @item Inactive timestamp
  5327. @cindex timestamp, inactive
  5328. @cindex inactive timestamp
  5329. Just like a plain timestamp, but with square brackets instead of
  5330. angular ones. These timestamps are inactive in the sense that
  5331. they do @emph{not} trigger an entry to show up in the agenda.
  5332. @example
  5333. * Gillian comes late for the fifth time
  5334. [2006-11-01 Wed]
  5335. @end example
  5336. @end table
  5337. @node Creating Timestamps
  5338. @section Creating Timestamps
  5339. For Org mode to recognize timestamps, they need to be in the specific
  5340. format. All commands listed below produce timestamps in the correct
  5341. format.
  5342. @table @asis
  5343. @item @kbd{C-c .} (@code{org-time-stamp})
  5344. @kindex C-c .
  5345. @findex org-time-stamp
  5346. Prompt for a date and insert a corresponding timestamp. When the
  5347. cursor is at an existing timestamp in the buffer, the command is
  5348. used to modify this timestamp instead of inserting a new one.
  5349. When this command is used twice in succession, a time range is
  5350. inserted.
  5351. @kindex C-u C-c .
  5352. @vindex org-time-stamp-rounding-minutes
  5353. When called with a prefix argument, use the alternative format
  5354. which contains date and time. The default time can be rounded to
  5355. multiples of 5 minutes. See the option
  5356. @code{org-time-stamp-rounding-minutes}.
  5357. @kindex C-u C-u C-c .
  5358. With two prefix arguments, insert an active timestamp with the
  5359. current time without prompting.
  5360. @item @kbd{C-c !} (@code{org-time-stamp-inactive})
  5361. @kindex C-c !
  5362. @kindex C-u C-c !
  5363. @kindex C-u C-u C-c !
  5364. @findex org-time-stamp-inactive
  5365. Like @kbd{C-c .}, but insert an inactive timestamp that does
  5366. not cause an agenda entry.
  5367. @item @kbd{C-c C-c}
  5368. @kindex C-c C-c
  5369. Normalize timestamp, insert or fix day name if missing or wrong.
  5370. @item @kbd{C-c <} (@code{org-date-from-calendar})
  5371. @kindex C-c <
  5372. @findex org-date-from-calendar
  5373. Insert a timestamp corresponding to the cursor date in the
  5374. calendar.
  5375. @item @kbd{C-c >} (@code{org-goto-calendar})
  5376. @kindex C-c >
  5377. @findex org-goto-calendar
  5378. Access the Emacs calendar for the current date. If there is
  5379. a timestamp in the current line, go to the corresponding date
  5380. instead.
  5381. @item @kbd{C-c C-o} (@code{org-open-at-point})
  5382. @kindex C-c C-o
  5383. @findex org-open-at-point
  5384. Access the agenda for the date given by the timestamp or -range
  5385. at point (see @ref{Weekly/daily agenda}).
  5386. @item @kbd{S-@key{LEFT}} (@code{org-timestamp-down-day})
  5387. @itemx @kbd{S-@key{RIGHT}} (@code{org-timestamp-up-day})
  5388. @kindex S-LEFT
  5389. @kindex S-RIGHT
  5390. @findex org-timestamp-down-day
  5391. @findex org-timestamp-up-day
  5392. Change date at cursor by one day. These key bindings conflict
  5393. with shift-selection and related modes (see @ref{Conflicts}).
  5394. @item @kbd{S-@key{UP}} (@code{org-timestamp-up})
  5395. @itemx @kbd{S-@key{DOWN}} (@code{org-timestamp-down})
  5396. @kindex S-UP
  5397. @kindex S-DOWN
  5398. Change the item under the cursor in a timestamp. The cursor can
  5399. be on a year, month, day, hour or minute. When the timestamp
  5400. contains a time range like @samp{15:30-16:30}, modifying the first
  5401. time also shifts the second, shifting the time block with
  5402. constant length. To change the length, modify the second time.
  5403. Note that if the cursor is in a headline and not at a timestamp,
  5404. these same keys modify the priority of an item. (see
  5405. @ref{Priorities}). The key bindings also conflict with
  5406. shift-selection and related modes (see @ref{Conflicts}).
  5407. @item @kbd{C-c C-y} (@code{org-evaluate-time-range})
  5408. @kindex C-c C-y
  5409. @findex org-evaluate-time-range
  5410. @cindex evaluate time range
  5411. Evaluate a time range by computing the difference between start
  5412. and end. With a prefix argument, insert result after the time
  5413. range (in a table: into the following column).
  5414. @end table
  5415. @menu
  5416. * The date/time prompt:: How Org mode helps you enter dates and times.
  5417. * Custom time format:: Making dates look different.
  5418. @end menu
  5419. @node The date/time prompt
  5420. @subsection The date/time prompt
  5421. @cindex date, reading in minibuffer
  5422. @cindex time, reading in minibuffer
  5423. @vindex org-read-date-prefer-future
  5424. When Org mode prompts for a date/time, the default is shown in default
  5425. date/time format, and the prompt therefore seems to ask for a specific
  5426. format. But it in fact accepts date/time information in a variety of
  5427. formats. Generally, the information should start at the beginning of
  5428. the string. Org mode finds whatever information is in there and
  5429. derives anything you have not specified from the @emph{default date and
  5430. time}. The default is usually the current date and time, but when
  5431. modifying an existing timestamp, or when entering the second stamp of
  5432. a range, it is taken from the stamp in the buffer. When filling in
  5433. information, Org mode assumes that most of the time you want to enter
  5434. a date in the future: if you omit the month/year and the given
  5435. day/month is @emph{before} today, it assumes that you mean a future
  5436. date@footnote{See the variable @code{org-read-date-prefer-future}. You may set
  5437. that variable to the symbol @code{time} to even make a time before now
  5438. shift the date to tomorrow.}. If the date has been automatically shifted into the
  5439. future, the time prompt shows this with @samp{(=>F)}.
  5440. For example, let's assume that today is @strong{June 13, 2006}. Here is how
  5441. various inputs are interpreted, the items filled in by Org mode are in
  5442. @strong{bold}.
  5443. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  5444. @item @samp{3-2-5}
  5445. @tab @result{} 2003-02-05
  5446. @item @samp{2/5/3}
  5447. @tab @result{} 2003-02-05
  5448. @item @samp{14}
  5449. @tab @result{} @strong{2006}-@strong{06}-14
  5450. @item @samp{12}
  5451. @tab @result{} @strong{2006}-@strong{07}-12
  5452. @item @samp{2/5}
  5453. @tab @result{} @strong{2007}-02-05
  5454. @item @samp{Fri}
  5455. @tab @result{} nearest Friday (default date or later)
  5456. @item @samp{sep 15}
  5457. @tab @result{} @strong{2006}-09-15
  5458. @item @samp{feb 15}
  5459. @tab @result{} @strong{2007}-02-15
  5460. @item @samp{sep 12 9}
  5461. @tab @result{} 2009-09-12
  5462. @item @samp{12:45}
  5463. @tab @result{} @strong{2006}-@strong{06}-@strong{13} 12:45
  5464. @item @samp{22 sept 0:34}
  5465. @tab @result{} @strong{2006}-09-22 0:34
  5466. @item @samp{w4}
  5467. @tab @result{} ISO week for of the current year @strong{2006}
  5468. @item @samp{2012 w4 fri}
  5469. @tab @result{} Friday of ISO week 4 in 2012
  5470. @item @samp{2012-w04-5}
  5471. @tab @result{} Same as above
  5472. @end multitable
  5473. Furthermore you can specify a relative date by giving, as the @emph{first}
  5474. thing in the input: a plus/minus sign, a number and a letter---@samp{d},
  5475. @samp{w}, @samp{m} or @samp{y}---to indicate change in days, weeks, months, or
  5476. years. With a single plus or minus, the date is always relative to
  5477. today. With a double plus or minus, it is relative to the default
  5478. date. If instead of a single letter, you use the abbreviation of day
  5479. name, the date is the Nth such day, e.g.:
  5480. @multitable {aaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  5481. @item @samp{+0}
  5482. @tab @result{} today
  5483. @item @samp{.}
  5484. @tab @result{} today
  5485. @item @samp{+4d}
  5486. @tab @result{} four days from today
  5487. @item @samp{+4}
  5488. @tab @result{} same as +4d
  5489. @item @samp{+2w}
  5490. @tab @result{} two weeks from today
  5491. @item @samp{++5}
  5492. @tab @result{} five days from default date
  5493. @item @samp{+2tue}
  5494. @tab @result{} second Tuesday from now
  5495. @end multitable
  5496. @vindex parse-time-months
  5497. @vindex parse-time-weekdays
  5498. The function understands English month and weekday abbreviations. If
  5499. you want to use un-abbreviated names and/or other languages, configure
  5500. the variables @code{parse-time-months} and @code{parse-time-weekdays}.
  5501. @vindex org-read-date-force-compatible-dates
  5502. Not all dates can be represented in a given Emacs implementation. By
  5503. default Org mode forces dates into the compatibility range 1970--2037
  5504. which works on all Emacs implementations. If you want to use dates
  5505. outside of this range, read the docstring of the variable
  5506. @code{org-read-date-force-compatible-dates}.
  5507. You can specify a time range by giving start and end times or by
  5508. giving a start time and a duration (in HH:MM format). Use one or two
  5509. dash(es) as the separator in the former case and use @samp{+} as the
  5510. separator in the latter case, e.g.:
  5511. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaa}
  5512. @item @samp{11am-1:15pm}
  5513. @tab @result{} 11:00-13:15
  5514. @item @samp{11am--1:15pm}
  5515. @tab @result{} same as above
  5516. @item @samp{11am+2:15}
  5517. @tab @result{} same as above
  5518. @end multitable
  5519. @cindex calendar, for selecting date
  5520. @vindex org-popup-calendar-for-date-prompt
  5521. Parallel to the minibuffer prompt, a calendar is popped up@footnote{If you do not need/want the calendar, configure the variable
  5522. @code{org-popup-calendar-for-date-prompt}.}.
  5523. When you exit the date prompt, either by clicking on a date in the
  5524. calendar, or by pressing @kbd{@key{RET}}, the date selected in the
  5525. calendar is combined with the information entered at the prompt. You
  5526. can control the calendar fully from the minibuffer:
  5527. @kindex <
  5528. @kindex >
  5529. @kindex M-v
  5530. @kindex C-v
  5531. @kindex mouse-1
  5532. @kindex S-RIGHT
  5533. @kindex S-LEFT
  5534. @kindex S-DOWN
  5535. @kindex S-UP
  5536. @kindex M-S-RIGHT
  5537. @kindex M-S-LEFT
  5538. @kindex RET
  5539. @multitable @columnfractions 0.25 0.55
  5540. @item @kbd{@key{RET}}
  5541. @tab Choose date at cursor in calendar.
  5542. @item @kbd{mouse-1}
  5543. @tab Select date by clicking on it.
  5544. @item @kbd{S-@key{RIGHT}}
  5545. @tab One day forward.
  5546. @item @kbd{S-@key{LEFT}}
  5547. @tab One day backward.
  5548. @item @kbd{S-@key{DOWN}}
  5549. @tab One week forward.
  5550. @item @kbd{S-@key{UP}}
  5551. @tab One week backward.
  5552. @item @kbd{M-S-@key{RIGHT}}
  5553. @tab One month forward.
  5554. @item @kbd{M-S-@key{LEFT}}
  5555. @tab One month backward.
  5556. @item @kbd{>}
  5557. @tab Scroll calendar forward by one month.
  5558. @item @kbd{<}
  5559. @tab Scroll calendar backward by one month.
  5560. @item @kbd{M-v}
  5561. @tab Scroll calendar forward by 3 months.
  5562. @item @kbd{C-v}
  5563. @tab Scroll calendar backward by 3 months.
  5564. @end multitable
  5565. @vindex org-read-date-display-live
  5566. The actions of the date/time prompt may seem complex, but I assure you
  5567. they will grow on you, and you will start getting annoyed by pretty
  5568. much any other way of entering a date/time out there. To help you
  5569. understand what is going on, the current interpretation of your input
  5570. is displayed live in the minibuffer@footnote{If you find this distracting, turn off the display with
  5571. @code{org-read-date-display-live}.}.
  5572. @node Custom time format
  5573. @subsection Custom time format
  5574. @cindex custom date/time format
  5575. @cindex time format, custom
  5576. @cindex date format, custom
  5577. @vindex org-display-custom-times
  5578. @vindex org-time-stamp-custom-formats
  5579. Org mode uses the standard ISO notation for dates and times as it is
  5580. defined in ISO 8601. If you cannot get used to this and require
  5581. another representation of date and time to keep you happy, you can get
  5582. it by customizing the variables @code{org-display-custom-times} and
  5583. @code{org-time-stamp-custom-formats}.
  5584. @table @asis
  5585. @item @kbd{C-c C-x C-t} (@code{org-toggle-time-stamp-overlays})
  5586. @kindex C-c C-x C-t
  5587. @findex org-toggle-time-stamp-overlays
  5588. Toggle the display of custom formats for dates and times.
  5589. @end table
  5590. @noindent
  5591. Org mode needs the default format for scanning, so the custom
  5592. date/time format does not @emph{replace} the default format. Instead, it
  5593. is put @emph{over} the default format using text properties. This has the
  5594. following consequences:
  5595. @itemize
  5596. @item
  5597. You cannot place the cursor onto a timestamp anymore, only before or
  5598. after.
  5599. @item
  5600. The @kbd{S-@key{UP}} and @kbd{S-@key{DOWN}} keys can no longer be used
  5601. to adjust each component of a timestamp. If the cursor is at the
  5602. beginning of the stamp, @kbd{S-@key{UP}} and @kbd{S-@key{DOWN}} change
  5603. the stamp by one day, just like @kbd{S-@key{LEFT}}
  5604. @kbd{S-@key{RIGHT}}. At the end of the stamp, change the time by one
  5605. minute.
  5606. @item
  5607. If the timestamp contains a range of clock times or a repeater,
  5608. these are not overlaid, but remain in the buffer as they were.
  5609. @item
  5610. When you delete a timestamp character-by-character, it only
  5611. disappears from the buffer after @emph{all} (invisible) characters
  5612. belonging to the ISO timestamp have been removed.
  5613. @item
  5614. If the custom timestamp format is longer than the default and you
  5615. are using dates in tables, table alignment will be messed up. If
  5616. the custom format is shorter, things do work as expected.
  5617. @end itemize
  5618. @node Deadlines and Scheduling
  5619. @section Deadlines and Scheduling
  5620. A timestamp may be preceded by special keywords to facilitate
  5621. planning. Both the timestamp and the keyword have to be positioned
  5622. immediately after the task they refer to.
  5623. @table @asis
  5624. @item @samp{DEADLINE}
  5625. @cindex @samp{DEADLINE}
  5626. Meaning: the task (most likely a TODO item, though not
  5627. necessarily) is supposed to be finished on that date.
  5628. @vindex org-deadline-warning-days
  5629. On the deadline date, the task is listed in the agenda. In
  5630. addition, the agenda for @emph{today} carries a warning about the
  5631. approaching or missed deadline, starting
  5632. @code{org-deadline-warning-days} before the due date, and continuing
  5633. until the entry is marked DONE. An example:
  5634. @example
  5635. *** TODO write article about the Earth for the Guide
  5636. DEADLINE: <2004-02-29 Sun>
  5637. The editor in charge is [[bbdb:Ford Prefect]]
  5638. @end example
  5639. @vindex org-agenda-skip-deadline-prewarning-if-scheduled
  5640. You can specify a different lead time for warnings for a specific
  5641. deadlines using the following syntax. Here is an example with
  5642. a warning period of 5 days @samp{DEADLINE: <2004-02-29 Sun -5d>}.
  5643. This warning is deactivated if the task gets scheduled and you
  5644. set @code{org-agenda-skip-deadline-prewarning-if-scheduled} to @code{t}.
  5645. @item @samp{SCHEDULED}
  5646. @cindex @samp{SCHEDULED}
  5647. Meaning: you are planning to start working on that task on the
  5648. given date.
  5649. @vindex org-agenda-skip-scheduled-if-done
  5650. The headline is listed under the given date@footnote{It will still be listed on that date after it has been marked
  5651. DONE. If you do not like this, set the variable
  5652. @code{org-agenda-skip-scheduled-if-done}.}. In addition,
  5653. a reminder that the scheduled date has passed is present in the
  5654. compilation for @emph{today}, until the entry is marked DONE, i.e.,
  5655. the task is automatically forwarded until completed.
  5656. @example
  5657. *** TODO Call Trillian for a date on New Years Eve.
  5658. SCHEDULED: <2004-12-25 Sat>
  5659. @end example
  5660. @vindex org-scheduled-delay-days
  5661. @vindex org-agenda-skip-scheduled-delay-if-deadline
  5662. If you want to @emph{delay} the display of this task in the agenda,
  5663. use @samp{SCHEDULED: <2004-12-25 Sat -2d>}: the task is still
  5664. scheduled on the 25th but will appear two days later. In case
  5665. the task contains a repeater, the delay is considered to affect
  5666. all occurrences; if you want the delay to only affect the first
  5667. scheduled occurrence of the task, use @samp{--2d} instead. See
  5668. @code{org-scheduled-delay-days} and
  5669. @code{org-agenda-skip-scheduled-delay-if-deadline} for details on how
  5670. to control this globally or per agenda.
  5671. @noindent
  5672. @strong{Important:} Scheduling an item in Org mode should @emph{not} be
  5673. understood in the same way that we understand @emph{scheduling
  5674. a meeting}. Setting a date for a meeting is just a simple
  5675. appointment, you should mark this entry with a simple plain
  5676. timestamp, to get this item shown on the date where it applies.
  5677. This is a frequent misunderstanding by Org users. In Org mode,
  5678. @emph{scheduling} means setting a date when you want to start working
  5679. on an action item.
  5680. @end table
  5681. You may use timestamps with repeaters in scheduling and deadline
  5682. entries. Org mode issues early and late warnings based on the
  5683. assumption that the timestamp represents the @emph{nearest instance} of the
  5684. repeater. However, the use of diary S-exp entries like
  5685. @example
  5686. <%%(org-float t 42)>
  5687. @end example
  5688. @noindent
  5689. in scheduling and deadline timestamps is limited. Org mode does not
  5690. know enough about the internals of each S-exp function to issue early
  5691. and late warnings. However, it shows the item on each day where the
  5692. S-exp entry matches.
  5693. @menu
  5694. * Inserting deadline/schedule:: Planning items.
  5695. * Repeated tasks:: Items that show up again and again.
  5696. @end menu
  5697. @node Inserting deadline/schedule
  5698. @subsection Inserting deadlines or schedules
  5699. The following commands allow you to quickly insert a deadline or to
  5700. schedule an item:@footnote{The @samp{SCHEDULED} and @samp{DEADLINE} dates are inserted on the line
  5701. right below the headline. Do not put any text between this line and
  5702. the headline.}
  5703. @table @asis
  5704. @item @kbd{C-c C-d} (@code{org-deadline})
  5705. @kindex C-c C-d
  5706. @findex org-deadline
  5707. @vindex org-log-redeadline
  5708. Insert @samp{DEADLINE} keyword along with a stamp. The insertion
  5709. happens in the line directly following the headline. Remove any
  5710. @samp{CLOSED} timestamp . When called with a prefix argument, also
  5711. remove any existing deadline from the entry. Depending on the
  5712. variable @code{org-log-redeadline}, take a note when changing an
  5713. existing deadline@footnote{Note the corresponding @samp{STARTUP} options @samp{logredeadline},
  5714. @samp{lognoteredeadline}, and @samp{nologredeadline}.}.
  5715. @item @kbd{C-c C-s} (@code{org-schedule})
  5716. @kindex C-c C-s
  5717. @findex org-schedule
  5718. @vindex org-log-reschedule
  5719. Insert @samp{SCHEDULED} keyword along with a stamp. The insertion
  5720. happens in the line directly following the headline. Remove any
  5721. @samp{CLOSED} timestamp. When called with a prefix argument, also
  5722. remove the scheduling date from the entry. Depending on the
  5723. variable @code{org-log-reschedule}, take a note when changing an
  5724. existing scheduling time@footnote{Note the corresponding @samp{STARTUP} options @samp{logreschedule},
  5725. @samp{lognotereschedule}, and @samp{nologreschedule}.}.
  5726. @item @kbd{C-c C-x C-k} (@code{org-mark-entry-for-agenda-action})
  5727. @kindex C-c C-x C-k
  5728. @kindex k a
  5729. @kindex k s
  5730. @findex org-mark-entry-for-agenda-action
  5731. Mark the current entry for agenda action. After you have marked
  5732. the entry like this, you can open the agenda or the calendar to
  5733. find an appropriate date. With the cursor on the selected date,
  5734. press @kbd{k s} or @kbd{k d} to schedule the marked
  5735. item.
  5736. @item @kbd{C-c / d} (@code{org-check-deadlines})
  5737. @kindex C-c / d
  5738. @findex org-check-deadlines
  5739. @cindex sparse tree, for deadlines
  5740. @vindex org-deadline-warning-days
  5741. Create a sparse tree with all deadlines that are either past-due,
  5742. or which will become due within @code{org-deadline-warning-days}.
  5743. With @kbd{C-u} prefix, show all deadlines in the file. With
  5744. a numeric prefix, check that many days. For example, @kbd{C-1 C-c / d} shows all deadlines due tomorrow.
  5745. @item @kbd{C-c / b}, @code{org-check-before-date}
  5746. @kindex C-c / b
  5747. @findex org-check-before-date
  5748. Sparse tree for deadlines and scheduled items before a given
  5749. date.
  5750. @item @kbd{C-c / a}, @code{org-check-after-date}
  5751. @kindex C-c / a
  5752. @findex org-check-after-date
  5753. Sparse tree for deadlines and scheduled items after a given date.
  5754. @end table
  5755. Note that @code{org-schedule} and @code{org-deadline} supports setting the date
  5756. by indicating a relative time e.g., @samp{+1d} sets the date to the next
  5757. day after today, and @samp{--1w} sets the date to the previous week before
  5758. any current timestamp.
  5759. @node Repeated tasks
  5760. @subsection Repeated tasks
  5761. @cindex tasks, repeated
  5762. @cindex repeated tasks
  5763. Some tasks need to be repeated again and again. Org mode helps to
  5764. organize such tasks using a so-called repeater in a @samp{DEADLINE},
  5765. @samp{SCHEDULED}, or plain timestamp. In the following example:
  5766. @example
  5767. ** TODO Pay the rent
  5768. DEADLINE: <2005-10-01 Sat +1m>
  5769. @end example
  5770. noindent
  5771. the @samp{+1m} is a repeater; the intended interpretation is that the task
  5772. has a deadline on @samp{<2005-10-01>} and repeats itself every (one) month
  5773. starting from that time. You can use yearly, monthly, weekly, daily
  5774. and hourly repeat cookies by using the @code{y/w/m/d/h} letters. If you
  5775. need both a repeater and a special warning period in a deadline entry,
  5776. the repeater should come first and the warning period last: @samp{DEADLINE:
  5777. <2005-10-01 Sat +1m -3d>}.
  5778. @vindex org-todo-repeat-to-state
  5779. Deadlines and scheduled items produce entries in the agenda when they
  5780. are over-due, so it is important to be able to mark such an entry as
  5781. completed once you have done so. When you mark a @samp{DEADLINE} or
  5782. a @samp{SCHEDULED} with the TODO keyword @samp{DONE}, it no longer produces
  5783. entries in the agenda. The problem with this is, however, is that
  5784. then also the @emph{next} instance of the repeated entry will not be
  5785. active. Org mode deals with this in the following way: when you try
  5786. to mark such an entry DONE, using @kbd{C-c C-t}, it shifts the
  5787. base date of the repeating timestamp by the repeater interval, and
  5788. immediately sets the entry state back to TODO@footnote{In fact, the target state is taken from, in this sequence, the
  5789. @samp{REPEAT_TO_STATE} property, the variable @code{org-todo-repeat-to-state} if
  5790. it is a string, the previous TODO state if @code{org-todo-repeat-to-state}
  5791. is @code{t}, or the first state of the TODO state sequence.}. In the example
  5792. above, setting the state to DONE would actually switch the date like
  5793. this:
  5794. @example
  5795. ** TODO Pay the rent
  5796. DEADLINE: <2005-11-01 Tue +1m>
  5797. @end example
  5798. To mark a task with a repeater as DONE, use @kbd{C-- 1 C-c C-t},
  5799. i.e., @code{org-todo} with a numeric prefix argument of @samp{-1}.
  5800. @vindex org-log-repeat
  5801. A timestamp@footnote{You can change this using the option @code{org-log-repeat}, or the
  5802. @samp{STARTUP} options @samp{logrepeat}, @samp{lognoterepeat}, and @samp{nologrepeat}.
  5803. With @samp{lognoterepeat}, you will also be prompted for a note.} is added under the deadline, to keep a record that
  5804. you actually acted on the previous instance of this deadline.
  5805. As a consequence of shifting the base date, this entry is no longer
  5806. visible in the agenda when checking past dates, but all future
  5807. instances will be visible.
  5808. With the @samp{+1m} cookie, the date shift is always exactly one month. So
  5809. if you have not paid the rent for three months, marking this entry
  5810. DONE still keeps it as an overdue deadline. Depending on the task,
  5811. this may not be the best way to handle it. For example, if you forgot
  5812. to call your father for 3 weeks, it does not make sense to call him
  5813. 3 times in a single day to make up for it. Finally, there are tasks
  5814. like changing batteries which should always repeat a certain time
  5815. @emph{after} the last time you did it. For these tasks, Org mode has
  5816. special repeaters @samp{++} and @samp{.+}. For example:
  5817. @example
  5818. ** TODO Call Father
  5819. DEADLINE: <2008-02-10 Sun ++1w>
  5820. Marking this DONE shifts the date by at least one week, but also
  5821. by as many weeks as it takes to get this date into the future.
  5822. However, it stays on a Sunday, even if you called and marked it
  5823. done on Saturday.
  5824. ** TODO Empty kitchen trash
  5825. DEADLINE: <2008-02-08 Fri 20:00 ++1d>
  5826. Marking this DONE shifts the date by at least one day, and also
  5827. by as many days as it takes to get the timestamp into the future.
  5828. Since there is a time in the timestamp, the next deadline in the
  5829. future will be on today's date if you complete the task before
  5830. 20:00.
  5831. ** TODO Check the batteries in the smoke detectors
  5832. DEADLINE: <2005-11-01 Tue .+1m>
  5833. Marking this DONE will shift the date to one month after today.
  5834. @end example
  5835. @vindex org-agenda-skip-scheduled-if-deadline-is-shown
  5836. You may have both scheduling and deadline information for a specific
  5837. task. If the repeater is set for the scheduling information only, you
  5838. probably want the repeater to be ignored after the deadline. If so,
  5839. set the variable @code{org-agenda-skip-scheduled-if-deadline-is-shown} to
  5840. @code{repeated-after-deadline}. However, any scheduling information
  5841. without a repeater is no longer relevant once the task is done, and
  5842. thus, removed upon repeating the task. If you want both scheduling
  5843. and deadline information to repeat after the same interval, set the
  5844. same repeater for both timestamps.
  5845. An alternative to using a repeater is to create a number of copies of
  5846. a task subtree, with dates shifted in each copy. The command
  5847. @kbd{C-c C-x c} was created for this purpose; it is described in
  5848. @ref{Structure Editing}.
  5849. @node Clocking Work Time
  5850. @section Clocking Work Time
  5851. @cindex clocking time
  5852. @cindex time clocking
  5853. Org mode allows you to clock the time you spend on specific tasks in
  5854. a project. When you start working on an item, you can start the
  5855. clock. When you stop working on that task, or when you mark the task
  5856. done, the clock is stopped and the corresponding time interval is
  5857. recorded. It also computes the total time spent on each
  5858. subtree@footnote{Clocking only works if all headings are indented with less
  5859. than 30 stars. This is a hard-coded limitation of @code{lmax} in
  5860. @code{org-clock-sum}.} of a project. And it remembers a history or tasks
  5861. recently clocked, to that you can jump quickly between a number of
  5862. tasks absorbing your time.
  5863. To save the clock history across Emacs sessions, use:
  5864. @lisp
  5865. (setq org-clock-persist 'history)
  5866. (org-clock-persistence-insinuate)
  5867. @end lisp
  5868. @vindex org-clock-persist
  5869. When you clock into a new task after resuming Emacs, the incomplete
  5870. clock@footnote{To resume the clock under the assumption that you have worked
  5871. on this task while outside Emacs, use @code{(setq org-clock-persist t)}.} is retrieved (see @ref{Resolving idle time (1)}) and you are
  5872. prompted about what to do with it.
  5873. @menu
  5874. * Clocking commands:: Starting and stopping a clock.
  5875. * The clock table:: Detailed reports.
  5876. * Resolving idle time:: Resolving time when you've been idle.
  5877. @end menu
  5878. @node Clocking commands
  5879. @subsection Clocking commands
  5880. @table @asis
  5881. @item @kbd{C-c C-x C-i} (@code{org-clock-in})
  5882. @kindex C-c C-x C-i
  5883. @findex org-clock-in
  5884. @vindex org-clock-into-drawer
  5885. @vindex org-clock-continuously
  5886. @cindex @samp{LOG_INTO_DRAWER}, property
  5887. Start the clock on the current item (clock-in). This inserts the
  5888. CLOCK keyword together with a timestamp. If this is not the
  5889. first clocking of this item, the multiple CLOCK lines are wrapped
  5890. into a @samp{LOGBOOK} drawer (see also the variable
  5891. @code{org-clock-into-drawer}). You can also overrule the setting of
  5892. this variable for a subtree by setting a @samp{CLOCK_INTO_DRAWER} or
  5893. @samp{LOG_INTO_DRAWER} property. When called with a @kbd{C-u}
  5894. prefix argument, select the task from a list of recently clocked
  5895. tasks. With two @kbd{C-u C-u} prefixes, clock into the task
  5896. at point and mark it as the default task; the default task is
  5897. always be available with letter @kbd{d} when selecting
  5898. a clocking task. With three @kbd{C-u C-u C-u} prefixes,
  5899. force continuous clocking by starting the clock when the last
  5900. clock stopped.
  5901. @cindex @samp{CLOCK_MODELINE_TOTAL}, property
  5902. @cindex @samp{LAST_REPEAT}, property
  5903. @vindex org-clock-mode-line-total
  5904. @vindex org-clock-in-prepare-hook
  5905. While the clock is running, Org shows the current clocking time
  5906. in the mode line, along with the title of the task. The clock
  5907. time shown is all time ever clocked for this task and its
  5908. children. If the task has an effort estimate (see @ref{Effort Estimates}), the mode line displays the current clocking time
  5909. against it@footnote{To add an effort estimate ``on the fly'', hook a function doing
  5910. 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
  5911. task@footnote{The last reset of the task is recorded by the @samp{LAST_REPEAT}
  5912. property.}. You can exercise more control over show time with
  5913. the @samp{CLOCK_MODELINE_TOTAL} property. It may have the values
  5914. @samp{current} to show only the current clocking instance, @samp{today} to
  5915. show all time clocked on this tasks today---see also the
  5916. variable @code{org-extend-today-until}, @code{all} to include all time, or
  5917. @code{auto} which is the default@footnote{See also the variable @code{org-clock-mode-line-total}.}. Clicking with
  5918. @kbd{mouse-1} onto the mode line entry pops up a menu with
  5919. clocking options.
  5920. @item @kbd{C-c C-x C-o} (@code{org-clock-out})
  5921. @kindex C-c C-x C-o
  5922. @findex org-clock-out
  5923. @vindex org-log-note-clock-out
  5924. Stop the clock (clock-out). This inserts another timestamp at
  5925. the same location where the clock was last started. It also
  5926. directly computes the resulting time in inserts it after the time
  5927. range as @samp{=>HH:MM}. See the variable @code{org-log-note-clock-out}
  5928. for the possibility to record an additional note together with
  5929. the clock-out timestamp@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP:
  5930. lognoteclock-out}.}.
  5931. @item @kbd{C-c C-x C-x} (@code{org-clock-in-last})
  5932. @kindex C-c C-x C-x
  5933. @findex org-clock-in-last
  5934. @vindex org-clock-continuously
  5935. Re-clock the last clocked task. With one @kbd{C-u} prefix
  5936. argument, select the task from the clock history. With two
  5937. @kbd{C-u} prefixes, force continuous clocking by starting
  5938. the clock when the last clock stopped.
  5939. @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate})
  5940. @kindex C-c C-x C-e
  5941. @findex org-clock-modify-effort-estimate
  5942. Update the effort estimate for the current clock task.
  5943. @item @kbd{C-c C-c} or @kbd{C-c C-y} (@code{org-evaluate-time-range})
  5944. @kindex C-c C-c
  5945. @kindex C-c C-y
  5946. @findex org-evaluate-time-range
  5947. Recompute the time interval after changing one of the timestamps.
  5948. This is only necessary if you edit the timestamps directly. If
  5949. you change them with @kbd{S-<cursor>} keys, the update is
  5950. automatic.
  5951. @item @kbd{C-S-@key{UP}} (@code{org-clock-timestamps-up})
  5952. @itemx @kbd{C-S-@key{DOWN}} (@code{org-clock-timestamps-down})
  5953. @kindex C-S-UP
  5954. @findex org-clock-timestamps-up
  5955. @kindex C-S-DOWN
  5956. @findex org-clock-timestamps-down
  5957. On CLOCK log lines, increase/decrease both timestamps so that the
  5958. clock duration keeps the same value.
  5959. @item @kbd{S-M-@key{UP}} (@code{org-timestamp-up})
  5960. @itemx @kbd{S-M-@key{DOWN}} (@code{org-timestamp-down})
  5961. @kindex S-M-UP
  5962. @findex org-clock-timestamp-up
  5963. @kindex S-M-DOWN
  5964. @findex org-clock-timestamp-down
  5965. On @samp{CLOCK} log lines, increase/decrease the timestamp at point
  5966. and the one of the previous, or the next, clock timestamp by the
  5967. same duration. For example, if you hit @kbd{S-M-@key{UP}} to
  5968. increase a clocked-out timestamp by five minutes, then the
  5969. clocked-in timestamp of the next clock is increased by five
  5970. minutes.
  5971. @item @kbd{C-c C-t} (@code{org-todo})
  5972. @kindex C-c C-t
  5973. @findex org-todo
  5974. Changing the TODO state of an item to DONE automatically stops
  5975. the clock if it is running in this same item.
  5976. @item @kbd{C-c C-x C-q} (@code{org-clock-cancel})
  5977. @kindex C-c C-x C-q
  5978. @findex org-clock-cancel
  5979. Cancel the current clock. This is useful if a clock was started
  5980. by mistake, or if you ended up working on something else.
  5981. @item @kbd{C-c C-x C-j} (@code{org-clock-goto})
  5982. @kindex C-c C-x C-j
  5983. @findex or-clock-goto
  5984. Jump to the headline of the currently clocked in task. With
  5985. a @kbd{C-u} prefix argument, select the target task from
  5986. a list of recently clocked tasks.
  5987. @item @kbd{C-c C-x C-d} (@code{org-clock-display})
  5988. @kindex C-c C-x C-d
  5989. @findex org-clock-display
  5990. @vindex org-remove-highlights-with-change
  5991. Display time summaries for each subtree in the current buffer.
  5992. This puts overlays at the end of each headline, showing the total
  5993. time recorded under that heading, including the time of any
  5994. subheadings. You can use visibility cycling to study the tree,
  5995. but the overlays disappear when you change the buffer (see
  5996. variable @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
  5997. @end table
  5998. 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
  5999. a day.
  6000. @strong{Important:} note that both @code{org-clock-out} and @code{org-clock-in-last}
  6001. can have a global keybinding and do not modify the window disposition.
  6002. @node The clock table
  6003. @subsection The clock table
  6004. @cindex clocktable, dynamic block
  6005. @cindex report, of clocked time
  6006. Org mode can produce quite complex reports based on the time clocking
  6007. information. Such a report is called a @emph{clock table}, because it is
  6008. formatted as one or several Org tables.
  6009. @table @asis
  6010. @item @kbd{C-c C-x C-r} (@code{org-clock-report})
  6011. @kindex C-c C-x C-r
  6012. @findex org-clock-report
  6013. Insert a dynamic block (see @ref{Dynamic Blocks}) containing a clock
  6014. report as an Org mode table into the current file. When the
  6015. cursor is at an existing clock table, just update it. When
  6016. called with a prefix argument, jump to the first clock report in
  6017. the current document and update it. The clock table includes
  6018. archived trees.
  6019. @item @kbd{C-c C-c} or @kbd{C-c C-x C-u} (@code{org-dblock-update})
  6020. @kindex C-c C-c
  6021. @kindex C-c C-x C-u
  6022. @findex org-dblock-update
  6023. Update dynamic block at point. The cursor needs to be in the
  6024. @samp{BEGIN} line of the dynamic block.
  6025. @item @kbd{C-u C-c C-x C-u}
  6026. @kindex C-u C-c C-x C-u
  6027. Update all dynamic blocks (see @ref{Dynamic Blocks}). This is useful
  6028. if you have several clock table blocks in a buffer.
  6029. @item @kbd{S-@key{LEFT}}
  6030. @itemx @kbd{S-@key{RIGHT}} (@code{org-clocktable-try-shift})
  6031. @kindex S-LEFT
  6032. @kindex S-RIGHT
  6033. @findex org-clocktable-try-shift
  6034. Shift the current @samp{:block} interval and update the table. The
  6035. cursor needs to be in the @samp{#+BEGIN: clocktable} line for this
  6036. command. If @samp{:block} is @samp{today}, it is shifted to @samp{today-1},
  6037. etc.
  6038. @end table
  6039. Here is an example of the frame for a clock table as it is inserted
  6040. into the buffer with the @kbd{C-c C-x C-r} command:
  6041. @cindex @samp{BEGIN clocktable}
  6042. @example
  6043. #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
  6044. #+END: clocktable
  6045. @end example
  6046. @noindent
  6047. @vindex org-clocktable-defaults
  6048. The @samp{#+BEGIN} line and specify a number of options to define the
  6049. scope, structure, and formatting of the report. Defaults for all
  6050. these options can be configured in the variable
  6051. @code{org-clocktable-defaults}.
  6052. @noindent
  6053. First there are options that determine which clock entries are to
  6054. be selected:
  6055. @table @asis
  6056. @item :maxlevel
  6057. Maximum level depth to which times are listed in the table.
  6058. Clocks at deeper levels are summed into the upper level.
  6059. @item :scope
  6060. The scope to consider. This can be any of the following:
  6061. @multitable {aaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  6062. @item @code{nil}
  6063. @tab the current buffer or narrowed region
  6064. @item @code{file}
  6065. @tab the full current buffer
  6066. @item @code{subtree}
  6067. @tab the subtree where the clocktable is located
  6068. @item @code{treeN}
  6069. @tab the surrounding level N tree, for example @samp{tree3}
  6070. @item @code{tree}
  6071. @tab the surrounding level 1 tree
  6072. @item @code{agenda}
  6073. @tab all agenda files
  6074. @item @samp{("file" ...)}
  6075. @tab scan these files
  6076. @item @samp{FUNCTION}
  6077. @tab scan files returned by calling FUNCTION with no argument
  6078. @item @code{file-with-archives}
  6079. @tab current file and its archives
  6080. @item @code{agenda-with-archives}
  6081. @tab all agenda files, including archives
  6082. @end multitable
  6083. @item :block
  6084. The time block to consider. This block is specified either
  6085. absolutely, or relative to the current time and may be any of
  6086. these formats:
  6087. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaa}
  6088. @item @samp{2007-12-31}
  6089. @tab New year eve 2007
  6090. @item @samp{2007-12}
  6091. @tab December 2007
  6092. @item @samp{2007-W50}
  6093. @tab ISO-week 50 in 2007
  6094. @item @samp{2007-Q2}
  6095. @tab 2nd quarter in 2007
  6096. @item @samp{2007}
  6097. @tab the year 2007
  6098. @item @code{today}, @code{yesterday}, @code{today-N}
  6099. @tab a relative day
  6100. @item @code{thisweek}, @code{lastweek}, @code{thisweek-N}
  6101. @tab a relative week
  6102. @item @code{thismonth}, @code{lastmonth}, @code{thismonth-N}
  6103. @tab a relative month
  6104. @item @code{thisyear}, @code{lastyear}, @code{thisyear-N}
  6105. @tab a relative year
  6106. @item @code{untilnow}
  6107. @tab all clocked time ever
  6108. @end multitable
  6109. @vindex org-clock-display-default-range
  6110. When this option is not set, Org falls back to the value in
  6111. @code{org-clock-display-default-range}, which defaults to the current
  6112. year.
  6113. Use @kbd{S-@key{LEFT}} or @kbd{S-@key{RIGHT}} to shift the time
  6114. interval.
  6115. @item :tstart
  6116. A time string specifying when to start considering times.
  6117. Relative times like @samp{"<-2w>"} can also be used. See @ref{Matching tags and properties} for relative time syntax.
  6118. @item :tend
  6119. A time string specifying when to stop considering times.
  6120. Relative times like @samp{"<now>"} can also be used. See @ref{Matching tags and properties} for relative time syntax.
  6121. @item wstart
  6122. The starting day of the week. The default is 1 for Monday.
  6123. @item mstart
  6124. The starting day of the month. The default is 1 for the first.
  6125. @item :step
  6126. Set to @code{week} or @code{day} to split the table into chunks. To use
  6127. this, @code{:block} or @code{:tstart}, @code{:tend} are needed.
  6128. @item :stepskip0
  6129. Do not show steps that have zero time.
  6130. @item :fileskip0
  6131. Do not show table sections from files which did not contribute.
  6132. @item :tags
  6133. A tags match to select entries that should contribute. See
  6134. @ref{Matching tags and properties} for the match syntax.
  6135. @end table
  6136. @findex org-clocktable-write-default
  6137. Then there are options that determine the formatting of the table.
  6138. There options are interpreted by the function
  6139. @code{org-clocktable-write-default}, but you can specify your own function
  6140. using the @samp{:formatter} parameter.
  6141. @table @asis
  6142. @item :emphasize
  6143. When @code{t}, emphasize level one and level two items.
  6144. @item :lang
  6145. Language@footnote{Language terms can be set through the variable
  6146. @code{org-clock-clocktable-language-setup}.} to use for descriptive cells like ``Task''.
  6147. @item :link
  6148. Link the item headlines in the table to their origins.
  6149. @item :narrow
  6150. An integer to limit the width of the headline column in the Org
  6151. table. If you write it like @samp{50!}, then the headline is also
  6152. shortened in export.
  6153. @item :indent
  6154. Indent each headline field according to its level.
  6155. @item :tcolumns
  6156. Number of columns to be used for times. If this is smaller than
  6157. @samp{:maxlevel}, lower levels are lumped into one column.
  6158. @item :level
  6159. Should a level number column be included?
  6160. @item :sort
  6161. A cons cell containing the column to sort and a sorting type.
  6162. E.g., @samp{:sort (1 . ?a)} sorts the first column alphabetically.
  6163. @item :compact
  6164. Abbreviation for @samp{:level nil :indent t :narrow 40! :tcolumns 1}.
  6165. All are overwritten except if there is an explicit @samp{:narrow}.
  6166. @item :timestamp
  6167. A timestamp for the entry, when available. Look for SCHEDULED,
  6168. DEADLINE, TIMESTAMP and TIMESTAMP_IA special properties (see
  6169. @ref{Special Properties}), in this order.
  6170. @item :properties
  6171. List of properties shown in the table. Each property gets its
  6172. own column.
  6173. @item :inherit-props
  6174. When this flag is non-@code{nil}, the values for @samp{:properties} are
  6175. inherited.
  6176. @item :formula
  6177. Content of a @samp{TBLFM} keyword to be added and evaluated. As
  6178. a special case, @samp{:formula %} adds a column with % time. If you
  6179. do not specify a formula here, any existing formula below the
  6180. clock table survives updates and is evaluated.
  6181. @item :formatter
  6182. A function to format clock data and insert it into the buffer.
  6183. @end table
  6184. To get a clock summary of the current level 1 tree, for the current
  6185. day, you could write:
  6186. @example
  6187. #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
  6188. #+END: clocktable
  6189. @end example
  6190. @noindent
  6191. To use a specific time range you could write@footnote{Note that all parameters must be specified in a single
  6192. line---the line is broken here only to fit it into the manual.}
  6193. @example
  6194. #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
  6195. :tend "<2006-08-10 Thu 12:00>"
  6196. #+END: clocktable
  6197. @end example
  6198. A range starting a week ago and ending right now could be written as
  6199. @example
  6200. #+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
  6201. #+END: clocktable
  6202. @end example
  6203. A summary of the current subtree with % times would be:
  6204. @example
  6205. #+BEGIN: clocktable :scope subtree :link t :formula %
  6206. #+END: clocktable
  6207. @end example
  6208. A horizontally compact representation of everything clocked during
  6209. last week would be:
  6210. @example
  6211. #+BEGIN: clocktable :scope agenda :block lastweek :compact t
  6212. #+END: clocktable
  6213. @end example
  6214. @node Resolving idle time
  6215. @subsection Resolving idle time and continuous clocking
  6216. @anchor{Resolving idle time (1)}
  6217. @subsubheading Resolving idle time
  6218. @cindex resolve idle time
  6219. @cindex idle, resolve, dangling
  6220. If you clock in on a work item, and then walk away from your
  6221. computer---perhaps to take a phone call---you often need to
  6222. ``resolve'' the time you were away by either subtracting it from the
  6223. current clock, or applying it to another one.
  6224. @vindex org-clock-idle-time
  6225. @vindex org-clock-x11idle-program-name
  6226. By customizing the variable @code{org-clock-idle-time} to some integer,
  6227. such as 10 or 15, Emacs can alert you when you get back to your
  6228. computer after being idle for that many minutes@footnote{On computers using macOS, idleness is based on actual user
  6229. idleness, not just Emacs' idle time. For X11, you can install
  6230. a utility program @samp{x11idle.c}, available in the @samp{contrib/scripts/}
  6231. directory of the Org Git distribution, or install the xprintidle
  6232. package and set it to the variable @code{org-clock-x11idle-program-name} if
  6233. you are running Debian, to get the same general treatment of idleness.
  6234. On other systems, idle time refers to Emacs idle time only.}, and ask what
  6235. you want to do with the idle time. There will be a question waiting
  6236. for you when you get back, indicating how much idle time has passed
  6237. constantly updated with the current amount, as well as a set of
  6238. choices to correct the discrepancy:
  6239. @table @asis
  6240. @item @kbd{k}
  6241. @kindex k
  6242. To keep some or all of the minutes and stay clocked in, press
  6243. @kbd{k}. Org asks how many of the minutes to keep. Press
  6244. @kbd{@key{RET}} to keep them all, effectively changing nothing, or
  6245. enter a number to keep that many minutes.
  6246. @item @kbd{K}
  6247. @kindex K
  6248. If you use the shift key and press @kbd{K}, it keeps however
  6249. many minutes you request and then immediately clock out of that
  6250. task. If you keep all of the minutes, this is the same as just
  6251. clocking out of the current task.
  6252. @item @kbd{s}
  6253. @kindex s
  6254. To keep none of the minutes, use @kbd{s} to subtract all the
  6255. away time from the clock, and then check back in from the moment
  6256. you returned.
  6257. @item @kbd{S}
  6258. @kindex S
  6259. To keep none of the minutes and just clock out at the start of
  6260. the away time, use the shift key and press @kbd{S}.
  6261. Remember that using shift always leave you clocked out, no matter
  6262. which option you choose.
  6263. @item @kbd{C}
  6264. @kindex C
  6265. To cancel the clock altogether, use @kbd{C}. Note that if
  6266. instead of canceling you subtract the away time, and the
  6267. resulting clock amount is less than a minute, the clock is still
  6268. canceled rather than cluttering up the log with an empty entry.
  6269. @end table
  6270. What if you subtracted those away minutes from the current clock, and
  6271. now want to apply them to a new clock? Simply clock in to any task
  6272. immediately after the subtraction. Org will notice that you have
  6273. subtracted time ``on the books'', so to speak, and will ask if you want
  6274. to apply those minutes to the next task you clock in on.
  6275. There is one other instance when this clock resolution magic occurs.
  6276. Say you were clocked in and hacking away, and suddenly your cat chased
  6277. a mouse who scared a hamster that crashed into your UPS's power
  6278. button! You suddenly lose all your buffers, but thanks to auto-save
  6279. you still have your recent Org mode changes, including your last clock
  6280. in.
  6281. If you restart Emacs and clock into any task, Org will notice that you
  6282. have a dangling clock which was never clocked out from your last
  6283. session. Using that clock's starting time as the beginning of the
  6284. unaccounted-for period, Org will ask how you want to resolve that
  6285. time. The logic and behavior is identical to dealing with away time
  6286. due to idleness; it is just happening due to a recovery event rather
  6287. than a set amount of idle time.
  6288. You can also check all the files visited by your Org agenda for
  6289. dangling clocks at any time using @kbd{M-x org-resolve-clocks @key{RET}} (or @kbd{C-c C-x C-z}).
  6290. @anchor{Continuous clocking}
  6291. @subsubheading Continuous clocking
  6292. @cindex continuous clocking
  6293. @vindex org-clock-continuously
  6294. You may want to start clocking from the time when you clocked out the
  6295. previous task. To enable this systematically, set
  6296. @code{org-clock-continuously} to non-@code{nil}. Each time you clock in, Org
  6297. retrieves the clock-out time of the last clocked entry for this
  6298. session, and start the new clock from there.
  6299. If you only want this from time to time, use three universal prefix
  6300. arguments with @code{org-clock-in} and two @kbd{C-u C-u} with
  6301. @code{org-clock-in-last}.
  6302. @node Effort Estimates
  6303. @section Effort Estimates
  6304. @cindex effort estimates
  6305. @cindex @samp{EFFORT}, property
  6306. @vindex org-effort-property
  6307. If you want to plan your work in a very detailed way, or if you need
  6308. to produce offers with quotations of the estimated work effort, you
  6309. may want to assign effort estimates to entries. If you are also
  6310. clocking your work, you may later want to compare the planned effort
  6311. with the actual working time, a great way to improve planning
  6312. estimates. Effort estimates are stored in a special property
  6313. @samp{EFFORT}. You can set the effort for an entry with the following
  6314. commands:
  6315. @table @asis
  6316. @item @kbd{C-c C-x e} (@code{org-set-effort})
  6317. @kindex C-c C-x e
  6318. @findex org-set-effort
  6319. Set the effort estimate for the current entry. With a prefix
  6320. argument, set it to the next allowed value---see below. This
  6321. command is also accessible from the agenda with the @kbd{e}
  6322. key.
  6323. @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate})
  6324. @kindex C-c C-x C-e
  6325. @findex org-clock-modify-effort-estimate
  6326. Modify the effort estimate of the item currently being clocked.
  6327. @end table
  6328. Clearly the best way to work with effort estimates is through column
  6329. view (see @ref{Column View}). You should start by setting up discrete
  6330. values for effort estimates, and a @samp{COLUMNS} format that displays
  6331. these values together with clock sums---if you want to clock your
  6332. time. For a specific buffer you can use:
  6333. @example
  6334. #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
  6335. #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
  6336. @end example
  6337. noindent
  6338. @vindex org-global-properties
  6339. @vindex org-columns-default-format
  6340. or, even better, you can set up these values globally by customizing
  6341. the variables @code{org-global-properties} and
  6342. @code{org-columns-default-format}. In particular if you want to use this
  6343. setup also in the agenda, a global setup may be advised.
  6344. The way to assign estimates to individual items is then to switch to
  6345. column mode, and to use @kbd{S-@key{RIGHT}} and @kbd{S-@key{LEFT}} to
  6346. change the value. The values you enter are immediately summed up in
  6347. the hierarchy. In the column next to it, any clocked time is
  6348. displayed.
  6349. @vindex org-agenda-columns-add-appointments-to-effort-sum
  6350. If you switch to column view in the daily/weekly agenda, the effort
  6351. column summarizes the estimated work effort for each day@footnote{Please note the pitfalls of summing hierarchical data in
  6352. a flat list (@ref{Agenda Column View}).}, and
  6353. you can use this to find space in your schedule. To get an overview
  6354. of the entire part of the day that is committed, you can set the
  6355. option @code{org-agenda-columns-add-appointments-to-effort-sum}. The
  6356. appointments on a day that take place over a specified time interval
  6357. are then also added to the load estimate of the day.
  6358. Effort estimates can be used in secondary agenda filtering that is
  6359. triggered with the @kbd{/} key in the agenda (see @ref{Agenda Commands}). If you have these estimates defined consistently,
  6360. two or three key presses narrow down the list to stuff that fits into
  6361. an available time slot.
  6362. @node Timers
  6363. @section Taking Notes with a Relative Timer
  6364. @cindex relative timer
  6365. @cindex countdown timer
  6366. Org provides two types of timers. There is a relative timer that
  6367. counts up, which can be useful when taking notes during, for example,
  6368. a meeting or a video viewing. There is also a countdown timer.
  6369. The relative and countdown are started with separate commands.
  6370. @table @asis
  6371. @item @kbd{C-c C-x 0} (@code{org-timer-start})
  6372. @kindex C-c C-x 0
  6373. @findex org-timer-start
  6374. Start or reset the relative timer. By default, the timer is set
  6375. to 0. When called with a @kbd{C-u} prefix, prompt the user
  6376. for a starting offset. If there is a timer string at point, this
  6377. is taken as the default, providing a convenient way to restart
  6378. taking notes after a break in the process. When called with
  6379. a double prefix argument @kbd{C-u C-u}, change all timer
  6380. strings in the active region by a certain amount. This can be
  6381. used to fix timer strings if the timer was not started at exactly
  6382. the right moment.
  6383. @item @kbd{C-c C-x ;} (@code{org-timer-set-timer})
  6384. @kindex C-c C-x ;
  6385. @findex org-timer-set-timer
  6386. @vindex org-timer-default-timer
  6387. Start a countdown timer. The user is prompted for a duration.
  6388. @code{org-timer-default-timer} sets the default countdown value.
  6389. Giving a numeric prefix argument overrides this default value.
  6390. This command is available as @kbd{;} in agenda buffers.
  6391. @end table
  6392. Once started, relative and countdown timers are controlled with the
  6393. same commands.
  6394. @table @asis
  6395. @item @kbd{C-c C-x .} (@code{org-timer})
  6396. @kindex C-c C-x .
  6397. @findex org-timer
  6398. Insert a relative time into the buffer. The first time you use
  6399. this, the timer starts. Using a prefix argument restarts it.
  6400. @item @kbd{C-c C-x -} (@code{org-timer-item})
  6401. @kindex C-c C-x -
  6402. @findex org-timer-item
  6403. Insert a description list item with the current relative time.
  6404. With a prefix argument, first reset the timer to 0.
  6405. @item @kbd{M-@key{RET}} (@code{org-insert-heading})
  6406. @kindex M-RET
  6407. @findex org-insert-heading
  6408. Once the timer list is started, you can also use
  6409. @kbd{M-@key{RET}} to insert new timer items.
  6410. @item @kbd{C-c C-x ,} (@code{org-timer-pause-or-continue})
  6411. @kindex C-c C-x ,
  6412. @findex org-timer-pause-or-continue
  6413. Pause the timer, or continue it if it is already paused.
  6414. @item @kbd{C-c C-x _} (@code{org-timer-stop})
  6415. @kindex C-c C-x _
  6416. @findex org-timer-stop
  6417. Stop the timer. After this, you can only start a new timer, not
  6418. continue the old one. This command also removes the timer from
  6419. the mode line.
  6420. @end table
  6421. @node Capture Refile Archive
  6422. @chapter Capture, Refile, Archive
  6423. @cindex capture
  6424. An important part of any organization system is the ability to quickly
  6425. capture new ideas and tasks, and to associate reference material with
  6426. them. Org does this using a process called @emph{capture}. It also can
  6427. store files related to a task (@emph{attachments}) in a special directory.
  6428. Once in the system, tasks and projects need to be moved around.
  6429. Moving completed project trees to an archive file keeps the system
  6430. compact and fast.
  6431. @menu
  6432. * Capture:: Capturing new stuff.
  6433. * Attachments:: Add files to tasks.
  6434. * RSS Feeds:: Getting input from RSS feeds.
  6435. * Protocols:: External access to Emacs and Org.
  6436. * Refile and Copy:: Moving/copying a tree from one place to another.
  6437. * Archiving:: What to do with finished products.
  6438. @end menu
  6439. @node Capture
  6440. @section Capture
  6441. @cindex capture
  6442. Capture lets you quickly store notes with little interruption of your
  6443. work flow. Org's method for capturing new items is heavily inspired
  6444. by John Wiegley's excellent Remember package.
  6445. @menu
  6446. * Setting up capture:: Where notes will be stored.
  6447. * Using capture:: Commands to invoke and terminate capture.
  6448. * Capture templates:: Define the outline of different note types.
  6449. @end menu
  6450. @node Setting up capture
  6451. @subsection Setting up capture
  6452. The following customization sets a default target file for notes.
  6453. @vindex org-default-notes-file
  6454. @lisp
  6455. (setq org-default-notes-file (concat org-directory "/notes.org"))
  6456. @end lisp
  6457. You may also define a global key for capturing new material (see
  6458. @ref{Activation}).
  6459. @node Using capture
  6460. @subsection Using capture
  6461. @table @asis
  6462. @item @kbd{M-x org-capture} (@code{org-capture})
  6463. @findex org-capture
  6464. @cindex date tree
  6465. Display the capture templates menu. If you have templates
  6466. defined (see @ref{Capture templates}), it offers these templates for
  6467. selection or use a new Org outline node as the default template.
  6468. It inserts the template into the target file and switch to an
  6469. indirect buffer narrowed to this new node. You may then insert
  6470. the information you want.
  6471. @item @kbd{C-c C-c} (@code{org-capture-finalize})
  6472. @kindex C-c C-c @r{(Capture buffer)}
  6473. @findex org-capture-finalize
  6474. Once you have finished entering information into the capture
  6475. buffer, @kbd{C-c C-c} returns you to the window
  6476. configuration before the capture process, so that you can resume
  6477. your work without further distraction. When called with a prefix
  6478. argument, finalize and then jump to the captured item.
  6479. @item @kbd{C-c C-w} (@code{org-capture-refile})
  6480. @kindex C-c C-w @r{(Capture buffer)}
  6481. @findex org-capture-refile
  6482. Finalize the capture process by refiling the note to a different
  6483. place (see @ref{Refile and Copy}). Please realize that this is
  6484. a normal refiling command that will be executed---so the cursor
  6485. position at the moment you run this command is important. If you
  6486. have inserted a tree with a parent and children, first move the
  6487. cursor back to the parent. Any prefix argument given to this
  6488. command is passed on to the @code{org-refile} command.
  6489. @item @kbd{C-c C-k} (@code{org-capture-kill})
  6490. @kindex C-c C-k @r{(Capture buffer)}
  6491. @findex org-capture-kill
  6492. Abort the capture process and return to the previous state.
  6493. @end table
  6494. @kindex k c @r{(Agenda)}
  6495. You can also call @code{org-capture} in a special way from the agenda,
  6496. using the @kbd{k c} key combination. With this access, any
  6497. timestamps inserted by the selected capture template defaults to the
  6498. cursor date in the agenda, rather than to the current date.
  6499. To find the locations of the last stored capture, use @code{org-capture}
  6500. with prefix commands:
  6501. @table @asis
  6502. @item @kbd{C-u M-x org-capture}
  6503. Visit the target location of a capture template. You get to
  6504. select the template in the usual way.
  6505. @item @kbd{C-u C-u M-x org-capture}
  6506. Visit the last stored capture item in its buffer.
  6507. @end table
  6508. @vindex org-capture-bookmark
  6509. @vindex org-capture-last-stored
  6510. You can also jump to the bookmark @code{org-capture-last-stored}, which is
  6511. automatically created unless you set @code{org-capture-bookmark} to @code{nil}.
  6512. To insert the capture at point in an Org buffer, call @code{org-capture}
  6513. with a @code{C-0} prefix argument.
  6514. @node Capture templates
  6515. @subsection Capture templates
  6516. @cindex templates, for Capture
  6517. You can use templates for different types of capture items, and for
  6518. different target locations. The easiest way to create such templates
  6519. is through the customize interface.
  6520. @table @asis
  6521. @item @kbd{C}
  6522. @kindex C @r{(Capture menu}
  6523. @vindex org-capture-templates
  6524. Customize the variable @code{org-capture-templates}.
  6525. @end table
  6526. Before we give the formal description of template definitions, let's
  6527. look at an example. Say you would like to use one template to create
  6528. general TODO entries, and you want to put these entries under the
  6529. heading @samp{Tasks} in your file @samp{~/org/gtd.org}. Also, a date tree in
  6530. the file @samp{journal.org} should capture journal entries. A possible
  6531. configuration would look like:
  6532. @lisp
  6533. (setq org-capture-templates
  6534. '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
  6535. "* TODO %?\n %i\n %a")
  6536. ("j" "Journal" entry (file+datetree "~/org/journal.org")
  6537. "* %?\nEntered on %U\n %i\n %a")))
  6538. @end lisp
  6539. @noindent
  6540. If you then press @kbd{t} from the capture menu, Org will prepare
  6541. the template for you like this:
  6542. @example
  6543. * TODO
  6544. [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
  6545. @end example
  6546. @noindent
  6547. During expansion of the template, @code{%a} has been replaced by a link to
  6548. the location from where you called the capture command. This can be
  6549. extremely useful for deriving tasks from emails, for example. You
  6550. fill in the task definition, press @kbd{C-c C-c} and Org returns
  6551. you to the same place where you started the capture process.
  6552. To define special keys to capture to a particular template without
  6553. going through the interactive template selection, you can create your
  6554. key binding like this:
  6555. @lisp
  6556. (define-key global-map "\C-cx"
  6557. (lambda () (interactive) (org-capture nil "x")))
  6558. @end lisp
  6559. @menu
  6560. * Template elements:: What is needed for a complete template entry.
  6561. * Template expansion:: Filling in information about time and context.
  6562. * Templates in contexts:: Only show a template in a specific context.
  6563. @end menu
  6564. @node Template elements
  6565. @subsubsection Template elements
  6566. Now lets look at the elements of a template definition. Each entry in
  6567. @code{org-capture-templates} is a list with the following items:
  6568. @table @asis
  6569. @item keys
  6570. The keys that selects the template, as a string, characters only,
  6571. for example @samp{"a"}, for a template to be selected with a single
  6572. key, or @samp{"bt"} for selection with two keys. When using several
  6573. keys, keys using the same prefix key must be sequential in the
  6574. list and preceded by a 2-element entry explaining the prefix key,
  6575. for example:
  6576. @lisp
  6577. ("b" "Templates for marking stuff to buy")
  6578. @end lisp
  6579. @noindent
  6580. If you do not define a template for the @kbd{C} key, this
  6581. key opens the Customize buffer for this complex variable.
  6582. @item description
  6583. A short string describing the template, shown during selection.
  6584. @item type
  6585. The type of entry, a symbol. Valid values are:
  6586. @table @asis
  6587. @item @code{entry}
  6588. An Org mode node, with a headline. Will be filed as the child
  6589. of the target entry or as a top-level entry. The target file
  6590. should be an Org file.
  6591. @item @code{item}
  6592. A plain list item, placed in the first plain list at the
  6593. target location. Again the target file should be an Org
  6594. file.
  6595. @item @code{checkitem}
  6596. A checkbox item. This only differs from the plain list item
  6597. by the default template.
  6598. @item @code{table-line}
  6599. A new line in the first table at the target location. Where
  6600. exactly the line will be inserted depends on the properties
  6601. @code{:prepend} and @code{:table-line-pos} (see below).
  6602. @item @code{plain}
  6603. Text to be inserted as it is.
  6604. @end table
  6605. @item target
  6606. @vindex org-default-notes-file
  6607. @vindex org-directory
  6608. Specification of where the captured item should be placed. In
  6609. Org files, targets usually define a node. Entries will become
  6610. children of this node. Other types will be added to the table or
  6611. list in the body of this node. Most target specifications
  6612. contain a file name. If that file name is the empty string, it
  6613. defaults to @code{org-default-notes-file}. A file can also be given
  6614. as a variable or as a function called with no argument. When an
  6615. absolute path is not specified for a target, it is taken as
  6616. relative to @code{org-directory}.
  6617. Valid values are:
  6618. @table @asis
  6619. @item @samp{(file "path/to/file")}
  6620. Text will be placed at the beginning or end of that file.
  6621. @item @samp{(id "id of existing org entry")}
  6622. Filing as child of this entry, or in the body of the entry.
  6623. @item @samp{(file+headline "filename" "node headline")}
  6624. Fast configuration if the target heading is unique in the file.
  6625. @item @samp{(file+olp "filename" "Level 1 heading" "Level 2" ...)}
  6626. For non-unique headings, the full path is safer.
  6627. @item @samp{(file+regexp "filename" "regexp to find location")}
  6628. Use a regular expression to position the cursor.
  6629. @item @samp{(file+olp+datetree "filename" [ "Level 1 heading" ...])}
  6630. This target@footnote{Org used to offer four different targets for date/week tree
  6631. capture. Now, Org automatically translates these to use
  6632. @code{file+olp+datetree}, applying the @code{:time-prompt} and @code{:tree-type}
  6633. properties. Please rewrite your date/week-tree targets using
  6634. @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
  6635. level, months or ISO weeks as sublevels and then dates on the lowest
  6636. level. Tags are allowed in the tree structure.} for
  6637. today's date. If the optional outline path is given, the tree
  6638. will be built under the node it is pointing to, instead of at
  6639. top level. Check out the @code{:time-prompt} and @code{:tree-type}
  6640. properties below for additional options.
  6641. @item @code{(file+function "filename" function-finding-location)}
  6642. A function to find the right location in the file.
  6643. @item @code{(clock)}
  6644. File to the entry that is currently being clocked.
  6645. @item @code{(function function-finding-location)}
  6646. Most general way: write your own function which both visits the
  6647. file and moves point to the right location.
  6648. @end table
  6649. @item template
  6650. The template for creating the capture item. If you leave this
  6651. empty, an appropriate default template will be used. Otherwise
  6652. this is a string with escape codes, which will be replaced
  6653. depending on time and context of the capture call. The string
  6654. with escapes may be loaded from a template file, using the
  6655. special syntax @samp{(file "template filename")}. See below for more
  6656. details.
  6657. @item properties
  6658. The rest of the entry is a property list of additional options.
  6659. Recognized properties are:
  6660. @table @asis
  6661. @item @code{:prepend}
  6662. Normally new captured information will be appended at the
  6663. target location (last child, last table line, last list item,
  6664. @dots{}). Setting this property changes that.
  6665. @item @code{:immediate-finish}
  6666. When set, do not offer to edit the information, just file it
  6667. away immediately. This makes sense if the template only needs
  6668. information that can be added automatically.
  6669. @item @code{:empty-lines}
  6670. Set this to the number of lines to insert before and after the
  6671. new item. Default 0, and the only other common value is 1.
  6672. @item @code{:clock-in}
  6673. Start the clock in this item.
  6674. @item @code{:clock-keep}
  6675. Keep the clock running when filing the captured entry.
  6676. @item @code{:clock-resume}
  6677. If starting the capture interrupted a clock, restart that clock
  6678. when finished with the capture. Note that @code{:clock-keep} has
  6679. precedence over @code{:clock-resume}. When setting both to
  6680. non-@code{nil}, the current clock will run and the previous one will
  6681. not be resumed.
  6682. @item @code{:time-prompt}
  6683. Prompt for a date/time to be used for date/week trees and when
  6684. filling the template. Without this property, capture uses the
  6685. current date and time. Even if this property has not been set,
  6686. you can force the same behavior by calling @code{org-capture} with
  6687. a @kbd{C-1} prefix argument.
  6688. @item @code{:tree-type}
  6689. When @code{week}, make a week tree instead of the month tree, i.e.,
  6690. place the headings for each day under a heading with the
  6691. current ISO week.
  6692. @item @code{:unnarrowed}
  6693. Do not narrow the target buffer, simply show the full buffer. Default
  6694. is to narrow it so that you only see the new material.
  6695. @item @code{:table-line-pos}
  6696. Specification of the location in the table where the new line
  6697. should be inserted. It should be a string like @samp{II-3} meaning
  6698. that the new line should become the third line before the
  6699. second horizontal separator line.
  6700. @item @code{:kill-buffer}
  6701. If the target file was not yet visited when capture was invoked, kill
  6702. the buffer again after capture is completed.
  6703. @end table
  6704. @end table
  6705. @node Template expansion
  6706. @subsubsection Template expansion
  6707. In the template itself, special ``%-escapes''@footnote{If you need one of these sequences literally, escape the @samp{%}
  6708. with a backslash.} allow dynamic
  6709. insertion of content. The templates are expanded in the order given
  6710. here:
  6711. @table @asis
  6712. @item @code{%[FILE]}
  6713. Insert the contents of the file given by @var{FILE}.
  6714. @item @code{%(SEXP)}
  6715. Evaluate Elisp SEXP and replace with the result. The
  6716. @var{SEXP} must return a string.
  6717. @item @code{%<FORMAT>}
  6718. The result of format-time-string on the @var{FORMAT}
  6719. specification.
  6720. @item @code{%t}
  6721. Timestamp, date only.
  6722. @item @code{%T}
  6723. Timestamp, with date and time.
  6724. @item @code{%u}, @code{%U}
  6725. Like @code{%t}, @code{%T} above, but inactive timestamps.
  6726. @item @code{%i}
  6727. Initial content, the region when capture is called while the
  6728. region is active. The entire text will be indented like @code{%i}
  6729. itself.
  6730. @item @code{%a}
  6731. Annotation, normally the link created with @code{org-store-link}.
  6732. @item @code{%A}
  6733. Like @code{%a}, but prompt for the description part.
  6734. @item @code{%l}
  6735. Like @code{%a}, but only insert the literal link.
  6736. @item @code{%c}
  6737. Current kill ring head.
  6738. @item @code{%x}
  6739. Content of the X clipboard.
  6740. @item @code{%k}
  6741. Title of the currently clocked task.
  6742. @item @code{%K}
  6743. Link to the currently clocked task.
  6744. @item @code{%n}
  6745. User name (taken from @code{user-full-name}).
  6746. @item @code{%f}
  6747. File visited by current buffer when org-capture was called.
  6748. @item @code{%F}
  6749. Full path of the file or directory visited by current buffer.
  6750. @item @code{%:keyword}
  6751. Specific information for certain link types, see below.
  6752. @item @code{%^g}
  6753. Prompt for tags, with completion on tags in target file.
  6754. @item @code{%^G}
  6755. Prompt for tags, with completion all tags in all agenda files.
  6756. @item @code{%^t}
  6757. Like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}. You may
  6758. define a prompt like @code{%^@{Birthday@}t}.
  6759. @item @code{%^C}
  6760. Interactive selection of which kill or clip to use.
  6761. @item @code{%^L}
  6762. Like @code{%^C}, but insert as link.
  6763. @item @code{%^@{PROP@}p}
  6764. Prompt the user for a value for property PROP.
  6765. @item @code{%^@{PROMPT@}}
  6766. Prompt the user for a string and replace this sequence with it.
  6767. You may specify a default value and a completion table with
  6768. @code{%^@{prompt|default|completion2|completion3...@}}. The arrow keys
  6769. access a prompt-specific history.
  6770. @item @code{%\n}
  6771. Insert the text entered at the Nth @code{%^@{PROMPT@}}, where N is
  6772. a number, starting from 1.
  6773. @item @code{%?}
  6774. After completing the template, position cursor here.
  6775. @end table
  6776. @noindent
  6777. @vindex org-store-link-props
  6778. 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
  6779. accessed in capture templates in a similar way.}:
  6780. @vindex org-from-is-user-regexp
  6781. @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  6782. @headitem Link type
  6783. @tab Available keywords
  6784. @item bbdb
  6785. @tab @code{%:name}, @code{%:company}
  6786. @item irc
  6787. @tab @code{%:server}, @code{%:port}, @code{%:nick}
  6788. @item mh, rmail
  6789. @tab @code{%:type}, @code{%:subject}, @code{%:message-id}
  6790. @item
  6791. @tab @code{%:from}, @code{%:fromname}, @code{%:fromaddress}
  6792. @item
  6793. @tab @code{%:to}, @code{%:toname}, @code{%:toaddress}
  6794. @item
  6795. @tab @code{%:date} (message date header field)
  6796. @item
  6797. @tab @code{%:date-timestamp} (date as active timestamp)
  6798. @item
  6799. @tab @code{%:date-timestamp-inactive} (date as inactive timestamp)
  6800. @item
  6801. @tab @code{%:fromto} (either ``to NAME'' or ``from NAME'')@footnote{This is always the other, not the user. See the variable
  6802. @code{org-from-is-user-regexp}.}
  6803. @item gnus
  6804. @tab @code{%:group}, for messages also all email fields
  6805. @item w3, w3m
  6806. @tab @code{%:url}
  6807. @item info
  6808. @tab @code{%:file}, @code{%:node}
  6809. @item calendar
  6810. @tab @code{%:date}
  6811. @item org-protocol
  6812. @tab @code{%:link}, @code{%:description}, @code{%:annotation}
  6813. @end multitable
  6814. @node Templates in contexts
  6815. @subsubsection Templates in contexts
  6816. @vindex org-capture-templates-contexts
  6817. To control whether a capture template should be accessible from
  6818. a specific context, you can customize
  6819. @code{org-capture-templates-contexts}. Let's say, for example, that you
  6820. have a capture template ``p'' for storing Gnus emails containing
  6821. patches. Then you would configure this option like this:
  6822. @lisp
  6823. (setq org-capture-templates-contexts
  6824. '(("p" (in-mode . "message-mode"))))
  6825. @end lisp
  6826. You can also tell that the command key @kbd{p} should refer to
  6827. another template. In that case, add this command key like this:
  6828. @lisp
  6829. (setq org-capture-templates-contexts
  6830. '(("p" "q" (in-mode . "message-mode"))))
  6831. @end lisp
  6832. See the docstring of the variable for more information.
  6833. @node Attachments
  6834. @section Attachments
  6835. @cindex attachments
  6836. @vindex org-attach-directory
  6837. It is often useful to associate reference material with an outline
  6838. node/task. Small chunks of plain text can simply be stored in the
  6839. subtree of a project. Hyperlinks (see @ref{Hyperlinks}) can establish
  6840. associations with files that live elsewhere on your computer or in the
  6841. cloud, like emails or source code files belonging to a project.
  6842. Another method is @emph{attachments}, which are files located in
  6843. a directory belonging to an outline node. Org uses directories named
  6844. by the unique ID of each entry. These directories are located in the
  6845. @code{data} directory which lives in the same directory where your Org file
  6846. lives@footnote{If you move entries or Org files from one directory to
  6847. another, you may want to configure @code{org-attach-directory} to contain
  6848. an absolute path.}. If you initialize this directory with @samp{git init}, Org
  6849. automatically commits changes when it sees them. The attachment
  6850. system has been contributed to Org by John Wiegley.
  6851. In cases where it seems better to do so, you can attach a directory of
  6852. your choice to an entry. You can also make children inherit the
  6853. attachment directory from a parent, so that an entire subtree uses the
  6854. same attached directory.
  6855. @noindent
  6856. The following commands deal with attachments:
  6857. @table @asis
  6858. @item @kbd{C-c C-a} (@code{org-attach})
  6859. @kindex C-c C-a
  6860. @findex org-attach
  6861. The dispatcher for commands related to the attachment system.
  6862. After these keys, a list of commands is displayed and you must
  6863. press an additional key to select a command:
  6864. @table @asis
  6865. @item @kbd{a} (@code{org-attach-attach})
  6866. @kindex C-c C-a a
  6867. @findex org-attach-attach
  6868. @vindex org-attach-method
  6869. Select a file and move it into the task's attachment
  6870. directory. The file is copied, moved, or linked, depending
  6871. on @code{org-attach-method}. Note that hard links are not
  6872. supported on all systems.
  6873. @item @kbd{c}/@kbd{m}/@kbd{l}
  6874. @kindex C-c C-a c
  6875. @kindex C-c C-a m
  6876. @kindex C-c C-a l
  6877. Attach a file using the copy/move/link method. Note that
  6878. hard links are not supported on all systems.
  6879. @item @kbd{n} (@code{org-attach-new})
  6880. @kindex C-c C-a n
  6881. @findex org-attach-new
  6882. Create a new attachment as an Emacs buffer.
  6883. @item @kbd{z} (@code{org-attach-sync})
  6884. @kindex C-c C-a z
  6885. @findex org-attach-sync
  6886. Synchronize the current task with its attachment directory, in case
  6887. you added attachments yourself.
  6888. @item @kbd{o} (@code{org-attach-open})
  6889. @kindex C-c C-a o
  6890. @findex org-attach-open
  6891. @vindex org-file-apps
  6892. Open current task's attachment. If there is more than one,
  6893. prompt for a file name first. Opening follows the rules set
  6894. by @code{org-file-apps}. For more details, see the information
  6895. on following hyperlinks (see @ref{Handling Links}).
  6896. @item @kbd{O} (@code{org-attach-open-in-emacs})
  6897. @kindex C-c C-a O
  6898. @findex org-attach-open-in-emacs
  6899. Also open the attachment, but force opening the file in
  6900. Emacs.
  6901. @item @kbd{f} (@code{org-attach-reveal})
  6902. @kindex C-c C-a f
  6903. @findex org-attach-reveal
  6904. Open the current task's attachment directory.
  6905. @item @kbd{F} (@code{org-attach-reveal-in-emacs})
  6906. @kindex C-c C-a F
  6907. @findex org-attach-reveal-in-emacs
  6908. Also open the directory, but force using Dired in Emacs.
  6909. @item @kbd{d} (@code{org-attach-delete-one})
  6910. @kindex C-c C-a d
  6911. Select and delete a single attachment.
  6912. @item @kbd{D} (@code{org-attach-delete-all})
  6913. @kindex C-c C-a D
  6914. Delete all of a task's attachments. A safer way is to open
  6915. the directory in Dired and delete from there.
  6916. @item @kbd{s} (@code{org-attach-set-directory})
  6917. @kindex C-c C-a s
  6918. @cindex @samp{ATTACH_DIR}, property
  6919. Set a specific directory as the entry's attachment
  6920. directory. This works by putting the directory path into
  6921. the @samp{ATTACH_DIR} property.
  6922. @item @kbd{i} (@code{org-attach-set-inherit})
  6923. @kindex C-c C-a i
  6924. @cindex @samp{ATTACH_DIR_INHERIT}, property
  6925. Set the @samp{ATTACH_DIR_INHERIT} property, so that children use
  6926. the same directory for attachments as the parent does.
  6927. @end table
  6928. @end table
  6929. @cindex attach from Dired
  6930. @findex org-attach-dired-to-subtree
  6931. It is possible to attach files to a subtree from a Dired buffer. To
  6932. use this feature, have one window in Dired mode containing the file(s)
  6933. to be attached and another window with point in the subtree that shall
  6934. get the attachments. In the Dired window, with point on a file,
  6935. @kbd{M-x org-attach-dired-to-subtree} attaches the file to the
  6936. subtree using the attachment method set by variable
  6937. @code{org-attach-method}. When files are marked in the Dired window then
  6938. all marked files get attached.
  6939. Add the following lines to the Emacs init file to have @kbd{C-c C-x a} attach files in Dired buffers.
  6940. @lisp
  6941. (add-hook 'dired-mode-hook
  6942. (lambda ()
  6943. (define-key dired-mode-map
  6944. (kbd "C-c C-x a")
  6945. #'org-attach-dired-to-subtree))))
  6946. @end lisp
  6947. The following code shows how to bind the previous command with
  6948. a specific attachment method.
  6949. @lisp
  6950. (add-hook 'dired-mode-hook
  6951. (lambda ()
  6952. (define-key dired-mode-map (kbd "C-c C-x c")
  6953. (lambda ()
  6954. (interactive)
  6955. (let ((org-attach-method 'cp))
  6956. (call-interactively #'org-attach-dired-to-subtree))))))
  6957. @end lisp
  6958. @node RSS Feeds
  6959. @section RSS Feeds
  6960. @cindex RSS feeds
  6961. @cindex Atom feeds
  6962. Org can add and change entries based on information found in RSS feeds
  6963. and Atom feeds. You could use this to make a task out of each new
  6964. podcast in a podcast feed. Or you could use a phone-based
  6965. note-creating service on the web to import tasks into Org. To access
  6966. feeds, configure the variable @code{org-feed-alist}. The docstring of this
  6967. variable has detailed information. With the following
  6968. @lisp
  6969. (setq org-feed-alist
  6970. '(("Slashdot"
  6971. "http://rss.slashdot.org/Slashdot/slashdot"
  6972. "~/txt/org/feeds.org" "Slashdot Entries")))
  6973. @end lisp
  6974. @noindent
  6975. new items from the feed provided by @samp{rss.slashdot.org} result in new
  6976. entries in the file @samp{~/org/feeds.org} under the heading @samp{Slashdot
  6977. Entries}, whenever the following command is used:
  6978. @table @asis
  6979. @item @kbd{C-c C-x g} (@code{org-feed-update-all})
  6980. @kindex C-c C-x g
  6981. Collect items from the feeds configured in @code{org-feed-alist} and
  6982. act upon them.
  6983. @item @kbd{C-c C-x G} (@code{org-feed-goto-inbox})
  6984. @kindex C-c C-x G
  6985. Prompt for a feed name and go to the inbox configured for this feed.
  6986. @end table
  6987. Under the same headline, Org creates a drawer @samp{FEEDSTATUS} in which it
  6988. stores information about the status of items in the feed, to avoid
  6989. adding the same item several times.
  6990. For more information, including how to read atom feeds, see
  6991. @samp{org-feed.el} and the docstring of @code{org-feed-alist}.
  6992. @node Protocols
  6993. @section Protocols for External Access
  6994. @cindex protocols, for external access
  6995. Org protocol is a means to trigger custom actions in Emacs from
  6996. external applications. Any application that supports calling external
  6997. programs with an URL as argument may be used with this functionality.
  6998. For example, you can configure bookmarks in your web browser to send
  6999. a link to the current page to Org and create a note from it using
  7000. capture (see @ref{Capture}). You can also create a bookmark that tells
  7001. Emacs to open the local source file of a remote website you are
  7002. browsing.
  7003. @cindex Org protocol, set-up
  7004. @cindex Installing Org protocol
  7005. In order to use Org protocol from an application, you need to register
  7006. @samp{org-protocol://} as a valid scheme-handler. External calls are
  7007. passed to Emacs through the @samp{emacsclient} command, so you also need to
  7008. ensure an Emacs server is running. More precisely, when the
  7009. application calls
  7010. @example
  7011. emacsclient org-protocol://PROTOCOL?key1=val1&key2=val2
  7012. @end example
  7013. @noindent
  7014. Emacs calls the handler associated to @var{PROTOCOL} with
  7015. argument @samp{(:key1 val1 :key2 val2)}.
  7016. @cindex protocol, new protocol
  7017. @cindex defining new protocols
  7018. Org protocol comes with three predefined protocols, detailed in the
  7019. following sections. Configure @code{org-protocol-protocol-alist} to define
  7020. your own.
  7021. @menu
  7022. * @code{store-link} protocol:: Store a link, push URL to kill-ring.
  7023. * @code{capture} protocol:: Fill a buffer with external information.
  7024. * @code{open-source} protocol:: Edit published contents.
  7025. @end menu
  7026. @node @code{store-link} protocol
  7027. @subsection @code{store-link} protocol
  7028. @cindex store-link protocol
  7029. @cindex protocol, store-link
  7030. Using @code{store-link} handler, you can copy links, insertable through
  7031. @kbd{M-x org-insert-link} or yanking thereafter. More precisely,
  7032. the command
  7033. @example
  7034. emacsclient org-protocol://store-link?url=URL&title=TITLE
  7035. @end example
  7036. @noindent
  7037. stores the following link:
  7038. @example
  7039. [[URL][TITLE]]
  7040. @end example
  7041. In addition, @var{URL} is pushed on the kill-ring for yanking.
  7042. You need to encode @var{URL} and @var{TITLE} if they contain
  7043. slashes, and probably quote those for the shell.
  7044. To use this feature from a browser, add a bookmark with an arbitrary
  7045. name, e.g., @samp{Org: store-link} and enter this as @emph{Location}:
  7046. @example
  7047. javascript:location.href='org-protocol://store-link?url='+
  7048. encodeURIComponent(location.href);
  7049. @end example
  7050. @node @code{capture} protocol
  7051. @subsection @code{capture} protocol
  7052. @cindex capture protocol
  7053. @cindex protocol, capture
  7054. Activating ``capture'' handler pops up a @samp{Capture} buffer and fills the
  7055. capture template associated to the @samp{X} key with them.
  7056. @example
  7057. emacsclient org-protocol://capture?template=X?url=URL?title=TITLE?body=BODY
  7058. @end example
  7059. To use this feature, add a bookmark with an arbitrary name, e.g.
  7060. @samp{Org: capture} and enter this as @samp{Location}:
  7061. @example
  7062. javascript:location.href='org-protocol://capture?template=x'+
  7063. '&url='+encodeURIComponent(window.location.href)+
  7064. '&title='+encodeURIComponent(document.title)+
  7065. '&body='+encodeURIComponent(window.getSelection());
  7066. @end example
  7067. @vindex org-protocol-default-template-key
  7068. The result depends on the capture template used, which is set in the
  7069. bookmark itself, as in the example above, or in
  7070. @code{org-protocol-default-template-key}.
  7071. The following template placeholders are available:
  7072. @example
  7073. %:link The URL
  7074. %:description The webpage title
  7075. %:annotation Equivalent to [[%:link][%:description]]
  7076. %i The selected text
  7077. @end example
  7078. @node @code{open-source} protocol
  7079. @subsection @code{open-source} protocol
  7080. @cindex open-source protocol
  7081. @cindex protocol, open-source
  7082. The @code{open-source} handler is designed to help with editing local
  7083. sources when reading a document. To that effect, you can use
  7084. a bookmark with the following location:
  7085. @example
  7086. javascript:location.href='org-protocol://open-source?&url='+
  7087. encodeURIComponent(location.href)
  7088. @end example
  7089. @vindex org-protocol-project-alist
  7090. The variable @code{org-protocol-project-alist} maps URLs to local file
  7091. names, by stripping URL parameters from the end and replacing the
  7092. @code{:base-url} with @code{:working-directory} and @code{:online-suffix} with
  7093. @code{:working-suffix}. For example, assuming you own a local copy of
  7094. @samp{https://orgmode.org/worg/} contents at @samp{/home/user/worg}, you can set
  7095. @code{org-protocol-project-alist} to the following
  7096. @lisp
  7097. (setq org-protocol-project-alist
  7098. '(("Worg"
  7099. :base-url "https://orgmode.org/worg/"
  7100. :working-directory "/home/user/worg/"
  7101. :online-suffix ".html"
  7102. :working-suffix ".org")))
  7103. @end lisp
  7104. @noindent
  7105. If you are now browsing
  7106. @samp{https://orgmode.org/worg/org-contrib/org-protocol.html} and find
  7107. a typo or have an idea about how to enhance the documentation, simply
  7108. click the bookmark and start editing.
  7109. @cindex rewritten URL in open-source protocol
  7110. @cindex protocol, open-source rewritten URL
  7111. However, such mapping may not yield the desired results. Suppose you
  7112. maintain an online store located at @samp{http://example.com/}. The local
  7113. sources reside in @samp{/home/user/example/}. It is common practice to
  7114. serve all products in such a store through one file and rewrite URLs
  7115. that do not match an existing file on the server. That way, a request
  7116. to @samp{http://example.com/print/posters.html} might be rewritten on the
  7117. server to something like
  7118. @samp{http://example.com/shop/products.php/posters.html.php}. The
  7119. @code{open-source} handler probably cannot find a file named
  7120. @samp{/home/user/example/print/posters.html.php} and fails.
  7121. Such an entry in @code{org-protocol-project-alist} may hold an additional
  7122. property @code{:rewrites}. This property is a list of cons cells, each of
  7123. which maps a regular expression to a path relative to the
  7124. @code{:working-directory}.
  7125. Now map the URL to the path @samp{/home/user/example/products.php} by
  7126. adding @code{:rewrites} rules like this:
  7127. @lisp
  7128. (setq org-protocol-project-alist
  7129. '(("example.com"
  7130. :base-url "http://example.com/"
  7131. :working-directory "/home/user/example/"
  7132. :online-suffix ".php"
  7133. :working-suffix ".php"
  7134. :rewrites (("example.com/print/" . "products.php")
  7135. ("example.com/$" . "index.php")))))
  7136. @end lisp
  7137. @noindent
  7138. Since @samp{example.com/$} is used as a regular expression, it maps
  7139. @samp{http://example.com/}, @samp{https://example.com},
  7140. @samp{http://www.example.com/} and similar to
  7141. @samp{/home/user/example/index.php}.
  7142. The @code{:rewrites} rules are searched as a last resort if and only if no
  7143. existing file name is matched.
  7144. @cindex protocol, open-source, set-up mapping
  7145. @cindex mappings in open-source protocol
  7146. @findex org-protocol-create
  7147. @findex org-protocol-create-for-org
  7148. Two functions can help you filling @code{org-protocol-project-alist} with
  7149. valid contents: @code{org-protocol-create} and
  7150. @code{org-protocol-create-for-org}. The latter is of use if you're editing
  7151. an Org file that is part of a publishing project.
  7152. @node Refile and Copy
  7153. @section Refile and Copy
  7154. @cindex refiling notes
  7155. @cindex copying notes
  7156. When reviewing the captured data, you may want to refile or to copy
  7157. some of the entries into a different list, for example into a project.
  7158. Cutting, finding the right location, and then pasting the note is
  7159. cumbersome. To simplify this process, you can use the following
  7160. special command:
  7161. @table @asis
  7162. @item @kbd{C-c M-w} (@code{org-copy})
  7163. @kindex C-c M-w
  7164. @findex org-copy
  7165. Copying works like refiling, except that the original note is not
  7166. deleted.
  7167. @item @kbd{C-c C-w} (@code{org-refile})
  7168. @kindex C-c C-w
  7169. @findex org-refile
  7170. @vindex org-reverse-note-order
  7171. @vindex org-refile-targets
  7172. @vindex org-refile-use-outline-path
  7173. @vindex org-outline-path-complete-in-steps
  7174. @vindex org-refile-allow-creating-parent-nodes
  7175. @vindex org-log-refile
  7176. Refile the entry or region at point. This command offers
  7177. possible locations for refiling the entry and lets you select one
  7178. with completion. The item (or all items in the region) is filed
  7179. below the target heading as a subitem. Depending on
  7180. @code{org-reverse-note-order}, it is either the first or last subitem.
  7181. By default, all level 1 headlines in the current buffer are
  7182. considered to be targets, but you can have more complex
  7183. definitions across a number of files. See the variable
  7184. @code{org-refile-targets} for details. If you would like to select
  7185. a location via a file-path-like completion along the outline
  7186. path, see the variables @code{org-refile-use-outline-path} and
  7187. @code{org-outline-path-complete-in-steps}. If you would like to be
  7188. able to create new nodes as new parents for refiling on the fly,
  7189. check the variable @code{org-refile-allow-creating-parent-nodes}.
  7190. When the variable @code{org-log-refile}@footnote{Note the corresponding @samp{STARTUP} options @samp{logrefile},
  7191. @samp{lognoterefile}, and @samp{nologrefile}.} is set, a timestamp or
  7192. a note is recorded whenever an entry is refiled.
  7193. @item @kbd{C-u C-c C-w}
  7194. @kindex C-u C-c C-w
  7195. Use the refile interface to jump to a heading.
  7196. @item @kbd{C-u C-u C-c C-w} (@code{org-refile-goto-last-stored})
  7197. @kindex C-u C-u C-c C-w
  7198. @findex org-refile-goto-last-stored
  7199. Jump to the location where @code{org-refile} last moved a tree to.
  7200. @item @kbd{C-2 C-c C-w}
  7201. @kindex C-2 C-c C-w
  7202. Refile as the child of the item currently being clocked.
  7203. @item @kbd{C-3 C-c C-w}
  7204. @kindex C-3 C-c C-w
  7205. @vindex org-refile-keep
  7206. Refile and keep the entry in place. Also see @code{org-refile-keep}
  7207. to make this the default behavior, and beware that this may
  7208. result in duplicated @code{ID} properties.
  7209. @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})
  7210. @kindex C-u C-u C-u C-c C-w
  7211. @kindex C-0 C-c C-w
  7212. @findex org-refile-cache-clear
  7213. @vindex org-refile-use-cache
  7214. Clear the target cache. Caching of refile targets can be turned
  7215. on by setting @code{org-refile-use-cache}. To make the command see
  7216. new possible targets, you have to clear the cache with this
  7217. command.
  7218. @end table
  7219. @node Archiving
  7220. @section Archiving
  7221. @cindex archiving
  7222. When a project represented by a (sub)tree is finished, you may want to
  7223. move the tree out of the way and to stop it from contributing to the
  7224. agenda. Archiving is important to keep your working files compact and
  7225. global searches like the construction of agenda views fast.
  7226. @table @asis
  7227. @item @kbd{C-c C-x C-a} (@code{org-archive-subtree-default})
  7228. @kindex C-c C-x C-a
  7229. @findex org-archive-subtree-default
  7230. @vindex org-archive-default-command
  7231. Archive the current entry using the command specified in the
  7232. variable @code{org-archive-default-command}.
  7233. @end table
  7234. @menu
  7235. * Moving subtrees:: Moving a tree to an archive file.
  7236. * Internal archiving:: Switch off a tree but keep it in the file.
  7237. @end menu
  7238. @node Moving subtrees
  7239. @subsection Moving a tree to an archive file
  7240. @cindex external archiving
  7241. The most common archiving action is to move a project tree to another
  7242. file, the archive file.
  7243. @table @asis
  7244. @item @kbd{C-c C-x C-s} or short @kbd{C-c $} (@code{org-archive-subtree})
  7245. @kindex C-c C-x C-s
  7246. @kindex C-c $
  7247. @findex org-archive-subtree
  7248. @vindex org-archive-location
  7249. Archive the subtree starting at the cursor position to the
  7250. location given by @code{org-archive-location}.
  7251. @item @kbd{C-u C-c C-x C-s}
  7252. @kindex C-u C-c C-x C-s
  7253. Check if any direct children of the current headline could be
  7254. moved to the archive. To do this, check each subtree for open
  7255. TODO entries. If none is found, the command offers to move it to
  7256. the archive location. If the cursor is @emph{not} on a headline when
  7257. this command is invoked, check level 1 trees.
  7258. @item @kbd{C-u C-u C-c C-x C-s}
  7259. @kindex C-u C-u C-c C-x C-s
  7260. As above, but check subtree for timestamps instead of TODO
  7261. entries. The command offers to archive the subtree if it @emph{does}
  7262. contain a timestamp, and that timestamp is in the past.
  7263. @end table
  7264. @cindex archive locations
  7265. The default archive location is a file in the same directory as the
  7266. current file, with the name derived by appending @samp{_archive} to the
  7267. current file name. You can also choose what heading to file archived
  7268. items under, with the possibility to add them to a datetree in a file.
  7269. For information and examples on how to specify the file and the
  7270. heading, see the documentation string of the variable
  7271. @code{org-archive-location}.
  7272. There is also an in-buffer option for setting this variable, for
  7273. example:
  7274. @cindex @samp{ARCHIVE}, keyword
  7275. @example
  7276. #+ARCHIVE: %s_done::
  7277. @end example
  7278. @noindent
  7279. @cindex ARCHIVE, property
  7280. If you would like to have a special archive location for a single
  7281. entry or a (sub)tree, give the entry an @samp{ARCHIVE} property with the
  7282. location as the value (see @ref{Properties and Columns}).
  7283. @vindex org-archive-save-context-info
  7284. When a subtree is moved, it receives a number of special properties
  7285. that record context information like the file from where the entry
  7286. came, its outline path the archiving time etc. Configure the variable
  7287. @code{org-archive-save-context-info} to adjust the amount of information
  7288. added.
  7289. @node Internal archiving
  7290. @subsection Internal archiving
  7291. @cindex @samp{ARCHIVE}, tag
  7292. If you want to just switch off---for agenda views---certain subtrees
  7293. without moving them to a different file, you can use the @samp{ARCHIVE}
  7294. tag.
  7295. A headline that is marked with the @samp{ARCHIVE} tag (see @ref{Tags}) stays at
  7296. its location in the outline tree, but behaves in the following way:
  7297. @itemize
  7298. @item
  7299. @vindex org-cycle-open-archived-trees
  7300. It does not open when you attempt to do so with a visibility cycling
  7301. command (see @ref{Visibility Cycling}). You can force cycling archived
  7302. subtrees with @kbd{C-@key{TAB}}, or by setting the option
  7303. @code{org-cycle-open-archived-trees}. Also normal outline commands, like
  7304. @code{outline-show-all}, open archived subtrees.
  7305. @item
  7306. @vindex org-sparse-tree-open-archived-trees
  7307. During sparse tree construction (see @ref{Sparse Trees}), matches in
  7308. archived subtrees are not exposed, unless you configure the option
  7309. @code{org-sparse-tree-open-archived-trees}.
  7310. @item
  7311. @vindex org-agenda-skip-archived-trees
  7312. During agenda view construction (see @ref{Agenda Views}), the content of
  7313. archived trees is ignored unless you configure the option
  7314. @code{org-agenda-skip-archived-trees}, in which case these trees are
  7315. always included. In the agenda you can press @kbd{v a} to get
  7316. archives temporarily included.
  7317. @item
  7318. @vindex org-export-with-archived-trees
  7319. Archived trees are not exported (see @ref{Exporting}), only the headline
  7320. is. Configure the details using the variable
  7321. @code{org-export-with-archived-trees}.
  7322. @item
  7323. @vindex org-columns-skip-archived-trees
  7324. Archived trees are excluded from column view unless the variable
  7325. @code{org-columns-skip-archived-trees} is configured to @code{nil}.
  7326. @end itemize
  7327. The following commands help manage the @samp{ARCHIVE} tag:
  7328. @table @asis
  7329. @item @kbd{C-c C-x a} (@code{org-toggle-archive-tag})
  7330. @kindex C-c C-x a
  7331. @findex org-toggle-archive-tag
  7332. Toggle the archive tag for the current headline. When the tag is
  7333. set, the headline changes to a shadowed face, and the subtree
  7334. below it is hidden.
  7335. @item @kbd{C-u C-c C-x a}
  7336. @kindex C-u C-c C-x a
  7337. Check if any direct children of the current headline should be
  7338. archived. To do this, check each subtree for open TODO entries.
  7339. If none is found, the command offers to set the @samp{ARCHIVE} tag for
  7340. the child. If the cursor is @emph{not} on a headline when this
  7341. command is invoked, check the level 1 trees.
  7342. @item @kbd{C-@key{TAB}}, @code{org-force-cycle-archived}
  7343. @kindex C-TAB
  7344. Cycle a tree even if it is tagged with @samp{ARCHIVE}.
  7345. @item @kbd{C-c C-x A} (@code{org-archive-to-archive-sibling})
  7346. @kindex C-c C-x A
  7347. @findex org-archive-to-archive-sibling
  7348. Move the current entry to the @emph{Archive Sibling}. This is
  7349. a sibling of the entry with the heading @samp{Archive} and the archive
  7350. tag. The entry becomes a child of that sibling and in this way
  7351. retains a lot of its original context, including inherited tags
  7352. and approximate position in the outline.
  7353. @end table
  7354. @node Agenda Views
  7355. @chapter Agenda Views
  7356. @cindex agenda views
  7357. Due to the way Org works, TODO items, time-stamped items, and tagged
  7358. headlines can be scattered throughout a file or even a number of
  7359. files. To get an overview of open action items, or of events that are
  7360. important for a particular date, this information must be collected,
  7361. sorted and displayed in an organized way.
  7362. Org can select items based on various criteria and display them in
  7363. a separate buffer. Seven different view types are provided:
  7364. @itemize
  7365. @item
  7366. an @emph{agenda} that is like a calendar and shows information for
  7367. specific dates,
  7368. @item
  7369. a @emph{TODO list} that covers all unfinished action items,
  7370. @item
  7371. a @emph{match view}, showings headlines based on the tags, properties,
  7372. and TODO state associated with them,
  7373. @item
  7374. a @emph{timeline view} that shows all events in a single Org file, in
  7375. time-sorted view,
  7376. @item
  7377. a @emph{text search view} that shows all entries from multiple files that
  7378. contain specified keywords,
  7379. @item
  7380. a @emph{stuck projects view} showing projects that currently do not move
  7381. along, and
  7382. @item
  7383. @emph{custom views} that are special searches and combinations of
  7384. different views.
  7385. @end itemize
  7386. @noindent
  7387. The extracted information is displayed in a special @emph{agenda buffer}.
  7388. This buffer is read-only, but provides commands to visit the
  7389. corresponding locations in the original Org files, and even to edit
  7390. these files remotely.
  7391. @vindex org-agenda-skip-comment-trees
  7392. @vindex org-agenda-skip-archived-trees
  7393. @cindex commented entries, in agenda views
  7394. @cindex archived entries, in agenda views
  7395. By default, the report ignores commented (see @ref{Comment Lines}) and
  7396. archived (see @ref{Internal archiving}) entries. You can override this by
  7397. setting @code{org-agenda-skip-comment-trees} and
  7398. @code{org-agenda-skip-archived-trees} to @code{nil}.
  7399. @vindex org-agenda-window-setup
  7400. @vindex org-agenda-restore-windows-after-quit
  7401. Two variables control how the agenda buffer is displayed and whether
  7402. the window configuration is restored when the agenda exits:
  7403. @code{org-agenda-window-setup} and @code{org-agenda-restore-windows-after-quit}.
  7404. @menu
  7405. * Agenda Files:: Files being searched for agenda information.
  7406. * Agenda Dispatcher:: Keyboard access to agenda views.
  7407. * Built-in Agenda Views:: What is available out of the box?
  7408. * Presentation and Sorting:: How agenda items are prepared for display.
  7409. * Agenda Commands:: Remote editing of Org trees.
  7410. * Custom Agenda Views:: Defining special searches and views.
  7411. * Exporting Agenda Views:: Writing a view to a file.
  7412. * Agenda Column View:: Using column view for collected entries.
  7413. @end menu
  7414. @node Agenda Files
  7415. @section Agenda Files
  7416. @cindex agenda files
  7417. @cindex files for agenda
  7418. @vindex org-agenda-files
  7419. The information to be shown is normally collected from all @emph{agenda
  7420. 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
  7421. name, then the list of agenda files in maintained in that external
  7422. file.}.
  7423. If a directory is part of this list, all files with the extension
  7424. @samp{.org} in this directory are part of the list.
  7425. Thus, even if you only work with a single Org file, that file should
  7426. be put into the list@footnote{When using the dispatcher, pressing @kbd{<} before
  7427. selecting a command actually limits the command to the current file,
  7428. and ignores @code{org-agenda-files} until the next dispatcher command.}. You can customize @code{org-agenda-files},
  7429. but the easiest way to maintain it is through the following commands
  7430. @table @asis
  7431. @item @kbd{C-c [} (@code{org-agenda-file-to-front})
  7432. @kindex C-c [
  7433. @findex org-agenda-file-to-front
  7434. @cindex files, adding to agenda list
  7435. Add current file to the list of agenda files. The file is added
  7436. to the front of the list. If it was already in the list, it is
  7437. moved to the front. With a prefix argument, file is added/moved
  7438. to the end.
  7439. @item @kbd{C-c ]} (@code{org-remove-file})
  7440. @kindex C-c ]
  7441. @findex org-remove-file
  7442. Remove current file from the list of agenda files.
  7443. @item @kbd{C-'}
  7444. @itemx @kbd{C-,} (@code{org-cycle-agenda-files})
  7445. @kindex C-'
  7446. @kindex C-,
  7447. @findex org-cycle-agenda-files
  7448. @cindex cycling, of agenda files
  7449. Cycle through agenda file list, visiting one file after the other.
  7450. @item @kbd{M-x org-switchb}
  7451. @findex org-switchb
  7452. Command to use an iswitchb-like interface to switch to and
  7453. between Org buffers.
  7454. @end table
  7455. @noindent
  7456. The Org menu contains the current list of files and can be used to
  7457. visit any of them.
  7458. If you would like to focus the agenda temporarily on a file not in
  7459. this list, or on just one file in the list, or even on only a subtree
  7460. in a file, then this can be done in different ways. For a single
  7461. agenda command, you may press @kbd{<} once or several times in
  7462. the dispatcher (see @ref{Agenda Dispatcher}). To restrict the agenda
  7463. scope for an extended period, use the following commands:
  7464. @table @asis
  7465. @item @kbd{C-c C-x <} (@code{org-agenda-set-restriction-lock})
  7466. @kindex C-c C-x <
  7467. @findex org-agenda-set-restriction-lock
  7468. Permanently restrict the agenda to the current subtree. When
  7469. called with a prefix argument, or with the cursor before the
  7470. first headline in a file, set the agenda scope to the entire
  7471. file. This restriction remains in effect until removed with
  7472. @kbd{C-c C-x >}, or by typing either @kbd{<} or
  7473. @kbd{>} in the agenda dispatcher. If there is a window
  7474. displaying an agenda view, the new restriction takes effect
  7475. immediately.
  7476. @item @kbd{C-c C-x >} (@code{org-agenda-remove-restriction-lock})
  7477. @kindex C-c C-x >
  7478. @findex org-agenda-remove-restriction-lock
  7479. Remove the permanent restriction created by @kbd{C-c C-x <}.
  7480. @end table
  7481. @noindent
  7482. When working with @samp{speedbar.el}, you can use the following commands in
  7483. the Speedbar frame:
  7484. @table @asis
  7485. @item @kbd{<} (@code{org-speedbar-set-agenda-restriction})
  7486. @findex org-speedbar-set-agenda-restriction
  7487. Permanently restrict the agenda to the item---either an Org file
  7488. or a subtree in such a file---at the cursor in the Speedbar
  7489. frame. If there is a window displaying an agenda view, the new
  7490. restriction takes effect immediately.
  7491. @item @kbd{>} (@code{org-agenda-remove-restriction-lock})
  7492. @findex org-agenda-remove-restriction-lock
  7493. Lift the restriction.
  7494. @end table
  7495. @node Agenda Dispatcher
  7496. @section The Agenda Dispatcher
  7497. @cindex agenda dispatcher
  7498. @cindex dispatching agenda commands
  7499. The views are created through a dispatcher, accessible with @kbd{M-x org-agenda}, or, better, bound to a global key (see @ref{Activation}).
  7500. It displays a menu from which an additional letter is required to
  7501. execute a command. The dispatcher offers the following default
  7502. commands:
  7503. @table @asis
  7504. @item @kbd{a}
  7505. Create the calendar-like agenda (see @ref{Weekly/daily agenda}).
  7506. @item @kbd{t} or @kbd{T}
  7507. Create a list of all TODO items (see @ref{Global TODO list}).
  7508. @item @kbd{m} or @kbd{M}
  7509. Create a list of headlines matching a given expression (see
  7510. @ref{Matching tags and properties}).
  7511. @item @kbd{s}
  7512. @kindex s @r{(Agenda dispatcher)}
  7513. Create a list of entries selected by a boolean expression of
  7514. keywords and/or regular expressions that must or must not occur
  7515. in the entry.
  7516. @item @kbd{/}
  7517. @kindex / @r{(Agenda dispatcher)}
  7518. @vindex org-agenda-text-search-extra-files
  7519. Search for a regular expression in all agenda files and
  7520. additionally in the files listed in
  7521. @code{org-agenda-text-search-extra-files}. This uses the Emacs
  7522. command @code{multi-occur}. A prefix argument can be used to specify
  7523. the number of context lines for each match, default is
  7524. @enumerate
  7525. @item
  7526. @end enumerate
  7527. @item @kbd{#} or @kbd{!}
  7528. Create a list of stuck projects (see @ref{Stuck projects}).
  7529. @item @kbd{<}
  7530. @kindex < @r{(Agenda dispatcher)}
  7531. Restrict an agenda command to the current buffer@footnote{For backward compatibility, you can also press @kbd{1} to
  7532. restrict to the current buffer.}. After
  7533. pressing @kbd{<}, you still need to press the character
  7534. selecting the command.
  7535. @item @kbd{< <}
  7536. @kindex < < @r{(Agenda dispatcher)}
  7537. If there is an active region, restrict the following agenda
  7538. command to the region. Otherwise, restrict it to the current
  7539. subtree@footnote{For backward compatibility, you can also press @kbd{0} to
  7540. restrict to the current region/subtree.}. After pressing @kbd{< <}, you still need to
  7541. press the character selecting the command.
  7542. @item @kbd{*}
  7543. @kindex * @r{(Agenda dispatcher)}
  7544. @vindex org-agenda-sticky
  7545. @findex org-toggle-sticky-agenda
  7546. Toggle sticky agenda views. By default, Org maintains only
  7547. a single agenda buffer and rebuilds it each time you change the
  7548. view, to make sure everything is always up to date. If you
  7549. switch between views often and the build time bothers you, you
  7550. can turn on sticky agenda buffers (make this the default by
  7551. customizing the variable @code{org-agenda-sticky}). With sticky
  7552. agendas, the dispatcher only switches to the selected view, you
  7553. need to update it by hand with @kbd{r} or @kbd{g}. You
  7554. can toggle sticky agenda view any time with
  7555. @code{org-toggle-sticky-agenda}.
  7556. @end table
  7557. You can also define custom commands that are accessible through the
  7558. dispatcher, just like the default commands. This includes the
  7559. possibility to create extended agenda buffers that contain several
  7560. blocks together, for example the weekly agenda, the global TODO list
  7561. and a number of special tags matches. See @ref{Custom Agenda Views}.
  7562. @node Built-in Agenda Views
  7563. @section The Built-in Agenda Views
  7564. In this section we describe the built-in views.
  7565. @menu
  7566. * Weekly/daily agenda:: The calendar page with current tasks.
  7567. * Global TODO list:: All unfinished action items.
  7568. * Matching tags and properties:: Structured information with fine-tuned search.
  7569. * Search view:: Find entries by searching for text.
  7570. * Stuck projects:: Find projects you need to review.
  7571. @end menu
  7572. @node Weekly/daily agenda
  7573. @subsection Weekly/daily agenda
  7574. @cindex agenda
  7575. @cindex weekly agenda
  7576. @cindex daily agenda
  7577. The purpose of the weekly/daily @emph{agenda} is to act like a page of
  7578. a paper agenda, showing all the tasks for the current week or day.
  7579. @table @asis
  7580. @item @kbd{M-x org-agenda a} (@code{org-agenda-list})
  7581. @kindex a @r{(Agenda dispatcher)}
  7582. @findex org-agenda-list
  7583. @cindex org-agenda, command
  7584. Compile an agenda for the current week from a list of Org files.
  7585. The agenda shows the entries for each day. With a numeric prefix
  7586. argument@footnote{For backward compatibility, the universal prefix argument
  7587. @kbd{C-u} causes all TODO entries to be listed before the agenda.
  7588. This feature is deprecated, use the dedicated TODO list, or a block
  7589. agenda instead (see @ref{Block agenda}).}---like @kbd{C-u 2 1 M-x org-agenda a}---you
  7590. may set the number of days to be displayed.
  7591. @end table
  7592. @vindex org-agenda-span
  7593. @vindex org-agenda-start-day
  7594. @vindex org-agenda-start-on-weekday
  7595. The default number of days displayed in the agenda is set by the
  7596. variable @code{org-agenda-span}. This variable can be set to any number of
  7597. days you want to see by default in the agenda, or to a span name, such
  7598. a @code{day}, @code{week}, @code{month} or @code{year}. For weekly agendas, the default
  7599. is to start on the previous Monday (see
  7600. @code{org-agenda-start-on-weekday}). You can also set the start date using
  7601. a date shift: @code{(setq org-agenda-start-day "+10d")} starts the agenda
  7602. ten days from today in the future.
  7603. Remote editing from the agenda buffer means, for example, that you can
  7604. change the dates of deadlines and appointments from the agenda buffer.
  7605. The commands available in the Agenda buffer are listed in @ref{Agenda Commands}.
  7606. @anchor{Calendar/Diary integration}
  7607. @subsubheading Calendar/Diary integration
  7608. @cindex calendar integration
  7609. @cindex diary integration
  7610. Emacs contains the calendar and diary by Edward M. Reingold. The
  7611. calendar displays a three-month calendar with holidays from different
  7612. countries and cultures. The diary allows you to keep track of
  7613. anniversaries, lunar phases, sunrise/set, recurrent appointments
  7614. (weekly, monthly) and more. In this way, it is quite complementary to
  7615. Org. It can be very useful to combine output from Org with the diary.
  7616. In order to include entries from the Emacs diary into Org mode's
  7617. agenda, you only need to customize the variable
  7618. @lisp
  7619. (setq org-agenda-include-diary t)
  7620. @end lisp
  7621. @noindent
  7622. After that, everything happens automatically. All diary entries
  7623. including holidays, anniversaries, etc., are included in the agenda
  7624. buffer created by Org mode. @kbd{@key{SPC}}, @kbd{@key{TAB}}, and
  7625. @kbd{@key{RET}} can be used from the agenda buffer to jump to the diary
  7626. file in order to edit existing diary entries. The @kbd{i}
  7627. command to insert new entries for the current date works in the agenda
  7628. buffer, as well as the commands @kbd{S}, @kbd{M}, and
  7629. @kbd{C} to display Sunrise/Sunset times, show lunar phases and to
  7630. convert to other calendars, respectively. @kbd{c} can be used to
  7631. switch back and forth between calendar and agenda.
  7632. If you are using the diary only for S-exp entries and holidays, it is
  7633. faster to not use the above setting, but instead to copy or even move
  7634. the entries into an Org file. Org mode evaluates diary-style sexp
  7635. entries, and does it faster because there is no overhead for first
  7636. creating the diary display. Note that the sexp entries must start at
  7637. the left margin, no whitespace is allowed before them, as seen in the
  7638. following segment of an Org file:@footnote{The variable @code{org-anniversary} used in the example is just
  7639. like @code{diary-anniversary}, but the argument order is always according
  7640. to ISO and therefore independent of the value of
  7641. @code{calendar-date-style}.}
  7642. @example
  7643. * Holidays
  7644. :PROPERTIES:
  7645. :CATEGORY: Holiday
  7646. :END:
  7647. %%(org-calendar-holiday) ; special function for holiday names
  7648. * Birthdays
  7649. :PROPERTIES:
  7650. :CATEGORY: Ann
  7651. :END:
  7652. %%(org-anniversary 1956 5 14) Arthur Dent is %d years old
  7653. %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old
  7654. @end example
  7655. @anchor{Anniversaries from BBDB}
  7656. @subsubheading Anniversaries from BBDB
  7657. @cindex BBDB, anniversaries
  7658. @cindex anniversaries, from BBDB
  7659. @findex org-bbdb-anniversaries
  7660. If you are using the Insidious Big Brother Database to store your
  7661. contacts, you very likely prefer to store anniversaries in BBDB rather
  7662. than in a separate Org or diary file. Org supports this and can show
  7663. BBDB anniversaries as part of the agenda. All you need to do is to
  7664. add the following to one of your agenda files:
  7665. @example
  7666. * Anniversaries
  7667. :PROPERTIES:
  7668. :CATEGORY: Anniv
  7669. :END:
  7670. %%(org-bbdb-anniversaries)
  7671. @end example
  7672. You can then go ahead and define anniversaries for a BBDB record.
  7673. Basically, you need to press @kbd{C-o anniversary @key{RET}} with the
  7674. cursor in a BBDB record and then add the date in the format
  7675. @samp{YYYY-MM-DD} or @samp{MM-DD}, followed by a space and the class of the
  7676. anniversary (@samp{birthday}, @samp{wedding}, or a format string). If you omit
  7677. the class, it defaults to @samp{birthday}. Here are a few examples, the
  7678. header for the file @samp{org-bbdb.el} contains more detailed information.
  7679. @example
  7680. 1973-06-22
  7681. 06-22
  7682. 1955-08-02 wedding
  7683. 2008-04-14 %s released version 6.01 of Org mode, %d years ago
  7684. @end example
  7685. After a change to BBDB, or for the first agenda display during an
  7686. Emacs session, the agenda display suffers a short delay as Org updates
  7687. its hash with anniversaries. However, from then on things will be
  7688. very fast, much faster in fact than a long list of
  7689. @samp{%%(diary-anniversary)} entries in an Org or Diary file.
  7690. @findex org-bbdb-anniversaries-future
  7691. If you would like to see upcoming anniversaries with a bit of
  7692. forewarning, you can use the following instead:
  7693. @example
  7694. * Anniversaries
  7695. :PROPERTIES:
  7696. :CATEGORY: Anniv
  7697. :END:
  7698. %%(org-bbdb-anniversaries-future 3)
  7699. @end example
  7700. That will give you three days' warning: on the anniversary date itself
  7701. and the two days prior. The argument is optional: if omitted, it
  7702. defaults to 7.
  7703. @anchor{Appointment reminders}
  7704. @subsubheading Appointment reminders
  7705. @cindex @file{appt.el}
  7706. @cindex appointment reminders
  7707. @cindex appointment
  7708. @cindex reminders
  7709. @cindex APPT_WARNTIME, keyword
  7710. Org can interact with Emacs appointments notification facility. To
  7711. add the appointments of your agenda files, use the command
  7712. @code{org-agenda-to-appt}. This command lets you filter through the list
  7713. of your appointments and add only those belonging to a specific
  7714. category or matching a regular expression. It also reads
  7715. a @samp{APPT_WARNTIME} property which overrides the value of
  7716. @code{appt-message-warning-time} for this appointment. See the docstring
  7717. for details.
  7718. @node Global TODO list
  7719. @subsection The global TODO list
  7720. @cindex global TODO list
  7721. @cindex TODO list, global
  7722. The global TODO list contains all unfinished TODO items formatted and
  7723. collected into a single place.
  7724. @table @asis
  7725. @item @kbd{M-x org-agenda t} (@code{org-todo-list})
  7726. @kindex t @r{(Agenda dispatcher)}
  7727. @findex org-todo-list
  7728. Show the global TODO list. This collects the TODO items from all
  7729. agenda files (see @ref{Agenda Views}) into a single buffer. By
  7730. default, this lists items with a state the is not a DONE state.
  7731. The buffer is in @code{agenda-mode}, so there are commands to examine
  7732. and manipulate the TODO entries directly from that buffer (see
  7733. @ref{Agenda Commands}).
  7734. @item @kbd{M-x org-agenda T} (@code{org-todo-list})
  7735. @kindex T @r{(Agenda dispatcher)}
  7736. @findex org-todo-list
  7737. @cindex TODO keyword matching
  7738. @vindex org-todo-keywords
  7739. Like the above, but allows selection of a specific TODO keyword.
  7740. You can also do this by specifying a prefix argument to
  7741. @kbd{t}. You are prompted for a keyword, and you may also
  7742. specify several keywords by separating them with @samp{|} as the
  7743. boolean OR operator. With a numeric prefix, the Nth keyword in
  7744. @code{org-todo-keywords} is selected.
  7745. @kindex r
  7746. The @kbd{r} key in the agenda buffer regenerates it, and you
  7747. can give a prefix argument to this command to change the selected
  7748. TODO keyword, for example @kbd{3 r}. If you often need
  7749. a search for a specific keyword, define a custom command for it
  7750. (see @ref{Agenda Dispatcher}).
  7751. Matching specific TODO keywords can also be done as part of
  7752. a tags search (see @ref{Tag Searches}).
  7753. @end table
  7754. Remote editing of TODO items means that you can change the state of
  7755. a TODO entry with a single key press. The commands available in the
  7756. TODO list are described in @ref{Agenda Commands}.
  7757. @cindex sublevels, inclusion into TODO list
  7758. Normally the global TODO list simply shows all headlines with TODO
  7759. keywords. This list can become very long. There are two ways to keep
  7760. it more compact:
  7761. @itemize
  7762. @item
  7763. @vindex org-agenda-todo-ignore-scheduled
  7764. @vindex org-agenda-todo-ignore-deadlines
  7765. @vindex org-agenda-todo-ignore-timestamp
  7766. @vindex org-agenda-todo-ignore-with-date
  7767. Some people view a TODO item that has been @emph{scheduled} for execution
  7768. or have a @emph{deadline} (see @ref{Timestamps}) as
  7769. no longer @emph{open}. Configure the variables
  7770. @code{org-agenda-todo-ignore-scheduled},
  7771. @code{org-agenda-todo-ignore-deadlines},
  7772. @code{org-agenda-todo-ignore-timestamp} and/or
  7773. @code{org-agenda-todo-ignore-with-date} to exclude such items from the
  7774. global TODO list.
  7775. @item
  7776. @vindex org-agenda-todo-list-sublevels
  7777. TODO items may have sublevels to break up the task into subtasks.
  7778. In such cases it may be enough to list only the highest level TODO
  7779. headline and omit the sublevels from the global list. Configure the
  7780. variable @code{org-agenda-todo-list-sublevels} to get this behavior.
  7781. @end itemize
  7782. @node Matching tags and properties
  7783. @subsection Matching tags and properties
  7784. @cindex matching, of tags
  7785. @cindex matching, of properties
  7786. @cindex tags view
  7787. @cindex match view
  7788. If headlines in the agenda files are marked with @emph{tags} (see @ref{Tags}),
  7789. or have properties (see @ref{Properties and Columns}), you can select
  7790. headlines based on this metadata and collect them into an agenda
  7791. buffer. The match syntax described here also applies when creating
  7792. sparse trees with @kbd{C-c / m}.
  7793. @table @asis
  7794. @item @kbd{M-x org-agenda m} (@code{org-tags-view})
  7795. @kindex m @r{(Agenda dispatcher)}
  7796. @findex org-tags-view
  7797. Produce a list of all headlines that match a given set of tags.
  7798. The command prompts for a selection criterion, which is a boolean
  7799. logic expression with tags, like @samp{+work+urgent-withboss} or
  7800. @samp{work|home} (see @ref{Tags}). If you often need a specific search,
  7801. define a custom command for it (see @ref{Agenda Dispatcher}).
  7802. @item @kbd{M-x org-agenda M} (@code{org-tags-view})
  7803. @kindex M @r{(Agenda dispatcher)}
  7804. @findex org-tags-view
  7805. @vindex org-tags-match-list-sublevels
  7806. @vindex org-agenda-tags-todo-honor-ignore-options
  7807. Like @kbd{m}, but only select headlines that are also TODO
  7808. items and force checking subitems (see the variable
  7809. @code{org-tags-match-list-sublevels}). To exclude scheduled/deadline
  7810. items, see the variable
  7811. @code{org-agenda-tags-todo-honor-ignore-options}. Matching specific
  7812. TODO keywords together with a tags match is also possible, see
  7813. @ref{Tag Searches}.
  7814. @end table
  7815. The commands available in the tags list are described in @ref{Agenda Commands}.
  7816. @cindex boolean logic, for agenda searches
  7817. A search string can use Boolean operators @samp{&} for AND and @samp{|} for OR.
  7818. @samp{&} binds more strongly than @samp{|}. Parentheses are currently not
  7819. implemented. Each element in the search is either a tag, a regular
  7820. expression matching tags, or an expression like @samp{PROPERTY OPERATOR
  7821. VALUE} with a comparison operator, accessing a property value. Each
  7822. element may be preceded by @samp{-} to select against it, and @samp{+} is
  7823. syntactic sugar for positive selection. The AND operator @samp{&} is
  7824. optional when @samp{+} or @samp{-} is present. Here are some examples, using
  7825. only tags.
  7826. @table @asis
  7827. @item @code{+work-boss}
  7828. Select headlines tagged @samp{work}, but discard those also tagged
  7829. @samp{boss}.
  7830. @item @code{work|laptop}
  7831. Selects lines tagged @samp{work} or @samp{laptop}.
  7832. @item @code{work|laptop+night}
  7833. Like before, but require the @samp{laptop} lines to be tagged
  7834. also @samp{night}.
  7835. @end table
  7836. @cindex regular expressions, with tags search
  7837. Instead of a tag, you may also specify a regular expression enclosed
  7838. in curly braces. For example, @samp{work+@{^boss.*@}} matches headlines that
  7839. contain the tag @samp{:work:} and any tag @emph{starting} with @samp{boss}.
  7840. @cindex group tags, as regular expressions
  7841. Group tags (see @ref{Tag Hierarchy}) are expanded as regular expressions.
  7842. E.g., if @samp{work} is a group tag for the group @samp{:work:lab:conf:}, then
  7843. searching for @samp{work} also searches for @samp{@{\(?:work\|lab\|conf\)@}} and
  7844. searching for @samp{-work} searches for all headlines but those with one of
  7845. the tags in the group (i.e., @samp{-@{\(?:work\|lab\|conf\)@}}).
  7846. @cindex TODO keyword matching, with tags search
  7847. @cindex level, for tags/property match
  7848. @cindex category, for tags/property match
  7849. @vindex org-odd-levels-only
  7850. You may also test for properties (see @ref{Properties and Columns}) at the
  7851. same time as matching tags. The properties may be real properties, or
  7852. special properties that represent other metadata (see @ref{Special Properties}). For example, the property @samp{TODO} represents the TODO
  7853. keyword of the entry. Or, the property @samp{LEVEL} represents the level
  7854. of an entry. So searching @samp{+LEVEL=3+boss-TODO​="DONE"} lists all level
  7855. three headlines that have the tag @samp{boss} and are @emph{not} marked with the
  7856. TODO keyword @samp{DONE}. In buffers with @code{org-odd-levels-only} set,
  7857. @samp{LEVEL} does not count the number of stars, but @samp{LEVEL=2} corresponds
  7858. to 3 stars etc.
  7859. Here are more examples:
  7860. @table @asis
  7861. @item @samp{work+TODO​="WAITING"}
  7862. Select @samp{work}-tagged TODO lines with the specific TODO keyword
  7863. @samp{WAITING}.
  7864. @item @samp{work+TODO​="WAITING"|home+TODO​="WAITING"}
  7865. Waiting tasks both at work and at home.
  7866. @end table
  7867. When matching properties, a number of different operators can be used
  7868. to test the value of a property. Here is a complex example:
  7869. @example
  7870. +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2
  7871. +With=@{Sarah|Denny@}+SCHEDULED>="<2008-10-11>"
  7872. @end example
  7873. @noindent
  7874. The type of comparison depends on how the comparison value is written:
  7875. @itemize
  7876. @item
  7877. If the comparison value is a plain number, a numerical comparison is
  7878. done, and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=}, @samp{>=}, and
  7879. @samp{<>}.
  7880. @item
  7881. If the comparison value is enclosed in double-quotes, a string
  7882. comparison is done, and the same operators are allowed.
  7883. @item
  7884. If the comparison value is enclosed in double-quotes @emph{and} angular
  7885. brackets (like @samp{DEADLINE<​="<2008-12-24 18:30>"}), both values are
  7886. assumed to be date/time specifications in the standard Org way, and
  7887. the comparison is done accordingly. Valid values also include
  7888. @samp{"<now>"} for now (including time), @samp{"<today>"}, and @samp{"<tomorrow>"}
  7889. for these days at 0:00 hours, i.e., without a time specification.
  7890. You can also use strings like @samp{"<+5d>"} or @samp{"<-2m>"} with units @samp{d},
  7891. @samp{w}, @samp{m}, and @samp{y} for day, week, month, and year, respectively.
  7892. @item
  7893. If the comparison value is enclosed in curly braces, a regexp match
  7894. is performed, with @samp{=} meaning that the regexp matches the property
  7895. value, and @samp{<>} meaning that it does not match.
  7896. @end itemize
  7897. So the search string in the example finds entries tagged @samp{work} but
  7898. not @samp{boss}, which also have a priority value @samp{A}, a @samp{Coffee} property
  7899. with the value @samp{unlimited}, an @samp{EFFORT} property that is numerically
  7900. smaller than 2, a @samp{With} property that is matched by the regular
  7901. expression @samp{Sarah|Denny}, and that are scheduled on or after October
  7902. 11, 2008.
  7903. You can configure Org mode to use property inheritance during
  7904. a search, but beware that this can slow down searches considerably.
  7905. See @ref{Property Inheritance}, for details.
  7906. For backward compatibility, and also for typing speed, there is also
  7907. a different way to test TODO states in a search. For this, terminate
  7908. the tags/property part of the search string (which may include several
  7909. terms connected with @samp{|}) with a @samp{/} and then specify a Boolean
  7910. expression just for TODO keywords. The syntax is then similar to that
  7911. for tags, but should be applied with care: for example, a positive
  7912. selection on several TODO keywords cannot meaningfully be combined
  7913. with boolean AND. However, @emph{negative selection} combined with AND can
  7914. be meaningful. To make sure that only lines are checked that actually
  7915. 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
  7916. with @samp{!}. Using @kbd{M-x org-agenda M} or @samp{/!} does not match
  7917. TODO keywords in a DONE state. Examples:
  7918. @table @asis
  7919. @item @samp{work/WAITING}
  7920. Same as @samp{work+TODO​="WAITING"}.
  7921. @item @samp{work/!-WAITING-NEXT}
  7922. Select @samp{work}-tagged TODO lines that are neither @samp{WAITING} nor
  7923. @samp{NEXT}.
  7924. @item @samp{work/!+WAITING|+NEXT}
  7925. Select @samp{work}-tagged TODO lines that are either @samp{WAITING} or
  7926. @samp{NEXT}.
  7927. @end table
  7928. @node Search view
  7929. @subsection Search view
  7930. @cindex search view
  7931. @cindex text search
  7932. @cindex searching, for text
  7933. This agenda view is a general text search facility for Org mode
  7934. entries. It is particularly useful to find notes.
  7935. @table @asis
  7936. @item @kbd{M-x org-agenda s} (@code{org-search-view})
  7937. @kindex s @r{(Agenda dispatcher)}
  7938. @findex org-search-view
  7939. This is a special search that lets you select entries by matching
  7940. a substring or specific words using a boolean logic.
  7941. @end table
  7942. For example, the search string @samp{computer equipment} matches entries
  7943. that contain @samp{computer equipment} as a substring, even if the two
  7944. words are separated by more space or a line break.
  7945. Search view can also search for specific keywords in the entry, using
  7946. Boolean logic. The search string @samp{+computer
  7947. +wifi -ethernet -@{8\.11[bg]@}} matches note entries that contain the
  7948. keywords @samp{computer} and @samp{wifi}, but not the keyword @samp{ethernet}, and
  7949. which are also not matched by the regular expression @samp{8\.11[bg]},
  7950. meaning to exclude both @samp{8.11b} and @samp{8.11g}. The first @samp{+} is
  7951. necessary to turn on boolean search, other @samp{+} characters are
  7952. optional. For more details, see the docstring of the command
  7953. @code{org-search-view}.
  7954. You can incrementally adjust a boolean search with the following keys
  7955. @multitable @columnfractions 0.1 0.6
  7956. @item @kbd{[}
  7957. @tab Add a positive search word
  7958. @item @kbd{]}
  7959. @tab Add a negative search word
  7960. @item @kbd{@{}
  7961. @tab Add a positive regular expression
  7962. @item @kbd{@}}
  7963. @tab Add a negative regular expression
  7964. @end multitable
  7965. @vindex org-agenda-text-search-extra-files
  7966. Note that in addition to the agenda files, this command also searches
  7967. the files listed in @code{org-agenda-text-search-extra-files}.
  7968. @node Stuck projects
  7969. @subsection Stuck projects
  7970. @pindex GTD, Getting Things Done
  7971. If you are following a system like David Allen's GTD to organize your
  7972. work, one of the ``duties'' you have is a regular review to make sure
  7973. that all projects move along. A @emph{stuck} project is a project that has
  7974. no defined next actions, so it never shows up in the TODO lists Org
  7975. mode produces. During the review, you need to identify such projects
  7976. and define next actions for them.
  7977. @table @asis
  7978. @item @kbd{M-x org-agenda #} (@code{org-agenda-list-stuck-projects})
  7979. @kindex # @r{(Agenda dispatcher)}
  7980. @findex org-agenda-list-stuck-projects
  7981. List projects that are stuck.
  7982. @item @kbd{M-x org-agenda !}
  7983. @kindex ! @r{(Agenda dispatcher)}
  7984. @vindex org-stuck-projects
  7985. Customize the variable @code{org-stuck-projects} to define what
  7986. a stuck project is and how to find it.
  7987. @end table
  7988. You almost certainly need to configure this view before it works for
  7989. you. The built-in default assumes that all your projects are level-2
  7990. headlines, and that a project is not stuck if it has at least one
  7991. entry marked with a TODO keyword @samp{TODO} or @samp{NEXT} or @samp{NEXTACTION}.
  7992. Let's assume that you, in your own way of using Org mode, identify
  7993. projects with a tag @samp{:PROJECT:}, and that you use a TODO keyword
  7994. @samp{MAYBE} to indicate a project that should not be considered yet.
  7995. Let's further assume that the TODO keyword @samp{DONE} marks finished
  7996. projects, and that @samp{NEXT} and @samp{TODO} indicate next actions. The tag
  7997. @samp{:@@shop:} indicates shopping and is a next action even without the
  7998. NEXT tag. Finally, if the project contains the special word @samp{IGNORE}
  7999. anywhere, it should not be listed either. In this case you would
  8000. start by identifying eligible projects with a tags/TODO match (see
  8001. @ref{Tag Searches}) @samp{+PROJECT/-MAYBE-DONE}, and then check for @samp{TODO},
  8002. @samp{NEXT}, @samp{@@shop}, and @samp{IGNORE} in the subtree to identify projects that
  8003. are not stuck. The correct customization for this is:
  8004. @lisp
  8005. (setq org-stuck-projects
  8006. '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@shop")
  8007. "\\<IGNORE\\>"))
  8008. @end lisp
  8009. Note that if a project is identified as non-stuck, the subtree of this
  8010. entry is searched for stuck projects.
  8011. @node Presentation and Sorting
  8012. @section Presentation and Sorting
  8013. @cindex presentation, of agenda items
  8014. @vindex org-agenda-prefix-format
  8015. @vindex org-agenda-tags-column
  8016. Before displaying items in an agenda view, Org mode visually prepares
  8017. the items and sorts them. Each item occupies a single line. The line
  8018. starts with a @emph{prefix} that contains the @emph{category} (see @ref{Categories})
  8019. of the item and other important information. You can customize in
  8020. which column tags are displayed through @code{org-agenda-tags-column}. You
  8021. can also customize the prefix using the option
  8022. @code{org-agenda-prefix-format}. This prefix is followed by a cleaned-up
  8023. version of the outline headline associated with the item.
  8024. @menu
  8025. * Categories:: Not all tasks are equal.
  8026. * Time-of-day specifications:: How the agenda knows the time.
  8027. * Sorting of agenda items:: The order of things.
  8028. * Filtering/limiting agenda times:: Dynamically narrow the agenda.
  8029. @end menu
  8030. @node Categories
  8031. @subsection Categories
  8032. @cindex category
  8033. @cindex @samp{CATEGORY}, keyword
  8034. The category is a broad label assigned to each agenda item. By
  8035. default, the category is simply derived from the file name, but you
  8036. can also specify it with a special line in the buffer, like
  8037. this:
  8038. @example
  8039. #+CATEGORY: Thesis
  8040. @end example
  8041. @noindent
  8042. @cindex @samp{CATEGORY}, property
  8043. If you would like to have a special category for a single entry or
  8044. a (sub)tree, give the entry a @samp{CATEGORY} property with the special
  8045. category you want to apply as the value.
  8046. @noindent
  8047. The display in the agenda buffer looks best if the category is not
  8048. longer than 10 characters.
  8049. @noindent
  8050. @vindex org-agenda-category-icon-alist
  8051. You can set up icons for category by customizing the
  8052. @code{org-agenda-category-icon-alist} variable.
  8053. @node Time-of-day specifications
  8054. @subsection Time-of-day specifications
  8055. @cindex time-of-day specification
  8056. Org mode checks each agenda item for a time-of-day specification. The
  8057. time can be part of the timestamp that triggered inclusion into the
  8058. agenda, for example
  8059. @example
  8060. <2005-05-10 Tue 19:00>
  8061. @end example
  8062. @noindent
  8063. Time ranges can be specified with two timestamps:
  8064. @example
  8065. <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
  8066. @end example
  8067. In the headline of the entry itself, a time(range) may also appear as
  8068. plain text (like @samp{12:45} or a @samp{8:30-1pm}). If the agenda integrates
  8069. the Emacs diary (see @ref{Weekly/daily agenda}), time specifications in
  8070. diary entries are recognized as well.
  8071. For agenda display, Org mode extracts the time and displays it in
  8072. a standard 24 hour format as part of the prefix. The example times in
  8073. the previous paragraphs would end up in the agenda like this:
  8074. @example
  8075. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  8076. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  8077. 19:00...... The Vogon reads his poem
  8078. 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
  8079. @end example
  8080. @cindex time grid
  8081. If the agenda is in single-day mode, or for the display of today, the
  8082. timed entries are embedded in a time grid, like
  8083. @example
  8084. 8:00...... ------------------
  8085. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  8086. 10:00...... ------------------
  8087. 12:00...... ------------------
  8088. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  8089. 14:00...... ------------------
  8090. 16:00...... ------------------
  8091. 18:00...... ------------------
  8092. 19:00...... The Vogon reads his poem
  8093. 20:00...... ------------------
  8094. 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
  8095. @end example
  8096. @vindex org-agenda-use-time-grid
  8097. @vindex org-agenda-time-grid
  8098. The time grid can be turned on and off with the variable
  8099. @code{org-agenda-use-time-grid}, and can be configured with
  8100. @code{org-agenda-time-grid}.
  8101. @node Sorting of agenda items
  8102. @subsection Sorting of agenda items
  8103. @cindex sorting, of agenda items
  8104. @cindex priorities, of agenda items
  8105. Before being inserted into a view, the items are sorted. How this is
  8106. done depends on the type of view.
  8107. @itemize
  8108. @item
  8109. @vindex org-agenda-files
  8110. For the daily/weekly agenda, the items for each day are sorted. The
  8111. default order is to first collect all items containing an explicit
  8112. time-of-day specification. These entries are shown at the beginning
  8113. of the list, as a @emph{schedule} for the day. After that, items remain
  8114. grouped in categories, in the sequence given by @code{org-agenda-files}.
  8115. Within each category, items are sorted by priority (see
  8116. @ref{Priorities}), which is composed of the base priority (2000 for
  8117. priority @samp{A}, 1000 for @samp{B}, and 0 for @samp{C}), plus additional
  8118. increments for overdue scheduled or deadline items.
  8119. @item
  8120. For the TODO list, items remain in the order of categories, but
  8121. within each category, sorting takes place according to priority (see
  8122. @ref{Priorities}). The priority used for sorting derives from the
  8123. priority cookie, with additions depending on how close an item is to
  8124. its due or scheduled date.
  8125. @item
  8126. For tags matches, items are not sorted at all, but just appear in
  8127. the sequence in which they are found in the agenda files.
  8128. @end itemize
  8129. @vindex org-agenda-sorting-strategy
  8130. Sorting can be customized using the variable
  8131. @code{org-agenda-sorting-strategy}, and may also include criteria based on
  8132. the estimated effort of an entry (see @ref{Effort Estimates}).
  8133. @node Filtering/limiting agenda times
  8134. @subsection Filtering/limiting agenda times
  8135. Agenda built-in or customized commands are statically defined. Agenda
  8136. filters and limits provide two ways of dynamically narrowing down the
  8137. list of agenda entries: @emph{filters} and @emph{limits}. Filters only act on
  8138. the display of the items, while limits take effect before the list of
  8139. agenda entries is built. Filters are more often used interactively,
  8140. while limits are mostly useful when defined as local variables within
  8141. custom agenda commands.
  8142. @anchor{Filtering in the agenda}
  8143. @subsubheading Filtering in the agenda
  8144. @cindex agenda filtering
  8145. @cindex filtering entries, in agenda
  8146. @cindex tag filtering, in agenda
  8147. @cindex category filtering, in agenda
  8148. @cindex top headline filtering, in agenda
  8149. @cindex effort filtering, in agenda
  8150. @cindex query editing, in agenda
  8151. @table @asis
  8152. @item @kbd{/} (@code{org-agenda-filter-by-tag})
  8153. @findex org-agenda-filter-by-tag
  8154. @vindex org-agenda-tag-filter-preset
  8155. Filter the agenda view with respect to a tag and/or effort
  8156. estimates. The difference between this and a custom agenda
  8157. command is that filtering is very fast, so that you can switch
  8158. quickly between different filters without having to recreate the
  8159. agenda.@footnote{Custom commands can preset a filter by binding the variable
  8160. @code{org-agenda-tag-filter-preset} as an option. This filter is then
  8161. applied to the view and persists as a basic filter through refreshes
  8162. and more secondary filtering. The filter is a global property of the
  8163. entire agenda view---in a block agenda, you should only set this in
  8164. the global options section, not in the section of an individual block.}
  8165. You are prompted for a tag selection letter; @kbd{@key{SPC}} means
  8166. any tag at all. Pressing @kbd{@key{TAB}} at that prompt offers
  8167. completion to select a tag, including any tags that do not have
  8168. a selection character. The command then hides all entries that
  8169. do not contain or inherit this tag. When called with prefix
  8170. argument, remove the entries that @emph{do} have the tag. A second
  8171. @kbd{/} at the prompt turns off the filter and shows any
  8172. hidden entries. Pressing @kbd{+} or @kbd{-} switches
  8173. between filtering and excluding the next tag.
  8174. @vindex org-agenda-auto-exclude-function
  8175. Org also supports automatic, context-aware tag filtering. If the
  8176. variable @code{org-agenda-auto-exclude-function} is set to
  8177. a user-defined function, that function can decide which tags
  8178. should be excluded from the agenda automatically. Once this is
  8179. set, the @kbd{/} command then accepts @kbd{@key{RET}} as
  8180. a sub-option key and runs the auto exclusion logic. For example,
  8181. let's say you use a @samp{Net} tag to identify tasks which need
  8182. network access, an @samp{Errand} tag for errands in town, and a @samp{Call}
  8183. tag for making phone calls. You could auto-exclude these tags
  8184. based on the availability of the Internet, and outside of
  8185. business hours, with something like this:
  8186. @lisp
  8187. (defun org-my-auto-exclude-function (tag)
  8188. (and (cond
  8189. ((string= tag "Net")
  8190. (/= 0 (call-process "/sbin/ping" nil nil nil
  8191. "-c1" "-q" "-t1" "mail.gnu.org")))
  8192. ((or (string= tag "Errand") (string= tag "Call"))
  8193. (let ((hour (nth 2 (decode-time))))
  8194. (or (< hour 8) (> hour 21)))))
  8195. (concat "-" tag)))
  8196. (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
  8197. @end lisp
  8198. @item @kbd{<} (@code{org-agenda-filter-by-category})
  8199. @findex org-agenda-filter-by-category
  8200. Filter the current agenda view with respect to the category of
  8201. the item at point. Pressing @kbd{<} another time removes
  8202. this filter. When called with a prefix argument exclude the
  8203. category of the item at point from the agenda.
  8204. @vindex org-agenda-category-filter-preset
  8205. You can add a filter preset in custom agenda commands through the
  8206. option @code{org-agenda-category-filter-preset}. See @ref{Setting options}.
  8207. @item @kbd{^} (@code{org-agenda-filter-by-top-headline})
  8208. @findex org-agenda-filter-by-top-headline
  8209. Filter the current agenda view and only display the siblings and
  8210. the parent headline of the one at point.
  8211. @item @kbd{=} (@code{org-agenda-filter-by-regexp})
  8212. @findex org-agenda-filter-by-regexp
  8213. Filter the agenda view by a regular expression: only show agenda
  8214. entries matching the regular expression the user entered. When
  8215. called with a prefix argument, it filters @emph{out} entries matching
  8216. the regexp. With two universal prefix arguments, it removes all
  8217. the regexp filters, which can be accumulated.
  8218. @vindex org-agenda-regexp-filter-preset
  8219. You can add a filter preset in custom agenda commands through the
  8220. option @code{org-agenda-regexp-filter-preset}. See @ref{Setting options}.
  8221. @item @kbd{_} (@code{org-agenda-filter-by-effort})
  8222. @findex org-agenda-filter-by-effort
  8223. Filter the agenda view with respect to effort estimates. You
  8224. first need to set up allowed efforts globally, for example
  8225. @lisp
  8226. (setq org-global-properties
  8227. '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
  8228. @end lisp
  8229. @vindex org-sort-agenda-noeffort-is-high
  8230. You can then filter for an effort by first typing an operator,
  8231. one of @kbd{<}, @kbd{>} and @kbd{=}, and then the
  8232. one-digit index of an effort estimate in your array of allowed
  8233. values, where @kbd{0} means the 10th value. The filter then
  8234. restricts to entries with effort smaller-or-equal, equal, or
  8235. larger-or-equal than the selected value. For application of the
  8236. operator, entries without a defined effort are treated according
  8237. to the value of @code{org-sort-agenda-noeffort-is-high}.
  8238. When called with a prefix argument, it removes entries matching
  8239. the condition. With two universal prefix arguments, it clears
  8240. effort filters, which can be accumulated.
  8241. @vindex org-agenda-effort-filter-preset
  8242. You can add a filter preset in custom agenda commands through the
  8243. option @code{org-agenda-effort-filter-preset}. See @ref{Setting options}.
  8244. @item @kbd{|} (@code{org-agenda-filter-remove-all})
  8245. Remove all filters in the current agenda view.
  8246. @end table
  8247. @anchor{Setting limits for the agenda}
  8248. @subsubheading Setting limits for the agenda
  8249. @cindex limits, in agenda
  8250. Here is a list of options that you can set, either globally, or
  8251. locally in your custom agenda views (see @ref{Custom Agenda Views}).
  8252. @table @asis
  8253. @item @code{org-agenda-max-entries}
  8254. @vindex org-agenda-max-entries
  8255. Limit the number of entries.
  8256. @item @code{org-agenda-max-effort}
  8257. @vindex org-agenda-max-effort
  8258. Limit the duration of accumulated efforts (as minutes).
  8259. @item @code{org-agenda-max-todos}
  8260. @vindex org-agenda-max-todos
  8261. Limit the number of entries with TODO keywords.
  8262. @item @code{org-agenda-max-tags}
  8263. @vindex org-agenda-max-tags
  8264. Limit the number of tagged entries.
  8265. @end table
  8266. When set to a positive integer, each option excludes entries from
  8267. other categories: for example, @code{(setq org-agenda-max-effort 100)}
  8268. limits the agenda to 100 minutes of effort and exclude any entry that
  8269. has no effort property. If you want to include entries with no effort
  8270. property, use a negative value for @code{org-agenda-max-effort}. One
  8271. useful setup is to use @code{org-agenda-max-entries} locally in a custom
  8272. command. For example, this custom command displays the next five
  8273. entries with a @samp{NEXT} TODO keyword.
  8274. @lisp
  8275. (setq org-agenda-custom-commands
  8276. '(("n" todo "NEXT"
  8277. ((org-agenda-max-entries 5)))))
  8278. @end lisp
  8279. Once you mark one of these five entry as DONE, rebuilding the agenda
  8280. will again the next five entries again, including the first entry that
  8281. was excluded so far.
  8282. You can also dynamically set temporary limits, which are lost when
  8283. rebuilding the agenda:
  8284. @table @asis
  8285. @item @kbd{~} (@code{org-agenda-limit-interactively})
  8286. @findex org-agenda-limit-interactively
  8287. This prompts for the type of limit to apply and its value.
  8288. @end table
  8289. @node Agenda Commands
  8290. @section Commands in the Agenda Buffer
  8291. @cindex commands, in agenda buffer
  8292. Entries in the agenda buffer are linked back to the Org file or diary
  8293. file where they originate. You are not allowed to edit the agenda
  8294. buffer itself, but commands are provided to show and jump to the
  8295. original entry location, and to edit the Org files ``remotely'' from the
  8296. agenda buffer. In this way, all information is stored only once,
  8297. removing the risk that your agenda and note files may diverge.
  8298. Some commands can be executed with mouse clicks on agenda lines. For
  8299. the other commands, the cursor needs to be in the desired line.
  8300. @anchor{Motion (1)}
  8301. @subheading Motion
  8302. @cindex motion commands in agenda
  8303. @table @asis
  8304. @item @kbd{n} (@code{org-agenda-next-line})
  8305. @kindex n
  8306. @findex org-agenda-next-line
  8307. Next line (same as @kbd{@key{DOWN}} and @kbd{C-n}).
  8308. @item @kbd{p} (@code{org-agenda-previous-line})
  8309. @kindex p
  8310. @findex org-agenda-previous-line
  8311. Previous line (same as @kbd{@key{UP}} and @kbd{C-p}).
  8312. @end table
  8313. @anchor{View/Go to Org file}
  8314. @subheading View/Go to Org file
  8315. @cindex view file commands in agenda
  8316. @table @asis
  8317. @item @kbd{@key{SPC}} or @kbd{mouse-3} (@code{org-agenda-show-and-scroll-up})
  8318. @kindex SPC
  8319. @kindex mouse-3
  8320. @findex org-agenda-show-and-scroll-up
  8321. Display the original location of the item in another window.
  8322. With a prefix argument, make sure that drawers stay folded.
  8323. @item @kbd{L} (@code{org-agenda-recenter})
  8324. @findex org-agenda-recenter
  8325. Display original location and recenter that window.
  8326. @item @kbd{@key{TAB}} or @kbd{mouse-2} (@code{org-agenda-goto})
  8327. @kindex TAB
  8328. @kindex mouse-2
  8329. @findex org-agenda-goto
  8330. Go to the original location of the item in another window.
  8331. @item @kbd{@key{RET}} (@code{org-agenda-switch-to})
  8332. @kindex RET
  8333. @findex org-agenda-switch-to
  8334. Go to the original location of the item and delete other windows.
  8335. @item @kbd{F} (@code{org-agenda-follow-mode})
  8336. @kindex F
  8337. @findex org-agenda-follow-mode
  8338. @vindex org-agenda-start-with-follow-mode
  8339. Toggle Follow mode. In Follow mode, as you move the cursor
  8340. through the agenda buffer, the other window always shows the
  8341. corresponding location in the Org file. The initial setting for
  8342. this mode in new agenda buffers can be set with the variable
  8343. @code{org-agenda-start-with-follow-mode}.
  8344. @item @kbd{C-c C-x b} (@code{org-agenda-tree-to-indirect-buffer})
  8345. @kindex C-c C-x b
  8346. @findex org-agenda-tree-to-indirect-buffer
  8347. Display the entire subtree of the current item in an indirect
  8348. buffer. With a numeric prefix argument N, go up to level N and
  8349. then take that tree. If N is negative, go up that many levels.
  8350. With a @kbd{C-u} prefix, do not remove the previously used
  8351. indirect buffer.
  8352. @item @kbd{C-c C-o} (@code{org-agenda-open-link})
  8353. @kindex C-c C-o
  8354. @findex org-agenda-open-link
  8355. Follow a link in the entry. This offers a selection of any links
  8356. in the text belonging to the referenced Org node. If there is
  8357. only one link, follow it without a selection prompt.
  8358. @end table
  8359. @anchor{Change display}
  8360. @subheading Change display
  8361. @cindex change agenda display
  8362. @cindex display changing, in agenda
  8363. @table @asis
  8364. @item @kbd{A}
  8365. @kindex A
  8366. Interactively select another agenda view and append it to the
  8367. current view.
  8368. @item @kbd{o}
  8369. @kindex o
  8370. Delete other windows.
  8371. @item @kbd{v d} or short @kbd{d} (@code{org-agenda-day-view})
  8372. @kindex v d
  8373. @kindex d
  8374. @findex org-agenda-day-view
  8375. Switch to day view. When switching to day view, this setting
  8376. becomes the default for subsequent agenda refreshes. A numeric
  8377. prefix argument may be used to jump directly to a specific day of
  8378. the year. For example, @kbd{32 d} jumps to February 1st.
  8379. When setting day view, a year may be encoded in the prefix
  8380. argument as well. For example, @kbd{200712 d} jumps to
  8381. January 12, 2007. If such a year specification has only one or
  8382. two digits, it is expanded into one of the 30 next years or the
  8383. last 69 years.
  8384. @item @kbd{v w} or short @kbd{w} (@code{org-agenda-week-view})
  8385. @kindex v w
  8386. @kindex w
  8387. @findex org-agenda-week-view
  8388. Switch to week view. When switching week view, this setting
  8389. becomes the default for subsequent agenda refreshes. A numeric
  8390. prefix argument may be used to jump directly to a specific day of
  8391. the ISO week. For example @kbd{9 w} to ISO week number 9.
  8392. When setting week view, a year may be encoded in the prefix
  8393. argument as well. For example, @kbd{200712 w} jumps to week
  8394. 12 in 2007. If such a year specification has only one or two
  8395. digits, it is expanded into one of the 30 next years or the last
  8396. 69 years.
  8397. @item @kbd{v m} (@code{org-agenda-month-view})
  8398. @kindex v m
  8399. @findex org-agenda-month-view
  8400. Switch to month view. Because month views are slow to create,
  8401. they do not become the default for subsequent agenda refreshes.
  8402. A numeric prefix argument may be used to jump directly to
  8403. a specific day of the month. When setting month view, a year may
  8404. be encoded in the prefix argument as well. For example,
  8405. @kbd{200712 m} jumps to December, 2007. If such a year
  8406. specification has only one or two digits, it is expanded into one
  8407. of the 30 next years or the last 69 years.
  8408. @item @kbd{v y} (@code{org-agenda-year-view})
  8409. @kindex v y
  8410. @findex org-agenda-year-view
  8411. Switch to year view. Because year views are slow to create, they
  8412. do not become the default for subsequent agenda refreshes.
  8413. A numeric prefix argument may be used to jump directly to
  8414. a specific day of the year.
  8415. @item @kbd{v @key{SPC}} (@code{org-agenda-reset-view})
  8416. @kindex v SPC
  8417. @findex org-agenda-reset-view
  8418. @vindex org-agenda-span
  8419. Reset the current view to @code{org-agenda-span}.
  8420. @item @kbd{f} (@code{org-agenda-later})
  8421. @kindex f
  8422. @findex org-agenda-later
  8423. Go forward in time to display the span following the current one.
  8424. For example, if the display covers a week, switch to the
  8425. following week. With a prefix argument, repeat that many times.
  8426. @item @kbd{b} (@code{org-agenda-earlier})
  8427. @kindex b
  8428. @findex org-agenda-earlier
  8429. Go backward in time to display earlier dates.
  8430. @item @kbd{.} (@code{org-agenda-goto-today})
  8431. @kindex .
  8432. @findex org-agenda-goto-today
  8433. Go to today.
  8434. @item @kbd{j} (@code{org-agenda-goto-date})
  8435. @kindex j
  8436. @findex org-agenda-goto-date
  8437. Prompt for a date and go there.
  8438. @item @kbd{J} (@code{org-agenda-clock-goto})
  8439. @kindex J
  8440. @findex org-agenda-clock-goto
  8441. Go to the currently clocked-in task @emph{in the agenda buffer}.
  8442. @item @kbd{D} (@code{org-agenda-toggle-diary})
  8443. @kindex D
  8444. @findex org-agenda-toggle-diary
  8445. Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
  8446. @item @kbd{v l} or @kbd{v L} or short @kbd{l} (@code{org-agenda-log-mode})
  8447. @kindex v l
  8448. @kindex l
  8449. @kindex v L
  8450. @findex org-agenda-log-mode
  8451. @vindex org-log-done
  8452. @vindex org-agenda-log-mode-items
  8453. Toggle Logbook mode. In Logbook mode, entries that were marked
  8454. DONE while logging was on (see the variable @code{org-log-done}) are
  8455. shown in the agenda, as are entries that have been clocked on
  8456. that day. You can configure the entry types that should be
  8457. included in log mode using the variable
  8458. @code{org-agenda-log-mode-items}. When called with a @kbd{C-u}
  8459. prefix, show all possible logbook entries, including state
  8460. 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}.
  8461. @item @kbd{v [} or short @kbd{[} (@code{org-agenda-manipulate-query-add})
  8462. @kindex v [
  8463. @kindex [
  8464. @findex org-agenda-manipulate-query-add
  8465. Include inactive timestamps into the current view. Only for
  8466. weekly/daily agenda and timeline views.
  8467. @item @kbd{v a} (@code{org-agenda-archives-mode})
  8468. @kindex v a
  8469. @findex org-agenda-archives-mode
  8470. Toggle Archives mode. In Archives mode, trees that are archived
  8471. (see @ref{Internal archiving}) are also scanned when producing the
  8472. agenda. To exit archives mode, press @kbd{v a} again.
  8473. @item @kbd{v A}
  8474. @kindex v A
  8475. Toggle Archives mode. Include all archive files as well.
  8476. @item @kbd{v R} or short @kbd{R} (@code{org-agenda-clockreport-mode})
  8477. @kindex v R
  8478. @kindex R
  8479. @findex org-agenda-clockreport-mode
  8480. @vindex org-agenda-start-with-clockreport-mode
  8481. @vindex org-clock-report-include-clocking-task
  8482. Toggle Clockreport mode. In Clockreport mode, the daily/weekly
  8483. agenda always shows a table with the clocked times for the time
  8484. span and file scope covered by the current agenda view. The
  8485. initial setting for this mode in new agenda buffers can be set
  8486. with the variable @code{org-agenda-start-with-clockreport-mode}. By
  8487. using a prefix argument when toggling this mode (i.e., @kbd{C-u R}), the clock table does not show contributions from entries
  8488. that are hidden by agenda filtering@footnote{Only tags filtering is respected here, effort filtering is
  8489. ignored.}. See also the
  8490. variable @code{org-clock-report-include-clocking-task}.
  8491. @item @kbd{v c}
  8492. @kindex v c
  8493. @vindex org-agenda-clock-consistency-checks
  8494. Show overlapping clock entries, clocking gaps, and other clocking
  8495. problems in the current agenda range. You can then visit
  8496. clocking lines and fix them manually. See the variable
  8497. @code{org-agenda-clock-consistency-checks} for information on how to
  8498. customize the definition of what constituted a clocking problem.
  8499. To return to normal agenda display, press @kbd{l} to exit
  8500. Logbook mode.
  8501. @item @kbd{v E} or short @kbd{E} (@code{org-agenda-entry-text-mode})
  8502. @kindex v E
  8503. @kindex E
  8504. @findex org-agenda-entry-text-mode
  8505. @vindex org-agenda-start-with-entry-text-mode
  8506. @vindex org-agenda-entry-text-maxlines
  8507. Toggle entry text mode. In entry text mode, a number of lines
  8508. from the Org outline node referenced by an agenda line are
  8509. displayed below the line. The maximum number of lines is given
  8510. by the variable @code{org-agenda-entry-text-maxlines}. Calling this
  8511. command with a numeric prefix argument temporarily modifies that
  8512. number to the prefix value.
  8513. @item @kbd{G} (@code{org-agenda-toggle-time-grid})
  8514. @kindex G
  8515. @vindex org-agenda-use-time-grid
  8516. @vindex org-agenda-time-grid
  8517. Toggle the time grid on and off. See also the variables
  8518. @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
  8519. @item @kbd{r} (@code{org-agenda-redo})
  8520. @itemx @kbd{g}
  8521. @kindex r
  8522. @kindex g
  8523. @findex org-agenda-redo
  8524. Recreate the agenda buffer, for example to reflect the changes
  8525. after modification of the timestamps of items with
  8526. @kbd{S-@key{LEFT}} and @kbd{S-@key{RIGHT}}. When the
  8527. buffer is the global TODO list, a prefix argument is interpreted
  8528. to create a selective list for a specific TODO keyword.
  8529. @item @kbd{C-x C-s} or short @kbd{s} (@code{org-save-all-org-buffers})
  8530. @kindex C-x C-s
  8531. @findex org-save-all-org-buffers
  8532. @kindex s
  8533. Save all Org buffers in the current Emacs session, and also the
  8534. locations of IDs.
  8535. @item @kbd{C-c C-x C-c} (@code{org-agenda-columns})
  8536. @kindex C-c C-x C-c
  8537. @findex org-agenda-columns
  8538. @vindex org-columns-default-format
  8539. Invoke column view (see @ref{Column View}) in the agenda buffer. The
  8540. column view format is taken from the entry at point, or, if there
  8541. is no entry at point, from the first entry in the agenda view.
  8542. So whatever the format for that entry would be in the original
  8543. buffer (taken from a property, from a @samp{COLUMNS} keyword, or from
  8544. the default variable @code{org-columns-default-format}) is used in the
  8545. agenda.
  8546. @item @kbd{C-c C-x >} (@code{org-agenda-remove-restriction-lock})
  8547. @kindex C-c C-x >
  8548. @findex org-agenda-remove-restriction-lock
  8549. Remove the restriction lock on the agenda, if it is currently
  8550. restricted to a file or subtree (see @ref{Agenda Files}).
  8551. @item @kbd{M-@key{UP}} (@code{org-agenda-drag-line-backward})
  8552. @kindex M-UP
  8553. @findex org-agenda-drag-line-backward
  8554. Drag the line at point backward one line. With a numeric prefix
  8555. argument, drag backward by that many lines.
  8556. Moving agenda lines does not persist after an agenda refresh and
  8557. does not modify the contributing Org files.
  8558. @item @kbd{M-@key{DOWN}} (@code{org-agenda-drag-line-forward})
  8559. @kindex M-DOWN
  8560. @findex org-agenda-drag-line-forward
  8561. Drag the line at point forward one line. With a numeric prefix
  8562. argument, drag forward by that many lines.
  8563. @end table
  8564. @anchor{Remote editing}
  8565. @subheading Remote editing
  8566. @cindex remote editing, from agenda
  8567. @table @asis
  8568. @item @kbd{0--9}
  8569. Digit argument.
  8570. @item @kbd{C-_} (@code{org-agenda-undo})
  8571. @kindex C-_
  8572. @findex org-agenda-undo
  8573. @cindex undoing remote-editing events
  8574. @cindex remote editing, undo
  8575. Undo a change due to a remote editing command. The change is
  8576. undone both in the agenda buffer and in the remote buffer.
  8577. @item @kbd{t} (@code{org-agenda-todo})
  8578. @kindex t
  8579. @findex org-agenda-todo
  8580. Change the TODO state of the item, both in the agenda and in the
  8581. original Org file.
  8582. @item @kbd{C-S-@key{RIGHT}} (@code{org-agenda-todo-nextset})
  8583. @kindex C-S-RIGHT
  8584. @findex org-agenda-todo-nextset
  8585. Switch to the next set of TODO keywords.
  8586. @item @kbd{C-S-@key{LEFT}}, @code{org-agenda-todo-previousset}
  8587. @kindex C-S-LEFT
  8588. Switch to the previous set of TODO keywords.
  8589. @item @kbd{C-k} (@code{org-agenda-kill})
  8590. @kindex C-k
  8591. @findex org-agenda-kill
  8592. @vindex org-agenda-confirm-kill
  8593. Delete the current agenda item along with the entire subtree
  8594. belonging to it in the original Org file. If the text to be
  8595. deleted remotely is longer than one line, the kill needs to be
  8596. confirmed by the user. See variable @code{org-agenda-confirm-kill}.
  8597. @item @kbd{C-c C-w} (@code{org-agenda-refile})
  8598. @kindex C-c C-w
  8599. @findex org-agenda-refile
  8600. Refile the entry at point.
  8601. @item @kbd{C-c C-x C-a} or short @kbd{a} (@code{org-agenda-archive-default-with-confirmation})
  8602. @kindex C-c C-x C-a
  8603. @kindex a
  8604. @findex org-agenda-archive-default-with-confirmation
  8605. @vindex org-archive-default-command
  8606. Archive the subtree corresponding to the entry at point using the
  8607. default archiving command set in @code{org-archive-default-command}.
  8608. When using the @kbd{a} key, confirmation is required.
  8609. @item @kbd{C-c C-x a} (@code{org-agenda-toggle-archive-tag})
  8610. @kindex C-c C-x a
  8611. @findex org-agenda-toggle-archive-tag
  8612. Toggle the archive tag (see @ref{Internal archiving}) for the current
  8613. headline.
  8614. @item @kbd{C-c C-x A} (@code{org-agenda-archive-to-archive-sibling})
  8615. @kindex C-c C-x A
  8616. @findex org-agenda-archive-to-archive-sibling
  8617. Move the subtree corresponding to the current entry to its
  8618. @emph{archive sibling}.
  8619. @item @kbd{C-c C-x C-s} or short @kbd{$} (@code{org-agenda-archive})
  8620. @kindex C-c C-x C-s
  8621. @kindex $
  8622. @findex org-agenda-archive
  8623. Archive the subtree corresponding to the current headline. This
  8624. means the entry is moved to the configured archive location, most
  8625. likely a different file.
  8626. @item @kbd{T} (@code{org-agenda-show-tags})
  8627. @kindex T
  8628. @findex org-agenda-show-tags
  8629. @vindex org-agenda-show-inherited-tags
  8630. Show all tags associated with the current item. This is useful
  8631. if you have turned off @code{org-agenda-show-inherited-tags}, but
  8632. still want to see all tags of a headline occasionally.
  8633. @item @kbd{:} (@code{org-agenda-set-tags})
  8634. @kindex :
  8635. @findex org-agenda-set-tags
  8636. Set tags for the current headline. If there is an active region
  8637. in the agenda, change a tag for all headings in the region.
  8638. @item @kbd{,} (@code{org-agenda-priority})
  8639. @kindex ,
  8640. @findex org-agenda-priority
  8641. Set the priority for the current item. Org mode prompts for the
  8642. priority character. If you reply with @kbd{@key{SPC}}, the
  8643. priority cookie is removed from the entry.
  8644. @item @kbd{P} (@code{org-agenda-show-priority})
  8645. @kindex P
  8646. @findex org-agenda-show-priority
  8647. Display weighted priority of current item.
  8648. @item @kbd{+} or @kbd{S-@key{UP}} (@code{org-agenda-priority-up})
  8649. @kindex +
  8650. @kindex S-UP
  8651. @findex org-agenda-priority-up
  8652. Increase the priority of the current item. The priority is
  8653. changed in the original buffer, but the agenda is not resorted.
  8654. Use the @kbd{r} key for this.
  8655. @item @kbd{-} or @kbd{S-@key{DOWN}} (@code{org-agenda-priority-down})
  8656. @kindex -
  8657. @kindex S-DOWN
  8658. @findex org-agenda-priority-down
  8659. Decrease the priority of the current item.
  8660. @item @kbd{C-c C-z} or short @kbd{z} (@code{org-agenda-add-note})
  8661. @kindex z
  8662. @kindex C-c C-z
  8663. @findex org-agenda-add-note
  8664. @vindex org-log-into-drawer
  8665. Add a note to the entry. This note is recorded, and then filed
  8666. to the same location where state change notes are put. Depending
  8667. on @code{org-log-into-drawer}, this may be inside a drawer.
  8668. @item @kbd{C-c C-a} (@code{org-attach})
  8669. @kindex C-c C-a
  8670. @findex org-attach
  8671. Dispatcher for all command related to attachments.
  8672. @item @kbd{C-c C-s} (@code{org-agenda-schedule})
  8673. @kindex C-c C-s
  8674. @findex org-agenda-schedule
  8675. Schedule this item. With a prefix argument, remove the
  8676. scheduling timestamp
  8677. @item @kbd{C-c C-d} (@code{org-agenda-deadline})
  8678. @kindex C-c C-d
  8679. @findex org-agenda-deadline
  8680. Set a deadline for this item. With a prefix argument, remove the
  8681. deadline.
  8682. @item @kbd{S-@key{RIGHT}} (@code{org-agenda-do-date-later})
  8683. @kindex S-RIGHT
  8684. @findex org-agenda-do-date-later
  8685. Change the timestamp associated with the current line by one day
  8686. into the future. If the date is in the past, the first call to
  8687. this command moves it to today. With a numeric prefix argument,
  8688. 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}
  8689. prefix, change the time by one hour. If you immediately repeat
  8690. the command, it will continue to change hours even without the
  8691. prefix argument. With a double @kbd{C-u C-u} prefix, do the
  8692. same for changing minutes. The stamp is changed in the original
  8693. Org file, but the change is not directly reflected in the agenda
  8694. buffer. Use @kbd{r} or @kbd{g} to update the buffer.
  8695. @item @kbd{S-@key{LEFT}} (@code{org-agenda-do-date-earlier})
  8696. @kindex S-LEFT
  8697. @findex org-agenda-do-date-earlier
  8698. Change the timestamp associated with the current line by one day
  8699. into the past.
  8700. @item @kbd{>} (@code{org-agenda-date-prompt})
  8701. @kindex >
  8702. @findex org-agenda-date-prompt
  8703. Change the timestamp associated with the current line. The key
  8704. @kbd{>} has been chosen, because it is the same as
  8705. @kbd{S-.} on my keyboard.
  8706. @item @kbd{I} (@code{org-agenda-clock-in})
  8707. @kindex I
  8708. @findex org-agenda-clock-in
  8709. Start the clock on the current item. If a clock is running
  8710. already, it is stopped first.
  8711. @item @kbd{O} (@code{org-agenda-clock-out})
  8712. @kindex O
  8713. @findex org-agenda-clock-out
  8714. Stop the previously started clock.
  8715. @item @kbd{X} (@code{org-agenda-clock-cancel})
  8716. @kindex X
  8717. @findex org-agenda-clock-cancel
  8718. Cancel the currently running clock.
  8719. @item @kbd{J} (@code{org-agenda-clock-goto})
  8720. @kindex J
  8721. @findex org-agenda-clock-goto
  8722. Jump to the running clock in another window.
  8723. @item @kbd{k} (@code{org-agenda-capture})
  8724. @kindex k
  8725. @findex org-agenda-capture
  8726. @cindex capturing, from agenda
  8727. @vindex org-capture-use-agenda-date
  8728. Like @code{org-capture}, but use the date at point as the default date
  8729. for the capture template. See @code{org-capture-use-agenda-date} to
  8730. make this the default behavior of @code{org-capture}.
  8731. @end table
  8732. @anchor{Bulk remote editing selected entries}
  8733. @subheading Bulk remote editing selected entries
  8734. @cindex remote editing, bulk, from agenda
  8735. @vindex org-agenda-bulk-custom-functions
  8736. @table @asis
  8737. @item @kbd{m} (@code{org-agenda-bulk-mark})
  8738. @kindex m
  8739. @findex org-agenda-bulk-mark
  8740. Mark the entry at point for bulk action. If there is an active
  8741. region in the agenda, mark the entries in the region. With
  8742. numeric prefix argument, mark that many successive entries.
  8743. @item @kbd{*} (@code{org-agenda-bulk-mark-all})
  8744. @kindex *
  8745. @findex org-agenda-bulk-mark-all
  8746. Mark all visible agenda entries for bulk action.
  8747. @item @kbd{u} (@code{org-agenda-bulk-unmark})
  8748. @kindex u
  8749. @findex org-agenda-bulk-unmark
  8750. Unmark entry for bulk action.
  8751. @item @kbd{U} (@code{org-agenda-bulk-remove-all-marks})
  8752. @kindex U
  8753. @findex org-agenda-bulk-remove-all-marks
  8754. Unmark all marked entries for bulk action.
  8755. @item @kbd{M-m} (@code{org-agenda-bulk-toggle})
  8756. @kindex M-m
  8757. @findex org-agenda-bulk-toggle
  8758. Toggle mark of the entry at point for bulk action.
  8759. @item @kbd{M-*} (@code{org-agenda-bulk-toggle-all})
  8760. @kindex M-*
  8761. @findex org-agenda-bulk-toggle-all
  8762. Mark entries matching a regular expression for bulk action.
  8763. @item @kbd{%} (@code{org-agenda-bulk-mark-regexp})
  8764. @kindex %
  8765. @findex org-agenda-bulk-mark-regexp
  8766. Mark entries matching a regular expression for bulk action.
  8767. @item @kbd{B} (@code{org-agenda-bulk-action})
  8768. @kindex B
  8769. @findex org-agenda-bulk-action
  8770. @vindex org-agenda-bulk-persistent-marks
  8771. Bulk action: act on all marked entries in the agenda. This
  8772. prompts for another key to select the action to be applied. The
  8773. prefix argument to @kbd{B} is passed through to the
  8774. @kbd{s} and @kbd{d} commands, to bulk-remove these
  8775. special timestamps. By default, marks are removed after the
  8776. bulk. If you want them to persist, set
  8777. @code{org-agenda-bulk-persistent-marks} to @code{t} or hit @kbd{p} at
  8778. the prompt.
  8779. @table @asis
  8780. @item @kbd{*}
  8781. Toggle persistent marks.
  8782. @item @kbd{$}
  8783. Archive all selected entries.
  8784. @item @kbd{A}
  8785. Archive entries by moving them to their respective archive
  8786. siblings.
  8787. @item @kbd{t}
  8788. Change TODO state. This prompts for a single TODO keyword and
  8789. changes the state of all selected entries, bypassing blocking
  8790. and suppressing logging notes---but not timestamps.
  8791. @item @kbd{+}
  8792. Add a tag to all selected entries.
  8793. @item @kbd{-}
  8794. Remove a tag from all selected entries.
  8795. @item @kbd{s}
  8796. Schedule all items to a new date. To shift existing schedule
  8797. dates by a fixed number of days, use something starting with
  8798. double plus at the prompt, for example @samp{++8d} or @samp{++2w}.
  8799. @item @kbd{d}
  8800. Set deadline to a specific date.
  8801. @item @kbd{r}
  8802. Prompt for a single refile target and move all entries. The
  8803. entries are no longer in the agenda; refresh (@kbd{g}) to
  8804. bring them back.
  8805. @item @kbd{S}
  8806. Reschedule randomly into the coming N days. N is prompted for.
  8807. With a prefix argument (@kbd{C-u B S}), scatter only
  8808. across weekdays.
  8809. @item @kbd{f}
  8810. @vindex org-agenda-bulk-custom-functions
  8811. Apply a function@footnote{You can also create persistent custom functions through
  8812. @code{org-agenda-bulk-custom-functions}.} to marked entries. For example, the
  8813. function below sets the @samp{CATEGORY} property of the entries to
  8814. @samp{web}.
  8815. @lisp
  8816. (defun set-category ()
  8817. (interactive "P")
  8818. (let ((marker (or (org-get-at-bol 'org-hd-marker)
  8819. (org-agenda-error))))
  8820. (org-with-point-at marker
  8821. (org-back-to-heading t)
  8822. (org-set-property "CATEGORY" "web"))))
  8823. @end lisp
  8824. @end table
  8825. @end table
  8826. @anchor{Calendar commands}
  8827. @subheading Calendar commands
  8828. @cindex calendar commands, from agenda
  8829. @table @asis
  8830. @item @kbd{c} (@code{org-agenda-goto-calendar})
  8831. @kindex c
  8832. @findex org-agenda-goto-calendar
  8833. Open the Emacs calendar and move to the date at the agenda
  8834. cursor.
  8835. @item @kbd{c} (@code{org-calendar-goto-agenda})
  8836. @kindex c
  8837. @findex org-calendar-goto-agenda
  8838. When in the calendar, compute and show the Org agenda for the
  8839. date at the cursor.
  8840. @item @kbd{i} (@code{org-agenda-diary-entry})
  8841. @kindex i
  8842. @findex org-agenda-diary-entry
  8843. @cindex diary entries, creating from agenda
  8844. Insert a new entry into the diary, using the date at the cursor
  8845. and (for block entries) the date at the mark. This adds to the
  8846. Emacs diary file@footnote{This file is parsed for the agenda when
  8847. @code{org-agenda-include-diary} is set.}, in a way similar to the @kbd{i}
  8848. command in the calendar. The diary file pops up in another
  8849. window, where you can add the entry.
  8850. @vindex org-agenda-diary-file
  8851. If you configure @code{org-agenda-diary-file} to point to an Org file,
  8852. Org creates entries in that file instead. Most entries are
  8853. stored in a date-based outline tree that will later make it easy
  8854. to archive appointments from previous months/years. The tree is
  8855. built under an entry with a @samp{DATE_TREE} property, or else with
  8856. years as top-level entries. Emacs prompts you for the entry
  8857. text---if you specify it, the entry is created in
  8858. @code{org-agenda-diary-file} without further interaction. If you
  8859. directly press @kbd{@key{RET}} at the prompt without typing text,
  8860. the target file is shown in another window for you to finish the
  8861. entry there. See also the @kbd{k r} command.
  8862. @item @kbd{M} (@code{org-agenda-phases-of-moon})
  8863. @kindex M
  8864. @findex org-agenda-phases-of-moon
  8865. Show the phases of the moon for the three months around current
  8866. date.
  8867. @item @kbd{S} (@code{org-agenda-sunrise-sunset})
  8868. @kindex S
  8869. @findex org-agenda-sunrise-sunset
  8870. Show sunrise and sunset times. The geographical location must be
  8871. set with calendar variables, see the documentation for the Emacs
  8872. calendar.
  8873. @item @kbd{C} (@code{org-agenda-convert-date})
  8874. @kindex C
  8875. @findex org-agenda-convert-date
  8876. Convert the date at cursor into many other cultural and historic
  8877. calendars.
  8878. @item @kbd{H} (@code{org-agenda-holidays})
  8879. @kindex H
  8880. @findex org-agenda-holidays
  8881. Show holidays for three months around the cursor date.
  8882. @end table
  8883. @anchor{Quit and exit}
  8884. @subheading Quit and exit
  8885. @table @asis
  8886. @item @kbd{q} (@code{org-agenda-quit})
  8887. @kindex q
  8888. @findex org-agenda-quit
  8889. Quit agenda, remove the agenda buffer.
  8890. @item @kbd{x} (@code{org-agenda-exit})
  8891. @kindex x
  8892. @findex org-agenda-exit
  8893. @cindex agenda files, removing buffers
  8894. Exit agenda, remove the agenda buffer and all buffers loaded by
  8895. Emacs for the compilation of the agenda. Buffers created by the
  8896. user to visit Org files are not removed.
  8897. @end table
  8898. @node Custom Agenda Views
  8899. @section Custom Agenda Views
  8900. @cindex custom agenda views
  8901. @cindex agenda views, custom
  8902. Custom agenda commands serve two purposes: to store and quickly access
  8903. frequently used TODO and tags searches, and to create special
  8904. composite agenda buffers. Custom agenda commands are accessible
  8905. through the dispatcher (see @ref{Agenda Dispatcher}), just like the
  8906. default commands.
  8907. @menu
  8908. * Storing searches:: Type once, use often.
  8909. * Block agenda:: All the stuff you need in a single buffer.
  8910. * Setting options:: Changing the rules.
  8911. @end menu
  8912. @node Storing searches
  8913. @subsection Storing searches
  8914. The first application of custom searches is the definition of keyboard
  8915. shortcuts for frequently used searches, either creating an agenda
  8916. buffer, or a sparse tree (the latter covering of course only the
  8917. current buffer).
  8918. @kindex C @r{(Agenda dispatcher)}
  8919. @vindex org-agenda-custom-commands
  8920. @cindex agenda views, main example
  8921. @cindex agenda, as an agenda views
  8922. @cindex agenda*, as an agenda views
  8923. @cindex tags, as an agenda view
  8924. @cindex todo, as an agenda view
  8925. @cindex tags-todo
  8926. @cindex todo-tree
  8927. @cindex occur-tree
  8928. @cindex tags-tree
  8929. Custom commands are configured in the variable
  8930. @code{org-agenda-custom-commands}. You can customize this variable, for
  8931. example by pressing @kbd{C} from the agenda dispatcher (see @ref{Agenda Dispatcher}). You can also directly set it with Emacs Lisp in
  8932. the Emacs init file. The following example contains all valid agenda
  8933. views:
  8934. @lisp
  8935. (setq org-agenda-custom-commands
  8936. '(("x" agenda)
  8937. ("y" agenda*)
  8938. ("w" todo "WAITING")
  8939. ("W" todo-tree "WAITING")
  8940. ("u" tags "+boss-urgent")
  8941. ("v" tags-todo "+boss-urgent")
  8942. ("U" tags-tree "+boss-urgent")
  8943. ("f" occur-tree "\\<FIXME\\>")
  8944. ("h" . "HOME+Name tags searches") ;description for "h" prefix
  8945. ("hl" tags "+home+Lisa")
  8946. ("hp" tags "+home+Peter")
  8947. ("hk" tags "+home+Kim")))
  8948. @end lisp
  8949. @noindent
  8950. The initial string in each entry defines the keys you have to press
  8951. after the dispatcher command in order to access the command. Usually
  8952. this will be just a single character, but if you have many similar
  8953. commands, you can also define two-letter combinations where the first
  8954. character is the same in several combinations and serves as a prefix
  8955. key@footnote{You can provide a description for a prefix key by inserting
  8956. a cons cell with the prefix and the description.}. The second parameter is the search type, followed by the
  8957. string or regular expression to be used for the matching. The example
  8958. above will therefore define:
  8959. @table @asis
  8960. @item @kbd{x}
  8961. as a global search for agenda entries planned@footnote{@emph{Planned} means here that these entries have some planning
  8962. information attached to them, like a time-stamp, a scheduled or
  8963. a deadline string. See @code{org-agenda-entry-types} on how to set what
  8964. planning information is taken into account.} this
  8965. week/day.
  8966. @item @kbd{y}
  8967. as the same search, but only for entries with an hour
  8968. specification like @samp{[h]h:mm}---think of them as appointments.
  8969. @item @kbd{w}
  8970. as a global search for TODO entries with @samp{WAITING} as the TODO
  8971. keyword.
  8972. @item @kbd{W}
  8973. as the same search, but only in the current buffer and displaying
  8974. the results as a sparse tree.
  8975. @item @kbd{u}
  8976. as a global tags search for headlines tagged @samp{boss} but not
  8977. @samp{urgent}.
  8978. @item @kbd{v}
  8979. The same search, but limiting it to headlines that are also TODO
  8980. items.
  8981. @item @kbd{U}
  8982. as the same search, but only in the current buffer and displaying
  8983. the result as a sparse tree.
  8984. @item @kbd{f}
  8985. to create a sparse tree (again, current buffer only) with all
  8986. entries containing the word @samp{FIXME}.
  8987. @item @kbd{h}
  8988. as a prefix command for a @samp{HOME} tags search where you have to
  8989. press an additional key (@kbd{l}, @kbd{p} or
  8990. @kbd{k}) to select a name (Lisa, Peter, or Kim) as
  8991. additional tag to match.
  8992. @end table
  8993. Note that @code{*-tree} agenda views need to be called from an Org buffer
  8994. as they operate on the current buffer only.
  8995. @node Block agenda
  8996. @subsection Block agenda
  8997. @cindex block agenda
  8998. @cindex agenda, with block views
  8999. Another possibility is the construction of agenda views that comprise
  9000. the results of @emph{several} commands, each of which creates a block in
  9001. the agenda buffer. The available commands include @code{agenda} for the
  9002. daily or weekly agenda (as created with @kbd{a}) , @code{alltodo} for
  9003. the global TODO list (as constructed with @kbd{t}), and the
  9004. matching commands discussed above: @code{todo}, @code{tags}, and @code{tags-todo}.
  9005. Here are two examples:
  9006. @lisp
  9007. (setq org-agenda-custom-commands
  9008. '(("h" "Agenda and Home-related tasks"
  9009. ((agenda "")
  9010. (tags-todo "home")
  9011. (tags "garden")))
  9012. ("o" "Agenda and Office-related tasks"
  9013. ((agenda "")
  9014. (tags-todo "work")
  9015. (tags "office")))))
  9016. @end lisp
  9017. @noindent
  9018. This defines @kbd{h} to create a multi-block view for stuff you
  9019. need to attend to at home. The resulting agenda buffer contains your
  9020. agenda for the current week, all TODO items that carry the tag @samp{home},
  9021. and also all lines tagged with @samp{garden}. Finally the command
  9022. @kbd{o} provides a similar view for office tasks.
  9023. @node Setting options
  9024. @subsection Setting options for custom commands
  9025. @cindex options, for custom agenda views
  9026. @vindex org-agenda-custom-commands
  9027. Org mode contains a number of variables regulating agenda construction
  9028. and display. The global variables define the behavior for all agenda
  9029. commands, including the custom commands. However, if you want to
  9030. change some settings just for a single custom view, you can do so.
  9031. Setting options requires inserting a list of variable names and values
  9032. at the right spot in @code{org-agenda-custom-commands}. For example:
  9033. @lisp
  9034. (setq org-agenda-custom-commands
  9035. '(("w" todo "WAITING"
  9036. ((org-agenda-sorting-strategy '(priority-down))
  9037. (org-agenda-prefix-format " Mixed: ")))
  9038. ("U" tags-tree "+boss-urgent"
  9039. ((org-show-context-detail 'minimal)))
  9040. ("N" search ""
  9041. ((org-agenda-files '("~org/notes.org"))
  9042. (org-agenda-text-search-extra-files nil)))))
  9043. @end lisp
  9044. @noindent
  9045. Now the @kbd{w} command sorts the collected entries only by
  9046. priority, and the prefix format is modified to just say @samp{Mixed:}
  9047. instead of giving the category of the entry. The sparse tags tree of
  9048. @kbd{U} now turns out ultra-compact, because neither the headline
  9049. hierarchy above the match, nor the headline following the match are
  9050. shown. The command @kbd{N} does a text search limited to only
  9051. a single file.
  9052. For command sets creating a block agenda, @code{org-agenda-custom-commands}
  9053. has two separate spots for setting options. You can add options that
  9054. should be valid for just a single command in the set, and options that
  9055. should be valid for all commands in the set. The former are just
  9056. added to the command entry; the latter must come after the list of
  9057. command entries. Going back to the block agenda example (see @ref{Block agenda}), let's change the sorting strategy for the @kbd{h}
  9058. commands to @code{priority-down}, but let's sort the results for GARDEN
  9059. tags query in the opposite order, @code{priority-up}. This would look like
  9060. this:
  9061. @lisp
  9062. (setq org-agenda-custom-commands
  9063. '(("h" "Agenda and Home-related tasks"
  9064. ((agenda)
  9065. (tags-todo "home")
  9066. (tags "garden"
  9067. ((org-agenda-sorting-strategy '(priority-up)))))
  9068. ((org-agenda-sorting-strategy '(priority-down))))
  9069. ("o" "Agenda and Office-related tasks"
  9070. ((agenda)
  9071. (tags-todo "work")
  9072. (tags "office")))))
  9073. @end lisp
  9074. As you see, the values and parentheses setting is a little complex.
  9075. When in doubt, use the customize interface to set this variable---it
  9076. fully supports its structure. Just one caveat: when setting options
  9077. in this interface, the @emph{values} are just Lisp expressions. So if the
  9078. value is a string, you need to add the double-quotes around the value
  9079. yourself.
  9080. @vindex org-agenda-custom-commands-contexts
  9081. To control whether an agenda command should be accessible from
  9082. a specific context, you can customize
  9083. @code{org-agenda-custom-commands-contexts}. Let's say for example that you
  9084. have an agenda command @kbd{o} displaying a view that you only
  9085. need when reading emails. Then you would configure this option like
  9086. this:
  9087. @lisp
  9088. (setq org-agenda-custom-commands-contexts
  9089. '(("o" (in-mode . "message-mode"))))
  9090. @end lisp
  9091. You can also tell that the command key @kbd{o} should refer to
  9092. another command key @kbd{r}. In that case, add this command key
  9093. like this:
  9094. @lisp
  9095. (setq org-agenda-custom-commands-contexts
  9096. '(("o" "r" (in-mode . "message-mode"))))
  9097. @end lisp
  9098. See the docstring of the variable for more information.
  9099. @node Exporting Agenda Views
  9100. @section Exporting Agenda Views
  9101. @cindex agenda views, exporting
  9102. If you are away from your computer, it can be very useful to have
  9103. a printed version of some agenda views to carry around. Org mode can
  9104. export custom agenda views as plain text, HTML@footnote{For HTML you need to install Hrvoje Niksic's @samp{htmlize.el}
  9105. from @uref{https://github.com/hniksic/emacs-htmlize, Hrvoje Niksic's repository}.}, Postscript,
  9106. PDF@footnote{To create PDF output, the Ghostscript ps2pdf utility must be
  9107. installed on the system. Selecting a PDF file also creates the
  9108. postscript file.}, and iCalendar files. If you want to do this only
  9109. occasionally, use the following command:
  9110. @table @asis
  9111. @item @kbd{C-x C-w} (@code{org-agenda-write})
  9112. @kindex C-x C-w
  9113. @findex org-agenda-write
  9114. @cindex exporting agenda views
  9115. @cindex agenda views, exporting
  9116. @vindex org-agenda-exporter-settings
  9117. Write the agenda view to a file.
  9118. @end table
  9119. If you need to export certain agenda views frequently, you can
  9120. associate any custom agenda command with a list of output file
  9121. names@footnote{If you want to store standard views like the weekly agenda or
  9122. the global TODO list as well, you need to define custom commands for
  9123. them in order to be able to specify file names.}. Here is an example that first defines custom commands
  9124. for the agenda and the global TODO list, together with a number of
  9125. files to which to export them. Then we define two block agenda
  9126. commands and specify file names for them as well. File names can be
  9127. relative to the current working directory, or absolute.
  9128. @lisp
  9129. (setq org-agenda-custom-commands
  9130. '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  9131. ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  9132. ("h" "Agenda and Home-related tasks"
  9133. ((agenda "")
  9134. (tags-todo "home")
  9135. (tags "garden"))
  9136. nil
  9137. ("~/views/home.html"))
  9138. ("o" "Agenda and Office-related tasks"
  9139. ((agenda)
  9140. (tags-todo "work")
  9141. (tags "office"))
  9142. nil
  9143. ("~/views/office.ps" "~/calendars/office.ics"))))
  9144. @end lisp
  9145. The extension of the file name determines the type of export. If it
  9146. is @samp{.html}, Org mode uses the htmlize package to convert the buffer to
  9147. HTML and save it to this file name. If the extension is @samp{.ps},
  9148. @code{ps-print-buffer-with-faces} is used to produce Postscript output. If
  9149. the extension is @samp{.ics}, iCalendar export is run export over all files
  9150. that were used to construct the agenda, and limit the export to
  9151. entries listed in the agenda. Any other extension produces a plain
  9152. ASCII file.
  9153. The export files are @emph{not} created when you use one of those
  9154. commands interactively because this might use too much overhead.
  9155. Instead, there is a special command to produce @emph{all} specified
  9156. files in one step:
  9157. @table @asis
  9158. @item @kbd{e} (@code{org-store-agenda-views})
  9159. @kindex e @r{(Agenda dispatcher)}
  9160. @findex org-store-agenda-views
  9161. Export all agenda views that have export file names associated
  9162. with them.
  9163. @end table
  9164. You can use the options section of the custom agenda commands to also
  9165. set options for the export commands. For example:
  9166. @lisp
  9167. (setq org-agenda-custom-commands
  9168. '(("X" agenda ""
  9169. ((ps-number-of-columns 2)
  9170. (ps-landscape-mode t)
  9171. (org-agenda-prefix-format " [ ] ")
  9172. (org-agenda-with-colors nil)
  9173. (org-agenda-remove-tags t))
  9174. ("theagenda.ps"))))
  9175. @end lisp
  9176. @noindent
  9177. @vindex org-agenda-exporter-settings
  9178. This command sets two options for the Postscript exporter, to make it
  9179. print in two columns in landscape format---the resulting page can be
  9180. cut in two and then used in a paper agenda. The remaining settings
  9181. modify the agenda prefix to omit category and scheduling information,
  9182. and instead include a checkbox to check off items. We also remove the
  9183. tags to make the lines compact, and we do not want to use colors for
  9184. the black-and-white printer. Settings specified in
  9185. @code{org-agenda-exporter-settings} also apply, e.g.,
  9186. @lisp
  9187. (setq org-agenda-exporter-settings
  9188. '((ps-number-of-columns 2)
  9189. (ps-landscape-mode t)
  9190. (org-agenda-add-entry-text-maxlines 5)
  9191. (htmlize-output-type 'css)))
  9192. @end lisp
  9193. @noindent
  9194. but the settings in @code{org-agenda-custom-commands} take precedence.
  9195. @noindent
  9196. From the command line you may also use:
  9197. @example
  9198. emacs -eval (org-batch-store-agenda-views) -kill
  9199. @end example
  9200. @noindent
  9201. or, if you need to modify some parameters@footnote{Quoting depends on the system you use, please check the FAQ
  9202. for examples.}
  9203. @example
  9204. emacs -eval '(org-batch-store-agenda-views \
  9205. org-agenda-span (quote month) \
  9206. org-agenda-start-day "2007-11-01" \
  9207. org-agenda-include-diary nil \
  9208. org-agenda-files (quote ("~/org/project.org")))' \
  9209. -kill
  9210. @end example
  9211. @noindent
  9212. which creates the agenda views restricted to the file
  9213. @samp{~/org/project.org}, without diary entries and with a 30-day extent.
  9214. You can also extract agenda information in a way that allows further
  9215. processing by other programs. See @ref{Extracting Agenda Information}, for
  9216. more information.
  9217. @node Agenda Column View
  9218. @section Using Column View in the Agenda
  9219. @cindex column view, in agenda
  9220. @cindex agenda, column view
  9221. Column view (see @ref{Column View}) is normally used to view and edit
  9222. properties embedded in the hierarchical structure of an Org file. It
  9223. can be quite useful to use column view also from the agenda, where
  9224. entries are collected by certain criteria.
  9225. @table @asis
  9226. @item @kbd{C-c C-x C-c} (@code{org-agenda-columns})
  9227. @kindex C-c C-x C-c
  9228. @findex org-agenda-columns
  9229. Turn on column view in the agenda.
  9230. @end table
  9231. To understand how to use this properly, it is important to realize
  9232. that the entries in the agenda are no longer in their proper outline
  9233. environment. This causes the following issues:
  9234. @enumerate
  9235. @item
  9236. @vindex org-columns-default-format
  9237. @vindex org-overriding-columns-format
  9238. Org needs to make a decision which columns format to use. Since
  9239. the entries in the agenda are collected from different files, and
  9240. different files may have different columns formats, this is
  9241. a non-trivial problem. Org first checks if the variable
  9242. @code{org-agenda-overriding-columns-format} is currently set, and if so,
  9243. takes the format from there. Otherwise it takes the format
  9244. associated with the first item in the agenda, or, if that item does
  9245. not have a specific format (defined in a property, or in its file),
  9246. it uses @code{org-columns-default-format}.
  9247. @item
  9248. @cindex @samp{CLOCKSUM}, special property
  9249. If any of the columns has a summary type defined (see @ref{Column attributes}), turning on column view in the agenda visits all
  9250. relevant agenda files and make sure that the computations of this
  9251. property are up to date. This is also true for the special
  9252. @samp{CLOCKSUM} property. Org then sums the values displayed in the
  9253. agenda. In the daily/weekly agenda, the sums cover a single day;
  9254. in all other views they cover the entire block.
  9255. It is important to realize that the agenda may show the same entry
  9256. @emph{twice}---for example as scheduled and as a deadline---and it may
  9257. show two entries from the same hierarchy (for example a @emph{parent}
  9258. and its @emph{child}). In these cases, the summation in the agenda
  9259. leads to incorrect results because some values count double.
  9260. @item
  9261. When the column view in the agenda shows the @samp{CLOCKSUM} property,
  9262. that is always the entire clocked time for this item. So even in
  9263. the daily/weekly agenda, the clocksum listed in column view may
  9264. originate from times outside the current view. This has the
  9265. advantage that you can compare these values with a column listing
  9266. the planned total effort for a task---one of the major
  9267. applications for column view in the agenda. If you want
  9268. information about clocked time in the displayed period use clock
  9269. table mode (press @kbd{R} in the agenda).
  9270. @item
  9271. @cindex @samp{CLOCKSUM_T}, special property
  9272. When the column view in the agenda shows the @samp{CLOCKSUM_T} property,
  9273. that is always today's clocked time for this item. So even in the
  9274. weekly agenda, the clocksum listed in column view only originates
  9275. from today. This lets you compare the time you spent on a task for
  9276. today, with the time already spent---via @samp{CLOCKSUM}---and with
  9277. the planned total effort for it.
  9278. @end enumerate
  9279. @node Markup
  9280. @chapter Markup for Rich Export
  9281. When exporting Org documents, the exporter tries to reflect the
  9282. structure of the document as accurately as possible in the back-end.
  9283. Since export targets like HTML and @LaTeX{} allow much richer formatting,
  9284. Org mode has rules on how to prepare text for rich export. This
  9285. section summarizes the markup rules used in an Org mode buffer.
  9286. @menu
  9287. * Paragraphs:: The basic unit of text.
  9288. * Emphasis and Monospace:: Bold, italic, etc.
  9289. * Horizontal Rules:: Make a line.
  9290. * Images and Tables:: Images, tables and caption mechanism.
  9291. * Literal Examples:: Source code examples with special formatting.
  9292. * Special Symbols:: Greek letters and other symbols.
  9293. * Subscripts and Superscripts:: Simple syntax for raising/lowering text.
  9294. * Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents.
  9295. @end menu
  9296. @node Paragraphs
  9297. @section Paragraphs
  9298. @cindex paragraphs, markup rules
  9299. Paragraphs are separated by at least one empty line. If you need to
  9300. enforce a line break within a paragraph, use @code{\\} at the end of
  9301. a line.
  9302. To preserve the line breaks, indentation and blank lines in a region,
  9303. but otherwise use normal formatting, you can use this construct, which
  9304. can also be used to format poetry.
  9305. @cindex @samp{BEGIN_VERSE}
  9306. @cindex verse blocks
  9307. @example
  9308. #+BEGIN_VERSE
  9309. Great clouds overhead
  9310. Tiny black birds rise and fall
  9311. Snow covers Emacs
  9312. ---AlexSchroeder
  9313. #+END_VERSE
  9314. @end example
  9315. When quoting a passage from another document, it is customary to
  9316. format this as a paragraph that is indented on both the left and the
  9317. right margin. You can include quotations in Org documents like this:
  9318. @cindex @samp{BEGIN_QUOTE}
  9319. @cindex quote blocks
  9320. @example
  9321. #+BEGIN_QUOTE
  9322. Everything should be made as simple as possible,
  9323. but not any simpler ---Albert Einstein
  9324. #+END_QUOTE
  9325. @end example
  9326. If you would like to center some text, do it like this:
  9327. @cindex @samp{BEGIN_CENTER}
  9328. @cindex center blocks
  9329. @example
  9330. #+BEGIN_CENTER
  9331. Everything should be made as simple as possible, \\
  9332. but not any simpler
  9333. #+END_CENTER
  9334. @end example
  9335. @node Emphasis and Monospace
  9336. @section Emphasis and Monospace
  9337. @cindex underlined text, markup rules
  9338. @cindex bold text, markup rules
  9339. @cindex italic text, markup rules
  9340. @cindex verbatim text, markup rules
  9341. @cindex code text, markup rules
  9342. @cindex strike-through text, markup rules
  9343. You can make words @samp{*bold*}, @samp{/italic/}, @samp{_underlined_}, @samp{=verbatim=}
  9344. and @samp{~code~}, and, if you must, @samp{+strike-through+}. Text in the code
  9345. and verbatim string is not processed for Org mode specific syntax; it
  9346. is exported verbatim.
  9347. @vindex org-fontify-emphasized-text
  9348. To turn off fontification for marked up text, you can set
  9349. @code{org-fontify-emphasized-text} to @code{nil}. To narrow down the list of
  9350. available markup syntax, you can customize @code{org-emphasis-alist}.
  9351. @node Horizontal Rules
  9352. @section Horizontal Rules
  9353. @cindex horizontal rules, markup rules
  9354. A line consisting of only dashes, and at least 5 of them, is exported
  9355. as a horizontal line.
  9356. @node Images and Tables
  9357. @section Images and Tables
  9358. @cindex tables, markup rules
  9359. @cindex @samp{CAPTION}, keyword
  9360. @cindex @samp{NAME}, keyword
  9361. Both the native Org mode tables (see @ref{Tables}) and tables formatted
  9362. with the @samp{table.el} package are exported properly. For Org mode
  9363. tables, the lines before the first horizontal separator line become
  9364. table header lines. You can use the following lines somewhere before
  9365. the table to assign a caption and a label for cross references, and in
  9366. the text you can refer to the object with @samp{[[tab:basic-data]]} (see
  9367. @ref{Internal Links}):
  9368. @example
  9369. #+CAPTION: This is the caption for the next table (or link)
  9370. #+NAME: tab:basic-data
  9371. | ... | ... |
  9372. |-----+-----|
  9373. @end example
  9374. Optionally, the caption can take the form:
  9375. @example
  9376. #+CAPTION[Caption for list of tables]: Caption for table.
  9377. @end example
  9378. @cindex inlined images, markup rules
  9379. Some back-ends allow you to directly include images into the exported
  9380. document. Org does this, if a link to an image file does not have
  9381. a description part, for example @samp{[[./img/a.jpg]]}. If you wish to define
  9382. a caption for the image and maybe a label for internal cross
  9383. references, make sure that the link is on a line by itself and precede
  9384. it with @samp{CAPTION} and @samp{NAME} keywords as follows:
  9385. @example
  9386. #+CAPTION: This is the caption for the next figure link (or table)
  9387. #+NAME: fig:SED-HR4049
  9388. [[./img/a.jpg]]
  9389. @end example
  9390. @noindent
  9391. Such images can be displayed within the buffer. See @ref{Handling Links, , the discussion of
  9392. image links}.
  9393. Even though images and tables are prominent examples of captioned
  9394. structures, the same caption mechanism can apply to many
  9395. others---e.g., @LaTeX{} equations, source code blocks. Depending on the
  9396. export back-end, those may or may not be handled.
  9397. @node Literal Examples
  9398. @section Literal Examples
  9399. @cindex literal examples, markup
  9400. @cindex code line references, markup
  9401. You can include literal examples that should not be subjected to
  9402. markup. Such examples are typeset in monospace, so this is well
  9403. suited for source code and similar examples.
  9404. @cindex @samp{BEGIN_EXAMPLE}
  9405. @cindex example block
  9406. @example
  9407. #+BEGIN_EXAMPLE
  9408. Some example from a text file.
  9409. #+END_EXAMPLE
  9410. @end example
  9411. Note that such blocks may be @emph{indented} in order to align nicely with
  9412. indented text and in particular with plain list structure (see
  9413. @ref{Plain Lists}). For simplicity when using small examples, you can
  9414. also start the example lines with a colon followed by a space. There
  9415. may also be additional whitespace before the colon:
  9416. @example
  9417. Here is an example
  9418. : Some example from a text file.
  9419. @end example
  9420. @cindex formatting source code, markup rules
  9421. @vindex org-latex-listings
  9422. If the example is source code from a programming language, or any
  9423. other text that can be marked up by Font Lock in Emacs, you can ask
  9424. for the example to look like the fontified Emacs buffer@footnote{This works automatically for the HTML backend (it requires
  9425. version 1.34 of the @samp{htmlize.el} package, which you need to install).
  9426. Fontified code chunks in @LaTeX{} can be achieved using either the
  9427. listings package or the @uref{https://github.com/gpoore/minted, minted} package. Refer to
  9428. @code{org-export-latex-listings} for details.}. This
  9429. is done with the code block, where you also need to specify the name
  9430. of the major mode that should be used to fontify the example@footnote{Source code in code blocks may also be evaluated either
  9431. interactively or on export. See @ref{Working with Source Code} for more
  9432. information on evaluating code blocks.},
  9433. see @ref{Structure Templates} for shortcuts to easily insert code blocks.
  9434. @cindex @samp{BEGIN_SRC}
  9435. @cindex src block
  9436. @example
  9437. #+BEGIN_SRC emacs-lisp
  9438. (defun org-xor (a b)
  9439. "Exclusive or."
  9440. (if a (not b) b))
  9441. #+END_SRC
  9442. @end example
  9443. Both in @samp{example} and in @samp{src} snippets, you can add a @samp{-n} switch to
  9444. the end of the @samp{#+BEGIN} line, to get the lines of the example
  9445. numbered. The @samp{-n} takes an optional numeric argument specifying the
  9446. starting line number of the block. If you use a @samp{+n} switch, the
  9447. numbering from the previous numbered snippet is continued in the
  9448. current one. The @samp{+n} switch can also take a numeric argument. This
  9449. adds the value of the argument to the last line of the previous block
  9450. to determine the starting line number.
  9451. @example
  9452. #+BEGIN_SRC emacs-lisp -n 20
  9453. ;; This exports with line number 20.
  9454. (message "This is line 21")
  9455. #+END_SRC
  9456. #+BEGIN_SRC emacs-lisp +n 10
  9457. ;; This is listed as line 31.
  9458. (message "This is line 32")
  9459. #+END_SRC
  9460. @end example
  9461. In literal examples, Org interprets strings like @samp{(ref:name)} as
  9462. labels, and use them as targets for special hyperlinks like
  9463. @samp{[[(name)]]}---i.e., the reference name enclosed in single parenthesis.
  9464. In HTML, hovering the mouse over such a link remote-highlights the
  9465. corresponding code line, which is kind of cool.
  9466. You can also add a @samp{-r} switch which @emph{removes} the labels from the
  9467. source code@footnote{Adding @samp{-k} to @samp{-n -r} @emph{keeps} the labels in the source code
  9468. while using line numbers for the links, which might be useful to
  9469. explain those in an Org mode example code.}. With the @samp{-n} switch, links to these references
  9470. are labeled by the line numbers from the code listing. Otherwise
  9471. links use the labels with no parentheses. Here is an example:
  9472. @example
  9473. #+BEGIN_SRC emacs-lisp -n -r
  9474. (save-excursion (ref:sc)
  9475. (goto-char (point-min)) (ref:jump)
  9476. #+END_SRC
  9477. In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
  9478. jumps to point-min.
  9479. @end example
  9480. @cindex indentation, in source blocks
  9481. Finally, you can use @samp{-i} to preserve the indentation of a specific
  9482. code block (see @ref{Editing Source Code}).
  9483. @vindex org-coderef-label-format
  9484. If the syntax for the label format conflicts with the language syntax,
  9485. use a @samp{-l} switch to change the format, for example
  9486. @example
  9487. #+BEGIN_SRC pascal -n -r -l "((%s))"
  9488. @end example
  9489. @noindent
  9490. See also the variable @code{org-coderef-label-format}.
  9491. HTML export also allows examples to be published as text areas (see
  9492. @ref{Text areas in HTML export}).
  9493. Because the @samp{#+BEGIN} @dots{} @samp{#+END} patterns need to be added so often,
  9494. a shortcut is provided (see @ref{Structure Templates}).
  9495. @table @asis
  9496. @item @kbd{C-c '} (@code{org-edit-special})
  9497. @kindex C-c '
  9498. @findex org-edit-special
  9499. Edit the source code example at point in its native mode. This
  9500. works by switching to a temporary buffer with the source code.
  9501. You need to exit by pressing @kbd{C-c '} again@footnote{Upon exit, lines starting with @samp{*}, @samp{,*}, @samp{#+} and @samp{,#+} get
  9502. a comma prepended, to keep them from being interpreted by Org as
  9503. outline nodes or special syntax. These commas are stripped when
  9504. editing with @kbd{C-c '}, and also before export.}. The
  9505. edited version then replaces the old version in the Org buffer.
  9506. Fixed-width regions---where each line starts with a colon
  9507. followed by a space---are edited using @code{artist-mode}@footnote{You may select a different-mode with the variable
  9508. @code{org-edit-fixed-width-region-mode}.} to
  9509. allow creating ASCII drawings easily. Using this command in an
  9510. empty line creates a new fixed-width region.
  9511. @end table
  9512. @cindex storing link, in a source code buffer
  9513. Calling @code{org-store-link} (see @ref{Handling Links}) while editing a source
  9514. code example in a temporary buffer created with @kbd{C-c '}
  9515. prompts for a label. Make sure that it is unique in the current
  9516. buffer, and insert it with the proper formatting like @samp{(ref:label)} at
  9517. the end of the current line. Then the label is stored as a link
  9518. @samp{(label)}, for retrieval with @kbd{C-c C-l}.
  9519. @node Special Symbols
  9520. @section Special Symbols
  9521. @cindex math symbols
  9522. @cindex special symbols
  9523. @cindex @TeX{} macros
  9524. @cindex @LaTeX{} fragments, markup rules
  9525. @cindex HTML entities
  9526. @cindex @LaTeX{} entities
  9527. You can use @LaTeX{}-like syntax to insert special symbols---named
  9528. entities---like @samp{\alpha} to indicate the Greek letter, or @samp{\to} to indicate
  9529. an arrow. Completion for these symbols is available, just type @samp{\}
  9530. and maybe a few letters, and press @kbd{M-@key{TAB}} to see possible
  9531. completions. If you need such a symbol inside a word, terminate it
  9532. with a pair of curly brackets. For example
  9533. @example
  9534. Pro tip: Given a circle \Gamma of diameter d, the length of its
  9535. circumference is \pi@{@}d.
  9536. @end example
  9537. @findex org-entities-help
  9538. @vindex org-entities-user
  9539. A large number of entities is provided, with names taken from both
  9540. HTML and @LaTeX{}; you can comfortably browse the complete list from
  9541. a dedicated buffer using the command @code{org-entities-help}. It is also
  9542. possible to provide your own special symbols in the variable
  9543. @code{org-entities-user}.
  9544. During export, these symbols are transformed into the native format of
  9545. the exporter back-end. Strings like @samp{\alpha} are exported as @samp{&alpha;} in
  9546. the HTML output, and as @samp{\(\alpha\)} in the @LaTeX{} output. Similarly, @samp{\nbsp}
  9547. becomes @samp{&nbsp;} in HTML and @samp{~} in @LaTeX{}.
  9548. @cindex escaping characters
  9549. Entities may also be used as a way to escape markup in an Org
  9550. document, e.g., @samp{\under@{@}not underlined\under} exports as @samp{_not underlined_}.
  9551. @cindex special symbols, in-buffer display
  9552. If you would like to see entities displayed as UTF-8 characters, use
  9553. the following command@footnote{You can turn this on by default by setting the variable
  9554. @code{org-pretty-entities}, or on a per-file base with the @samp{STARTUP} option
  9555. @samp{entitiespretty}.}:
  9556. @table @asis
  9557. @item @kbd{C-c C-x \} (@code{org-toggle-pretty-entities})
  9558. @kindex C-c C-x \
  9559. @findex org-toggle-pretty-entities
  9560. Toggle display of entities as UTF-8 characters. This does not
  9561. change the buffer content which remains plain ASCII, but it
  9562. overlays the UTF-8 character for display purposes only.
  9563. @end table
  9564. @cindex shy hyphen, special symbol
  9565. @cindex dash, special symbol
  9566. @cindex ellipsis, special symbol
  9567. In addition to regular entities defined above, Org exports in
  9568. a special way@footnote{This behavior can be disabled with @samp{-} export setting (see
  9569. @ref{Export Settings}).} the following commonly used character
  9570. combinations: @samp{\-} is treated as a shy hyphen, @samp{--} and @samp{---} are
  9571. converted into dashes, and @samp{...} becomes a compact set of dots.
  9572. @node Subscripts and Superscripts
  9573. @section Subscripts and Superscripts
  9574. @cindex subscript
  9575. @cindex superscript
  9576. @samp{^} and @samp{_} are used to indicate super- and subscripts. To increase
  9577. the readability of ASCII text, it is not necessary, but OK, to
  9578. surround multi-character sub- and superscripts with curly braces. For
  9579. example
  9580. @example
  9581. The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand,
  9582. the radius of Alpha Centauri is R_@{Alpha Centauri@} = 1.28 x R_@{sun@}.
  9583. @end example
  9584. @vindex org-use-sub-superscripts
  9585. If you write a text where the underscore is often used in a different
  9586. context, Org's convention to always interpret these as subscripts can
  9587. get in your way. Configure the variable @code{org-use-sub-superscripts} to
  9588. change this convention. For example, when setting this variable to
  9589. @code{@{@}}, @samp{a_b} is not interpreted as a subscript, but @samp{a_@{b@}} is.
  9590. @table @asis
  9591. @item @kbd{C-c C-x \} (@code{org-toggle-pretty-entities~})
  9592. @kindex C-c C-x \
  9593. @findex org-toggle-pretty-entities
  9594. In addition to showing entities as UTF-8 characters, this command
  9595. also formats sub- and superscripts in a WYSIWYM way.
  9596. @end table
  9597. @node Embedded @LaTeX{}
  9598. @section Embedded @LaTeX{}
  9599. @cindex @TeX{} interpretation
  9600. @cindex @LaTeX{} interpretation
  9601. Plain ASCII is normally sufficient for almost all note taking.
  9602. Exceptions include scientific notes, which often require mathematical
  9603. symbols and the occasional formula. @LaTeX{}@footnote{@LaTeX{} is a macro system based on Donald@tie{}E.@tie{}Knuth's @TeX{}
  9604. system. Many of the features described here as ``@LaTeX{}'' are really
  9605. from @TeX{}, but for simplicity I am blurring this distinction.} is widely used to
  9606. typeset scientific documents. Org mode supports embedding @LaTeX{} code
  9607. into its files, because many academics are used to writing and reading
  9608. @LaTeX{} source code, and because it can be readily processed to produce
  9609. pretty output for a number of export back-ends.
  9610. @menu
  9611. * @LaTeX{} fragments:: Complex formulas made easy.
  9612. * Previewing @LaTeX{} fragments:: What will this snippet look like?
  9613. * CD@LaTeX{} mode:: Speed up entering of formulas.
  9614. @end menu
  9615. @node @LaTeX{} fragments
  9616. @subsection @LaTeX{} fragments
  9617. @cindex @LaTeX{} fragments
  9618. @vindex org-format-latex-header
  9619. Org mode can contain @LaTeX{} math fragments, and it supports ways to
  9620. process these for several export back-ends. When exporting to @LaTeX{},
  9621. the code is left as it is. When exporting to HTML, Org can use either
  9622. @uref{http://www.mathjax.org, MathJax} (see @ref{Math formatting in HTML export}) or transcode the math
  9623. into images (see @ref{Previewing @LaTeX{} fragments}).
  9624. @LaTeX{} fragments do not need any special marking at all. The following
  9625. snippets are identified as @LaTeX{} source code:
  9626. @itemize
  9627. @item
  9628. Environments of any kind@footnote{When MathJax is used, only the environments recognized by
  9629. MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is
  9630. used to create images, any @LaTeX{} environment is handled.}. The only requirement is that the
  9631. @samp{\begin} statement appears on a new line, preceded by only
  9632. whitespace.
  9633. @item
  9634. Text within the usual @LaTeX{} math delimiters. To avoid conflicts
  9635. with currency specifications, single @samp{$} characters are only
  9636. recognized as math delimiters if the enclosed text contains at most
  9637. two line breaks, is directly attached to the @samp{$} characters with no
  9638. whitespace in between, and if the closing @samp{$} is followed by
  9639. whitespace, punctuation or a dash. For the other delimiters, there
  9640. is no such restriction, so when in doubt, use @samp{\(...\)} as inline
  9641. math delimiters.
  9642. @end itemize
  9643. @noindent
  9644. For example:
  9645. @example
  9646. \begin@{equation@} % arbitrary environments,
  9647. x=\sqrt@{b@} % even tables, figures
  9648. \end@{equation@} % etc
  9649. If $a^2=b$ and \( b=2 \), then the solution must be
  9650. either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
  9651. @end example
  9652. @vindex org-export-with-latex
  9653. @LaTeX{} processing can be configured with the variable
  9654. @code{org-export-with-latex}. The default setting is @code{t} which means
  9655. MathJax for HTML, and no processing for ASCII and @LaTeX{} back-ends.
  9656. You can also set this variable on a per-file basis using one of these
  9657. lines:
  9658. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  9659. @item @samp{#+OPTIONS: tex:t}
  9660. @tab Do the right thing automatically (MathJax)
  9661. @item @samp{#+OPTIONS: tex:nil}
  9662. @tab Do not process @LaTeX{} fragments at all
  9663. @item @samp{#+OPTIONS: tex:verbatim}
  9664. @tab Verbatim export, for jsMath or so
  9665. @end multitable
  9666. @node Previewing @LaTeX{} fragments
  9667. @subsection Previewing @LaTeX{} fragments
  9668. @cindex @LaTeX{} fragments, preview
  9669. @vindex org-preview-latex-default-process
  9670. If you have a working @LaTeX{} installation and @samp{dvipng}, @samp{dvisvgm} or
  9671. @samp{convert} installed@footnote{These are respectively available at
  9672. @uref{http://sourceforge.net/projects/dvipng/}, @uref{http://dvisvgm.bplaced.net/}
  9673. and from the ImageMagick suite. Choose the converter by setting the
  9674. variable @code{org-preview-latex-default-process} accordingly.}, @LaTeX{} fragments can be processed to
  9675. produce images of the typeset expressions to be used for inclusion
  9676. while exporting to HTML (see @ref{@LaTeX{} fragments}), or for inline
  9677. previewing within Org mode.
  9678. @vindex org-format-latex-options
  9679. @vindex org-format-latex-header
  9680. You can customize the variables @code{org-format-latex-options} and
  9681. @code{org-format-latex-header} to influence some aspects of the preview.
  9682. In particular, the @code{:scale} (and for HTML export, @code{:html-scale})
  9683. property of the former can be used to adjust the size of the preview
  9684. images.
  9685. @table @asis
  9686. @item @kbd{C-c C-x C-l} (@code{org-toggle-latex-fragment})
  9687. @kindex C-c C-x C-l
  9688. @findex org-toggle-latex-fragment
  9689. Produce a preview image of the @LaTeX{} fragment at point and
  9690. overlay it over the source code. If there is no fragment at
  9691. point, process all fragments in the current entry (between two
  9692. headlines). When called with a prefix argument, process the
  9693. entire subtree. When called with two prefix arguments, or when
  9694. the cursor is before the first headline, process the entire
  9695. buffer.
  9696. @end table
  9697. @vindex org-startup-with-latex-preview
  9698. You can turn on the previewing of all @LaTeX{} fragments in a file with
  9699. @example
  9700. #+STARTUP: latexpreview
  9701. @end example
  9702. To disable it, simply use
  9703. @example
  9704. #+STARTUP: nolatexpreview
  9705. @end example
  9706. @node CD@LaTeX{} mode
  9707. @subsection Using CD@LaTeX{} to enter math
  9708. @cindex CD@LaTeX{}
  9709. CD@LaTeX{} mode is a minor mode that is normally used in combination with
  9710. a major @LaTeX{} mode like AUC@TeX{} in order to speed-up insertion of
  9711. environments and math templates. Inside Org mode, you can make use of
  9712. some of the features of CD@LaTeX{} mode. You need to install
  9713. @samp{cdlatex.el} and @samp{texmathp.el} (the latter comes also with AUC@TeX{})
  9714. from @uref{http://www.astro.uva.nl/~dominik/Tools/cdlatex}. Do not use
  9715. CD@LaTeX{} mode itself under Org mode, but use the light version
  9716. @code{org-cdlatex-mode} that comes as part of Org mode. Turn it on for the
  9717. current buffer with @kbd{M-x org-cdlatex-mode}, or for all Org
  9718. files with
  9719. @lisp
  9720. (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
  9721. @end lisp
  9722. When this mode is enabled, the following features are present (for
  9723. more details see the documentation of CD@LaTeX{} mode):
  9724. @table @asis
  9725. @item @kbd{C-c @{}
  9726. @kindex C-c @{
  9727. Insert an environment template.
  9728. @item @kbd{@key{TAB}}
  9729. @kindex TAB
  9730. The @kbd{@key{TAB}} key expands the template if the cursor is
  9731. inside a @LaTeX{} fragment@footnote{Org mode has a method to test if the cursor is inside such
  9732. a fragment, see the documentation of the function
  9733. @code{org-inside-LaTeX-fragment-p}.}. For example, @kbd{@key{TAB}}
  9734. expands @samp{fr} to @samp{\frac@{@}@{@}} and position the cursor correctly
  9735. inside the first brace. Another @kbd{@key{TAB}} gets you into the
  9736. second brace.
  9737. Even outside fragments, @kbd{@key{TAB}} expands environment
  9738. abbreviations at the beginning of a line. For example, if you
  9739. write @samp{equ} at the beginning of a line and press @kbd{@key{TAB}},
  9740. this abbreviation is expanded to an @samp{equation} environment. To
  9741. get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
  9742. @item @kbd{^}
  9743. @itemx @kbd{_}
  9744. @kindex _
  9745. @kindex ^
  9746. @vindex cdlatex-simplify-sub-super-scripts
  9747. Pressing @kbd{_} and @kbd{^} inside a @LaTeX{} fragment
  9748. inserts these characters together with a pair of braces. If you
  9749. use @kbd{@key{TAB}} to move out of the braces, and if the braces
  9750. surround only a single character or macro, they are removed again
  9751. (depending on the variable @code{cdlatex-simplify-sub-super-scripts}).
  9752. @item @kbd{`}
  9753. @kindex `
  9754. Pressing the backquote followed by a character inserts math
  9755. macros, also outside @LaTeX{} fragments. If you wait more than 1.5
  9756. seconds after the backquote, a help window pops up.
  9757. @item @kbd{'}
  9758. @kindex '
  9759. Pressing the single-quote followed by another character modifies
  9760. the symbol before point with an accent or a font. If you wait
  9761. more than 1.5 seconds after the single-quote, a help window pops
  9762. up. Character modification works only inside @LaTeX{} fragments;
  9763. outside the quote is normal.
  9764. @end table
  9765. @node Exporting
  9766. @chapter Exporting
  9767. @cindex exporting
  9768. Sometimes, you may want to pretty print your notes, publish them on
  9769. the web or even share them with people not using Org. In these cases,
  9770. the Org export facilities can be used to convert your documents to
  9771. a variety of other formats, while retaining as much structure (see
  9772. @ref{Document Structure}) and markup (see @ref{Markup}) as
  9773. possible.
  9774. @cindex export back-end
  9775. Libraries responsible for such translation are called back-ends. Org
  9776. ships with the following ones
  9777. @itemize
  9778. @item
  9779. @emph{ascii} (ASCII format)
  9780. @item
  9781. @emph{beamer} (@LaTeX{} Beamer format)
  9782. @item
  9783. @emph{html} (HTML format)
  9784. @item
  9785. @emph{icalendar} (iCalendar format)
  9786. @item
  9787. @emph{latex} (@LaTeX{} format)
  9788. @item
  9789. @emph{md} (Markdown format)
  9790. @item
  9791. @emph{odt} (OpenDocument Text format)
  9792. @item
  9793. @emph{org} (Org format)
  9794. @item
  9795. @emph{texinfo} (Texinfo format)
  9796. @item
  9797. @emph{man} (Man page format)
  9798. @end itemize
  9799. @noindent
  9800. Org also uses additional libraries located in @samp{contrib/} directory
  9801. (see @ref{Installation}). Users can install additional export libraries
  9802. for additional formats from the Emacs packaging system. For easy
  9803. discovery, these packages have a common naming scheme: @code{ox-NAME},
  9804. where @var{NAME} is one of the formats. For example,
  9805. @code{ox-koma-letter} @emph{koma-letter} back-end.
  9806. @vindex org-export-backends
  9807. Org loads back-ends for the following formats by default: ASCII, HTML,
  9808. iCalendar, @LaTeX{} and ODT. Org can load additional back-ends either of
  9809. two ways: through the @code{org-export-backends} variable configuration;
  9810. or, by requiring the library in the Emacs init file like this:
  9811. @lisp
  9812. (require 'ox-md)
  9813. @end lisp
  9814. @menu
  9815. * The Export Dispatcher:: The main interface.
  9816. * Export Settings:: Common export settings.
  9817. * Table of Contents:: The if and where of the table of contents.
  9818. * Include Files:: Include additional files into a document.
  9819. * Macro Replacement:: Use macros to create templates.
  9820. * Comment Lines:: What will not be exported.
  9821. * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding.
  9822. * Beamer Export::
  9823. * HTML Export:: Exporting to HTML.
  9824. * @LaTeX{} Export:: Exporting to @LaTeX{} and processing to PDF.
  9825. * Markdown Export:: Exporting to Markdown.
  9826. * OpenDocument Text Export:: Exporting to OpenDocument Text.
  9827. * Org Export:: Exporting to Org.
  9828. * Texinfo Export:: Exporting to Texinfo.
  9829. * iCalendar Export:: Exporting to iCalendar.
  9830. * Other Built-in Back-ends:: Exporting to a man page.
  9831. * Advanced Configuration:: Fine-tuning the export output.
  9832. * Export in Foreign Buffers:: Author tables and lists in Org syntax.
  9833. @end menu
  9834. @node The Export Dispatcher
  9835. @section The Export Dispatcher
  9836. @cindex dispatcher, for export commands
  9837. @cindex Export, dispatcher
  9838. The export dispatcher is the main interface for Org's exports.
  9839. A hierarchical menu presents the currently configured export formats.
  9840. Options are shown as easy toggle switches on the same screen.
  9841. @vindex org-export-dispatch-use-expert-ui
  9842. Org also has a minimal prompt interface for the export dispatcher.
  9843. When the variable @code{org-export-dispatch-use-expert-ui} is set to
  9844. a non-@code{nil} value, Org prompts in the minibuffer. To switch back to
  9845. the hierarchical menu, press @kbd{?}.
  9846. @table @asis
  9847. @item @kbd{C-c C-e} (@code{org-export})
  9848. @kindex C-c C-e
  9849. @findex org-export
  9850. Invokes the export dispatcher interface. The options show
  9851. default settings. The @kbd{C-u} prefix argument preserves
  9852. options from the previous export, including any sub-tree
  9853. selections.
  9854. @end table
  9855. Org exports the entire buffer by default. If the Org buffer has an
  9856. active region, then Org exports just that region.
  9857. Within the dispatcher interface, the following key combinations can
  9858. further alter what is exported, and how.
  9859. @table @asis
  9860. @item @kbd{C-a}
  9861. @kindex C-c C-e C-a
  9862. Toggle asynchronous export. Asynchronous export uses an external
  9863. Emacs process with a specially configured initialization file to
  9864. complete the exporting process in the background thereby
  9865. releasing the current interface. This is particularly useful
  9866. when exporting long documents.
  9867. Output from an asynchronous export is saved on the ``the export
  9868. stack''. To view this stack, call the export dispatcher with
  9869. a double @kbd{C-u} prefix argument. If already in the
  9870. export dispatcher menu, @kbd{&} displays the stack.
  9871. @vindex org-export-async-init-file
  9872. To make the background export process the default, customize the
  9873. variable, @code{org-export-in-background}. Additionally, you can set
  9874. the initialization file used by the background process with
  9875. @code{org-export-async-init-file}.
  9876. @vindex org-export-in-background
  9877. You can make asynchronous export the default by setting
  9878. @code{org-export-in-background}.
  9879. @item @kbd{C-b}
  9880. @kindex C-c C-e C-b
  9881. Toggle body-only export. Useful for excluding headers and
  9882. footers in the export. Affects only those back-end formats that
  9883. have such sections---like @samp{<head>...</head>} in HTML.
  9884. @item @{@{@{kbd(C-s@}@}@}
  9885. @kindex C-c C-e C-s
  9886. Toggle sub-tree export. When turned on, Org exports only the
  9887. sub-tree starting from the cursor position at the time the export
  9888. dispatcher was invoked. Org uses the top heading of this
  9889. sub-tree as the document's title. If the cursor is not on
  9890. a heading, Org uses the nearest enclosing header. If the cursor
  9891. is in the document preamble, Org signals an error and aborts
  9892. export.
  9893. @vindex org-export-initial-scope
  9894. To make the sub-tree export the default, customize the variable
  9895. @code{org-export-initial-scope}.
  9896. @item @kbd{C-v}
  9897. @kindex C-c C-e C-v
  9898. Toggle visible-only export. Useful for exporting only visible
  9899. parts of an Org document by adjusting outline visibility
  9900. settings.
  9901. @end table
  9902. @node Export Settings
  9903. @section Export Settings
  9904. @cindex options, for export
  9905. @cindex Export, settings
  9906. @cindex @samp{OPTIONS}, keyword
  9907. Export options can be set: globally with variables; for an individual
  9908. file by making variables buffer-local with in-buffer settings (see
  9909. @ref{In-buffer Settings}), by setting individual keywords, or by
  9910. specifying them in a compact form with the @samp{OPTIONS} keyword; or for
  9911. a tree by setting properties (see @ref{Properties and Columns}). Options
  9912. set at a specific level override options set at a more general level.
  9913. @cindex SETUPFILE, keyword
  9914. In-buffer settings may appear anywhere in the file, either directly or
  9915. indirectly through a file included using @samp{#+SETUPFILE: filename or
  9916. URL} syntax. Option keyword sets tailored to a particular back-end
  9917. can be inserted from the export dispatcher (see @ref{The Export Dispatcher}) using the @samp{Insert template} command by pressing
  9918. @kbd{#}. To insert keywords individually, a good way to make
  9919. sure the keyword is correct is to type @samp{#+} and then to use
  9920. @kbd{M-@key{TAB}}@footnote{Many desktops intercept @kbd{M-@key{TAB}} to switch windows.
  9921. Use @kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} instead.} for completion.
  9922. The export keywords available for every back-end, and their equivalent
  9923. global variables, include:
  9924. @table @asis
  9925. @item @samp{AUTHOR}
  9926. @cindex @samp{AUTHOR}, keyword
  9927. @vindex user-full-name
  9928. The document author (@code{user-full-name}).
  9929. @item @samp{CREATOR}
  9930. @cindex @samp{CREATOR}, keyword
  9931. @vindex org-expot-creator-string
  9932. Entity responsible for output generation
  9933. (@code{org-export-creator-string}).
  9934. @item @samp{DATE}
  9935. @cindex @samp{DATE}, keyword
  9936. @vindex org-export-date-timestamp-format
  9937. A date or a time-stamp@footnote{The variable @code{org-export-date-timestamp-format} defines how
  9938. this timestamp are exported.}.
  9939. @item @samp{EMAIL}
  9940. @cindex @samp{EMAIL}, keyword
  9941. @vindex user-mail-address
  9942. The email address (@code{user-mail-address}).
  9943. @item @samp{LANGUAGE}
  9944. @cindex @samp{LANGUAGE}, keyword
  9945. @vindex org-export-default-language
  9946. Language to use for translating certain strings
  9947. (@code{org-export-default-language}). With @samp{#+LANGUAGE: fr}, for
  9948. example, Org translates @samp{Table of contents} to the French @samp{Table
  9949. des matières}.
  9950. @item @samp{SELECT_TAGS}
  9951. @cindex @samp{SELECT_TAGS}, keyword
  9952. @vindex org-export-select-tags
  9953. The default value is @code{("export")}. When a tree is tagged with
  9954. @samp{export} (@code{org-export-select-tags}), Org selects that tree and
  9955. its sub-trees for export. Org excludes trees with @samp{noexport}
  9956. tags, see below. When selectively exporting files with @samp{export}
  9957. tags set, Org does not export any text that appears before the
  9958. first headline.
  9959. @item @samp{EXCLUDE_TAGS}
  9960. @cindex @samp{EXCLUDE_TAGS}, keyword
  9961. @vindex org-export-exclude-tags
  9962. The default value is @code{("noexport")}. When a tree is tagged with
  9963. @samp{noexport} (@code{org-export-exclude-tags}), Org excludes that tree
  9964. and its sub-trees from export. Entries tagged with @samp{noexport}
  9965. are unconditionally excluded from the export, even if they have
  9966. an @samp{export} tag. Even if a sub-tree is not exported, Org
  9967. executes any code blocks contained there.
  9968. @item @samp{TITLE}
  9969. @cindex @samp{TITLE}, keyword
  9970. @cindex document title
  9971. Org displays this title. For long titles, use multiple @samp{#+TITLE}
  9972. lines.
  9973. @item @samp{EXPORT_FILE_NAME}
  9974. @cindex @samp{EXPORT_FILE_NAME}, keyword
  9975. The name of the output file to be generated. Otherwise, Org
  9976. generates the file name based on the buffer name and the
  9977. extension based on the back-end format.
  9978. @end table
  9979. The @samp{OPTIONS} keyword is a compact form. To configure multiple
  9980. options, use several @samp{OPTIONS} lines. @samp{OPTIONS} recognizes the
  9981. following arguments.
  9982. @table @asis
  9983. @item @code{'}
  9984. @vindex org-export-with-smart-quotes
  9985. Toggle smart quotes (@code{org-export-with-smart-quotes}). Depending
  9986. on the language used, when activated, Org treats pairs of double
  9987. quotes as primary quotes, pairs of single quotes as secondary
  9988. quotes, and single quote marks as apostrophes.
  9989. @item @code{*}
  9990. @vindex org-export-with-emphasize
  9991. Toggle emphasized text (@code{org-export-with-emphasize}).
  9992. @item @code{-}
  9993. @vindex org-export-with-special-strings
  9994. Toggle conversion of special strings
  9995. (@code{org-export-with-special-strings}).
  9996. @item @code{:}
  9997. @vindex org-export-with-fixed-width
  9998. Toggle fixed-width sections (@code{org-export-with-fixed-width}).
  9999. @item @code{<}
  10000. @vindex org-export-with-timestamps
  10001. Toggle inclusion of time/date active/inactive stamps
  10002. (@code{org-export-with-timestamps}).
  10003. @item @code{\n}
  10004. @vindex org-export-preserve-breaks
  10005. Toggles whether to preserve line breaks
  10006. (@code{org-export-preserve-breaks}).
  10007. @item @code{^}
  10008. @vindex org-export-with-sub-superscripts
  10009. Toggle @TeX{}-like syntax for sub- and superscripts. If you write
  10010. @samp{^:@{@}}, @samp{a_@{b@}} is interpreted, but the simple @samp{a_b} is left as
  10011. it is (@code{org-export-with-sub-superscripts}).
  10012. @item @code{arch}
  10013. @vindex org-export-with-archived-trees
  10014. Configure how archived trees are exported. When set to
  10015. @code{headline}, the export process skips the contents and processes
  10016. only the headlines (@code{org-export-with-archived-trees}).
  10017. @item @code{author}
  10018. @vindex org-export-with-author
  10019. Toggle inclusion of author name into exported file
  10020. (@code{org-export-with-author}).
  10021. @item @code{broken-links}
  10022. @vindex org-export-with-broken-links
  10023. Toggles if Org should continue exporting upon finding a broken
  10024. internal link. When set to @code{mark}, Org clearly marks the problem
  10025. link in the output (@code{org-export-with-broken-links}).
  10026. @item @code{c}
  10027. @vindex org-export-with-clocks
  10028. Toggle inclusion of CLOCK keywords (@code{org-export-with-clocks}).
  10029. @item @code{creator}
  10030. @vindex org-export-with-creator
  10031. Toggle inclusion of creator information in the exported file
  10032. (@code{org-export-with-creator}).
  10033. @item @code{d}
  10034. @vindex org-export-with-drawers
  10035. Toggles inclusion of drawers, or list of drawers to include, or
  10036. list of drawers to exclude (@code{org-export-with-drawers}).
  10037. @item @code{date}
  10038. @vindex org-export-with-date
  10039. Toggle inclusion of a date into exported file
  10040. (@code{org-export-with-date}).
  10041. @item @code{e}
  10042. @vindex org-export-with-entities
  10043. Toggle inclusion of entities (@code{org-export-with-entities}).
  10044. @item @code{email}
  10045. @vindex org-export-with-email
  10046. Toggle inclusion of the author's e-mail into exported file
  10047. (@code{org-export-with-email}).
  10048. @item @code{f}
  10049. @vindex org-export-with-footnotes
  10050. Toggle the inclusion of footnotes (@code{org-export-with-footnotes}).
  10051. @item @code{H}
  10052. @vindex org-export-headline-levels
  10053. Set the number of headline levels for export
  10054. (@code{org-export-headline-levels}). Below that level, headlines are
  10055. treated differently. In most back-ends, they become list items.
  10056. @item @code{inline}
  10057. @vindex org-export-with-inlinetasks
  10058. Toggle inclusion of inlinetasks (@code{org-export-with-inlinetasks}).
  10059. @item @code{num}
  10060. @vindex org-export-with-section-numbers
  10061. @cindex @samp{UNNUMBERED}, property
  10062. Toggle section-numbers (@code{org-export-with-section-numbers}). When
  10063. set to number N, Org numbers only those headlines at level N or
  10064. above. Set @samp{UNNUMBERED} property to non-@code{nil} to disable
  10065. numbering of heading and subheadings entirely. Moreover, when
  10066. the value is @samp{notoc} the headline, and all its children, do not
  10067. appear in the table of contents either (see @ref{Table of Contents}).
  10068. @item @code{p}
  10069. @vindex org-export-with-planning
  10070. Toggle export of planning information
  10071. (@code{org-export-with-planning}). ``Planning information'' comes from
  10072. lines located right after the headline and contain any
  10073. combination of these cookies: @samp{SCHEDULED}, @samp{DEADLINE}, or
  10074. @samp{CLOSED}.
  10075. @item @code{pri}
  10076. @vindex org-export-with-priority
  10077. Toggle inclusion of priority cookies
  10078. (@code{org-export-with-priority}).
  10079. @item @code{prop}
  10080. @vindex org-export-with-properties
  10081. Toggle inclusion of property drawers, or list the properties to
  10082. include (@code{org-export-with-properties}).
  10083. @item @code{stat}
  10084. @vindex org-export-with-statistics-cookies
  10085. Toggle inclusion of statistics cookies
  10086. (@code{org-export-with-statistics-cookies}).
  10087. @item @code{tags}
  10088. @vindex org-export-with-tags
  10089. Toggle inclusion of tags, may also be @code{not-in-toc}
  10090. (@code{org-export-with-tags}).
  10091. @item @code{tasks}
  10092. @vindex org-export-with-tasks
  10093. Toggle inclusion of tasks (TODO items); or @code{nil} to remove all
  10094. tasks; or @code{todo} to remove DONE tasks; or list the keywords to
  10095. keep (@code{org-export-with-tasks}).
  10096. @item @code{tex}
  10097. @vindex org-export-with-latex
  10098. @code{nil} does not export; @code{t} exports; @code{verbatim} keeps everything
  10099. in verbatim (@code{org-export-with-latex}).
  10100. @item @code{timestamp}
  10101. @vindex org-export-time-stamp-file
  10102. Toggle inclusion of the creation time in the exported file
  10103. (@code{org-export-time-stamp-file}).
  10104. @item @code{title}
  10105. @vindex org-export-with-title
  10106. Toggle inclusion of title (@code{org-export-with-title}).
  10107. @item @code{toc}
  10108. @vindex org-export-with-toc
  10109. Toggle inclusion of the table of contents, or set the level limit
  10110. (@code{org-export-with-toc}).
  10111. @item @code{todo}
  10112. @vindex org-export-with-todo-keywords
  10113. Toggle inclusion of TODO keywords into exported text
  10114. (@code{org-export-with-todo-keywords}).
  10115. @item @code{|}
  10116. @vindex org-export-with-tables
  10117. Toggle inclusion of tables (@code{org-export-with-tables}).
  10118. @end table
  10119. When exporting sub-trees, special node properties in them can override
  10120. the above keywords. They are special because they have an @samp{EXPORT_}
  10121. prefix. For example, @samp{DATE} and @samp{EXPORT_FILE_NAME} keywords become,
  10122. respectively, @samp{EXPORT_DATE} and @samp{EXPORT_FILE_NAME}. Except for
  10123. @samp{SETUPFILE}, all other keywords listed above have an @samp{EXPORT_}
  10124. equivalent.
  10125. @cindex @samp{BIND}, keyword
  10126. @vindex org-export-allow-bind-keywords
  10127. If @code{org-export-allow-bind-keywords} is non-@code{nil}, Emacs variables can
  10128. become buffer-local during export by using the @samp{BIND} keyword. Its
  10129. syntax is @samp{#+BIND: variable value}. This is particularly useful for
  10130. in-buffer settings that cannot be changed using keywords.
  10131. @node Table of Contents
  10132. @section Table of Contents
  10133. @cindex table of contents
  10134. @cindex list of tables
  10135. @cindex list of listings
  10136. @cindex @samp{toc}, in @samp{OPTIONS} keyword
  10137. @vindex org-export-with-toc
  10138. The table of contents includes all headlines in the document. Its
  10139. depth is therefore the same as the headline levels in the file. If
  10140. you need to use a different depth, or turn it off entirely, set the
  10141. @code{org-export-with-toc} variable accordingly. You can achieve the same
  10142. on a per file basis, using the following @samp{toc} item in @samp{OPTIONS}
  10143. keyword:
  10144. @example
  10145. #+OPTIONS: toc:2 (only include two levels in TOC)
  10146. #+OPTIONS: toc:nil (no default TOC at all)
  10147. @end example
  10148. @cindex excluding entries from table of contents
  10149. @cindex table of contents, exclude entries
  10150. Org includes both numbered and unnumbered headlines in the table of
  10151. contents@footnote{At the moment, some export back-ends do not obey this
  10152. specification. For example, @LaTeX{} export excludes every unnumbered
  10153. headline from the table of contents.}. If you need to exclude an unnumbered headline,
  10154. along with all its children, set the @samp{UNNUMBERED} property to @samp{notoc}
  10155. value.
  10156. @example
  10157. * Subtree not numbered, not in table of contents either
  10158. :PROPERTIES:
  10159. :UNNUMBERED: notoc
  10160. :END:
  10161. @end example
  10162. @cindex @samp{TOC}, keyword
  10163. Org normally inserts the table of contents directly before the first
  10164. headline of the file. To move the table of contents to a different
  10165. location, first turn off the default with @code{org-export-with-toc}
  10166. variable or with @samp{#+OPTIONS: toc:nil}. Then insert @samp{#+TOC: headlines
  10167. N} at the desired location(s).
  10168. @example
  10169. #+OPTIONS: toc:nil
  10170. ...
  10171. #+TOC: headlines 2
  10172. @end example
  10173. To adjust the table of contents depth for a specific section of the
  10174. Org document, append an additional @samp{local} parameter. This parameter
  10175. becomes a relative depth for the current level. The following example
  10176. inserts a local table of contents, with direct children only.
  10177. @example
  10178. * Section
  10179. #+TOC: headlines 1 local
  10180. @end example
  10181. Note that for this feature to work properly in @LaTeX{} export, the Org
  10182. file requires the inclusion of the titletoc package. Because of
  10183. compatibility issues, titletoc has to be loaded @emph{before} hyperref.
  10184. Customize the @code{org-latex-default-packages-alist} variable.
  10185. Use the @samp{TOC} keyword to generate list of tables---respectively, all
  10186. listings---with captions.
  10187. @example
  10188. #+TOC: listings
  10189. #+TOC: tables
  10190. @end example
  10191. @cindex @samp{ALT_TITLE}, property
  10192. Normally Org uses the headline for its entry in the table of contents.
  10193. But with @samp{ALT_TITLE} property, a different entry can be specified for
  10194. the table of contents.
  10195. @node Include Files
  10196. @section Include Files
  10197. @cindex include files, during export
  10198. @cindex Export, include files
  10199. @cindex @samp{INCLUDE}, keyword
  10200. During export, you can include the content of another file. For
  10201. example, to include your @samp{.emacs} file, you could use:
  10202. @example
  10203. #+INCLUDE: "~/.emacs" src emacs-lisp
  10204. @end example
  10205. @noindent
  10206. The optional second and third parameter are the markup (e.g., @samp{quote},
  10207. @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the language for
  10208. formatting the contents. The markup is optional; if it is not given,
  10209. assume text is in Org syntax and process it normally. The @samp{INCLUDE}
  10210. keyword also allows additional parameters @samp{:prefix1} and @samp{:prefix} to
  10211. specify prefixes for the first line and for each following line,
  10212. @samp{:minlevel} in order to get Org mode content demoted to a specified
  10213. level, as well as any options accepted by the selected markup. For
  10214. example, to include a file as an item, use:
  10215. @example
  10216. #+INCLUDE: "~/snippets/xx" :prefix1 " + " :prefix " "
  10217. @end example
  10218. You can also include a portion of a file by specifying a lines range
  10219. using the @samp{:lines} parameter. The line at the upper end of the range
  10220. is not included. The start and/or the end of the range may be omitted
  10221. to use the obvious defaults.
  10222. @table @asis
  10223. @item @samp{#+INCLUDE: "~/.emacs" :lines "5-10"}
  10224. Include lines 5 to 10, 10 excluded.
  10225. @item @samp{#+INCLUDE: "~/.emacs" :lines "-10"}
  10226. Include lines 1 to 10, 10 excluded.
  10227. @item @samp{#+INCLUDE: "~/.emacs" :lines "10-"}
  10228. Include lines from 10 to EOF.
  10229. @end table
  10230. You can visit the file being included with the following command.
  10231. @table @asis
  10232. @item @kbd{C-c '} (@code{org-edit~special})
  10233. @kindex C-c '
  10234. @findex org-edit-special
  10235. Visit the include file at point.
  10236. @end table
  10237. @node Macro Replacement
  10238. @section Macro Replacement
  10239. @cindex macro replacement, during export
  10240. @cindex @samp{MACRO}, keyword
  10241. @vindex org-export-global-macros
  10242. Macros replace text snippets during export. Macros are defined
  10243. globally in @code{org-export-global-macros}, or document-wise with the
  10244. following syntax:
  10245. @example
  10246. #+MACRO: name replacement text; $1, $2 are arguments
  10247. @end example
  10248. @noindent
  10249. which can be referenced using @samp{@{@{@{name(arg1, arg2)@}@}@}}@footnote{Since commas separate the arguments, commas within arguments
  10250. have to be escaped with the backslash character. So only those
  10251. backslash characters before a comma need escaping with another
  10252. backslash character.}. For
  10253. example
  10254. @example
  10255. #+MACRO: poem The rose is $1, The violet's $2. Life's ordered: Org assists you.
  10256. @{@{@{poem(red,blue)@}@}@}
  10257. @end example
  10258. @noindent
  10259. becomes
  10260. @example
  10261. The rose is red, The violet's blue. Life's ordered: Org assists you.
  10262. @end example
  10263. As a special case, Org parses any replacement text starting with
  10264. @samp{(eval} as an Emacs Lisp expression and evaluates it accordingly.
  10265. Within such templates, arguments become strings. Thus, the following
  10266. macro
  10267. @example
  10268. #+MACRO: gnucheck (eval (concat "GNU/" (capitalize $1)))
  10269. @end example
  10270. @noindent
  10271. turns @samp{@{@{@{gnucheck(linux)@}@}@}} into @samp{GNU/Linux} during export.
  10272. Org recognizes macro references in following Org markup areas:
  10273. paragraphs, headlines, verse blocks, tables cells and lists. Org also
  10274. recognizes macro references in keywords, such as @samp{CAPTION}, @samp{TITLE},
  10275. @samp{AUTHOR}, @samp{DATE}, and for some back-end specific export options.
  10276. Org comes with following pre-defined macros:
  10277. @table @asis
  10278. @item @samp{@{@{@{keyword(NAME)@}@}@}}
  10279. @itemx @samp{@{@{@{title@}@}@}}
  10280. @itemx @samp{@{@{@{author@}@}@}}
  10281. @itemx @samp{@{@{@{email@}@}@}}
  10282. @cindex @samp{keyword}, macro
  10283. @cindex @samp{title}, macro
  10284. @cindex @samp{author}, macro
  10285. @cindex @samp{email}, macro
  10286. The @samp{keyword} macro collects all values from @var{NAME}
  10287. keywords throughout the buffer, separated with white space.
  10288. @samp{title}, @samp{author} and @samp{email} macros are shortcuts for,
  10289. respectively, @samp{@{@{@{keyword(TITLE)@}@}@}}, @samp{@{@{@{keyword(AUTHOR)@}@}@}} and
  10290. @samp{@{@{@{keyword(EMAIL)@}@}@}}.
  10291. @item @samp{@{@{@{date@}@}@}}
  10292. @itemx @samp{@{@{@{date(FORMAT)@}@}@}}
  10293. @cindex @samp{date}, macro
  10294. This macro refers to the @samp{DATE} keyword. @var{FORMAT} is an
  10295. optional argument to the @samp{date} macro that is used only if @samp{DATE}
  10296. is a single timestamp. @var{FORMAT} should be a format
  10297. string understood by @code{format-time-string}.
  10298. @item @samp{@{@{@{time(FORMAT)@}@}@}}
  10299. @itemx @samp{@{@{@{modification-time(FORMAT, VC)@}@}@}}
  10300. @cindex @samp{time}, macro
  10301. @cindex @samp{modification-time}, macro
  10302. These macros refer to the document's date and time of export and
  10303. date and time of modification. @var{FORMAT} is a string
  10304. understood by @code{format-time-string}. If the second argument to
  10305. the @code{modification-time} macro is non-@code{nil}, Org uses @samp{vc.el} to
  10306. retrieve the document's modification time from the version
  10307. control system. Otherwise Org reads the file attributes.
  10308. @item @samp{@{@{@{input-file@}@}@}}
  10309. @cindex @samp{input-file}, macro
  10310. This macro refers to the filename of the exported file.
  10311. @item @samp{@{@{@{property(PROPERTY-NAME)@}@}@}}
  10312. @itemx @samp{@{@{@{property(PROPERTY-NAME, SEARCH OPTION)@}@}@}}
  10313. @cindex @samp{property}, macro
  10314. This macro returns the value of property @var{PROPERTY-NAME}
  10315. in the current entry. If @var{SEARCH-OPTION} (see @ref{Search Options}) refers to a remote entry, use it instead.
  10316. @item @samp{@{@{@{n@}@}@}}
  10317. @itemx @samp{@{@{@{n(NAME)@}@}@}}
  10318. @itemx @samp{@{@{@{n(NAME, ACTION)@}@}@}}
  10319. @cindex @samp{n}, macro
  10320. @cindex counter, macro
  10321. This macro implements custom counters by returning the number of
  10322. times the macro has been expanded so far while exporting the
  10323. buffer. You can create more than one counter using different
  10324. @var{NAME} values. If @var{ACTION} is @samp{-}, previous
  10325. value of the counter is held, i.e., the specified counter is not
  10326. incremented. If the value is a number, the specified counter is
  10327. set to that value. If it is any other non-empty string, the
  10328. specified counter is reset to 1. You may leave @var{NAME}
  10329. empty to reset the default counter.
  10330. @end table
  10331. @vindex org-hide-macro-markers
  10332. The surrounding brackets can be made invisible by setting
  10333. @code{org-hide-macro-markers} non-@code{nil}.
  10334. Org expands macros at the very beginning of the export process.
  10335. @node Comment Lines
  10336. @section Comment Lines
  10337. @cindex exporting, not
  10338. @cindex comment lines
  10339. Lines starting with zero or more whitespace characters followed by one
  10340. @samp{#} and a whitespace are treated as comments and, as such, are not
  10341. exported.
  10342. @cindex @samp{BEGIN_COMMENT}
  10343. @cindex comment block
  10344. Likewise, regions surrounded by @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT}
  10345. are not exported.
  10346. @cindex comment trees
  10347. Finally, a @samp{COMMENT} keyword at the beginning of an entry, but after
  10348. any other keyword or priority cookie, comments out the entire subtree.
  10349. In this case, the subtree is not exported and no code block within it
  10350. is executed either@footnote{For a less drastic behavior, consider using a select tag (see
  10351. @ref{Export Settings}) instead.}. The command below helps changing the
  10352. comment status of a headline.
  10353. @table @asis
  10354. @item @kbd{C-c ;} (@code{org-toggle-comment})
  10355. @kindex C-c ;
  10356. @findex org-toggle-comment
  10357. Toggle the @samp{COMMENT} keyword at the beginning of an entry.
  10358. @end table
  10359. @node ASCII/Latin-1/UTF-8 export
  10360. @section ASCII/Latin-1/UTF-8 export
  10361. @cindex ASCII export
  10362. @cindex Latin-1 export
  10363. @cindex UTF-8 export
  10364. ASCII export produces an output file containing only plain ASCII
  10365. characters. This is the simplest and most direct text output. It
  10366. does not contain any Org markup. Latin-1 and UTF-8 export use
  10367. additional characters and symbols available in these encoding
  10368. standards. All three of these export formats offer the most basic of
  10369. text output for maximum portability.
  10370. @vindex org-ascii-text-width
  10371. On export, Org fills and justifies text according to the text width
  10372. set in @code{org-ascii-text-width}.
  10373. @vindex org-ascii-links-to-notes
  10374. Org exports links using a footnote-like style where the descriptive
  10375. part is in the text and the link is in a note before the next heading.
  10376. See the variable @code{org-ascii-links-to-notes} for details.
  10377. @anchor{ASCII export commands}
  10378. @subheading ASCII export commands
  10379. @table @asis
  10380. @item @kbd{C-c C-e t a} (@code{org-ascii-export-to-ascii})
  10381. @itemx @kbd{C-c C-e t l}
  10382. @itemx @kbd{C-c C-e t u}
  10383. @kindex C-c C-e t a
  10384. @kindex C-c C-e t l
  10385. @kindex C-c C-e t u
  10386. @findex org-ascii-export-to-ascii
  10387. Export as an ASCII file with a @samp{.txt} extension. For
  10388. @samp{myfile.org}, Org exports to @samp{myfile.txt}, overwriting without
  10389. warning. For @samp{myfile.txt}, Org exports to @samp{myfile.txt.txt} in
  10390. order to prevent data loss.
  10391. @end table
  10392. @table @asis
  10393. @item @kbd{C-c C-e t A} (@code{org-ascii-export-to-ascii})
  10394. @itemx @kbd{C-c C-e t L}
  10395. @itemx @kbd{C-c C-e t U}
  10396. @kindex C-c C-e t A
  10397. @kindex C-c C-e t L
  10398. @kindex C-c C-e t U
  10399. @findex org-ascii-export-to-ascii
  10400. Export to a temporary buffer. Does not create a file.
  10401. @end table
  10402. @anchor{ASCII specific export settings}
  10403. @subheading ASCII specific export settings
  10404. The ASCII export back-end has one extra keyword for customizing ASCII
  10405. output. Setting this keyword works similar to the general options
  10406. (see @ref{Export Settings}).
  10407. @table @asis
  10408. @item @samp{SUBTITLE}
  10409. @cindex @samp{SUBTITLE}, keyword
  10410. The document subtitle. For long subtitles, use multiple
  10411. @samp{#+SUBTITLE} lines in the Org file. Org prints them on one
  10412. continuous line, wrapping into multiple lines if necessary.
  10413. @end table
  10414. @anchor{Header and sectioning structure}
  10415. @subheading Header and sectioning structure
  10416. Org converts the first three outline levels into headlines for ASCII
  10417. export. The remaining levels are turned into lists. To change this
  10418. cut-off point where levels become lists, see @ref{Export Settings}.
  10419. @anchor{Quoting ASCII text}
  10420. @subheading Quoting ASCII text
  10421. To insert text within the Org file by the ASCII back-end, use one the
  10422. following constructs, inline, keyword, or export block:
  10423. @cindex @samp{ASCII}, keyword
  10424. @cindex @samp{BEGIN_EXPORT ascii}
  10425. @example
  10426. Inline text @@@@ascii:and additional text@@@@ within a paragraph.
  10427. #+ASCII: Some text
  10428. #+BEGIN_EXPORT ascii
  10429. Org exports text in this block only when using ASCII back-end.
  10430. #+END_EXPORT
  10431. @end example
  10432. @anchor{ASCII specific attributes}
  10433. @subheading ASCII specific attributes
  10434. @cindex @samp{ATTR_ASCII}, keyword
  10435. @cindex horizontal rules, in ASCII export
  10436. ASCII back-end recognizes only one attribute, @code{:width}, which
  10437. specifies the width of an horizontal rule in number of characters.
  10438. The keyword and syntax for specifying widths is:
  10439. @example
  10440. #+ATTR_ASCII: :width 10
  10441. -----
  10442. @end example
  10443. @anchor{ASCII special blocks}
  10444. @subheading ASCII special blocks
  10445. @cindex special blocks, in ASCII export
  10446. @cindex @samp{BEGIN_JUSTIFYLEFT}
  10447. @cindex @samp{BEGIN_JUSTIFYRIGHT}
  10448. Besides @samp{#+BEGIN_CENTER} blocks (see @ref{Paragraphs}), ASCII back-end has
  10449. these two left and right justification blocks:
  10450. @example
  10451. #+BEGIN_JUSTIFYLEFT
  10452. It's just a jump to the left...
  10453. #+END_JUSTIFYLEFT
  10454. #+BEGIN_JUSTIFYRIGHT
  10455. ...and then a step to the right.
  10456. #+END_JUSTIFYRIGHT
  10457. @end example
  10458. @node Beamer Export
  10459. @section Beamer Export
  10460. @cindex Beamer export
  10461. Org uses Beamer export to convert an Org file tree structure into
  10462. high-quality interactive slides for presentations. Beamer is a @LaTeX{}
  10463. document class for creating presentations in PDF, HTML, and other
  10464. popular display formats.
  10465. @menu
  10466. * Beamer export commands:: For creating Beamer documents.
  10467. * Beamer specific export settings:: For customizing Beamer export.
  10468. * Frames and Blocks in Beamer:: For composing Beamer slides.
  10469. * Beamer specific syntax:: For using in Org documents.
  10470. * Editing support:: Editing support.
  10471. * A Beamer example:: A complete presentation.
  10472. @end menu
  10473. @node Beamer export commands
  10474. @subsection Beamer export commands
  10475. @table @asis
  10476. @item @kbd{C-c C-e l b} (@code{org-beamer-export-to-latex})
  10477. @kindex C-c C-e l b
  10478. @findex org-beamer-export-to-latex
  10479. Export as @LaTeX{} file with a @samp{.tex} extension. For @samp{myfile.org},
  10480. Org exports to @samp{myfile.tex}, overwriting without warning.
  10481. @item @kbd{C-c C-e l B} (@code{org-beamer-export-as-latex})
  10482. @kindex C-c C-e l B
  10483. @findex org-beamer-export-as-latex
  10484. Export to a temporary buffer. Does not create a file.
  10485. @item @kbd{C-c C-e l P} (@code{org-beamer-export-to-pdf})
  10486. @kindex C-c C-e l P
  10487. @findex org-beamer-export-to-pdf
  10488. Export as @LaTeX{} file and then convert it to PDF format.
  10489. @item @kbd{C-c C-e l O}
  10490. @kindex C-c C-e l O
  10491. Export as @LaTeX{} file, convert it to PDF format, and then open the
  10492. PDF file.
  10493. @end table
  10494. @node Beamer specific export settings
  10495. @subsection Beamer specific export settings
  10496. Beamer export back-end has several additional keywords for customizing
  10497. Beamer output. These keywords work similar to the general options
  10498. settings (see @ref{Export Settings}).
  10499. @table @asis
  10500. @item @samp{BEAMER_THEME}
  10501. @cindex @samp{BEAMER_THEME}, keyword
  10502. @vindex org-beamer-theme
  10503. The Beamer layout theme (@code{org-beamer-theme}). Use square
  10504. brackets for options. For example:
  10505. @example
  10506. #+BEAMER_THEME: Rochester [height=20pt]
  10507. @end example
  10508. @item @samp{BEAMER_FONT_THEME}
  10509. @cindex @samp{BEAMER_FONT_THEME}, keyword
  10510. The Beamer font theme.
  10511. @item @samp{BEAMER_INNER_THEME}
  10512. @cindex @samp{BEAMER_INNER_THEME}, keyword
  10513. The Beamer inner theme.
  10514. @item @samp{BEAMER_OUTER_THEME}
  10515. @cindex @samp{BEAMER_OUTER_THEME}, keyword
  10516. The Beamer outer theme.
  10517. @item @samp{BEAMER_HEADER}
  10518. @cindex @samp{BEAMER_HEADER}, keyword
  10519. Arbitrary lines inserted in the preamble, just before the
  10520. @samp{hyperref} settings.
  10521. @item @samp{DESCRIPTION}
  10522. @cindex @samp{DESCRIPTION}, keyword
  10523. The document description. For long descriptions, use multiple
  10524. @samp{DESCRIPTION} keywords. By default, @samp{hyperref} inserts
  10525. @samp{DESCRIPTION} as metadata. Use @code{org-latex-hyperref-template} to
  10526. configure document metadata. Use @code{org-latex-title-command} to
  10527. configure typesetting of description as part of front matter.
  10528. @item @samp{KEYWORDS}
  10529. @cindex @samp{KEYWORDS}, keyword
  10530. The keywords for defining the contents of the document. Use
  10531. multiple @samp{KEYWORDS} lines if necessary. By default, @samp{hyperref}
  10532. inserts @samp{KEYWORDS} as metadata. Use
  10533. @code{org-latex-hyperref-template} to configure document metadata.
  10534. Use @code{org-latex-title-command} to configure typesetting of
  10535. keywords as part of front matter.
  10536. @item @samp{SUBTITLE}
  10537. @cindex @samp{SUBTITLE}, keyword
  10538. Document's subtitle. For typesetting, use
  10539. @code{org-beamer-subtitle-format} string. Use
  10540. @code{org-latex-hyperref-template} to configure document metadata.
  10541. Use @code{org-latex-title-command} to configure typesetting of
  10542. subtitle as part of front matter.
  10543. @end table
  10544. @node Frames and Blocks in Beamer
  10545. @subsection Frames and Blocks in Beamer
  10546. Org transforms heading levels into Beamer's sectioning elements,
  10547. frames and blocks. Any Org tree with a not-too-deep-level nesting
  10548. should in principle be exportable as a Beamer presentation.
  10549. @itemize
  10550. @item
  10551. @vindex org-beamer-frame-level
  10552. Org headlines become Beamer frames when the heading level in Org is
  10553. equal to @code{org-beamer-frame-level} or @samp{H} value in a @samp{OPTIONS} line
  10554. (see @ref{Export Settings}).
  10555. @cindex @samp{BEAMER_ENV}, property
  10556. Org overrides headlines to frames conversion for the current tree of
  10557. an Org file if it encounters the @samp{BEAMER_ENV} property set to
  10558. @samp{frame} or @samp{fullframe}. Org ignores whatever
  10559. @code{org-beamer-frame-level} happens to be for that headline level in
  10560. the Org tree. In Beamer terminology, a full frame is a frame
  10561. without its title.
  10562. @item
  10563. Org exports a Beamer frame's objects as block environments. Org can
  10564. enforce wrapping in special block types when @samp{BEAMER_ENV} property
  10565. is set@footnote{If @samp{BEAMER_ENV} is set, Org export adds @samp{B_environment} tag
  10566. to make it visible. The tag serves as a visual aid and has no
  10567. semantic relevance.}. For valid values see
  10568. @code{org-beamer-environments-default}. To add more values, see
  10569. @code{org-beamer-environments-extra}.
  10570. @vindex org-beamer-environments-default
  10571. @vindex org-beamer-environments-extra
  10572. @item
  10573. @cindex @samp{BEAMER_REF}, property
  10574. If @samp{BEAMER_ENV} is set to @samp{appendix}, Org exports the entry as an
  10575. appendix. When set to @samp{note}, Org exports the entry as a note
  10576. within the frame or between frames, depending on the entry's heading
  10577. level. When set to @samp{noteNH}, Org exports the entry as a note
  10578. without its title. When set to @samp{againframe}, Org exports the entry
  10579. with @samp{\againframe} command, which makes setting the @samp{BEAMER_REF}
  10580. property mandatory because @samp{\againframe} needs frame to resume.
  10581. When @samp{ignoreheading} is set, Org export ignores the entry's headline
  10582. but not its content. This is useful for inserting content between
  10583. frames. It is also useful for properly closing a @samp{column}
  10584. environment. @@end itemize
  10585. @cindex @samp{BEAMER_ACT}, property
  10586. @cindex @samp{BEAMER_OPT}, property
  10587. When @samp{BEAMER_ACT} is set for a headline, Org export translates that
  10588. headline as an overlay or action specification. When enclosed in
  10589. square brackets, Org export makes the overlay specification
  10590. a default. Use @samp{BEAMER_OPT} to set any options applicable to the
  10591. current Beamer frame or block. The Beamer export back-end wraps
  10592. with appropriate angular or square brackets. It also adds the
  10593. @samp{fragile} option for any code that may require a verbatim block.
  10594. @cindex @samp{BEAMER_COL}, property
  10595. To create a column on the Beamer slide, use the @samp{BEAMER_COL}
  10596. property for its headline in the Org file. Set the value of
  10597. @samp{BEAMER_COL} to a decimal number representing the fraction of the
  10598. total text width. Beamer export uses this value to set the column's
  10599. width and fills the column with the contents of the Org entry. If
  10600. the Org entry has no specific environment defined, Beamer export
  10601. ignores the heading. If the Org entry has a defined environment,
  10602. Beamer export uses the heading as title. Behind the scenes, Beamer
  10603. export automatically handles @LaTeX{} column separations for contiguous
  10604. headlines. To manually adjust them for any unique configurations
  10605. needs, use the @samp{BEAMER_ENV} property.
  10606. @end itemize
  10607. @node Beamer specific syntax
  10608. @subsection Beamer specific syntax
  10609. Since Org's Beamer export back-end is an extension of the @LaTeX{}
  10610. back-end, it recognizes other @LaTeX{} specific syntax---for example,
  10611. @samp{#+LATEX:} or @samp{#+ATTR_LATEX:}. See @ref{@LaTeX{} Export}, for details.
  10612. Beamer export wraps the table of contents generated with @samp{toc:t}
  10613. @samp{OPTION} keyword in a @samp{frame} environment. Beamer export does not
  10614. wrap the table of contents generated with @samp{TOC} keyword (see @ref{Table of Contents}). Use square brackets for specifying options.
  10615. @example
  10616. #+TOC: headlines [currentsection]
  10617. @end example
  10618. Insert Beamer-specific code using the following constructs:
  10619. @cindex @samp{BEAMER}, keyword
  10620. @cindex @samp{BEGIN_EXPORT beamer}
  10621. @example
  10622. #+BEAMER: \pause
  10623. #+BEGIN_EXPORT beamer
  10624. Only Beamer export back-end exports this.
  10625. #+END_BEAMER
  10626. Text @@@@beamer:some code@@@@ within a paragraph.
  10627. @end example
  10628. Inline constructs, such as the last one above, are useful for adding
  10629. overlay specifications to objects with @code{bold}, @code{item}, @code{link},
  10630. @code{radio-target} and @code{target} types. Enclose the value in angular
  10631. brackets and place the specification at the beginning of the object as
  10632. shown in this example:
  10633. @example
  10634. A *@@@@beamer:<2->@@@@useful* feature
  10635. @end example
  10636. @cindex @samp{ATTR_BEAMER}, keyword
  10637. Beamer export recognizes the @samp{ATTR_BEAMER} keyword with the following
  10638. attributes from Beamer configurations: @samp{:environment} for changing
  10639. local Beamer environment, @samp{:overlay} for specifying Beamer overlays in
  10640. angular or square brackets, and @samp{:options} for inserting optional
  10641. arguments.
  10642. @example
  10643. #+ATTR_BEAMER: :environment nonindentlist
  10644. - item 1, not indented
  10645. - item 2, not indented
  10646. - item 3, not indented
  10647. @end example
  10648. @example
  10649. #+ATTR_BEAMER: :overlay <+->
  10650. - item 1
  10651. - item 2
  10652. @end example
  10653. @example
  10654. #+ATTR_BEAMER: :options [Lagrange]
  10655. Let $G$ be a finite group, and let $H$ be
  10656. a subgroup of $G$. Then the order of $H$ divides the order of $G$.
  10657. @end example
  10658. @node Editing support
  10659. @subsection Editing support
  10660. The @code{org-beamer-mode} is a special minor mode for faster editing of
  10661. Beamer documents.
  10662. @example
  10663. #+STARTUP: beamer
  10664. @end example
  10665. @table @asis
  10666. @item @kbd{C-c C-b} (@code{org-beamer-select-environment})
  10667. @kindex C-c C-b
  10668. @findex org-beamer-select-environment
  10669. The @code{org-beamer-mode} provides this key for quicker selections in
  10670. Beamer normal environments, and for selecting the @samp{BEAMER_COL}
  10671. property.
  10672. @end table
  10673. @node A Beamer example
  10674. @subsection A Beamer example
  10675. Here is an example of an Org document ready for Beamer export.
  10676. @example
  10677. ;#+TITLE: Example Presentation
  10678. ;#+AUTHOR: Carsten Dominik
  10679. ;#+OPTIONS: H:2 toc:t num:t
  10680. ;#+LATEX_CLASS: beamer
  10681. ;#+LATEX_CLASS_OPTIONS: [presentation]
  10682. ;#+BEAMER_THEME: Madrid
  10683. ;#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) %8BEAMER_OPT(Opt)
  10684. * This is the first structural section
  10685. ** Frame 1
  10686. *** Thanks to Eric Fraga :B_block:
  10687. :PROPERTIES:
  10688. :BEAMER_COL: 0.48
  10689. :BEAMER_ENV: block
  10690. :END:
  10691. for the first viable Beamer setup in Org
  10692. *** Thanks to everyone else :B_block:
  10693. :PROPERTIES:
  10694. :BEAMER_COL: 0.48
  10695. :BEAMER_ACT: <2->
  10696. :BEAMER_ENV: block
  10697. :END:
  10698. for contributing to the discussion
  10699. **** This will be formatted as a beamer note :B_note:
  10700. :PROPERTIES:
  10701. :BEAMER_env: note
  10702. :END:
  10703. ** Frame 2 (where we will not use columns)
  10704. *** Request
  10705. Please test this stuff!
  10706. @end example
  10707. @node HTML Export
  10708. @section HTML Export
  10709. @cindex HTML export
  10710. Org mode contains an HTML exporter with extensive HTML formatting
  10711. compatible with XHTML 1.0 strict standard.
  10712. @menu
  10713. * HTML export commands:: Invoking HTML export.
  10714. * HTML specific export settings:: Settings for HTML export.
  10715. * HTML doctypes:: Exporting various (X)HTML flavors.
  10716. * HTML preamble and postamble:: Inserting preamble and postamble.
  10717. * Quoting HTML tags:: Using direct HTML in Org files.
  10718. * Links in HTML export:: Inserting and formatting links.
  10719. * Tables in HTML export:: How to modify the formatting of tables.
  10720. * Images in HTML export:: How to insert figures into HTML output.
  10721. * Math formatting in HTML export:: Beautiful math also on the web.
  10722. * Text areas in HTML export:: An alternate way to show an example.
  10723. * CSS support:: Changing the appearance of the output.
  10724. * JavaScript support:: Info and folding in a web browser.
  10725. @end menu
  10726. @node HTML export commands
  10727. @subsection HTML export commands
  10728. @table @asis
  10729. @item @kbd{C-c C-e h h} (@code{org-html-export-to-html})
  10730. @kindex C-c C-e h h
  10731. @kindex C-c C-e h o
  10732. @findex org-html-export-to-html
  10733. Export as HTML file with a @samp{.html} extension. For @samp{myfile.org},
  10734. Org exports to @samp{myfile.html}, overwriting without warning.
  10735. @{@{@{kbd@{C-c C-e h o)@}@}@} exports to HTML and opens it in a web
  10736. browser.
  10737. @item @kbd{C-c C-e h H} (@code{org-html-export-as-html})
  10738. @kindex C-c C-e h H
  10739. @findex org-html-export-as-html
  10740. Exports to a temporary buffer. Does not create a file.
  10741. @end table
  10742. @node HTML specific export settings
  10743. @subsection HTML specific export settings
  10744. HTML export has a number of keywords, similar to the general options
  10745. settings described in @ref{Export Settings}.
  10746. @table @asis
  10747. @item @samp{DESCRIPTION}
  10748. @cindex @samp{DESCRIPTION}, keyword
  10749. This is the document's description, which the HTML exporter
  10750. inserts it as a HTML meta tag in the HTML file. For long
  10751. descriptions, use multiple @samp{DESCRIPTION} lines. The exporter
  10752. takes care of wrapping the lines properly.
  10753. @item @samp{HTML_DOCTYPE}
  10754. @cindex @samp{HTML_DOCTYPE}, keyword
  10755. @vindex org-html-doctype
  10756. Specify the document type, for example: HTML5
  10757. (@code{org-html-doctype}).
  10758. @item @samp{HTML_CONTAINER}
  10759. @cindex @samp{HTML_CONTAINER}, keyword
  10760. @vindex org-html-container-element
  10761. Specify the HTML container, such as @samp{div}, for wrapping sections
  10762. and elements (@code{org-html-container-element}).
  10763. @item @samp{HTML_LINK_HOME}
  10764. @cindex @samp{HTML_LINK_HOME}, keyword
  10765. @vindex org-html-link-home
  10766. The URL for home link (@code{org-html-link-home}).
  10767. @item @samp{HTML_LINK_UP}
  10768. @cindex @samp{HTML_LINK_UP}, keyword
  10769. @vindex org-html-link-up
  10770. The URL for the up link of exported HTML pages
  10771. (@code{org-html-link-up}).
  10772. @item @samp{HTML_MATHJAX}
  10773. @cindex @samp{HTML_MATHJAX}, keyword
  10774. @vindex org-html-mathjax-options
  10775. Options for MathJax (@code{org-html-mathjax-options}). MathJax is
  10776. used to typeset @LaTeX{} math in HTML documents. See @ref{Math formatting in HTML export}, for an example.
  10777. @item @samp{HTML_HEAD}
  10778. @cindex @samp{HTML_HEAD}, keyword
  10779. @vindex org-html-head
  10780. Arbitrary lines for appending to the HTML document's head
  10781. (@code{org-html-head}).
  10782. @item @samp{HTML_HEAD_EXTRA}
  10783. @cindex @samp{HTML_HEAD_EXTRA}, keyword
  10784. @vindex org-html-head-extra
  10785. More arbitrary lines for appending to the HTML document's head
  10786. (@code{org-html-head-extra}).
  10787. @item @samp{KEYWORDS}
  10788. @cindex @samp{KEYWORDS}, keyword
  10789. Keywords to describe the document's content. HTML exporter
  10790. inserts these keywords as HTML meta tags. For long keywords, use
  10791. multiple @samp{KEYWORDS} lines.
  10792. @item @samp{LATEX_HEADER}
  10793. @cindex @samp{LATEX_HEADER}, keyword
  10794. Arbitrary lines for appending to the preamble; HTML exporter
  10795. appends when transcoding @LaTeX{} fragments to images (see @ref{Math formatting in HTML export}).
  10796. @item @samp{SUBTITLE}
  10797. @cindex @samp{SUBTITLE}, keyword
  10798. The document's subtitle. HTML exporter formats subtitle if
  10799. document type is @samp{HTML5} and the CSS has a @samp{subtitle} class.
  10800. @end table
  10801. Some of these keywords are explained in more detail in the following
  10802. sections of the manual.
  10803. @node HTML doctypes
  10804. @subsection HTML doctypes
  10805. Org can export to various (X)HTML flavors.
  10806. @vindex org-html-doctype
  10807. @vindex org-html-doctype-alist
  10808. Set the @code{org-html-doctype} variable for different (X)HTML variants.
  10809. Depending on the variant, the HTML exporter adjusts the syntax of HTML
  10810. conversion accordingly. Org includes the following ready-made
  10811. variants:
  10812. @itemize
  10813. @item
  10814. @code{"html4-strict"}
  10815. @item
  10816. @code{"html4-transitional"}
  10817. @item
  10818. @code{"html4-frameset"}
  10819. @item
  10820. @code{"xhtml-strict"}
  10821. @item
  10822. @code{"xhtml-transitional"}
  10823. @item
  10824. @code{"xhtml-frameset"}
  10825. @item
  10826. @code{"xhtml-11"}
  10827. @item
  10828. @code{"html5"}
  10829. @item
  10830. @code{"xhtml5"}
  10831. @end itemize
  10832. @noindent
  10833. See the variable @code{org-html-doctype-alist} for details. The default is
  10834. @code{"xhtml-strict"}.
  10835. @vindex org-html-html5-fancy
  10836. @cindex @samp{HTML5}, export new elements
  10837. Org's HTML exporter does not by default enable new block elements
  10838. introduced with the HTML5 standard. To enable them, set
  10839. @code{org-html-html5-fancy} to non-@code{nil}. Or use an @samp{OPTIONS} line in the
  10840. file to set @samp{html5-fancy}.
  10841. HTML5 documents can now have arbitrary @samp{#+BEGIN} @dots{} @samp{#+END} blocks.
  10842. For example:
  10843. @example
  10844. #+BEGIN_aside
  10845. Lorem ipsum
  10846. #+END_aside
  10847. @end example
  10848. @noindent
  10849. exports to:
  10850. @example
  10851. <aside>
  10852. <p>Lorem ipsum</p>
  10853. </aside>
  10854. @end example
  10855. @noindent
  10856. while this:
  10857. @example
  10858. #+ATTR_HTML: :controls controls :width 350
  10859. #+BEGIN_video
  10860. #+HTML: <source src="movie.mp4" type="video/mp4">
  10861. #+HTML: <source src="movie.ogg" type="video/ogg">
  10862. Your browser does not support the video tag.
  10863. #+END_video
  10864. @end example
  10865. @noindent
  10866. exports to:
  10867. @example
  10868. <video controls="controls" width="350">
  10869. <source src="movie.mp4" type="video/mp4">
  10870. <source src="movie.ogg" type="video/ogg">
  10871. <p>Your browser does not support the video tag.</p>
  10872. </video>
  10873. @end example
  10874. @vindex org-html-html5-elements
  10875. When special blocks do not have a corresponding HTML5 element, the
  10876. HTML exporter reverts to standard translation (see
  10877. @code{org-html-html5-elements}). For example, @samp{#+BEGIN_lederhosen} exports
  10878. to @code{<div class="lederhosen">}.
  10879. Special blocks cannot have headlines. For the HTML exporter to wrap
  10880. the headline and its contents in @code{<section>} or @code{<article>} tags, set
  10881. the @samp{HTML_CONTAINER} property for the headline.
  10882. @node HTML preamble and postamble
  10883. @subsection HTML preamble and postamble
  10884. @vindex org-html-preamble
  10885. @vindex org-html-postamble
  10886. @vindex org-html-preamble-format
  10887. @vindex org-html-postamble-format
  10888. @vindex org-html-validation-link
  10889. @vindex org-export-creator-string
  10890. @vindex org-export-time-stamp-file
  10891. The HTML exporter has delineations for preamble and postamble. The
  10892. default value for @code{org-html-preamble} is @code{t}, which makes the HTML
  10893. exporter insert the preamble. See the variable
  10894. @code{org-html-preamble-format} for the format string.
  10895. Set @code{org-html-preamble} to a string to override the default format
  10896. string. If the string is a function, the HTML exporter expects the
  10897. function to return a string upon execution. The HTML exporter inserts
  10898. this string in the preamble. The HTML exporter does not insert
  10899. a preamble if @code{org-html-preamble} is set @code{nil}.
  10900. The default value for @code{org-html-postamble} is @code{auto}, which makes the
  10901. HTML exporter build a postamble from looking up author's name, email
  10902. address, creator's name, and date. Set @code{org-html-postamble} to @code{t} to
  10903. insert the postamble in the format specified in the
  10904. @code{org-html-postamble-format} variable. The HTML exporter does not
  10905. insert a postamble if @code{org-html-postamble} is set to @code{nil}.
  10906. @node Quoting HTML tags
  10907. @subsection Quoting HTML tags
  10908. The HTML export back-end transforms @samp{<} and @samp{>} to @samp{&lt;} and @samp{&gt;}.
  10909. To include raw HTML code in the Org file so the HTML export back-end
  10910. can insert that HTML code in the output, use this inline syntax:
  10911. @samp{@@@@html:...@@@@}. For example:
  10912. @example
  10913. @@@@html:<b>@@@@bold text@@@@html:</b>@@@@
  10914. @end example
  10915. @cindex @samp{HTML}, keyword
  10916. @cindex @samp{BEGIN_EXPORT html}
  10917. For larger raw HTML code blocks, use these HTML export code blocks:
  10918. @example
  10919. #+HTML: Literal HTML code for export
  10920. #+BEGIN_EXPORT html
  10921. All lines between these markers are exported literally
  10922. #+END_EXPORT
  10923. @end example
  10924. @node Links in HTML export
  10925. @subsection Links in HTML export
  10926. @cindex links, in HTML export
  10927. @cindex internal links, in HTML export
  10928. @cindex external links, in HTML export
  10929. The HTML export back-end transforms Org's internal links (see
  10930. @ref{Internal Links}) to equivalent HTML links in the output. The back-end
  10931. similarly handles Org's automatic links created by radio targets (see
  10932. @ref{Radio Targets}) similarly. For Org links to external files, the
  10933. back-end transforms the links to @emph{relative} paths.
  10934. @vindex org-html-link-org-files-as-html
  10935. For Org links to other @samp{.org} files, the back-end automatically
  10936. changes the file extension to @samp{.html} and makes file paths relative.
  10937. If the @samp{.org} files have an equivalent @samp{.html} version at the same
  10938. location, then the converted links should work without any further
  10939. manual intervention. However, to disable this automatic path
  10940. translation, set @code{org-html-link-org-files-as-html} to @code{nil}. When
  10941. disabled, the HTML export back-end substitutes the ID-based links in
  10942. the HTML output. For more about linking files when publishing to
  10943. a directory, see @ref{Publishing links}.
  10944. Org files can also have special directives to the HTML export
  10945. back-end. For example, by using @samp{#+ATTR_HTML} lines to specify new
  10946. format attributes to @code{<a>} or @code{<img>} tags. This example shows
  10947. changing the link's title and style:
  10948. @cindex @samp{ATTR_HTML}, keyword
  10949. @example
  10950. #+ATTR_HTML: :title The Org mode homepage :style color:red;
  10951. [[https://orgmode.org]]
  10952. @end example
  10953. @node Tables in HTML export
  10954. @subsection Tables in HTML export
  10955. @cindex tables, in HTML
  10956. @vindex org-export-html-table-tag
  10957. The HTML export back-end uses @code{org-html-table-default-attributes} when
  10958. exporting Org tables to HTML. By default, the exporter does not draw
  10959. frames and cell borders. To change for this for a table, use the
  10960. following lines before the table in the Org file:
  10961. @cindex @samp{CAPTION}, keyword
  10962. @cindex @samp{ATTR_HTML}, keyword
  10963. @example
  10964. #+CAPTION: This is a table with lines around and between cells
  10965. #+ATTR_HTML: border="2" rules="all" frame="border"
  10966. @end example
  10967. The HTML export back-end preserves column groupings in Org tables (see
  10968. @ref{Column Groups}) when exporting to HTML.
  10969. Additional options for customizing tables for HTML export.
  10970. @table @asis
  10971. @item @code{org-html-table-align-individual-fields}
  10972. @vindex org-html-table-align-individual-fields
  10973. Non-@code{nil} attaches style attributes for alignment to each table
  10974. field.
  10975. @item @code{org-html-table-caption-above}
  10976. @vindex org-html-table-caption-above
  10977. Non-@code{nil} places caption string at the beginning of the table.
  10978. @item @code{org-html-table-data-tags}
  10979. @vindex org-html-table-data-tags
  10980. Opening and ending tags for table data fields.
  10981. @item @code{org-html-table-default-attributes}
  10982. @vindex org-html-table-default-attributes
  10983. Default attributes and values for table tags.
  10984. @item @code{org-html-table-header-tags}
  10985. @vindex org-html-table-header-tags
  10986. Opening and ending tags for table's header fields.
  10987. @item @code{org-html-table-row-tags}
  10988. @vindex org-html-table-row-tags
  10989. Opening and ending tags for table rows.
  10990. @item @code{org-html-table-use-header-tags-for-first-column}
  10991. @vindex org-html-table-use-header-tags-for-first-column
  10992. Non-@code{nil} formats column one in tables with header tags.
  10993. @end table
  10994. @node Images in HTML export
  10995. @subsection Images in HTML export
  10996. @cindex images, inline in HTML
  10997. @cindex inlining images in HTML
  10998. The HTML export back-end has features to convert Org image links to
  10999. HTML inline images and HTML clickable image links.
  11000. @vindex org-html-inline-images
  11001. When the link in the Org file has no description, the HTML export
  11002. back-end by default in-lines that image. For example:
  11003. @samp{[[file:myimg.jpg]]} is in-lined, while @samp{[[file:myimg.jpg][the image]]} links to the text,
  11004. @samp{the image}. For more details, see the variable
  11005. @code{org-html-inline-images}.
  11006. On the other hand, if the description part of the Org link is itself
  11007. another link, such as @samp{file:} or @samp{http:} URL pointing to an image, the
  11008. HTML export back-end in-lines this image and links to the main image.
  11009. This Org syntax enables the back-end to link low-resolution thumbnail
  11010. to the high-resolution version of the image, as shown in this example:
  11011. @example
  11012. [[file:highres.jpg][file:thumb.jpg]]
  11013. @end example
  11014. To change attributes of in-lined images, use @samp{#+ATTR_HTML} lines in
  11015. the Org file. This example shows realignment to right, and adds @code{alt}
  11016. and @code{title} attributes in support of text viewers and modern web
  11017. accessibility standards.
  11018. @cindex @samp{CAPTION}, keyword
  11019. @cindex @samp{ATTR_HTML}, keyword
  11020. @example
  11021. #+CAPTION: A black cat stalking a spider
  11022. #+ATTR_HTML: :alt cat/spider image :title Action! :align right
  11023. [[./img/a.jpg]]
  11024. @end example
  11025. @noindent
  11026. The HTML export back-end copies the @samp{http} links from the Org file as
  11027. is.
  11028. @node Math formatting in HTML export
  11029. @subsection Math formatting in HTML export
  11030. @cindex MathJax
  11031. @cindex dvipng
  11032. @cindex dvisvgm
  11033. @cindex ImageMagick
  11034. @vindex org-html-mathjax-options~
  11035. @LaTeX{} math snippets (see @ref{@LaTeX{} fragments}) can be displayed in two
  11036. different ways on HTML pages. The default is to use the @uref{http://www.mathjax.org, MathJax},
  11037. 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
  11038. @uref{http://www.mathjax.org, MathJax}.}. Some MathJax
  11039. display options can be configured via @code{org-html-mathjax-options}, or
  11040. in the buffer. For example, with the following settings,
  11041. @example
  11042. #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
  11043. #+HTML_MATHJAX: cancel.js noErrors.js
  11044. @end example
  11045. @noindent
  11046. equation labels are displayed on the left margin and equations are
  11047. five em from the left margin. In addition, it loads the two MathJax
  11048. 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
  11049. about extensions.}.
  11050. @vindex org-html-mathjax-template
  11051. See the docstring of @code{org-html-mathjax-options} for all supported
  11052. variables. The MathJax template can be configure via
  11053. @code{org-html-mathjax-template}.
  11054. If you prefer, you can also request that @LaTeX{} fragments are processed
  11055. into small images that will be inserted into the browser page. Before
  11056. the availability of MathJax, this was the default method for Org
  11057. files. This method requires that the dvipng program, dvisvgm or
  11058. ImageMagick suite is available on your system. You can still get this
  11059. processing with
  11060. @example
  11061. #+OPTIONS: tex:dvipng
  11062. @end example
  11063. @example
  11064. #+OPTIONS: tex:dvisvgm
  11065. @end example
  11066. @noindent
  11067. or
  11068. @example
  11069. #+OPTIONS: tex:imagemagick
  11070. @end example
  11071. @node Text areas in HTML export
  11072. @subsection Text areas in HTML export
  11073. @cindex text areas, in HTML
  11074. Before Org mode's Babel, one popular approach to publishing code in
  11075. HTML was by using @samp{:textarea}. The advantage of this approach was
  11076. that copying and pasting was built into browsers with simple
  11077. JavaScript commands. Even editing before pasting was made simple.
  11078. The HTML export back-end can create such text areas. It requires an
  11079. @samp{#+ATTR_HTML} line as shown in the example below with the @samp{:textarea}
  11080. option. This must be followed by either an example or a source code
  11081. block. Other Org block types do not honor the @samp{:textarea} option.
  11082. By default, the HTML export back-end creates a text area 80 characters
  11083. wide and height just enough to fit the content. Override these
  11084. defaults with @samp{:width} and @samp{:height} options on the @samp{#+ATTR_HTML}
  11085. line.
  11086. @example
  11087. #+ATTR_HTML: :textarea t :width 40
  11088. #+BEGIN_EXAMPLE
  11089. (defun org-xor (a b)
  11090. "Exclusive or."
  11091. (if a (not b) b))
  11092. #+END_EXAMPLE
  11093. @end example
  11094. @node CSS support
  11095. @subsection CSS support
  11096. @cindex CSS, for HTML export
  11097. @cindex HTML export, CSS
  11098. @vindex org-export-html-todo-kwd-class-prefix
  11099. @vindex org-export-html-tag-class-prefix
  11100. You can modify the CSS style definitions for the exported file. The
  11101. HTML exporter assigns the following special CSS classes@footnote{If the classes on TODO keywords and tags lead to conflicts,
  11102. use the variables @code{org-html-todo-kwd-class-prefix} and
  11103. @code{org-html-tag-class-prefix} to make them unique.} to
  11104. appropriate parts of the document---your style specifications may
  11105. change these, in addition to any of the standard classes like for
  11106. headlines, tables, etc.
  11107. @multitable {aaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  11108. @item @code{p.author}
  11109. @tab author information, including email
  11110. @item @code{p.date}
  11111. @tab publishing date
  11112. @item @code{p.creator}
  11113. @tab creator info, about org mode version
  11114. @item @code{.title}
  11115. @tab document title
  11116. @item @code{.subtitle}
  11117. @tab document subtitle
  11118. @item @code{.todo}
  11119. @tab TODO keywords, all not-done states
  11120. @item @code{.done}
  11121. @tab the DONE keywords, all states that count as done
  11122. @item @code{.WAITING}
  11123. @tab each TODO keyword also uses a class named after itself
  11124. @item @code{.timestamp}
  11125. @tab timestamp
  11126. @item @code{.timestamp-kwd}
  11127. @tab keyword associated with a timestamp, like @samp{SCHEDULED}
  11128. @item @code{.timestamp-wrapper}
  11129. @tab span around keyword plus timestamp
  11130. @item @code{.tag}
  11131. @tab tag in a headline
  11132. @item @code{._HOME}
  11133. @tab each tag uses itself as a class, ``@@'' replaced by ``_''
  11134. @item @code{.target}
  11135. @tab target for links
  11136. @item @code{.linenr}
  11137. @tab the line number in a code example
  11138. @item @code{.code-highlighted}
  11139. @tab for highlighting referenced code lines
  11140. @item @code{div.outline-N}
  11141. @tab div for outline level N (headline plus text)
  11142. @item @code{div.outline-text-N}
  11143. @tab extra div for text at outline level N
  11144. @item @code{.section-number-N}
  11145. @tab section number in headlines, different for each level
  11146. @item @code{.figure-number}
  11147. @tab label like ``Figure 1:''
  11148. @item @code{.table-number}
  11149. @tab label like ``Table 1:''
  11150. @item @code{.listing-number}
  11151. @tab label like ``Listing 1:''
  11152. @item @code{div.figure}
  11153. @tab how to format an in-lined image
  11154. @item @code{pre.src}
  11155. @tab formatted source code
  11156. @item @code{pre.example}
  11157. @tab normal example
  11158. @item @code{p.verse}
  11159. @tab verse paragraph
  11160. @item @code{div.footnotes}
  11161. @tab footnote section headline
  11162. @item @code{p.footnote}
  11163. @tab footnote definition paragraph, containing a footnote
  11164. @item @code{.footref}
  11165. @tab a footnote reference number (always a <sup>)
  11166. @item @code{.footnum}
  11167. @tab footnote number in footnote definition (always <sup>)
  11168. @item @code{.org-svg}
  11169. @tab default class for a linked @samp{.svg} image
  11170. @end multitable
  11171. @vindex org-html-style-default
  11172. @vindex org-html-head
  11173. @vindex org-html-head-extra
  11174. @cindex @samp{HTML_INCLUDE_STYLE}, keyword
  11175. The HTML export back-end includes a compact default style in each
  11176. exported HTML file. To override the default style with another style,
  11177. use these keywords in the Org file. They will replace the global
  11178. defaults the HTML exporter uses.
  11179. @cindex @samp{HTML_HEAD}, keyword
  11180. @cindex @samp{HTML_HEAD_EXTRA}, keyword
  11181. @example
  11182. #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
  11183. #+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />
  11184. @end example
  11185. @vindex org-html-head-include-default-style
  11186. To just turn off the default style, customize
  11187. @code{org-html-head-include-default-style} variable, or use this option
  11188. line in the Org file.
  11189. @cindex @samp{html-style}, @samp{OPTIONS} item
  11190. @example
  11191. #+OPTIONS: html-style:nil
  11192. @end example
  11193. For longer style definitions, either use several @samp{HTML_HEAD} and
  11194. @samp{HTML_HEAD_EXTRA} keywords, or use @code{<style> ... </style>} blocks
  11195. around them. Both of these approaches can avoid referring to an
  11196. external file.
  11197. @cindex @samp{HTML_CONTAINER_CLASS}, property
  11198. In order to add styles to a sub-tree, use the @samp{HTML_CONTAINER_CLASS}
  11199. property to assign a class to the tree. In order to specify CSS
  11200. styles for a particular headline, you can use the id specified in
  11201. a @samp{CUSTOM_ID} property.
  11202. Never change the @code{org-html-style-default} constant. Instead use other
  11203. simpler ways of customizing as described above.
  11204. @node JavaScript support
  11205. @subsection JavaScript supported display of web pages
  11206. Sebastian Rose has written a JavaScript program especially designed to
  11207. enhance the web viewing experience of HTML files created with Org.
  11208. This program enhances large files in two different ways of viewing.
  11209. One is an @emph{Info}-like mode where each section is displayed separately
  11210. and navigation can be done with the @kbd{n} and @kbd{p}
  11211. keys, and some other keys as well, press @kbd{?} for an overview
  11212. of the available keys. The second one has a @emph{folding} view, much like
  11213. Org provides inside Emacs. The script is available at
  11214. @uref{https://orgmode.org/org-info.js} and the documentation at
  11215. @uref{https://orgmode.org/worg/code/org-info-js/}. The script is hosted on
  11216. @uref{https://orgmode.org}, but for reliability, prefer installing it on your
  11217. own web server.
  11218. To use this program, just add this line to the Org file:
  11219. @cindex @samp{INFOJS_OPT}, keyword
  11220. @example
  11221. #+INFOJS_OPT: view:info toc:nil
  11222. @end example
  11223. @noindent
  11224. The HTML header now has the code needed to automatically invoke the
  11225. script. For setting options, use the syntax from the above line for
  11226. options described below:
  11227. @table @asis
  11228. @item @samp{path:}
  11229. The path to the script. The default is to grab the script from
  11230. @uref{https://orgmode.org/org-info.js}, but you might want to have
  11231. a local copy and use a path like @samp{../scripts/org-info.js}.
  11232. @item @samp{view:}
  11233. Initial view when the website is first shown. Possible values are:
  11234. @multitable {aaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  11235. @item @samp{info}
  11236. @tab Info-like interface with one section per page
  11237. @item @samp{overview}
  11238. @tab Folding interface, initially showing only top-level
  11239. @item @samp{content}
  11240. @tab Folding interface, starting with all headlines visible
  11241. @item @samp{showall}
  11242. @tab Folding interface, all headlines and text visible
  11243. @end multitable
  11244. @item @samp{sdepth:}
  11245. Maximum headline level still considered as an independent section
  11246. for info and folding modes. The default is taken from
  11247. @code{org-export-headline-levels}, i.e., the @samp{H} switch in @samp{OPTIONS}.
  11248. If this is smaller than in @code{org-export-headline-levels}, each
  11249. info/folding section can still contain child headlines.
  11250. @item @samp{toc:}
  11251. Should the table of contents @emph{initially} be visible? Even when
  11252. @samp{nil}, you can always get to the ``toc'' with @kbd{i}.
  11253. @item @samp{tdepth:}
  11254. The depth of the table of contents. The defaults are taken from
  11255. the variables @code{org-export-headline-levels} and
  11256. @code{org-export-with-toc}.
  11257. @item @samp{ftoc:}
  11258. Does the CSS of the page specify a fixed position for the ``toc''?
  11259. If yes, the toc is displayed as a section.
  11260. @item @samp{ltoc:}
  11261. Should there be short contents (children) in each section? Make
  11262. this @samp{above} if the section should be above initial text.
  11263. @item @samp{mouse:}
  11264. Headings are highlighted when the mouse is over them. Should be
  11265. @samp{underline} (default) or a background color like @samp{#cccccc}.
  11266. @item @samp{buttons:}
  11267. Should view-toggle buttons be everywhere? When @samp{nil} (the
  11268. default), only one such button is present.
  11269. @end table
  11270. @noindent
  11271. @vindex org-infojs-options
  11272. @vindex org-export-html-use-infojs
  11273. You can choose default values for these options by customizing the
  11274. variable @code{org-infojs-options}. If you always want to apply the script
  11275. to your pages, configure the variable @code{org-export-html-use-infojs}.
  11276. @node @LaTeX{} Export
  11277. @section @LaTeX{} Export
  11278. @cindex @LaTeX{} export
  11279. @cindex PDF export
  11280. The @LaTeX{} export back-end can handle complex documents, incorporate
  11281. standard or custom @LaTeX{} document classes, generate documents using
  11282. alternate @LaTeX{} engines, and produce fully linked PDF files with
  11283. indexes, bibliographies, and tables of contents, destined for
  11284. interactive online viewing or high-quality print publication.
  11285. While the details are covered in-depth in this section, here are some
  11286. quick references to variables for the impatient: for engines, see
  11287. @code{org-latex-compiler}; for build sequences, see
  11288. @code{org-latex-pdf-process}; for packages, see
  11289. @code{org-latex-default-packages-alist} and @code{org-latex-packages-alist}.
  11290. An important note about the @LaTeX{} export back-end: it is sensitive to
  11291. blank lines in the Org document. That's because @LaTeX{} itself depends
  11292. on blank lines to tell apart syntactical elements, such as paragraphs.
  11293. @menu
  11294. * @LaTeX{}/PDF export commands:: For producing @LaTeX{} and PDF documents.
  11295. * @LaTeX{} specific export settings:: Unique to this @LaTeX{} back-end.
  11296. * @LaTeX{} header and sectioning:: Setting up the export file structure.
  11297. * Quoting @LaTeX{} code:: Incorporating literal @LaTeX{} code.
  11298. * Tables in @LaTeX{} export:: Options for exporting tables to @LaTeX{}.
  11299. * Images in @LaTeX{} export:: How to insert figures into @LaTeX{} output.
  11300. * Plain lists in @LaTeX{} export:: Attributes specific to lists.
  11301. * Source blocks in @LaTeX{} export:: Attributes specific to source code blocks.
  11302. * Example blocks in @LaTeX{} export:: Attributes specific to example blocks.
  11303. * Special blocks in @LaTeX{} export:: Attributes specific to special blocks.
  11304. * Horizontal rules in @LaTeX{} export:: Attributes specific to horizontal rules.
  11305. @end menu
  11306. @node @LaTeX{}/PDF export commands
  11307. @subsection @LaTeX{}/PDF export commands
  11308. @table @asis
  11309. @item @kbd{C-c C-e l l} (@code{org-latex-export-to-latex})
  11310. @kindex C-c C-e l l
  11311. @findex org-latex-export-to-latex~
  11312. Export to a @LaTeX{} file with a @samp{.tex} extension. For
  11313. @samp{myfile.org}, Org exports to @samp{myfile.tex}, overwriting without
  11314. warning.
  11315. @item @kbd{C-c C-e l L} (@code{org-latex-export-as-latex})
  11316. @kindex C-c C-e l L
  11317. @findex org-latex-export-as-latex
  11318. Export to a temporary buffer. Do not create a file.
  11319. @item @kbd{C-c C-e l p} (@code{org-latex-export-to-pdf})
  11320. @kindex C-c C-e l p
  11321. @findex org-latex-export-to-pdf
  11322. Export as @LaTeX{} file and convert it to PDF file.
  11323. @item @kbd{C-c C-e l o}
  11324. @kindex C-c C-e l o
  11325. Export as @LaTeX{} file and convert it to PDF, then open the PDF
  11326. using the default viewer.
  11327. @item @kbd{M-x org-export-region-as-latex}
  11328. Convert the region to @LaTeX{} under the assumption that it was in Org
  11329. mode syntax before. This is a global command that can be invoked in
  11330. any buffer.
  11331. @end table
  11332. @vindex org-latex-compiler
  11333. @vindex org-latex-bibtex-compiler
  11334. @vindex org-latex-default-packages-alist
  11335. @cindex pdflatex
  11336. @cindex xelatex
  11337. @cindex lualatex
  11338. @cindex @samp{LATEX_COMPILER}, keyword
  11339. The @LaTeX{} export back-end can use any of these @LaTeX{} engines:
  11340. @samp{pdflatex}, @samp{xelatex}, and @samp{lualatex}. These engines compile @LaTeX{}
  11341. files with different compilers, packages, and output options. The
  11342. @LaTeX{} export back-end finds the compiler version to use from
  11343. @code{org-latex-compiler} variable or the @samp{#+LATEX_COMPILER} keyword in the
  11344. Org file. See the docstring for the
  11345. @code{org-latex-default-packages-alist} for loading packages with certain
  11346. compilers. Also see @code{org-latex-bibtex-compiler} to set the
  11347. bibliography compiler@footnote{This does not allow setting different bibliography compilers
  11348. for different files. However, ``smart'' @LaTeX{} compilation systems, such
  11349. as latexmk, can select the correct bibliography compiler.}.
  11350. @node @LaTeX{} specific export settings
  11351. @subsection @LaTeX{} specific export settings
  11352. The @LaTeX{} export back-end has several additional keywords for
  11353. customizing @LaTeX{} output. Setting these keywords works similar to the
  11354. general options (see @ref{Export Settings}).
  11355. @table @asis
  11356. @item @samp{DESCRIPTION}
  11357. @cindex @samp{DESCRIPTION}, keyword
  11358. @vindex org-latex-hyperref-template
  11359. @vindex org-latex-title-command
  11360. The document's description. The description along with author
  11361. name, keywords, and related file metadata are inserted in the
  11362. output file by the hyperref package. See
  11363. @code{org-latex-hyperref-template} for customizing metadata items.
  11364. See @code{org-latex-title-command} for typesetting description into
  11365. the document's front matter. Use multiple @samp{DESCRIPTION} keywords
  11366. for long descriptions.
  11367. @item @samp{LATEX_CLASS}
  11368. @cindex @samp{LATEX_CLASS}, keyword
  11369. @vindex org-latex-default-class
  11370. @vindex org-latex-classes
  11371. This is @LaTeX{} document class, such as @emph{article}, @emph{report},
  11372. @emph{book}, and so on, which contain predefined preamble and headline
  11373. level mapping that the @LaTeX{} export back-end needs. The back-end
  11374. reads the default class name from the @code{org-latex-default-class}
  11375. variable. Org has @emph{article} as the default class. A valid
  11376. default class must be an element of @code{org-latex-classes}.
  11377. @item @samp{LATEX_CLASS_OPTIONS}
  11378. @cindex @samp{LATEX_CLASS_OPTIONS}, keyword
  11379. Options the @LaTeX{} export back-end uses when calling the @LaTeX{}
  11380. document class.
  11381. @item @samp{LATEX_COMPILER}
  11382. @cindex @samp{LATEX_COMPILER}, keyword
  11383. @vindex org-latex-compiler
  11384. The compiler, such as @samp{pdflatex}, @samp{xelatex}, @samp{lualatex}, for
  11385. producing the PDF. See @code{org-latex-compiler}.
  11386. @item @samp{LATEX_HEADER}
  11387. @itemx @samp{LATEX_HEADER_EXTRA}
  11388. @cindex @samp{LATEX_HEADER}, keyword
  11389. @cindex @samp{LATEX_HEADER_EXTRA}, keyword
  11390. @vindex org-latex-classes
  11391. Arbitrary lines to add to the document's preamble, before the
  11392. hyperref settings. See @code{org-latex-classes} for adjusting the
  11393. structure and order of the @LaTeX{} headers.
  11394. @item @samp{KEYWORDS}
  11395. @cindex @samp{KEYWORDS}, keyword
  11396. @vindex org-latex-hyperref-template
  11397. @vindex org-latex-title-command
  11398. The keywords for the document. The description along with author
  11399. name, keywords, and related file metadata are inserted in the
  11400. output file by the hyperref package. See
  11401. @code{org-latex-hyperref-template} for customizing metadata items.
  11402. See @code{org-latex-title-command} for typesetting description into
  11403. the document's front matter. Use multiple @samp{KEYWORDS} lines if
  11404. necessary.
  11405. @item @samp{SUBTITLE}
  11406. @cindex @samp{SUBTITLE}, keyword
  11407. @vindex org-latex-subtitle-separate
  11408. @vindex org-latex-subtitle-format
  11409. The document's subtitle. It is typeset as per
  11410. @code{org-latex-subtitle-format}. If @code{org-latex-subtitle-separate} is
  11411. non-@code{nil}, it is typed as part of the @code{\title} macro. See
  11412. @code{org-latex-hyperref-template} for customizing metadata items.
  11413. See @code{org-latex-title-command} for typesetting description
  11414. into the document's front matter.
  11415. @end table
  11416. The following sections have further details.
  11417. @node @LaTeX{} header and sectioning
  11418. @subsection @LaTeX{} header and sectioning structure
  11419. @cindex @LaTeX{} class
  11420. @cindex @LaTeX{} sectioning structure
  11421. @cindex @LaTeX{} header
  11422. @cindex header, for @LaTeX{} files
  11423. @cindex sectioning structure, for @LaTeX{} export
  11424. The @LaTeX{} export back-end converts the first three of Org's outline
  11425. levels into @LaTeX{} headlines. The remaining Org levels are exported as
  11426. lists. To change this globally for the cut-off point between levels
  11427. and lists, (see @ref{Export Settings}).
  11428. By default, the @LaTeX{} export back-end uses the @emph{article} class.
  11429. @vindex org-latex-default-class
  11430. @vindex org-latex-classes
  11431. @vindex org-latex-default-packages-alist
  11432. @vindex org-latex-packages-alist
  11433. To change the default class globally, edit @code{org-latex-default-class}.
  11434. To change the default class locally in an Org file, add option lines
  11435. @samp{#+LATEX_CLASS: myclass}. To change the default class for just a part
  11436. of the Org file, set a sub-tree property, @samp{EXPORT_LATEX_CLASS}. The
  11437. class name entered here must be valid member of @code{org-latex-classes}.
  11438. This variable defines a header template for each class into which the
  11439. exporter splices the values of @code{org-latex-default-packages-alist} and
  11440. @code{org-latex-packages-alist}. Use the same three variables to define
  11441. custom sectioning or custom classes.
  11442. @cindex @samp{LATEX_CLASS}, keyword
  11443. @cindex @samp{LATEX_CLASS_OPTIONS}, keyword
  11444. @cindex @samp{EXPORT_LATEX_CLASS}, property
  11445. @cindex @samp{EXPORT_LATEX_CLASS_OPTIONS}, property
  11446. The @LaTeX{} export back-end sends the @samp{LATEX_CLASS_OPTIONS} keyword and
  11447. @samp{EXPORT_LATEX_CLASS_OPTIONS} property as options to the @LaTeX{}
  11448. @code{\documentclass} macro. The options and the syntax for specifying
  11449. them, including enclosing them in square brackets, follow @LaTeX{}
  11450. conventions.
  11451. @example
  11452. #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]
  11453. @end example
  11454. @cindex @samp{LATEX_HEADER}, keyword
  11455. @cindex @samp{LATEX_HEADER_EXTRA}, keyword
  11456. The @LaTeX{} export back-end appends values from @samp{LATEX_HEADER} and
  11457. @samp{LATEX_HEADER_EXTRA} keywords to the @LaTeX{} header. The docstring for
  11458. @code{org-latex-classes} explains in more detail. Also note that @LaTeX{}
  11459. export back-end does not append @samp{LATEX_HEADER_EXTRA} to the header
  11460. when previewing @LaTeX{} snippets (see @ref{Previewing @LaTeX{} fragments}).
  11461. A sample Org file with the above headers:
  11462. @example
  11463. #+LATEX_CLASS: article
  11464. #+LATEX_CLASS_OPTIONS: [a4paper]
  11465. #+LATEX_HEADER: \usepackage@{xyz@}
  11466. * Headline 1
  11467. some text
  11468. * Headline 2
  11469. some more text
  11470. @end example
  11471. @node Quoting @LaTeX{} code
  11472. @subsection Quoting @LaTeX{} code
  11473. The @LaTeX{} export back-end can insert any arbitrary @LaTeX{} code, see
  11474. @ref{Embedded @LaTeX{}}. There are three ways to embed such code in the Org
  11475. file and they all use different quoting syntax.
  11476. @cindex inline, in @LaTeX{} export
  11477. Inserting in-line quoted with @@ symbols:
  11478. @example
  11479. Code embedded in-line @@@@latex:any arbitrary LaTeX code@@@@ in a paragraph.
  11480. @end example
  11481. @cindex @samp{LATEX}, keyword
  11482. Inserting as one or more keyword lines in the Org file:
  11483. @example
  11484. #+LATEX: any arbitrary LaTeX code
  11485. @end example
  11486. @cindex @samp{BEGIN_EXPORT latex}
  11487. Inserting as an export block in the Org file, where the back-end
  11488. exports any code between begin and end markers:
  11489. @example
  11490. #+BEGIN_EXPORT latex
  11491. any arbitrary LaTeX code
  11492. #+END_EXPORT
  11493. @end example
  11494. @node Tables in @LaTeX{} export
  11495. @subsection Tables in @LaTeX{} export
  11496. @cindex tables, in @LaTeX{} export
  11497. The @LaTeX{} export back-end can pass several @LaTeX{} attributes for table
  11498. contents and layout. Besides specifying label and caption (see
  11499. @ref{Images and Tables}), the other valid @LaTeX{} attributes include:
  11500. @table @asis
  11501. @item @samp{:mode}
  11502. @vindex org-latex-default-table-mode
  11503. The @LaTeX{} export back-end wraps the table differently depending
  11504. on the mode for accurate rendering of math symbols. Mode is
  11505. either @samp{table}, @samp{math}, @samp{inline-math} or @samp{verbatim}.
  11506. For @samp{math} or @samp{inline-math} mode, @LaTeX{} export back-end wraps the
  11507. table in a math environment, but every cell in it is exported
  11508. as-is. The @LaTeX{} export back-end determines the default mode
  11509. from @code{org-latex-default-table-mode}. The @LaTeX{} export back-end
  11510. merges contiguous tables in the same mode into a single
  11511. environment.
  11512. @item @samp{:environment}
  11513. @vindex org-latex-default-table-environment
  11514. Set the default @LaTeX{} table environment for the @LaTeX{} export
  11515. back-end to use when exporting Org tables. Common @LaTeX{} table
  11516. environments are provided by these packages: tabularx, longtable,
  11517. array, tabu, and bmatrix. For packages, such as tabularx and
  11518. tabu, or any newer replacements, include them in the
  11519. @code{org-latex-packages-alist} variable so the @LaTeX{} export back-end
  11520. can insert the appropriate load package headers in the converted
  11521. @LaTeX{} file. Look in the docstring for the
  11522. @code{org-latex-packages-alist} variable for configuring these
  11523. packages for @LaTeX{} snippet previews, if any.
  11524. @item @samp{:caption}
  11525. Use @samp{CAPTION} keyword to set a simple caption for a table (see
  11526. @ref{Images and Tables}). For custom captions, use @samp{:caption}
  11527. attribute, which accepts raw @LaTeX{} code. @samp{:caption} value
  11528. overrides @samp{CAPTION} value.
  11529. @item @samp{:float}
  11530. @itemx @samp{:placement}
  11531. The table environments by default are not floats in @LaTeX{}. To
  11532. make them floating objects use @samp{:float} with one of the following
  11533. options: @samp{sideways}, @samp{multicolumn}, @samp{t}, and @samp{nil}.
  11534. @LaTeX{} floats can also have additional layout @samp{:placement}
  11535. attributes. These are the usual @samp{[h t b p ! H]} permissions
  11536. specified in square brackets. Note that for @samp{:float sideways}
  11537. tables, the @LaTeX{} export back-end ignores @samp{:placement}
  11538. attributes.
  11539. @item @samp{:align}
  11540. @itemx @samp{:font}
  11541. @itemx @samp{:width}
  11542. The @LaTeX{} export back-end uses these attributes for regular
  11543. tables to set their alignments, fonts, and widths.
  11544. @item @samp{:spread}
  11545. When @samp{:spread} is non-@code{nil}, the @LaTeX{} export back-end spreads or
  11546. shrinks the table by the @samp{:width} for tabu and longtabu
  11547. environments. @samp{:spread} has no effect if @samp{:width} is not set.
  11548. @item @samp{:booktabs}
  11549. @itemx @samp{:center}
  11550. @itemx @samp{:rmlines}
  11551. @vindex org-latex-tables-booktabs
  11552. @vindex org-latex-tables-centered
  11553. All three commands are toggles. @samp{:booktabs} brings in modern
  11554. typesetting enhancements to regular tables. The booktabs package
  11555. has to be loaded through @code{org-latex-packages-alist}. @samp{:center}
  11556. is for centering the table. @samp{:rmlines} removes all but the very
  11557. first horizontal line made of ASCII characters from ``table.el''
  11558. tables only.
  11559. @item @samp{:math-prefix}
  11560. @itemx @samp{:math-suffix}
  11561. @itemx @samp{:math-arguments}
  11562. The @LaTeX{} export back-end inserts @samp{:math-prefix} string value in
  11563. a math environment before the table. The @LaTeX{} export back-end
  11564. inserts @samp{:math-suffix} string value in a math environment after
  11565. the table. The @LaTeX{} export back-end inserts @samp{:math-arguments}
  11566. string value between the macro name and the table's contents.
  11567. @samp{:math-arguments} comes in use for matrix macros that require
  11568. more than one argument, such as @samp{qbordermatrix}.
  11569. @end table
  11570. @LaTeX{} table attributes help formatting tables for a wide range of
  11571. situations, such as matrix product or spanning multiple pages:
  11572. @example
  11573. #+ATTR_LATEX: :environment longtable :align l|lp@{3cm@}r|l
  11574. | ... | ... |
  11575. | ... | ... |
  11576. #+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times
  11577. | a | b |
  11578. | c | d |
  11579. #+ATTR_LATEX: :mode math :environment bmatrix
  11580. | 1 | 2 |
  11581. | 3 | 4 |
  11582. @end example
  11583. Set the caption with the @LaTeX{} command
  11584. @samp{\bicaption@{HeadingA@}@{HeadingB@}}:
  11585. @example
  11586. #+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
  11587. | ... | ... |
  11588. | ... | ... |
  11589. @end example
  11590. @node Images in @LaTeX{} export
  11591. @subsection Images in @LaTeX{} export
  11592. @cindex images, inline in LaTeX
  11593. @cindex inlining images in LaTeX
  11594. @cindex @samp{ATTR_LATEX}, keyword
  11595. The @LaTeX{} export back-end processes image links in Org files that do
  11596. not have descriptions, such as these links @samp{[[file:img.jpg]]} or
  11597. @samp{[[./img.jpg]]}, as direct image insertions in the final PDF output. In
  11598. the PDF, they are no longer links but actual images embedded on the
  11599. page. The @LaTeX{} export back-end uses @samp{\includegraphics} macro to
  11600. insert the image. But for TikZ (@uref{http://sourceforge.net/projects/pgf/})
  11601. images, the back-end uses an @code{\input} macro wrapped within
  11602. a @code{tikzpicture} environment.
  11603. For specifying image @samp{:width}, @samp{:height}, and other @samp{:options}, use
  11604. this syntax:
  11605. @example
  11606. #+ATTR_LATEX: :width 5cm :options angle=90
  11607. [[./img/sed-hr4049.pdf]]
  11608. @end example
  11609. For custom commands for captions, use the @samp{:caption} attribute. It
  11610. overrides the default @samp{#+CAPTION} value:
  11611. @example
  11612. #+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
  11613. [[./img/sed-hr4049.pdf]]
  11614. @end example
  11615. When captions follow the method as described in @ref{Images and Tables},
  11616. the @LaTeX{} export back-end wraps the picture in a floating @samp{figure}
  11617. environment. To float an image without specifying a caption, set the
  11618. @samp{:float} attribute to one of the following:
  11619. @table @asis
  11620. @item @samp{t}
  11621. For a standard @samp{figure} environment; used by default whenever an
  11622. image has a caption.
  11623. @item @samp{multicolumn}
  11624. To span the image across multiple columns of a page; the back-end
  11625. wraps the image in a @samp{figure*} environment.
  11626. @item @samp{wrap}
  11627. For text to flow around the image on the right; the figure
  11628. occupies the left half of the page.
  11629. @item @samp{sideways}
  11630. For a new page with the image sideways, rotated ninety degrees,
  11631. in a @samp{sidewaysfigure} environment; overrides @samp{:placement}
  11632. setting.
  11633. @item @samp{nil}
  11634. To avoid a @samp{:float} even if using a caption.
  11635. @end table
  11636. @noindent
  11637. Use the @samp{placement} attribute to modify a floating environment's
  11638. placement.
  11639. @example
  11640. #+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement @{r@}@{0.4\textwidth@}
  11641. [[./img/hst.png]]
  11642. @end example
  11643. @vindex org-latex-images-centered
  11644. @cindex center image in LaTeX export
  11645. @cindex image, centering in LaTeX export
  11646. The @LaTeX{} export back-end centers all images by default. Setting
  11647. @samp{:center} to @samp{nil} disables centering. To disable centering globally,
  11648. set @code{org-latex-images-centered} to @samp{t}.
  11649. Set the @samp{:comment-include} attribute to non-@code{nil} value for the @LaTeX{}
  11650. export back-end to comment out the @samp{\includegraphics} macro.
  11651. @node Plain lists in @LaTeX{} export
  11652. @subsection Plain lists in @LaTeX{} export
  11653. @cindex plain lists, in @LaTeX{} export
  11654. @cindex @samp{ATTR_LATEX}, keyword
  11655. The @LaTeX{} export back-end accepts the @samp{environment} and @samp{options}
  11656. attributes for plain lists. Both attributes work together for
  11657. customizing lists, as shown in the examples:
  11658. @example
  11659. #+LATEX_HEADER: \usepackage[inline]@{enumitem@}
  11660. Some ways to say "Hello":
  11661. #+ATTR_LATEX: :environment itemize*
  11662. #+ATTR_LATEX: :options [label=@{@}, itemjoin=@{,@}, itemjoin*=@{, and@}]
  11663. - Hola
  11664. - Bonjour
  11665. - Guten Tag.
  11666. @end example
  11667. Since @LaTeX{} supports only four levels of nesting for lists, use an
  11668. external package, such as @samp{enumitem} in @LaTeX{}, for levels deeper than
  11669. four:
  11670. @example
  11671. #+LATEX_HEADER: \usepackage@{enumitem@}
  11672. #+LATEX_HEADER: \renewlist@{itemize@}@{itemize@}@{9@}
  11673. #+LATEX_HEADER: \setlist[itemize]@{label=$\circ$@}
  11674. - One
  11675. - Two
  11676. - Three
  11677. - Four
  11678. - Five
  11679. @end example
  11680. @node Source blocks in @LaTeX{} export
  11681. @subsection Source blocks in @LaTeX{} export
  11682. @cindex source blocks, in @LaTeX{} export
  11683. @cindex @samp{ATTR_LATEX}, keyword
  11684. The @LaTeX{} export back-end can make source code blocks into floating
  11685. objects through the attributes @samp{:float} and @samp{:options}. For @samp{:float}:
  11686. @table @asis
  11687. @item @samp{t}
  11688. Makes a source block float; by default floats any source block
  11689. with a caption.
  11690. @item @samp{multicolumn}
  11691. Spans the source block across multiple columns of a page.
  11692. @item @samp{nil}
  11693. Avoids a @samp{:float} even if using a caption; useful for source code
  11694. blocks that may not fit on a page.
  11695. @end table
  11696. @example
  11697. #+ATTR_LATEX: :float nil
  11698. #+BEGIN_SRC emacs-lisp
  11699. Lisp code that may not fit in a single page.
  11700. #+END_SRC
  11701. @end example
  11702. @vindex org-latex-listings-options
  11703. @vindex org-latex-minted-options
  11704. The @LaTeX{} export back-end passes string values in @samp{:options} to @LaTeX{}
  11705. packages for customization of that specific source block. In the
  11706. example below, the @samp{:options} are set for Minted. Minted is a source
  11707. code highlighting @LaTeX{} package with many configurable options.
  11708. @example
  11709. #+ATTR_LATEX: :options commentstyle=\bfseries
  11710. #+BEGIN_SRC emacs-lisp
  11711. (defun Fib (n)
  11712. (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
  11713. #+END_SRC
  11714. @end example
  11715. To apply similar configuration options for all source blocks in
  11716. a file, use the @code{org-latex-listings-options} and
  11717. @code{org-latex-minted-options} variables.
  11718. @node Example blocks in @LaTeX{} export
  11719. @subsection Example blocks in @LaTeX{} export
  11720. @cindex example blocks, in @LaTeX{} export
  11721. @cindex verbatim blocks, in @LaTeX{} export
  11722. @cindex @samp{ATTR_LATEX}, keyword
  11723. The @LaTeX{} export back-end wraps the contents of example blocks in
  11724. a @samp{verbatim} environment. To change this behavior to use another
  11725. environment globally, specify an appropriate export filter (see
  11726. @ref{Advanced Configuration}). To change this behavior to use another
  11727. environment for each block, use the @samp{:environment} parameter to
  11728. specify a custom environment.
  11729. @example
  11730. #+ATTR_LATEX: :environment myverbatim
  11731. #+BEGIN_EXAMPLE
  11732. This sentence is false.
  11733. #+END_EXAMPLE
  11734. @end example
  11735. @node Special blocks in @LaTeX{} export
  11736. @subsection Special blocks in @LaTeX{} export
  11737. @cindex special blocks, in @LaTeX{} export
  11738. @cindex abstract, in @LaTeX{} export
  11739. @cindex proof, in @LaTeX{} export
  11740. @cindex @samp{ATTR_LATEX}, keyword
  11741. For other special blocks in the Org file, the @LaTeX{} export back-end
  11742. makes a special environment of the same name. The back-end also takes
  11743. @samp{:options}, if any, and appends as-is to that environment's opening
  11744. string. For example:
  11745. @example
  11746. #+BEGIN_abstract
  11747. We demonstrate how to solve the Syracuse problem.
  11748. #+END_abstract
  11749. #+ATTR_LATEX: :options [Proof of important theorem]
  11750. #+BEGIN_proof
  11751. ...
  11752. Therefore, any even number greater than 2 is the sum of two primes.
  11753. #+END_proof
  11754. @end example
  11755. @noindent
  11756. exports to
  11757. @example
  11758. \begin@{abstract@}
  11759. We demonstrate how to solve the Syracuse problem.
  11760. \end@{abstract@}
  11761. \begin@{proof@}[Proof of important theorem]
  11762. ...
  11763. Therefore, any even number greater than 2 is the sum of two primes.
  11764. \end@{proof@}
  11765. @end example
  11766. If you need to insert a specific caption command, use @samp{:caption}
  11767. attribute. It overrides standard @samp{CAPTION} value, if any. For
  11768. example:
  11769. @example
  11770. #+ATTR_LATEX: :caption \MyCaption@{HeadingA@}
  11771. #+BEGIN_proof
  11772. ...
  11773. #+END_proof
  11774. @end example
  11775. @node Horizontal rules in @LaTeX{} export
  11776. @subsection Horizontal rules in @LaTeX{} export
  11777. @cindex horizontal rules, in @LaTeX{} export
  11778. @cindex @samp{ATTR_LATEX}, keyword
  11779. The @LaTeX{} export back-end converts horizontal rules by the specified
  11780. @samp{:width} and @samp{:thickness} attributes. For example:
  11781. @example
  11782. #+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt
  11783. -----
  11784. @end example
  11785. @node Markdown Export
  11786. @section Markdown Export
  11787. @cindex Markdown export
  11788. The Markdown export back-end, ``md'', converts an Org file to a Markdown
  11789. format, as defined at @uref{http://daringfireball.net/projects/markdown/}.
  11790. Since ``md'' is built on top of the HTML back-end, any Org constructs
  11791. not supported by Markdown, such as tables, the underlying ``html''
  11792. back-end (see @ref{HTML Export}) converts them.
  11793. @anchor{Markdown export commands}
  11794. @subheading Markdown export commands
  11795. @table @asis
  11796. @item @kbd{C-c C-e m m} (@code{org-md-export-to-markdown})
  11797. @kindex C-c C-c m m
  11798. @findex org-md-export-to-markdown
  11799. Export to a text file with Markdown syntax. For @samp{myfile.org},
  11800. Org exports to @samp{myfile.md}, overwritten without warning.
  11801. @item @kbd{C-c C-e m M} (@code{org-md-export-as-markdown})
  11802. @kindex C-c C-c m M
  11803. @findex org-md-export-as-markdown
  11804. Export to a temporary buffer. Does not create a file.
  11805. @item @kbd{C-c C-e m o}
  11806. @kindex C-c C-e m o
  11807. Export as a text file with Markdown syntax, then open it.
  11808. @end table
  11809. @anchor{Header and sectioning structure (1)}
  11810. @subheading Header and sectioning structure
  11811. @vindex org-md-headline-style
  11812. Based on @code{org-md-headline-style}, Markdown export can generate
  11813. headlines of both @emph{atx} and @emph{setext} types. @emph{atx} limits headline
  11814. levels to two whereas @emph{setext} limits headline levels to six. Beyond
  11815. these limits, the export back-end converts headlines to lists. To set
  11816. a limit to a level before the absolute limit (see @ref{Export Settings}).
  11817. @node OpenDocument Text Export
  11818. @section OpenDocument Text Export
  11819. @cindex ODT
  11820. @cindex OpenDocument
  11821. @cindex export, OpenDocument
  11822. @cindex LibreOffice
  11823. The ODT export back-end handles creating of OpenDocument Text (ODT)
  11824. format. Documents created by this exporter use the
  11825. @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
  11826. (OpenDocument) Version 1.2}.} and are compatible
  11827. with LibreOffice 3.4.
  11828. @menu
  11829. * Pre-requisites for ODT export:: Required packages.
  11830. * ODT export commands:: Invoking export.
  11831. * ODT specific export settings:: Configuration options.
  11832. * Extending ODT export:: Producing DOC, PDF files.
  11833. * Applying custom styles:: Styling the output.
  11834. * Links in ODT export:: Handling and formatting links.
  11835. * Tables in ODT export:: Org tables conversions.
  11836. * Images in ODT export:: Inserting images.
  11837. * Math formatting in ODT export:: Formatting @LaTeX{} fragments.
  11838. * Labels and captions in ODT export:: Rendering objects.
  11839. * Literal examples in ODT export:: For source code and example blocks.
  11840. * Advanced topics in ODT export:: For power users.
  11841. @end menu
  11842. @node Pre-requisites for ODT export
  11843. @subsection Pre-requisites for ODT export
  11844. @cindex zip
  11845. The ODT export back-end relies on the zip program to create the final
  11846. compressed ODT output. Check if @samp{zip} is locally available and
  11847. executable. Without it, export cannot finish.
  11848. @node ODT export commands
  11849. @subsection ODT export commands
  11850. @table @asis
  11851. @item @kbd{C-c C-e o o} (@code{org-export-to-odt})
  11852. @kindex C-c C-e o o
  11853. @findex org-export-to-odt
  11854. Export as OpenDocument Text file.
  11855. @cindex @samp{EXPORT_FILE_NAME}, property
  11856. @vindex org-odt-preferred-output-format
  11857. If @code{org-odt-preferred-output-format} is specified, the ODT export
  11858. back-end automatically converts the exported file to that format.
  11859. For @samp{myfile.org}, Org exports to @samp{myfile.odt}, overwriting
  11860. without warning. The ODT export back-end exports a region only
  11861. if a region was active.
  11862. If the selected region is a single tree, the ODT export back-end
  11863. makes the tree head the document title. Incidentally, @kbd{C-c @@} selects the current sub-tree. If the tree head entry has,
  11864. or inherits, an @samp{EXPORT_FILE_NAME} property, the ODT export
  11865. back-end uses that for file name.
  11866. @item @kbd{C-c C-e o O}
  11867. @kindex C-c C-e o O
  11868. Export as an OpenDocument Text file and open the resulting file.
  11869. @vindex org-export-odt-preferred-output-format
  11870. If @code{org-export-odt-preferred-output-format} is specified, open
  11871. the converted file instead. See @ref{Automatically exporting to other formats}.
  11872. @end table
  11873. @node ODT specific export settings
  11874. @subsection ODT specific export settings
  11875. The ODT export back-end has several additional keywords for
  11876. customizing ODT output. Setting these keywords works similar to the
  11877. general options (see @ref{Export Settings}).
  11878. @table @asis
  11879. @item @samp{DESCRIPTION}
  11880. @cindex @samp{DESCRIPTION}, keyword
  11881. This is the document's description, which the ODT export back-end
  11882. inserts as document metadata. For long descriptions, use
  11883. multiple lines, prefixed with @samp{DESCRIPTION}.
  11884. @item @samp{KEYWORDS}
  11885. @cindex @samp{KEYWORDS}, keyword
  11886. The keywords for the document. The ODT export back-end inserts
  11887. the description along with author name, keywords, and related
  11888. file metadata as metadata in the output file. Use multiple
  11889. @samp{KEYWORDS} if necessary.
  11890. @item @samp{ODT_STYLES_FILE}
  11891. @cindex @samp{ODT_STYLES_FILE}, keyword
  11892. @vindex org-odt-styles-file
  11893. The ODT export back-end uses the @code{org-odt-styles-file} by
  11894. default. See @ref{Applying custom styles} for details.
  11895. @item @samp{SUBTITLE}
  11896. @cindex @samp{SUBTITLE}, keyword
  11897. The document subtitle.
  11898. @end table
  11899. @node Extending ODT export
  11900. @subsection Extending ODT export
  11901. The ODT export back-end can produce documents in other formats besides
  11902. ODT using a specialized ODT converter process. Its common interface
  11903. works with popular converters to produce formats such as @samp{doc}, or
  11904. convert a document from one format, say @samp{csv}, to another format, say
  11905. @samp{xls}.
  11906. @cindex @file{unoconv}
  11907. @vindex org-odt-convert-process
  11908. Customize @code{org-odt-convert-process} variable to point to @samp{unoconv},
  11909. which is the ODT's preferred converter. Working installations of
  11910. LibreOffice would already have @samp{unoconv} installed. Alternatively,
  11911. other converters may be substituted here. See @ref{Configuring a document converter}.
  11912. @anchor{Automatically exporting to other formats}
  11913. @subsubheading Automatically exporting to other formats
  11914. @vindex org-odt-preferred-output-format
  11915. If ODT format is just an intermediate step to get to other formats,
  11916. such as @samp{doc}, @samp{docx}, @samp{rtf}, or @samp{pdf}, etc., then extend the ODT
  11917. export back-end to directly produce that format. Specify the final
  11918. format in the @code{org-odt-preferred-output-format} variable. This is one
  11919. way to extend (see @ref{ODT export commands}).
  11920. @anchor{Converting between document formats}
  11921. @subsubheading Converting between document formats
  11922. The Org export back-end is made to be inter-operable with a wide range
  11923. of text document format converters. Newer generation converters, such
  11924. as LibreOffice and Pandoc, can handle hundreds of formats at once.
  11925. Org provides a consistent interaction with whatever converter is
  11926. installed. Here are some generic commands:
  11927. @table @asis
  11928. @item @kbd{M-x org-odt-convert}
  11929. @findex org-odt-convert
  11930. Convert an existing document from one format to another. With
  11931. a prefix argument, opens the newly produced file.
  11932. @end table
  11933. @node Applying custom styles
  11934. @subsection Applying custom styles
  11935. @cindex styles, custom
  11936. @cindex template, custom
  11937. The ODT export back-end comes with many OpenDocument styles (see
  11938. @ref{Working with OpenDocument style files}). To expand or further
  11939. customize these built-in style sheets, either edit the style sheets
  11940. directly or generate them using an application such as LibreOffice.
  11941. The example here shows creating a style using LibreOffice.
  11942. @anchor{Applying custom styles the easy way}
  11943. @subsubheading Applying custom styles: the easy way
  11944. @enumerate
  11945. @item
  11946. Create a sample @samp{example.org} file with settings as shown below,
  11947. and export it to ODT format.
  11948. @example
  11949. #+OPTIONS: H:10 num:t
  11950. @end example
  11951. @item
  11952. Open the above @samp{example.odt} using LibreOffice. Use the @emph{Stylist}
  11953. to locate the target styles, which typically have the ``Org'' prefix.
  11954. Open one, modify, and save as either OpenDocument Text (ODT) or
  11955. OpenDocument Template (OTT) file.
  11956. @item
  11957. @vindex org-odt-styles-file
  11958. Customize the variable @code{org-odt-styles-file} and point it to the
  11959. newly created file. For additional configuration options, see
  11960. @ref{x-overriding-factory-styles, , Overriding factory styles}.
  11961. @cindex @samp{ODT_STYLES_FILE}, keyword
  11962. To apply an ODT style to a particular file, use the
  11963. @samp{ODT_STYLES_FILE} keyword as shown in the example below:
  11964. @example
  11965. #+ODT_STYLES_FILE: "/path/to/example.ott"
  11966. @end example
  11967. @noindent
  11968. or
  11969. @example
  11970. #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
  11971. @end example
  11972. @end enumerate
  11973. @anchor{Using third-party styles and templates}
  11974. @subsubheading Using third-party styles and templates
  11975. The ODT export back-end relies on many templates and style names.
  11976. Using third-party styles and templates can lead to mismatches.
  11977. Templates derived from built in ODT templates and styles seem to have
  11978. fewer problems.
  11979. @node Links in ODT export
  11980. @subsection Links in ODT export
  11981. @cindex links, in ODT export
  11982. ODT exporter creates native cross-references for internal links. It
  11983. creates Internet-style links for all other links.
  11984. A link with no description and pointing to a regular, un-itemized,
  11985. outline heading is replaced with a cross-reference and section number
  11986. of the heading.
  11987. A @samp{\ref@{label@}}-style reference to an image, table etc., is replaced
  11988. with a cross-reference and sequence number of the labeled entity. See
  11989. @ref{Labels and captions in ODT export}.
  11990. @node Tables in ODT export
  11991. @subsection Tables in ODT export
  11992. @cindex tables, in ODT export
  11993. The ODT export back-end handles native Org mode tables (see @ref{Tables})
  11994. and simple @samp{table.el} tables. Complex @samp{table.el} tables having column
  11995. or row spans are not supported. Such tables are stripped from the
  11996. exported document.
  11997. By default, the ODT export back-end exports a table with top and
  11998. bottom frames and with ruled lines separating row and column groups
  11999. (see @ref{Column Groups}). All tables are typeset to occupy the same
  12000. width. The ODT export back-end honors any table alignments and
  12001. relative widths for columns (see @ref{Column Width and Alignment}).
  12002. Note that the ODT export back-end interprets column widths as weighted
  12003. ratios, the default weight being 1.
  12004. @cindex @samp{ATTR_ODT}, keyword
  12005. Specifying @samp{:rel-width} property on an @samp{ATTR_ODT} line controls the
  12006. width of the table. For example:
  12007. @example
  12008. #+ATTR_ODT: :rel-width 50
  12009. | Area/Month | Jan | Feb | Mar | Sum |
  12010. |---------------+-------+-------+-------+-------|
  12011. | / | < | | | < |
  12012. | <l13> | <r5> | <r5> | <r5> | <r6> |
  12013. | North America | 1 | 21 | 926 | 948 |
  12014. | Middle East | 6 | 75 | 844 | 925 |
  12015. | Asia Pacific | 9 | 27 | 790 | 826 |
  12016. |---------------+-------+-------+-------+-------|
  12017. | Sum | 16 | 123 | 2560 | 2699 |
  12018. @end example
  12019. On export, the above table takes 50% of text width area. The exporter
  12020. sizes the columns in the ratio: 13:5:5:5:6. The first column is
  12021. left-aligned and rest of the columns, right-aligned. Vertical rules
  12022. separate the header and the last column. Horizontal rules separate
  12023. the header and the last row.
  12024. For even more customization, create custom table styles and associate
  12025. them with a table using the @samp{ATTR_ODT} keyword. See @ref{Customizing tables in ODT export}.
  12026. @node Images in ODT export
  12027. @subsection Images in ODT export
  12028. @cindex images, embedding in ODT
  12029. @cindex embedding images in ODT
  12030. @anchor{Embedding images}
  12031. @subsubheading Embedding images
  12032. The ODT export back-end processes image links in Org files that do not
  12033. have descriptions, such as these links @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]},
  12034. as direct image insertions in the final output. Either of these
  12035. examples works:
  12036. @example
  12037. [[file:img.png]]
  12038. @end example
  12039. @example
  12040. [[./img.png]]
  12041. @end example
  12042. @anchor{Embedding clickable images}
  12043. @subsubheading Embedding clickable images
  12044. For clickable images, provide a link whose description is another link
  12045. to an image file. For example, to embed an image
  12046. @samp{org-mode-unicorn.png} which when clicked jumps to @uref{https://orgmode.org}
  12047. website, do the following
  12048. @example
  12049. [[https://orgmode.org][./org-mode-unicorn.png]]
  12050. @end example
  12051. @anchor{Sizing and scaling of embedded images}
  12052. @subsubheading Sizing and scaling of embedded images
  12053. @cindex @samp{ATTR_ODT}, keyword
  12054. Control the size and scale of the embedded images with the @samp{ATTR_ODT}
  12055. attribute.
  12056. @cindex identify, ImageMagick
  12057. @vindex org-odt-pixels-per-inch
  12058. The ODT export back-end starts with establishing the size of the image
  12059. in the final document. The dimensions of this size are measured in
  12060. centimeters. The back-end then queries the image file for its
  12061. dimensions measured in pixels. For this measurement, the back-end
  12062. relies on ImageMagick's identify program or Emacs @code{create-image} and
  12063. @code{image-size} API. ImageMagick is the preferred choice for large file
  12064. sizes or frequent batch operations. The back-end then converts the
  12065. pixel dimensions using @code{org-odt-pixels-per-inch} into the familiar 72
  12066. dpi or 96 dpi. The default value for this is in
  12067. @code{display-pixels-per-inch}, which can be tweaked for better results
  12068. based on the capabilities of the output device. Here are some common
  12069. image scaling operations:
  12070. @table @asis
  12071. @item Explicitly size the image
  12072. To embed @samp{img.png} as a 10 cm x 10 cm image, do the following:
  12073. @example
  12074. #+ATTR_ODT: :width 10 :height 10
  12075. [[./img.png]]
  12076. @end example
  12077. @item Scale the image
  12078. To embed @samp{img.png} at half its size, do the following:
  12079. @example
  12080. #+ATTR_ODT: :scale 0.5
  12081. [[./img.png]]
  12082. @end example
  12083. @item Scale the image to a specific width
  12084. To embed @samp{img.png} with a width of 10 cm while retaining the
  12085. original height:width ratio, do the following:
  12086. @example
  12087. #+ATTR_ODT: :width 10
  12088. [[./img.png]]
  12089. @end example
  12090. @item Scale the image to a specific height
  12091. To embed @samp{img.png} with a height of 10 cm while retaining the
  12092. original height:width ratio, do the following:
  12093. @example
  12094. #+ATTR_ODT: :height 10
  12095. [[./img.png]]
  12096. @end example
  12097. @end table
  12098. @anchor{Anchoring of images}
  12099. @subsubheading Anchoring of images
  12100. @cindex @samp{ATTR_ODT}, keyword
  12101. The ODT export back-end can anchor images to @samp{"as-char"},
  12102. @samp{"paragraph"}, or @samp{"page"}. Set the preferred anchor using the
  12103. @samp{:anchor} property of the @samp{ATTR_ODT} line.
  12104. To create an image that is anchored to a page:
  12105. @example
  12106. #+ATTR_ODT: :anchor "page"
  12107. [[./img.png]]
  12108. @end example
  12109. @node Math formatting in ODT export
  12110. @subsection Math formatting in ODT export
  12111. The ODT exporter has special support for handling math.
  12112. @menu
  12113. * @LaTeX{} math snippets:: Embedding in @LaTeX{} format.
  12114. * MathML and OpenDocument formula files:: Embedding in native format.
  12115. @end menu
  12116. @node @LaTeX{} math snippets
  12117. @subsubsection @LaTeX{} math snippets
  12118. @LaTeX{} math snippets (see @ref{@LaTeX{} fragments}) can be embedded in the ODT
  12119. document in one of the following ways:
  12120. @table @asis
  12121. @item MathML
  12122. @cindex MathML
  12123. Add this line to the Org file. This option is activated on
  12124. a per-file basis.
  12125. @example
  12126. #+OPTIONS: tex:t
  12127. @end example
  12128. With this option, @LaTeX{} fragments are first converted into MathML
  12129. fragments using an external @LaTeX{}-to-MathML converter program.
  12130. The resulting MathML fragments are then embedded as an
  12131. OpenDocument Formula in the exported document.
  12132. @vindex org-latex-to-mathml-convert-command
  12133. @vindex org-latex-to-mathml-jar-file
  12134. You can specify the @LaTeX{}-to-MathML converter by customizing the
  12135. variables @code{org-latex-to-mathml-convert-command} and
  12136. @code{org-latex-to-mathml-jar-file}.
  12137. If you prefer to use MathToWeb@footnote{See @uref{http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl, MathToWeb}.} as your converter, you can
  12138. configure the above variables as shown below.
  12139. @lisp
  12140. (setq org-latex-to-mathml-convert-command
  12141. "java -jar %j -unicode -force -df %o %I"
  12142. org-latex-to-mathml-jar-file
  12143. "/path/to/mathtoweb.jar")
  12144. @end lisp
  12145. To use @LaTeX{}​ML@footnote{See @uref{http://dlmf.nist.gov/LaTeXML/}.} use
  12146. @lisp
  12147. (setq org-latex-to-mathml-convert-command
  12148. "latexmlmath \"%i\" --presentationmathml=%o")
  12149. @end lisp
  12150. To quickly verify the reliability of the @LaTeX{}-to-MathML
  12151. converter, use the following commands:
  12152. @table @asis
  12153. @item @kbd{M-x org-export-as-odf}
  12154. Convert a @LaTeX{} math snippet to an OpenDocument formula
  12155. (@samp{.odf}) file.
  12156. @item @kbd{M-x org-export-as-odf-and-open}
  12157. Convert a @LaTeX{} math snippet to an OpenDocument formula
  12158. (@samp{.odf}) file and open the formula file with the
  12159. system-registered application.
  12160. @end table
  12161. @item PNG images
  12162. @cindex dvipng
  12163. @cindex dvisvgm
  12164. @cindex ImageMagick
  12165. Add this line to the Org file. This option is activated on
  12166. a per-file basis.
  12167. @example
  12168. #+OPTIONS: tex:dvipng
  12169. @end example
  12170. @example
  12171. #+OPTIONS: tex:dvisvgm
  12172. @end example
  12173. @noindent
  12174. or
  12175. @example
  12176. #+OPTIONS: tex:imagemagick
  12177. @end example
  12178. Under this option, @LaTeX{} fragments are processed into PNG or SVG
  12179. images and the resulting images are embedded in the exported
  12180. document. This method requires dvipng program, dvisvgm or
  12181. ImageMagick programs.
  12182. @end table
  12183. @node MathML and OpenDocument formula files
  12184. @subsubsection MathML and OpenDocument formula files
  12185. When embedding @LaTeX{} math snippets in ODT documents is not reliable,
  12186. there is one more option to try. Embed an equation by linking to its
  12187. MathML (@samp{.mml}) source or its OpenDocument formula (@samp{.odf}) file as
  12188. shown below:
  12189. @example
  12190. [[./equation.mml]]
  12191. @end example
  12192. @noindent
  12193. or
  12194. @example
  12195. [[./equation.odf]]
  12196. @end example
  12197. @node Labels and captions in ODT export
  12198. @subsection Labels and captions in ODT export
  12199. ODT format handles labeling and captioning of objects based on their
  12200. types. Inline images, tables, @LaTeX{} fragments, and Math formulas are
  12201. numbered and captioned separately. Each object also gets a unique
  12202. sequence number based on its order of first appearance in the Org
  12203. file. Each category has its own sequence. A caption is just a label
  12204. applied to these objects.
  12205. @example
  12206. #+CAPTION: Bell curve
  12207. #+NAME: fig:SED-HR4049
  12208. [[./img/a.png]]
  12209. @end example
  12210. When rendered, it may show as follows in the exported document:
  12211. @example
  12212. Figure 2: Bell curve
  12213. @end example
  12214. @vindex org-odt-category-map-alist
  12215. To modify the category component of the caption, customize the option
  12216. @code{org-odt-category-map-alist}. For example, to tag embedded images
  12217. with the string ``Illustration'' instead of the default string ``Figure'',
  12218. use the following setting:
  12219. @lisp
  12220. (setq org-odt-category-map-alist
  12221. '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)))
  12222. @end lisp
  12223. With the above modification, the previous example changes to:
  12224. @example
  12225. Illustration 2: Bell curve
  12226. @end example
  12227. @node Literal examples in ODT export
  12228. @subsection Literal examples in ODT export
  12229. The ODT export back-end supports literal examples (see @ref{Literal Examples}) with full fontification. Internally, the ODT export
  12230. back-end relies on @samp{htmlfontify.el} to generate the style definitions
  12231. needed for fancy listings. The auto-generated styles get @samp{OrgSrc}
  12232. prefix and inherit colors from the faces used by Emacs Font Lock
  12233. library for that source language.
  12234. @vindex org-odt-fontify-srcblocks
  12235. For custom fontification styles, customize the
  12236. @code{org-odt-create-custom-styles-for-srcblocks} option.
  12237. @vindex org-odt-create-custom-styles-for-srcblocks
  12238. To turn off fontification of literal examples, customize the
  12239. @code{org-odt-fontify-srcblocks} option.
  12240. @node Advanced topics in ODT export
  12241. @subsection Advanced topics in ODT export
  12242. The ODT export back-end has extensive features useful for power users
  12243. and frequent uses of ODT formats.
  12244. @anchor{Configuring a document converter}
  12245. @subsubheading Configuring a document converter
  12246. @cindex convert
  12247. @cindex doc, docx, rtf
  12248. @cindex converter
  12249. The ODT export back-end works with popular converters with little or
  12250. no extra configuration. See @ref{Extending ODT export}. The following is
  12251. for unsupported converters or tweaking existing defaults.
  12252. @table @asis
  12253. @item Register the converter
  12254. @vindex org-export-odt-convert-processes
  12255. Add the name of the converter to the @code{org-odt-convert-processes}
  12256. variable. Note that it also requires how the converter is
  12257. invoked on the command line. See the variable's docstring for
  12258. details.
  12259. @item Configure its capabilities
  12260. @vindex org-export-odt-convert-capabilities
  12261. Specify which formats the converter can handle by customizing the
  12262. variable @code{org-odt-convert-capabilities}. Use the entry for the
  12263. default values in this variable for configuring the new
  12264. converter. Also see its docstring for details.
  12265. @item Choose the converter
  12266. @vindex org-export-odt-convert-process
  12267. Select the newly added converter as the preferred one by
  12268. customizing the option @code{org-odt-convert-process}.
  12269. @end table
  12270. @anchor{Working with OpenDocument style files}
  12271. @subsubheading Working with OpenDocument style files
  12272. @cindex styles, custom
  12273. @cindex template, custom
  12274. This section explores the internals of the ODT exporter; the means by which
  12275. it produces styled documents; the use of automatic and custom OpenDocument
  12276. styles.
  12277. The ODT exporter relies on two files for generating its output. These
  12278. files are bundled with the distribution under the directory pointed to
  12279. by the variable @code{org-odt-styles-dir}. The two files are:
  12280. @table @asis
  12281. @item @samp{OrgOdtStyles.xml} @anchor{x-orgodtstyles-xml}
  12282. This file contributes to the @samp{styles.xml} file of the final ODT
  12283. document. This file gets modified for the following purposes:
  12284. @enumerate
  12285. @item
  12286. To control outline numbering based on user settings;
  12287. @item
  12288. To add styles generated by @samp{htmlfontify.el} for fontification of
  12289. code blocks.
  12290. @end enumerate
  12291. @item @samp{OrgOdtContentTemplate.xml} @anchor{x-orgodtcontenttemplate-xml}
  12292. This file contributes to the @samp{content.xml} file of the final ODT
  12293. document. The contents of the Org outline are inserted between the
  12294. @samp{<office:text>} @dots{} @samp{</office:text>} elements of this file.
  12295. Apart from serving as a template file for the final @samp{content.xml},
  12296. the file serves the following purposes:
  12297. @enumerate
  12298. @item
  12299. It contains automatic styles for formatting of tables which are
  12300. referenced by the exporter;
  12301. @item
  12302. It contains @samp{<text:sequence-decl>} @dots{} @samp{</text:sequence-decl>}
  12303. elements that control numbering of tables, images, equations, and
  12304. similar entities.
  12305. @end enumerate
  12306. @end table
  12307. @anchor{x-overriding-factory-styles} The following two variables control
  12308. the location from where the ODT exporter picks up the custom styles
  12309. and content template files. Customize these variables to override the
  12310. factory styles used by the exporter.
  12311. @table @asis
  12312. @item @code{org-odt-styles-file}
  12313. The ODT export back-end uses the file pointed to by this
  12314. variable, such as @samp{styles.xml}, for the final output. It can
  12315. take one of the following values:
  12316. @table @asis
  12317. @item @samp{FILE.xml}
  12318. Use this file instead of the default @samp{styles.xml}
  12319. @item @samp{FILE.odt} or @samp{FILE.ott}
  12320. Use the @samp{styles.xml} contained in the specified OpenDocument
  12321. Text or Template file
  12322. @item @samp{FILE.odt} or @samp{FILE.ott} and a subset of included files
  12323. Use the @samp{styles.xml} contained in the specified OpenDocument
  12324. Text or Template file. Additionally extract the specified
  12325. member files and embed those within the final ODT document.
  12326. Use this option if the @samp{styles.xml} file references additional
  12327. files like header and footer images.
  12328. @item @code{nil}
  12329. Use the default @samp{styles.xml}.
  12330. @end table
  12331. @item @code{org-odt-content-template-file}
  12332. Use this variable to specify the blank @samp{content.xml} used in the
  12333. final output.
  12334. @end table
  12335. @anchor{Creating one-off styles}
  12336. @subsubheading Creating one-off styles
  12337. The ODT export back-end can read embedded raw OpenDocument XML from
  12338. the Org file. Such direct formatting is useful for one-off instances.
  12339. @table @asis
  12340. @item Embedding ODT tags as part of regular text
  12341. Enclose OpenDocument syntax in @samp{@@@@odt:...@@@@} for inline markup.
  12342. For example, to highlight a region of text do the following:
  12343. @example
  12344. @@@@odt:<text:span text:style-name="Highlight">This is highlighted
  12345. text</text:span>@@@@. But this is regular text.
  12346. @end example
  12347. @strong{Hint:} To see the above example in action, edit the @samp{styles.xml}
  12348. (see @ref{x-orgodtstyles-xml, , Factory styles}) and add a custom @emph{Highlight} style as shown
  12349. below:
  12350. @example
  12351. <style:style style:name="Highlight" style:family="text">
  12352. <style:text-properties fo:background-color="#ff0000"/>
  12353. </style:style>
  12354. @end example
  12355. @item Embedding a one-line OpenDocument XML
  12356. @cindex @samp{ODT}, keyword
  12357. The ODT export back-end can read one-liner options with @samp{#+ODT:}
  12358. in the Org file. For example, to force a page break:
  12359. @example
  12360. #+ODT: <text:p text:style-name="PageBreak"/>
  12361. @end example
  12362. @strong{Hint:} To see the above example in action, edit your
  12363. @samp{styles.xml} (see @ref{x-orgodtstyles-xml, , Factory styles}) and add a custom @samp{PageBreak}
  12364. style as shown below.
  12365. @example
  12366. <style:style style:name="PageBreak" style:family="paragraph"
  12367. style:parent-style-name="Text_20_body">
  12368. <style:paragraph-properties fo:break-before="page"/>
  12369. </style:style>
  12370. @end example
  12371. @item Embedding a block of OpenDocument XML
  12372. The ODT export back-end can also read ODT export blocks for
  12373. OpenDocument XML. Such blocks use the @samp{#+BEGIN_EXPORT odt}
  12374. @dots{} @samp{#+END_EXPORT} constructs.
  12375. For example, to create a one-off paragraph that uses bold text,
  12376. do the following:
  12377. @example
  12378. #+BEGIN_EXPORT odt
  12379. <text:p text:style-name="Text_20_body_20_bold">
  12380. This paragraph is specially formatted and uses bold text.
  12381. </text:p>
  12382. #+END_EXPORT
  12383. @end example
  12384. @end table
  12385. @anchor{Customizing tables in ODT export}
  12386. @subsubheading Customizing tables in ODT export
  12387. @cindex tables, in ODT export
  12388. @cindex @samp{ATTR_ODT}, keyword
  12389. Override the default table format by specifying a custom table style
  12390. with the @samp{#+ATTR_ODT} line. For a discussion on default formatting of
  12391. tables, see @ref{Tables in ODT export}.
  12392. This feature closely mimics the way table templates are defined in the
  12393. OpenDocument-v1.2 specification.@footnote{@uref{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, OpenDocument-v1.2 Specification}}
  12394. @vindex org-odt-table-styles
  12395. For quick preview of this feature, install the settings below and export the
  12396. table that follows:
  12397. @lisp
  12398. (setq org-export-odt-table-styles
  12399. (append org-export-odt-table-styles
  12400. '(("TableWithHeaderRowAndColumn" "Custom"
  12401. ((use-first-row-styles . t)
  12402. (use-first-column-styles . t)))
  12403. ("TableWithFirstRowandLastRow" "Custom"
  12404. ((use-first-row-styles . t)
  12405. (use-last-row-styles . t))))))
  12406. @end lisp
  12407. @example
  12408. #+ATTR_ODT: :style TableWithHeaderRowAndColumn
  12409. | Name | Phone | Age |
  12410. | Peter | 1234 | 17 |
  12411. | Anna | 4321 | 25 |
  12412. @end example
  12413. The example above used @samp{Custom} template and installed two table
  12414. styles @samp{TableWithHeaderRowAndColumn} and
  12415. @samp{TableWithFirstRowandLastRow}. @strong{Important:} The OpenDocument styles
  12416. needed for producing the above template were pre-defined. They are
  12417. available in the section marked @samp{Custom Table Template} in
  12418. @samp{OrgOdtContentTemplate.xml} (see @ref{x-orgodtcontenttemplate-xml, , Factory styles}). For adding new
  12419. templates, define new styles there.
  12420. To use this feature proceed as follows:
  12421. @enumerate
  12422. @item
  12423. Create a table template@footnote{See the @samp{<table:table-template>} element of the
  12424. OpenDocument-v1.2 specification.}.
  12425. A table template is set of @samp{table-cell} and @samp{paragraph} styles for
  12426. each of the following table cell categories:
  12427. @itemize
  12428. @item
  12429. Body
  12430. @item
  12431. First column
  12432. @item
  12433. Last column
  12434. @item
  12435. First row
  12436. @item
  12437. Last row
  12438. @item
  12439. Even row
  12440. @item
  12441. Odd row
  12442. @item
  12443. Even column
  12444. @item
  12445. Odd Column
  12446. @end itemize
  12447. The names for the above styles must be chosen based on the name of
  12448. the table template using a well-defined convention.
  12449. The naming convention is better illustrated with an example. For
  12450. a table template with the name @samp{Custom}, the needed style names are
  12451. listed in the following table.
  12452. @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  12453. @headitem Cell type
  12454. @tab Cell style
  12455. @tab Paragraph style
  12456. @item Body
  12457. @tab @samp{CustomTableCell}
  12458. @tab @samp{CustomTableParagraph}
  12459. @item First column
  12460. @tab @samp{CustomFirstColumnTableCell}
  12461. @tab @samp{CustomFirstColumnTableParagraph}
  12462. @item Last column
  12463. @tab @samp{CustomLastColumnTableCell}
  12464. @tab @samp{CustomLastColumnTableParagraph}
  12465. @item First row
  12466. @tab @samp{CustomFirstRowTableCell}
  12467. @tab @samp{CustomFirstRowTableParagraph}
  12468. @item Last row
  12469. @tab @samp{CustomLastRowTableCell}
  12470. @tab @samp{CustomLastRowTableParagraph}
  12471. @item Even row
  12472. @tab @samp{CustomEvenRowTableCell}
  12473. @tab @samp{CustomEvenRowTableParagraph}
  12474. @item Odd row
  12475. @tab @samp{CustomOddRowTableCell}
  12476. @tab @samp{CustomOddRowTableParagraph}
  12477. @item Even column
  12478. @tab @samp{CustomEvenColumnTableCell}
  12479. @tab @samp{CustomEvenColumnTableParagraph}
  12480. @item Odd column
  12481. @tab @samp{CustomOddColumnTableCell}
  12482. @tab @samp{CustomOddColumnTableParagraph}
  12483. @end multitable
  12484. To create a table template with the name @samp{Custom}, define the above
  12485. styles in the @samp{<office:automatic-styles>} @dots{}
  12486. @samp{</office:automatic-styles>} element of the content template file
  12487. (see @ref{x-orgodtcontenttemplate-xml, , Factory styles}).
  12488. @item
  12489. Define a table style@footnote{See the attributes @samp{table:template-name},
  12490. @samp{table:use-first-row-styles}, @samp{table:use-last-row-styles},
  12491. @samp{table:use-first-column-styles}, @samp{table:use-last-column-styles},
  12492. @samp{table:use-banding-rows-styles}, and @samp{table:use-banding-column-styles}
  12493. of the @samp{<table:table>} element in the OpenDocument-v1.2 specification.}.
  12494. @vindex org-odt-table-styles
  12495. To define a table style, create an entry for the style in the
  12496. variable @code{org-odt-table-styles} and specify the following:
  12497. @itemize
  12498. @item
  12499. the name of the table template created in step (1),
  12500. @item
  12501. the set of cell styles in that template that are to be activated.
  12502. @end itemize
  12503. For example, the entry below defines two different table styles
  12504. @samp{TableWithHeaderRowAndColumn} and @samp{TableWithFirstRowandLastRow}
  12505. based on the same template @samp{Custom}. The styles achieve their
  12506. intended effect by selectively activating the individual cell
  12507. styles in that template.
  12508. @lisp
  12509. (setq org-export-odt-table-styles
  12510. (append org-export-odt-table-styles
  12511. '(("TableWithHeaderRowAndColumn" "Custom"
  12512. ((use-first-row-styles . t)
  12513. (use-first-column-styles . t)))
  12514. ("TableWithFirstRowandLastRow" "Custom"
  12515. ((use-first-row-styles . t)
  12516. (use-last-row-styles . t))))))
  12517. @end lisp
  12518. @item
  12519. Associate a table with the table style.
  12520. To do this, specify the table style created in step (2) as part of
  12521. the @samp{ATTR_ODT} line as shown below.
  12522. @example
  12523. #+ATTR_ODT: :style TableWithHeaderRowAndColumn
  12524. | Name | Phone | Age |
  12525. | Peter | 1234 | 17 |
  12526. | Anna | 4321 | 25 |
  12527. @end example
  12528. @end enumerate
  12529. @anchor{Validating OpenDocument XML}
  12530. @subsubheading Validating OpenDocument XML
  12531. Sometimes ODT format files may not open due to @samp{.odt} file corruption.
  12532. To verify if such a file is corrupt, validate it against the
  12533. OpenDocument Relax NG Compact (RNC) syntax schema. But first the
  12534. @samp{.odt} files have to be decompressed using @samp{zip}. Note that @samp{.odt}
  12535. files are ZIP archives: @ref{File Archives,,,emacs,}. The contents of
  12536. ODT files are in XML. For general help with validation---and
  12537. schema-sensitive editing---of XML files:
  12538. @ref{Introduction,,,nxml-mode,}.
  12539. @vindex org-export-odt-schema-dir
  12540. Customize @code{org-odt-schema-dir} to point to a directory with
  12541. OpenDocument RNC files and the needed schema-locating rules. The ODT
  12542. export back-end takes care of updating the
  12543. @code{rng-schema-locating-files}.
  12544. @node Org Export
  12545. @section Org Export
  12546. @cindex Org export
  12547. @emph{org} export back-end creates a normalized version of the Org document
  12548. in current buffer. The exporter evaluates Babel code (see @ref{Evaluating Code Blocks}) and removes content specific to other back-ends.
  12549. @anchor{Org export commands}
  12550. @subheading Org export commands
  12551. @table @asis
  12552. @item @kbd{C-c C-e O o} (@code{org-org-export-to-org})
  12553. @kindex C-c C-e O o
  12554. @findex org-org-export-to-org
  12555. Export as an Org file with a @samp{.org} extension. For @samp{myfile.org},
  12556. Org exports to @samp{myfile.org.org}, overwriting without warning.
  12557. @item @kbd{C-c C-e O v} (~~)
  12558. @kindex C-c C-e O v
  12559. Export to an Org file, then open it.
  12560. @end table
  12561. @node Texinfo Export
  12562. @section Texinfo Export
  12563. @menu
  12564. * Texinfo export commands:: Invoking commands.
  12565. * Texinfo specific export settings:: Setting the environment.
  12566. * Texinfo file header:: Generating the header.
  12567. * Texinfo title and copyright page:: Creating preamble pages.
  12568. * Info directory file:: Installing a manual in Info file hierarchy.
  12569. * Headings and sectioning structure:: Building document structure.
  12570. * Indices:: Creating indices.
  12571. * Quoting Texinfo code:: Incorporating literal Texinfo code.
  12572. * Plain lists in Texinfo export:: List attributes.
  12573. * Tables in Texinfo export:: Table attributes.
  12574. * Images in Texinfo export:: Image attributes.
  12575. * Special blocks in Texinfo export:: Special block attributes.
  12576. * A Texinfo example:: Processing Org to Texinfo.
  12577. @end menu
  12578. @node Texinfo export commands
  12579. @subsection Texinfo export commands
  12580. @table @asis
  12581. @item @kbd{C-c C-e i t} (@code{org-texinfo-export-to-texinfo})
  12582. @kindex C-c C-e i t
  12583. @findex org-texinfo-export-to-texinfo
  12584. Export as a Texinfo file with @samp{.texi} extension. For
  12585. @samp{myfile.org}, Org exports to @samp{myfile.texi}, overwriting without
  12586. warning.
  12587. @item @kbd{C-c C-e i i} (@code{org-texinfo-export-to-info})
  12588. @kindex C-c C-e i i
  12589. @findex org-texinfo-export-to-info
  12590. @vindex org-texinfo-info-process
  12591. Export to Texinfo format first and then process it to make an
  12592. Info file. To generate other formats, such as DocBook, customize
  12593. the @code{org-texinfo-info-process} variable.
  12594. @end table
  12595. @node Texinfo specific export settings
  12596. @subsection Texinfo specific export settings
  12597. The Texinfo export back-end has several additional keywords for
  12598. customizing Texinfo output. Setting these keywords works similar to
  12599. the general options (see @ref{Export Settings}).
  12600. @table @asis
  12601. @item @samp{SUBTITLE}
  12602. @cindex @samp{SUBTITLE}, keyword
  12603. The document subtitle.
  12604. @item @samp{SUBAUTHOR}
  12605. @cindex @samp{SUBAUTHOR}, keyword
  12606. Additional authors for the document.
  12607. @item @samp{TEXINFO_FILENAME}
  12608. @cindex @samp{TEXINFO_FILENAME}, keyword
  12609. The Texinfo filename.
  12610. @item @samp{TEXINFO_CLASS}
  12611. @cindex @samp{TEXINFO_CLASS}, keyword
  12612. @vindex org-texinfo-default-class
  12613. The default document class (@code{org-texinfo-default-class}), which
  12614. must be a member of @code{org-texinfo-classes}.
  12615. @item @samp{TEXINFO_HEADER}
  12616. @cindex @samp{TEXINFO_HEADER}, keyword
  12617. Arbitrary lines inserted at the end of the header.
  12618. @item @samp{TEXINFO_POST_HEADER}
  12619. @cindex @samp{TEXINFO_POST_HEADER}, keyword
  12620. Arbitrary lines inserted after the end of the header.
  12621. @item @samp{TEXINFO_DIR_CATEGORY}
  12622. @cindex @samp{TEXINFO_DIR_CATEGORY}, keyword
  12623. The directory category of the document.
  12624. @item @samp{TEXINFO_DIR_TITLE}
  12625. @cindex @samp{TEXINFO_DIR_TITLE}, keyword
  12626. The directory title of the document.
  12627. @item @samp{TEXINFO_DIR_DESC}
  12628. @cindex @samp{TEXINFO_DIR_DESC}, keyword
  12629. The directory description of the document.
  12630. @item @samp{TEXINFO_PRINTED_TITLE}
  12631. @cindex @samp{TEXINFO_PRINTED_TITLE}, keyword
  12632. The printed title of the document.
  12633. @end table
  12634. @node Texinfo file header
  12635. @subsection Texinfo file header
  12636. @cindex @samp{TEXINFO_FILENAME}, keyword
  12637. After creating the header for a Texinfo file, the Texinfo back-end
  12638. automatically generates a name and destination path for the Info file.
  12639. To override this default with a more sensible path and name, specify
  12640. the @samp{TEXINFO_FILENAME} keyword.
  12641. @vindex org-texinfo-coding-system
  12642. @cindex @samp{TEXINFO_HEADER}, keyword
  12643. Along with the output's file name, the Texinfo header also contains
  12644. language details (see @ref{Export Settings}) and encoding system as set in
  12645. the @code{org-texinfo-coding-system} variable. Insert @samp{TEXINFO_HEADER}
  12646. keywords for each additional command in the header, for example:
  12647. @example
  12648. #+TEXINFO_HEADER: @@synindex
  12649. @end example
  12650. @cindex @samp{TEXINFO_CLASS}, keyword
  12651. @vindex org-texinfo-classes
  12652. Instead of repeatedly installing the same set of commands, define
  12653. a class in @code{org-texinfo-classes} once, and then activate it in the
  12654. document by setting the @samp{TEXINFO_CLASS} keyword to that class.
  12655. @node Texinfo title and copyright page
  12656. @subsection Texinfo title and copyright page
  12657. @cindex @samp{TEXINFO_PRINTED_TITLE}, keyword
  12658. The default template for hard copy output has a title page with
  12659. @samp{TITLE} and @samp{AUTHOR} keywords (see @ref{Export Settings}). To replace the
  12660. regular title with something different for the printed version, use
  12661. the @samp{TEXINFO_PRINTED_TITLE} and @samp{SUBTITLE} keywords. Both expect raw
  12662. Texinfo code for setting their values.
  12663. @cindex @samp{SUBAUTHOR}, keyword
  12664. If one @samp{AUTHOR} line is not sufficient, add multiple @samp{SUBAUTHOR}
  12665. keywords. They have to be set in raw Texinfo code.
  12666. @example
  12667. #+AUTHOR: Jane Smith
  12668. #+SUBAUTHOR: John Doe
  12669. #+TEXINFO_PRINTED_TITLE: This Long Title@@@@inlinefmt@{tex,@@*@} Is Broken in @@TeX@{@}
  12670. @end example
  12671. @cindex @samp{COPYING}, property
  12672. Copying material is defined in a dedicated headline with a non-@code{nil}
  12673. @samp{COPYING} property. The back-end inserts the contents within
  12674. a @samp{@@copying} command at the beginning of the document. The heading
  12675. itself does not appear in the structure of the document.
  12676. Copyright information is printed on the back of the title page.
  12677. @example
  12678. * Legalese
  12679. :PROPERTIES:
  12680. :COPYING: t
  12681. :END:
  12682. This is a short example of a complete Texinfo file, version 1.0.
  12683. Copyright \copy 2016 Free Software Foundation, Inc.
  12684. @end example
  12685. @node Info directory file
  12686. @subsection Info directory file
  12687. @cindex @samp{dir} file, in Texinfo export
  12688. @cindex Info directory file, in Texinfo export
  12689. @cindex @code{install-info}, in Texinfo export
  12690. @cindex @samp{TEXINFO_DIR_CATEGORY}, keyword
  12691. @cindex @samp{TEXINFO_DIR_TITLE}, keyword
  12692. @cindex @samp{TEXINFO_DIR_DESC}, keyword
  12693. The end result of the Texinfo export process is the creation of an
  12694. Info file. This Info file's metadata has variables for category,
  12695. title, and description: @samp{TEXINFO_DIR_CATEGORY}, @samp{TEXINFO_DIR_TITLE},
  12696. and @samp{TEXINFO_DIR_DESC} keywords that establish where in the Info
  12697. hierarchy the file fits.
  12698. Here is an example that writes to the Info directory file:
  12699. @example
  12700. #+TEXINFO_DIR_CATEGORY: Emacs
  12701. #+TEXINFO_DIR_TITLE: Org Mode: (org)
  12702. #+TEXINFO_DIR_DESC: Outline-based notes management and organizer
  12703. @end example
  12704. @node Headings and sectioning structure
  12705. @subsection Headings and sectioning structure
  12706. @vindex org-texinfo-classes
  12707. @vindex org-texinfo-default-class
  12708. @cindex @samp{TEXINFO_CLASS}, keyword
  12709. The Texinfo export back-end uses a pre-defined scheme to convert Org
  12710. headlines to equivalent Texinfo structuring commands. A scheme like
  12711. this maps top-level headlines to numbered chapters tagged as
  12712. @code{@@chapter} and lower-level headlines to unnumbered chapters tagged as
  12713. @code{@@unnumbered}. To override such mappings to introduce @code{@@part} or
  12714. other Texinfo structuring commands, define a new class in
  12715. @code{org-texinfo-classes}. Activate the new class with the
  12716. @samp{TEXINFO_CLASS} keyword. When no new class is defined and activated,
  12717. the Texinfo export back-end defaults to the
  12718. @code{org-texinfo-default-class}.
  12719. If an Org headline's level has no associated Texinfo structuring
  12720. command, or is below a certain threshold (see @ref{Export Settings}), then
  12721. the Texinfo export back-end makes it into a list item.
  12722. @cindex @samp{APPENDIX}, property
  12723. The Texinfo export back-end makes any headline with a non-@code{nil}
  12724. @samp{APPENDIX} property into an appendix. This happens independent of the
  12725. Org headline level or the @samp{TEXINFO_CLASS} keyword.
  12726. @cindex @samp{ALT_TITLE}, property
  12727. @cindex @samp{DESCRIPTION}, property
  12728. The Texinfo export back-end creates a menu entry after the Org
  12729. headline for each regular sectioning structure. To override this with
  12730. 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
  12731. @samp{DESCRIPTION} property. Here's an example that uses both to override
  12732. the default menu entry:
  12733. @example
  12734. * Controlling Screen Display
  12735. :PROPERTIES:
  12736. :ALT_TITLE: Display
  12737. :DESCRIPTION: Controlling Screen Display
  12738. :END:
  12739. @end example
  12740. @cindex Top node, in Texinfo export
  12741. The text before the first headline belongs to the @emph{Top} node, i.e.,
  12742. the node in which a reader enters an Info manual. As such, it is
  12743. expected not to appear in printed output generated from the @samp{.texi}
  12744. file. See @ref{The Top Node,,,texinfo,}, for more information.
  12745. @node Indices
  12746. @subsection Indices
  12747. @cindex @samp{CINDEX}, keyword
  12748. @cindex concept index, in Texinfo export
  12749. @cindex @samp{FINDEX}, keyword
  12750. @cindex function index, in Texinfo export
  12751. @cindex @samp{KINDEX}, keyword
  12752. @cindex keystroke index, in Texinfo export
  12753. @cindex @samp{PINDEX}, keyword
  12754. @cindex program index, in Texinfo export
  12755. @cindex @samp{TINDEX}, keyword
  12756. @cindex data type index, in Texinfo export
  12757. @cindex @samp{VINDEX}, keyword
  12758. @cindex variable index, in Texinfo export
  12759. The Texinfo export back-end recognizes these indexing keywords if used
  12760. in the Org file: @samp{CINDEX}, @samp{FINDEX}, @samp{KINDEX}, @samp{PINDEX}, @samp{TINDEX} and
  12761. @samp{VINDEX}. Write their value as verbatim Texinfo code; in particular,
  12762. @samp{@{}, @samp{@}} and @samp{@@} characters need to be escaped with @samp{@@} if they do not
  12763. belong to a Texinfo command.
  12764. @example
  12765. #+CINDEX: Defining indexing entries
  12766. @end example
  12767. @cindex @samp{INDEX}, property
  12768. For the back-end to generate an index entry for a headline, set the
  12769. @samp{INDEX} property to @samp{cp} or @samp{vr}. These abbreviations come from
  12770. Texinfo that stand for concept index and variable index. The Texinfo
  12771. manual has abbreviations for all other kinds of indexes. The back-end
  12772. exports the headline as an unnumbered chapter or section command, and
  12773. then inserts the index after its contents.
  12774. @example
  12775. * Concept Index
  12776. :PROPERTIES:
  12777. :INDEX: cp
  12778. :END:
  12779. @end example
  12780. @node Quoting Texinfo code
  12781. @subsection Quoting Texinfo code
  12782. Use any of the following three methods to insert or escape raw Texinfo
  12783. code:
  12784. @cindex @samp{TEXINFO}, keyword
  12785. @cindex @samp{BEGIN_EXPORT texinfo}
  12786. @example
  12787. Richard @@@@texinfo:@@sc@{@@@@Stallman@@@@texinfo:@}@@@@ commence' GNU.
  12788. #+TEXINFO: @@need800
  12789. This paragraph is preceded by...
  12790. #+BEGIN_EXPORT texinfo
  12791. @@auindex Johnson, Mark
  12792. @@auindex Lakoff, George
  12793. #+END_EXPORT
  12794. @end example
  12795. @node Plain lists in Texinfo export
  12796. @subsection Plain lists in Texinfo export
  12797. @cindex @samp{ATTR_TEXINFO}, keyword
  12798. @cindex two-column tables, in Texinfo export
  12799. @cindex table types, in Texinfo export
  12800. The Texinfo export back-end by default converts description lists in
  12801. the Org file using the default command @samp{@@table}, which results in
  12802. a table with two columns. To change this behavior, specify
  12803. @samp{:table-type} with @samp{ftable} or @samp{vtable} attributes. For more
  12804. information, see @ref{Two-column Tables,,,texinfo,}.
  12805. @vindex org-texinfo-table-default-markup
  12806. The Texinfo export back-end by default also applies a text highlight
  12807. based on the defaults stored in @code{org-texinfo-table-default-markup}.
  12808. To override the default highlight command, specify another one with
  12809. the @samp{:indic} attribute.
  12810. @cindex multiple items in Texinfo lists
  12811. Org syntax is limited to one entry per list item. Nevertheless, the
  12812. Texinfo export back-end can split that entry according to any text
  12813. provided through the @samp{:sep} attribute. Each part then becomes a new
  12814. entry in the first column of the table.
  12815. The following example illustrates all the attributes above:
  12816. @example
  12817. #+ATTR_TEXINFO: :table-type vtable :sep , :indic asis
  12818. - foo, bar :: This is the common text for variables foo and bar.
  12819. @end example
  12820. @noindent
  12821. becomes
  12822. @example
  12823. @@vtable @@asis
  12824. @@item foo
  12825. @@itemx bar
  12826. This is the common text for variables foo and bar.
  12827. @@end table
  12828. @end example
  12829. @node Tables in Texinfo export
  12830. @subsection Tables in Texinfo export
  12831. @cindex @samp{ATTR_TEXINFO}, keyword
  12832. When exporting tables, the Texinfo export back-end uses the widest
  12833. cell width in each column. To override this and instead specify as
  12834. fractions of line length, use the @samp{:columns} attribute. See example
  12835. below.
  12836. @example
  12837. #+ATTR_TEXINFO: :columns .5 .5
  12838. | a cell | another cell |
  12839. @end example
  12840. @node Images in Texinfo export
  12841. @subsection Images in Texinfo export
  12842. @cindex @samp{ATTR_TEXINFO}, keyword
  12843. Insert a file link to the image in the Org file, and the Texinfo
  12844. export back-end inserts the image. These links must have the usual
  12845. supported image extensions and no descriptions. To scale the image,
  12846. use @samp{:width} and @samp{:height} attributes. For alternate text, use @samp{:alt}
  12847. and specify the text using Texinfo code, as shown in the example:
  12848. @example
  12849. #+ATTR_TEXINFO: :width 1in :alt Alternate @@i@{text@}
  12850. [[ridt.pdf]]
  12851. @end example
  12852. @node Special blocks in Texinfo export
  12853. @subsection Special blocks in Texinfo export
  12854. @cindex @samp{ATTR_TEXINFO}, keyword
  12855. The Texinfo export back-end converts special blocks to commands with
  12856. the same name. It also adds any @samp{:options} attributes to the end of
  12857. the command, as shown in this example:
  12858. @example
  12859. #+ATTR_TEXINFO: :options org-org-export-to-org ...
  12860. #+BEGIN_defun
  12861. A somewhat obsessive function name.
  12862. #+END_defun
  12863. @end example
  12864. @noindent
  12865. becomes
  12866. @example
  12867. @@defun org-org-export-to-org ...
  12868. A somewhat obsessive function name.
  12869. @@end defun
  12870. @end example
  12871. @node A Texinfo example
  12872. @subsection A Texinfo example
  12873. Here is a more detailed example Org file. See
  12874. @ref{GNU Sample Texts,,,texinfo,} for an equivalent example using
  12875. Texinfo code.
  12876. @example
  12877. #+TITLE: GNU Sample @{@{@{version@}@}@}
  12878. #+SUBTITLE: for version @{@{@{version@}@}@}, @{@{@{updated@}@}@}
  12879. #+AUTHOR: A.U. Thor
  12880. #+EMAIL: bug-sample@@gnu.org
  12881. #+OPTIONS: ':t toc:t author:t email:t
  12882. #+LANGUAGE: en
  12883. #+MACRO: version 2.0
  12884. #+MACRO: updated last updated 4 March 2014
  12885. #+TEXINFO_FILENAME: sample.info
  12886. #+TEXINFO_HEADER: @@syncodeindex pg cp
  12887. #+TEXINFO_DIR_CATEGORY: Texinfo documentation system
  12888. #+TEXINFO_DIR_TITLE: sample: (sample)
  12889. #+TEXINFO_DIR_DESC: Invoking sample
  12890. #+TEXINFO_PRINTED_TITLE: GNU Sample
  12891. This manual is for GNU Sample (version @{@{@{version@}@}@},
  12892. @{@{@{updated@}@}@}).
  12893. * Copying
  12894. :PROPERTIES:
  12895. :COPYING: t
  12896. :END:
  12897. This manual is for GNU Sample (version @{@{@{version@}@}@},
  12898. @{@{@{updated@}@}@}), which is an example in the Texinfo documentation.
  12899. Copyright \copy 2016 Free Software Foundation, Inc.
  12900. #+BEGIN_QUOTE
  12901. Permission is granted to copy, distribute and/or modify this
  12902. document under the terms of the GNU Free Documentation License,
  12903. Version 1.3 or any later version published by the Free Software
  12904. Foundation; with no Invariant Sections, with no Front-Cover Texts,
  12905. and with no Back-Cover Texts. A copy of the license is included in
  12906. the section entitled "GNU Free Documentation License".
  12907. #+END_QUOTE
  12908. * Invoking sample
  12909. #+PINDEX: sample
  12910. #+CINDEX: invoking @@command@{sample@}
  12911. This is a sample manual. There is no sample program to invoke, but
  12912. if there were, you could see its basic usage and command line
  12913. options here.
  12914. * GNU Free Documentation License
  12915. :PROPERTIES:
  12916. :APPENDIX: t
  12917. :END:
  12918. #+TEXINFO: @@include fdl.texi
  12919. * Index
  12920. :PROPERTIES:
  12921. :INDEX: cp
  12922. :END:
  12923. @end example
  12924. @node iCalendar Export
  12925. @section iCalendar Export
  12926. @cindex iCalendar export
  12927. A large part of Org mode's interoperability success is its ability to
  12928. easily export to or import from external applications. The iCalendar
  12929. export back-end takes calendar data from Org files and exports to the
  12930. standard iCalendar format.
  12931. @vindex org-icalendar-include-todo
  12932. @vindex org-icalendar-use-deadline
  12933. @vindex org-icalendar-use-scheduled
  12934. The iCalendar export back-end can also incorporate TODO entries based
  12935. on the configuration of the @code{org-icalendar-include-todo} variable.
  12936. The back-end exports plain timestamps as @samp{VEVENT}, TODO items as
  12937. @samp{VTODO}, and also create events from deadlines that are in non-TODO
  12938. items. The back-end uses the deadlines and scheduling dates in Org
  12939. TODO items for setting the start and due dates for the iCalendar TODO
  12940. entry. Consult the @code{org-icalendar-use-deadline} and
  12941. @code{org-icalendar-use-scheduled} variables for more details.
  12942. @vindex org-icalendar-categories
  12943. @vindex org-icalendar-alarm-time
  12944. For tags on the headline, the iCalendar export back-end makes them
  12945. into iCalendar categories. To tweak the inheritance of tags and TODO
  12946. states, configure the variable @code{org-icalendar-categories}. To assign
  12947. clock alarms based on time, configure the @code{org-icalendar-alarm-time}
  12948. variable.
  12949. @vindex org-icalendar-store-UID
  12950. @cindex @samp{ID}, property
  12951. The iCalendar format standard requires globally unique identifier---or
  12952. UID---for each entry. The iCalendar export back-end creates UIDs
  12953. during export. To save a copy of the UID in the Org file set the
  12954. variable @code{org-icalendar-store-UID}. The back-end looks for the @samp{ID}
  12955. property of the entry for re-using the same UID for subsequent
  12956. exports.
  12957. Since a single Org entry can result in multiple iCalendar
  12958. entries---timestamp, deadline, scheduled item, or TODO item---Org adds
  12959. prefixes to the UID, depending on which part of the Org entry
  12960. triggered the creation of the iCalendar entry. Prefixing ensures UIDs
  12961. remains unique, yet enable synchronization programs trace the
  12962. connections.
  12963. @table @asis
  12964. @item @kbd{C-c C-e c f} (@code{org-icalendar-export-to-ics})
  12965. @kindex C-c C-e c f
  12966. @findex org-icalendar-export-to-ics
  12967. Create iCalendar entries from the current Org buffer and store
  12968. them in the same directory, using a file extension @samp{.ics}.
  12969. @item @kbd{C-c C-e c a} (@code{org-icalendar-export-agenda-files})
  12970. @kindex C-c C-e c a
  12971. @findex org-icalendar-export-agenda-files
  12972. Create iCalendar entries from Org files in @code{org-agenda-files} and
  12973. store in a separate iCalendar file for each Org file.
  12974. @item @kbd{C-c C-e c c} (@code{org-icalendar-combine-agenda-files})
  12975. @kindex C-c C-e c c
  12976. @findex org-icalendar-combine-agenda-files
  12977. @vindex org-icalendar-combined-agenda-file
  12978. Create a combined iCalendar file from Org files in
  12979. @code{org-agenda-files} and write it to
  12980. @code{org-icalendar-combined-agenda-file} file name.
  12981. @end table
  12982. @cindex @samp{SUMMARY}, property
  12983. @cindex @samp{DESCRIPTION}, property
  12984. @cindex @samp{LOCATION}, property
  12985. @cindex @samp{TIMEZONE}, property
  12986. The iCalendar export back-end includes @samp{SUMMARY}, @samp{DESCRIPTION},
  12987. @samp{LOCATION} and @samp{TIMEZONE} properties from the Org entries when
  12988. exporting. To force the back-end to inherit the @samp{LOCATION} and
  12989. @samp{TIMEZONE} properties, configure the @code{org-use-property-inheritance}
  12990. variable.
  12991. @vindex org-icalendar-include-body
  12992. When Org entries do not have @samp{SUMMARY}, @samp{DESCRIPTION} and @samp{LOCATION}
  12993. properties, the iCalendar export back-end derives the summary from the
  12994. headline, and derives the description from the body of the Org item.
  12995. The @code{org-icalendar-include-body} variable limits the maximum number of
  12996. characters of the content are turned into its description.
  12997. The @samp{TIMEZONE} property can be used to specify a per-entry time zone,
  12998. and is applied to any entry with timestamp information. Time zones
  12999. should be specified as per the IANA time zone database format, e.g.,
  13000. @samp{Asia/Almaty}. Alternately, the property value can be @samp{UTC}, to force
  13001. UTC time for this entry only.
  13002. Exporting to iCalendar format depends in large part on the
  13003. capabilities of the destination application. Some are more lenient
  13004. than others. Consult the Org mode FAQ for advice on specific
  13005. applications.
  13006. @node Other Built-in Back-ends
  13007. @section Other Built-in Back-ends
  13008. Other export back-ends included with Org are:
  13009. @itemize
  13010. @item
  13011. @samp{ox-man.el}: Export to a man page.
  13012. @end itemize
  13013. To activate such back-ends, either customize @code{org-export-backends} or
  13014. load directly with @code{(require 'ox-man)}. On successful load, the
  13015. back-end adds new keys in the export dispatcher (see @ref{The Export Dispatcher}).
  13016. Follow the comment section of such files, for example, @samp{ox-man.el},
  13017. for usage and configuration details.
  13018. @node Advanced Configuration
  13019. @section Advanced Configuration
  13020. @anchor{Hooks}
  13021. @subheading Hooks
  13022. @vindex org-export-before-processing-hook
  13023. @vindex org-export-before-parsing-hook
  13024. The export process executes two hooks before the actual exporting
  13025. begins. The first hook, @code{org-export-before-processing-hook}, runs
  13026. before any expansions of macros, Babel code, and include keywords in
  13027. the buffer. The second hook, @code{org-export-before-parsing-hook}, runs
  13028. before the buffer is parsed.
  13029. Functions added to these hooks are called with a single argument: the
  13030. export back-end actually used, as a symbol. You may use them for
  13031. heavy duty structural modifications of the document. For example, you
  13032. can remove every headline in the buffer during export like this:
  13033. @lisp
  13034. (defun my-headline-removal (backend)
  13035. "Remove all headlines in the current buffer.
  13036. BACKEND is the export back-end being used, as a symbol."
  13037. (org-map-entries
  13038. (lambda () (delete-region (point) (line-beginning-position 2)))))
  13039. (add-hook 'org-export-before-parsing-hook 'my-headline-removal)
  13040. @end lisp
  13041. @anchor{Filters}
  13042. @subheading Filters
  13043. @cindex Filters, exporting
  13044. Filters are lists of functions to be applied to certain parts for
  13045. a given back-end. The output from the first function in the filter is
  13046. passed on to the next function in the filter. The final output is the
  13047. output from the final function in the filter.
  13048. The Org export process has many filter sets applicable to different
  13049. types of objects, plain text, parse trees, export options, and final
  13050. output formats. The filters are named after the element type or
  13051. object type: @code{org-export-filter-TYPE-functions}, where @var{TYPE}
  13052. is the type targeted by the filter. Valid types are:
  13053. @multitable @columnfractions 0.33 0.33 0.33
  13054. @item body
  13055. @tab bold
  13056. @tab babel-call
  13057. @item center-block
  13058. @tab clock
  13059. @tab code
  13060. @item diary-sexp
  13061. @tab drawer
  13062. @tab dynamic-block
  13063. @item entity
  13064. @tab example-block
  13065. @tab export-block
  13066. @item export-snippet
  13067. @tab final-output
  13068. @tab fixed-width
  13069. @item footnote-definition
  13070. @tab footnote-reference
  13071. @tab headline
  13072. @item horizontal-rule
  13073. @tab inline-babel-call
  13074. @tab inline-src-block
  13075. @item inlinetask
  13076. @tab italic
  13077. @tab item
  13078. @item keyword
  13079. @tab latex-environment
  13080. @tab latex-fragment
  13081. @item line-break
  13082. @tab link
  13083. @tab node-property
  13084. @item options
  13085. @tab paragraph
  13086. @tab parse-tree
  13087. @item plain-list
  13088. @tab plain-text
  13089. @tab planning
  13090. @item property-drawer
  13091. @tab quote-block
  13092. @tab radio-target
  13093. @item section
  13094. @tab special-block
  13095. @tab src-block
  13096. @item statistics-cookie
  13097. @tab strike-through
  13098. @tab subscript
  13099. @item superscript
  13100. @tab table
  13101. @tab table-cell
  13102. @item table-row
  13103. @tab target
  13104. @tab timestamp
  13105. @item underline
  13106. @tab verbatim
  13107. @tab verse-block
  13108. @end multitable
  13109. Here is an example filter that replaces non-breaking spaces @code{ } in the
  13110. Org buffer with @samp{~} for the @LaTeX{} back-end.
  13111. @lisp
  13112. (defun my-latex-filter-nobreaks (text backend info)
  13113. "Ensure \" \" are properly handled in LaTeX export."
  13114. (when (org-export-derived-backend-p backend 'latex)
  13115. (replace-regexp-in-string " " "~" text)))
  13116. (add-to-list 'org-export-filter-plain-text-functions
  13117. 'my-latex-filter-nobreaks)
  13118. @end lisp
  13119. A filter requires three arguments: the code to be transformed, the
  13120. name of the back-end, and some optional information about the export
  13121. process. The third argument can be safely ignored. Note the use of
  13122. @code{org-export-derived-backend-p} predicate that tests for @emph{latex}
  13123. back-end or any other back-end, such as @emph{beamer}, derived from
  13124. @emph{latex}.
  13125. @anchor{Defining filters for individual files}
  13126. @subheading Defining filters for individual files
  13127. The Org export can filter not just for back-ends, but also for
  13128. specific files through the @samp{BIND} keyword. Here is an example with
  13129. two filters; one removes brackets from time stamps, and the other
  13130. removes strike-through text. The filter functions are defined in
  13131. a code block in the same Org file, which is a handy location for
  13132. debugging.
  13133. @example
  13134. #+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
  13135. #+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
  13136. #+BEGIN_SRC emacs-lisp :exports results :results none
  13137. (defun tmp-f-timestamp (s backend info)
  13138. (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
  13139. (defun tmp-f-strike-through (s backend info) "")
  13140. #+END_SRC
  13141. @end example
  13142. @anchor{Extending an existing back-end}
  13143. @subheading Extending an existing back-end
  13144. Some parts of the conversion process can be extended for certain
  13145. elements so as to introduce a new or revised translation. That is how
  13146. the HTML export back-end was extended to handle Markdown format. The
  13147. extensions work seamlessly so any aspect of filtering not done by the
  13148. extended back-end is handled by the original back-end. Of all the
  13149. export customization in Org, extending is very powerful as it operates
  13150. at the parser level.
  13151. For this example, make the @emph{ascii} back-end display the language used
  13152. in a source code block. Also make it display only when some attribute
  13153. is non-@code{nil}, like the following:
  13154. @example
  13155. #+ATTR_ASCII: :language t
  13156. @end example
  13157. Then extend ASCII back-end with a custom ``my-ascii'' back-end.
  13158. @lisp
  13159. (defun my-ascii-src-block (src-block contents info)
  13160. "Transcode a SRC-BLOCK element from Org to ASCII.
  13161. CONTENTS is nil. INFO is a plist used as a communication
  13162. channel."
  13163. (if (not (org-export-read-attribute :attr_ascii src-block :language))
  13164. (org-export-with-backend 'ascii src-block contents info)
  13165. (concat
  13166. (format ",--[ %s ]--\n%s`----"
  13167. (org-element-property :language src-block)
  13168. (replace-regexp-in-string
  13169. "^" "| "
  13170. (org-element-normalize-string
  13171. (org-export-format-code-default src-block info)))))))
  13172. (org-export-define-derived-backend 'my-ascii 'ascii
  13173. :translate-alist '((src-block . my-ascii-src-block)))
  13174. @end lisp
  13175. The @code{my-ascii-src-block} function looks at the attribute above the
  13176. current element. If not true, hands over to @emph{ascii} back-end. If
  13177. true, which it is in this example, it creates a box around the code
  13178. and leaves room for the inserting a string for language. The last
  13179. form creates the new back-end that springs to action only when
  13180. translating @code{src-block} type elements.
  13181. To use the newly defined back-end, evaluate the following from an Org
  13182. buffer:
  13183. @lisp
  13184. (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*")
  13185. @end lisp
  13186. Further steps to consider would be an interactive function,
  13187. self-installing an item in the export dispatcher menu, and other
  13188. user-friendly improvements.
  13189. @node Export in Foreign Buffers
  13190. @section Export in Foreign Buffers
  13191. The export back-ends in Org often include commands to convert selected
  13192. regions. A convenient feature of this in-place conversion is that the
  13193. exported output replaces the original source. Here are such
  13194. functions:
  13195. @table @asis
  13196. @item @code{org-html-convert-region-to-html}
  13197. @findex org-html-convert-region-to-html
  13198. Convert the selected region into HTML.
  13199. @item @code{org-latex-convert-region-to-latex}
  13200. @findex org-latex-convert-region-to-latex
  13201. Convert the selected region into @LaTeX{}.
  13202. @item @code{org-texinfo-convert-region-to-texinfo}
  13203. @findex org-texinfo-convert-region-to-texinfo
  13204. Convert the selected region into Texinfo.
  13205. @item @code{org-md-convert-region-to-md}
  13206. @findex org-md-convert-region-to-md
  13207. Convert the selected region into Markdown.
  13208. @end table
  13209. In-place conversions are particularly handy for quick conversion of
  13210. tables and lists in foreign buffers. For example, turn on the minor
  13211. mode @kbd{M-x orgstruct-mode} in an HTML buffer, then use the
  13212. convenient Org keyboard commands to create a list, select it, and
  13213. covert it to HTML with @kbd{M-x org-html-convert-region-to-html}.
  13214. @node Publishing
  13215. @chapter Publishing
  13216. @cindex publishing
  13217. Org includes a publishing management system that allows you to
  13218. configure automatic HTML conversion of @emph{projects} composed of
  13219. interlinked Org files. You can also configure Org to automatically
  13220. upload your exported HTML pages and related attachments, such as
  13221. images and source code files, to a web server.
  13222. You can also use Org to convert files into PDF, or even combine HTML
  13223. and PDF conversion so that files are available in both formats on the
  13224. server.
  13225. Publishing has been contributed to Org by David O'Toole.
  13226. @menu
  13227. * Configuration:: Defining projects.
  13228. * Uploading Files:: How to get files up on the server.
  13229. * Sample Configuration:: Example projects.
  13230. * Triggering Publication:: Publication commands.
  13231. @end menu
  13232. @node Configuration
  13233. @section Configuration
  13234. Publishing needs significant configuration to specify files,
  13235. destination and many other properties of a project.
  13236. @menu
  13237. * Project alist:: The central configuration variable.
  13238. * Sources and destinations:: From here to there.
  13239. * Selecting files:: What files are part of the project?
  13240. * Publishing action:: Setting the function doing the publishing.
  13241. * Publishing options:: Tweaking HTML/@LaTeX{} export.
  13242. * Publishing links:: Which links keep working after publishing?
  13243. * Site map:: Generating a list of all pages.
  13244. * Generating an index:: An index that reaches across pages.
  13245. @end menu
  13246. @node Project alist
  13247. @subsection The variable @code{org-publish-project-alist}
  13248. @cindex projects, for publishing
  13249. @vindex org-publish-project-alist
  13250. Publishing is configured almost entirely through setting the value of
  13251. one variable, called @code{org-publish-project-alist}. Each element of the
  13252. list configures one project, and may be in one of the two following
  13253. forms:
  13254. @lisp
  13255. ("project-name" :property value :property value ...)
  13256. @end lisp
  13257. @noindent
  13258. i.e., a well-formed property list with alternating keys and values,
  13259. or:
  13260. @lisp
  13261. ("project-name" :components ("project-name" "project-name" ...))
  13262. @end lisp
  13263. In both cases, projects are configured by specifying property values.
  13264. A project defines the set of files that are to be published, as well
  13265. as the publishing configuration to use when publishing those files.
  13266. When a project takes the second form listed above, the individual
  13267. members of the @code{:components} property are taken to be sub-projects,
  13268. which group together files requiring different publishing options.
  13269. When you publish such a ``meta-project'', all the components are also
  13270. published, in the sequence given.
  13271. @node Sources and destinations
  13272. @subsection Sources and destinations for files
  13273. @cindex directories, for publishing
  13274. Most properties are optional, but some should always be set. In
  13275. particular, Org needs to know where to look for source files, and
  13276. where to put published files.
  13277. @table @asis
  13278. @item @code{:base-directory}
  13279. Directory containing publishing source files.
  13280. @item @code{:publishing-directory}
  13281. Directory where output files are published. You can directly
  13282. publish to a webserver using a file name syntax appropriate for
  13283. the Emacs tramp package. Or you can publish to a local directory
  13284. and use external tools to upload your website (see @ref{Uploading Files}).
  13285. @item @code{:preparation-function}
  13286. Function or list of functions to be called before starting the
  13287. publishing process, for example, to run @samp{make} for updating files
  13288. to be published. Each preparation function is called with
  13289. a single argument, the project property list.
  13290. @item @code{:completion-function}
  13291. Function or list of functions called after finishing the
  13292. publishing process, for example, to change permissions of the
  13293. resulting files. Each completion function is called with
  13294. a single argument, the project property list.
  13295. @end table
  13296. @node Selecting files
  13297. @subsection Selecting files
  13298. @cindex files, selecting for publishing
  13299. By default, all files with extension @samp{.org} in the base directory are
  13300. considered part of the project. This can be modified by setting the
  13301. following properties
  13302. @table @asis
  13303. @item @code{:base-extension}
  13304. Extension---without the dot---of source files. This actually
  13305. is a regular expression. Set this to the symbol @code{any} if you
  13306. want to get all files in @code{:base-directory}, even without
  13307. extension.
  13308. @item @code{:exclude}
  13309. Regular expression to match file names that should not be published,
  13310. even though they have been selected on the basis of their extension.
  13311. @item @code{:include}
  13312. List of files to be included regardless of @code{:base-extension} and
  13313. @code{:exclude}.
  13314. @item @code{:recursive}
  13315. Non-@code{nil} means, check base-directory recursively for files to
  13316. publish.
  13317. @end table
  13318. @node Publishing action
  13319. @subsection Publishing action
  13320. @cindex action, for publishing
  13321. Publishing means that a file is copied to the destination directory
  13322. and possibly transformed in the process. The default transformation
  13323. is to export Org files as HTML files, and this is done by the function
  13324. @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
  13325. @code{org-publish-org-to-pdf}, or as ASCII, Texinfo, etc., using the
  13326. corresponding functions.
  13327. If you want to publish the Org file as an @samp{.org} file but with
  13328. @emph{archived}, @emph{commented}, and @emph{tag-excluded} trees removed, use
  13329. @code{org-publish-org-to-org}. This produces @samp{file.org} and put it in the
  13330. publishing directory. If you want a htmlized version of this file,
  13331. set the parameter @code{:htmlized-source} to @code{t}. It produces
  13332. @samp{file.org.html} in the publishing directory@footnote{If the publishing directory is the same as the source
  13333. directory, @samp{file.org} is exported as @samp{file.org.org}, so you probably
  13334. do not want to do this.}.
  13335. Other files like images only need to be copied to the publishing
  13336. destination; for this you can use @code{org-publish-attachment}. For
  13337. non-Org files, you always need to specify the publishing function:
  13338. @table @asis
  13339. @item @code{:publishing-function}
  13340. Function executing the publication of a file. This may also be
  13341. a list of functions, which are all called in turn.
  13342. @item @code{:plain-source}
  13343. Non-@code{nil} means, publish plain source.
  13344. @item @code{:htmlized-source}
  13345. Non-@code{nil} means, publish htmlized source.
  13346. @end table
  13347. The function must accept three arguments: a property list containing
  13348. at least a @code{:publishing-directory} property, the name of the file to
  13349. be published, and the path to the publishing directory of the output
  13350. file. It should take the specified file, make the necessary
  13351. transformation, if any, and place the result into the destination
  13352. folder.
  13353. @node Publishing options
  13354. @subsection Options for the exporters
  13355. @cindex options, for publishing
  13356. @cindex publishing options
  13357. The property list can be used to set many export options for the HTML
  13358. and @LaTeX{} exporters. In most cases, these properties correspond to
  13359. user variables in Org. The table below lists these properties along
  13360. with the variable they belong to. See the documentation string for
  13361. the respective variable for details.
  13362. @vindex org-publish-project-alist
  13363. When a property is given a value in @code{org-publish-project-alist}, its
  13364. setting overrides the value of the corresponding user variable, if
  13365. any, during publishing. Options set within a file (see @ref{Export Settings}), however, override everything.
  13366. @anchor{Generic properties}
  13367. @subsubheading Generic properties
  13368. @multitable {aaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13369. @item @code{:archived-trees}
  13370. @tab @code{org-export-with-archived-trees}
  13371. @item @code{:exclude-tags}
  13372. @tab @code{org-export-exclude-tags}
  13373. @item @code{:headline-levels}
  13374. @tab @code{org-export-headline-levels}
  13375. @item @code{:language}
  13376. @tab @code{org-export-default-language}
  13377. @item @code{:preserve-breaks}
  13378. @tab @code{org-export-preserve-breaks}
  13379. @item @code{:section-numbers}
  13380. @tab @code{org-export-with-section-numbers}
  13381. @item @code{:select-tags}
  13382. @tab @code{org-export-select-tags}
  13383. @item @code{:with-author}
  13384. @tab @code{org-export-with-author}
  13385. @item @code{:with-broken-links}
  13386. @tab @code{org-export-with-broken-links}
  13387. @item @code{:with-clocks}
  13388. @tab @code{org-export-with-clocks}
  13389. @item @code{:with-creator}
  13390. @tab @code{org-export-with-creator}
  13391. @item @code{:with-date}
  13392. @tab @code{org-export-with-date}
  13393. @item @code{:with-drawers}
  13394. @tab @code{org-export-with-drawers}
  13395. @item @code{:with-email}
  13396. @tab @code{org-export-with-email}
  13397. @item @code{:with-emphasize}
  13398. @tab @code{org-export-with-emphasize}
  13399. @item @code{:with-fixed-width}
  13400. @tab @code{org-export-with-fixed-width}
  13401. @item @code{:with-footnotes}
  13402. @tab @code{org-export-with-footnotes}
  13403. @item @code{:with-latex}
  13404. @tab @code{org-export-with-latex}
  13405. @item @code{:with-planning}
  13406. @tab @code{org-export-with-planning}
  13407. @item @code{:with-priority}
  13408. @tab @code{org-export-with-priority}
  13409. @item @code{:with-properties}
  13410. @tab @code{org-export-with-properties}
  13411. @item @code{:with-special-strings}
  13412. @tab @code{org-export-with-special-strings}
  13413. @item @code{:with-sub-superscript}
  13414. @tab @code{org-export-with-sub-superscripts}
  13415. @item @code{:with-tables}
  13416. @tab @code{org-export-with-tables}
  13417. @item @code{:with-tags}
  13418. @tab @code{org-export-with-tags}
  13419. @item @code{:with-tasks}
  13420. @tab @code{org-export-with-tasks}
  13421. @item @code{:with-timestamps}
  13422. @tab @code{org-export-with-timestamps}
  13423. @item @code{:with-title}
  13424. @tab @code{org-export-with-title}
  13425. @item @code{:with-toc}
  13426. @tab @code{org-export-with-toc}
  13427. @item @code{:with-todo-keywords}
  13428. @tab @code{org-export-with-todo-keywords}
  13429. @end multitable
  13430. @anchor{ASCII specific properties}
  13431. @subsubheading ASCII specific properties
  13432. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13433. @item @code{:ascii-bullets}
  13434. @tab @code{org-ascii-bullets}
  13435. @item @code{:ascii-caption-above}
  13436. @tab @code{org-ascii-caption-above}
  13437. @item @code{:ascii-charset}
  13438. @tab @code{org-ascii-charset}
  13439. @item @code{:ascii-global-margin}
  13440. @tab @code{org-ascii-global-margin}
  13441. @item @code{:ascii-format-drawer-function}
  13442. @tab @code{org-ascii-format-drawer-function}
  13443. @item @code{:ascii-format-inlinetask-function}
  13444. @tab @code{org-ascii-format-inlinetask-function}
  13445. @item @code{:ascii-headline-spacing}
  13446. @tab @code{org-ascii-headline-spacing}
  13447. @item @code{:ascii-indented-line-width}
  13448. @tab @code{org-ascii-indented-line-width}
  13449. @item @code{:ascii-inlinetask-width}
  13450. @tab @code{org-ascii-inlinetask-width}
  13451. @item @code{:ascii-inner-margin}
  13452. @tab @code{org-ascii-inner-margin}
  13453. @item @code{:ascii-links-to-notes}
  13454. @tab @code{org-ascii-links-to-notes}
  13455. @item @code{:ascii-list-margin}
  13456. @tab @code{org-ascii-list-margin}
  13457. @item @code{:ascii-paragraph-spacing}
  13458. @tab @code{org-ascii-paragraph-spacing}
  13459. @item @code{:ascii-quote-margin}
  13460. @tab @code{org-ascii-quote-margin}
  13461. @item @code{:ascii-table-keep-all-vertical-lines}
  13462. @tab @code{org-ascii-table-keep-all-vertical-lines}
  13463. @item @code{:ascii-table-use-ascii-art}
  13464. @tab @code{org-ascii-table-use-ascii-art}
  13465. @item @code{:ascii-table-widen-columns}
  13466. @tab @code{org-ascii-table-widen-columns}
  13467. @item @code{:ascii-text-width}
  13468. @tab @code{org-ascii-text-width}
  13469. @item @code{:ascii-underline}
  13470. @tab @code{org-ascii-underline}
  13471. @item @code{:ascii-verbatim-format}
  13472. @tab @code{org-ascii-verbatim-format}
  13473. @end multitable
  13474. @anchor{Beamer specific properties}
  13475. @subsubheading Beamer specific properties
  13476. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13477. @item @code{:beamer-theme}
  13478. @tab @code{org-beamer-theme}
  13479. @item @code{:beamer-column-view-format}
  13480. @tab @code{org-beamer-column-view-format}
  13481. @item @code{:beamer-environments-extra}
  13482. @tab @code{org-beamer-environments-extra}
  13483. @item @code{:beamer-frame-default-options}
  13484. @tab @code{org-beamer-frame-default-options}
  13485. @item @code{:beamer-outline-frame-options}
  13486. @tab @code{org-beamer-outline-frame-options}
  13487. @item @code{:beamer-outline-frame-title}
  13488. @tab @code{org-beamer-outline-frame-title}
  13489. @item @code{:beamer-subtitle-format}
  13490. @tab @code{org-beamer-subtitle-format}
  13491. @end multitable
  13492. @anchor{HTML specific properties}
  13493. @subsubheading HTML specific properties
  13494. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13495. @item @code{:html-allow-name-attribute-in-anchors}
  13496. @tab @code{org-html-allow-name-attribute-in-anchors}
  13497. @item @code{:html-checkbox-type}
  13498. @tab @code{org-html-checkbox-type}
  13499. @item @code{:html-container}
  13500. @tab @code{org-html-container-element}
  13501. @item @code{:html-divs}
  13502. @tab @code{org-html-divs}
  13503. @item @code{:html-doctype}
  13504. @tab @code{org-html-doctype}
  13505. @item @code{:html-extension}
  13506. @tab @code{org-html-extension}
  13507. @item @code{:html-footnote-format}
  13508. @tab @code{org-html-footnote-format}
  13509. @item @code{:html-footnote-separator}
  13510. @tab @code{org-html-footnote-separator}
  13511. @item @code{:html-footnotes-section}
  13512. @tab @code{org-html-footnotes-section}
  13513. @item @code{:html-format-drawer-function}
  13514. @tab @code{org-html-format-drawer-function}
  13515. @item @code{:html-format-headline-function}
  13516. @tab @code{org-html-format-headline-function}
  13517. @item @code{:html-format-inlinetask-function}
  13518. @tab @code{org-html-format-inlinetask-function}
  13519. @item @code{:html-head-extra}
  13520. @tab @code{org-html-head-extra}
  13521. @item @code{:html-head-include-default-style}
  13522. @tab @code{org-html-head-include-default-style}
  13523. @item @code{:html-head-include-scripts}
  13524. @tab @code{org-html-head-include-scripts}
  13525. @item @code{:html-head}
  13526. @tab @code{org-html-head}
  13527. @item @code{:html-home/up-format}
  13528. @tab @code{org-html-home/up-format}
  13529. @item @code{:html-html5-fancy}
  13530. @tab @code{org-html-html5-fancy}
  13531. @item @code{:html-indent}
  13532. @tab @code{org-html-indent}
  13533. @item @code{:html-infojs-options}
  13534. @tab @code{org-html-infojs-options}
  13535. @item @code{:html-infojs-template}
  13536. @tab @code{org-html-infojs-template}
  13537. @item @code{:html-inline-image-rules}
  13538. @tab @code{org-html-inline-image-rules}
  13539. @item @code{:html-inline-images}
  13540. @tab @code{org-html-inline-images}
  13541. @item @code{:html-link-home}
  13542. @tab @code{org-html-link-home}
  13543. @item @code{:html-link-org-files-as-html}
  13544. @tab @code{org-html-link-org-files-as-html}
  13545. @item @code{:html-link-up}
  13546. @tab @code{org-html-link-up}
  13547. @item @code{:html-link-use-abs-url}
  13548. @tab @code{org-html-link-use-abs-url}
  13549. @item @code{:html-mathjax-options}
  13550. @tab @code{org-html-mathjax-options}
  13551. @item @code{:html-mathjax-template}
  13552. @tab @code{org-html-mathjax-template}
  13553. @item @code{:html-metadata-timestamp-format}
  13554. @tab @code{org-html-metadata-timestamp-format}
  13555. @item @code{:html-postamble-format}
  13556. @tab @code{org-html-postamble-format}
  13557. @item @code{:html-postamble}
  13558. @tab @code{org-html-postamble}
  13559. @item @code{:html-preamble-format}
  13560. @tab @code{org-html-preamble-format}
  13561. @item @code{:html-preamble}
  13562. @tab @code{org-html-preamble}
  13563. @item @code{:html-table-align-individual-field}
  13564. @tab @code{de@{org-html-table-align-individual-fields}
  13565. @item @code{:html-table-attributes}
  13566. @tab @code{org-html-table-default-attributes}
  13567. @item @code{:html-table-caption-above}
  13568. @tab @code{org-html-table-caption-above}
  13569. @item @code{:html-table-data-tags}
  13570. @tab @code{org-html-table-data-tags}
  13571. @item @code{:html-table-header-tags}
  13572. @tab @code{org-html-table-header-tags}
  13573. @item @code{:html-table-row-tags}
  13574. @tab @code{org-html-table-row-tags}
  13575. @item @code{:html-table-use-header-tags-for-first-column}
  13576. @tab @code{org-html-table-use-header-tags-for-first-column}
  13577. @item @code{:html-tag-class-prefix}
  13578. @tab @code{org-html-tag-class-prefix}
  13579. @item @code{:html-text-markup-alist}
  13580. @tab @code{org-html-text-markup-alist}
  13581. @item @code{:html-todo-kwd-class-prefix}
  13582. @tab @code{org-html-todo-kwd-class-prefix}
  13583. @item @code{:html-toplevel-hlevel}
  13584. @tab @code{org-html-toplevel-hlevel}
  13585. @item @code{:html-use-infojs}
  13586. @tab @code{org-html-use-infojs}
  13587. @item @code{:html-validation-link}
  13588. @tab @code{org-html-validation-link}
  13589. @item @code{:html-viewport}
  13590. @tab @code{org-html-viewport}
  13591. @item @code{:html-xml-declaration}
  13592. @tab @code{org-html-xml-declaration}
  13593. @end multitable
  13594. @anchor{@LaTeX{} specific properties}
  13595. @subsubheading @LaTeX{} specific properties
  13596. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13597. @item @code{:latex-active-timestamp-format}
  13598. @tab @code{org-latex-active-timestamp-format}
  13599. @item @code{:latex-caption-above}
  13600. @tab @code{org-latex-caption-above}
  13601. @item @code{:latex-classes}
  13602. @tab @code{org-latex-classes}
  13603. @item @code{:latex-class}
  13604. @tab @code{org-latex-default-class}
  13605. @item @code{:latex-compiler}
  13606. @tab @code{org-latex-compiler}
  13607. @item @code{:latex-default-figure-position}
  13608. @tab @code{org-latex-default-figure-position}
  13609. @item @code{:latex-default-table-environment}
  13610. @tab @code{org-latex-default-table-environment}
  13611. @item @code{:latex-default-table-mode}
  13612. @tab @code{org-latex-default-table-mode}
  13613. @item @code{:latex-diary-timestamp-format}
  13614. @tab @code{org-latex-diary-timestamp-format}
  13615. @item @code{:latex-footnote-defined-format}
  13616. @tab @code{org-latex-footnote-defined-format}
  13617. @item @code{:latex-footnote-separator}
  13618. @tab @code{org-latex-footnote-separator}
  13619. @item @code{:latex-format-drawer-function}
  13620. @tab @code{org-latex-format-drawer-function}
  13621. @item @code{:latex-format-headline-function}
  13622. @tab @code{org-latex-format-headline-function}
  13623. @item @code{:latex-format-inlinetask-function}
  13624. @tab @code{org-latex-format-inlinetask-function}
  13625. @item @code{:latex-hyperref-template}
  13626. @tab @code{org-latex-hyperref-template}
  13627. @item @code{:latex-image-default-height}
  13628. @tab @code{org-latex-image-default-height}
  13629. @item @code{:latex-image-default-option}
  13630. @tab @code{org-latex-image-default-option}
  13631. @item @code{:latex-image-default-width}
  13632. @tab @code{org-latex-image-default-width}
  13633. @item @code{:latex-images-centered}
  13634. @tab @code{org-latex-images-centered}
  13635. @item @code{:latex-inactive-timestamp-format}
  13636. @tab @code{org-latex-inactive-timestamp-format}
  13637. @item @code{:latex-inline-image-rules}
  13638. @tab @code{org-latex-inline-image-rules}
  13639. @item @code{:latex-link-with-unknown-path-format}
  13640. @tab @code{org-latex-link-with-unknown-path-format}
  13641. @item @code{:latex-listings-langs}
  13642. @tab @code{org-latex-listings-langs}
  13643. @item @code{:latex-listings-options}
  13644. @tab @code{org-latex-listings-options}
  13645. @item @code{:latex-listings}
  13646. @tab @code{org-latex-listings}
  13647. @item @code{:latex-minted-langs}
  13648. @tab @code{org-latex-minted-langs}
  13649. @item @code{:latex-minted-options}
  13650. @tab @code{org-latex-minted-options}
  13651. @item @code{:latex-prefer-user-labels}
  13652. @tab @code{org-latex-prefer-user-labels}
  13653. @item @code{:latex-subtitle-format}
  13654. @tab @code{org-latex-subtitle-format}
  13655. @item @code{:latex-subtitle-separate}
  13656. @tab @code{org-latex-subtitle-separate}
  13657. @item @code{:latex-table-scientific-notation}
  13658. @tab @code{org-latex-table-scientific-notation}
  13659. @item @code{:latex-tables-booktabs}
  13660. @tab @code{org-latex-tables-booktabs}
  13661. @item @code{:latex-tables-centered}
  13662. @tab @code{org-latex-tables-centered}
  13663. @item @code{:latex-text-markup-alist}
  13664. @tab @code{org-latex-text-markup-alist}
  13665. @item @code{:latex-title-command}
  13666. @tab @code{org-latex-title-command}
  13667. @item @code{:latex-toc-command}
  13668. @tab @code{org-latex-toc-command}
  13669. @end multitable
  13670. @anchor{Markdown specific properties}
  13671. @subsubheading Markdown specific properties
  13672. @multitable {aaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaa}
  13673. @item @code{:md-footnote-format}
  13674. @tab @code{org-md-footnote-format}
  13675. @item @code{:md-footnotes-section}
  13676. @tab @code{org-md-footnotes-section}
  13677. @item @code{:md-headline-style}
  13678. @tab @code{org-md-headline-style}
  13679. @end multitable
  13680. @anchor{ODT specific properties}
  13681. @subsubheading ODT specific properties
  13682. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13683. @item @code{:odt-content-template-file}
  13684. @tab @code{org-odt-content-template-file}
  13685. @item @code{:odt-display-outline-level}
  13686. @tab @code{org-odt-display-outline-level}
  13687. @item @code{:odt-fontify-srcblocks}
  13688. @tab @code{org-odt-fontify-srcblocks}
  13689. @item @code{:odt-format-drawer-function}
  13690. @tab @code{org-odt-format-drawer-function}
  13691. @item @code{:odt-format-headline-function}
  13692. @tab @code{org-odt-format-headline-function}
  13693. @item @code{:odt-format-inlinetask-function}
  13694. @tab @code{org-odt-format-inlinetask-function}
  13695. @item @code{:odt-inline-formula-rules}
  13696. @tab @code{org-odt-inline-formula-rules}
  13697. @item @code{:odt-inline-image-rules}
  13698. @tab @code{org-odt-inline-image-rules}
  13699. @item @code{:odt-pixels-per-inch}
  13700. @tab @code{org-odt-pixels-per-inch}
  13701. @item @code{:odt-styles-file}
  13702. @tab @code{org-odt-styles-file}
  13703. @item @code{:odt-table-styles}
  13704. @tab @code{org-odt-table-styles}
  13705. @item @code{:odt-use-date-fields}
  13706. @tab @code{org-odt-use-date-fields}
  13707. @end multitable
  13708. @anchor{Texinfo specific properties}
  13709. @subsubheading Texinfo specific properties
  13710. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13711. @item @code{:texinfo-active-timestamp-format}
  13712. @tab @code{org-texinfo-active-timestamp-format}
  13713. @item @code{:texinfo-classes}
  13714. @tab @code{org-texinfo-classes}
  13715. @item @code{:texinfo-class}
  13716. @tab @code{org-texinfo-default-class}
  13717. @item @code{:texinfo-table-default-markup}
  13718. @tab @code{org-texinfo-table-default-markup}
  13719. @item @code{:texinfo-diary-timestamp-format}
  13720. @tab @code{org-texinfo-diary-timestamp-format}
  13721. @item @code{:texinfo-filename}
  13722. @tab @code{org-texinfo-filename}
  13723. @item @code{:texinfo-format-drawer-function}
  13724. @tab @code{org-texinfo-format-drawer-function}
  13725. @item @code{:texinfo-format-headline-function}
  13726. @tab @code{org-texinfo-format-headline-function}
  13727. @item @code{:texinfo-format-inlinetask-function}
  13728. @tab @code{org-texinfo-format-inlinetask-function}
  13729. @item @code{:texinfo-inactive-timestamp-format}
  13730. @tab @code{org-texinfo-inactive-timestamp-format}
  13731. @item @code{:texinfo-link-with-unknown-path-format}
  13732. @tab @code{org-texinfo-link-with-unknown-path-format}
  13733. @item @code{:texinfo-node-description-column}
  13734. @tab @code{org-texinfo-node-description-column}
  13735. @item @code{:texinfo-table-scientific-notation}
  13736. @tab @code{org-texinfo-table-scientific-notation}
  13737. @item @code{:texinfo-tables-verbatim}
  13738. @tab @code{org-texinfo-tables-verbatim}
  13739. @item @code{:texinfo-text-markup-alist}
  13740. @tab @code{org-texinfo-text-markup-alist}
  13741. @end multitable
  13742. @node Publishing links
  13743. @subsection Publishing links
  13744. @cindex links, publishing
  13745. To create a link from one Org file to another, you would use something
  13746. like @samp{[[file:foo.org][The foo]]} or simply @samp{[[file:foo.org]]} (see @ref{External Links}). When
  13747. published, this link becomes a link to @samp{foo.html}. You can thus
  13748. interlink the pages of your ``Org web'' project and the links will work
  13749. as expected when you publish them to HTML. If you also publish the
  13750. Org source file and want to link to it, use an @samp{http} link instead of
  13751. a @samp{file:} link, because @samp{file} links are converted to link to the
  13752. corresponding @samp{.html} file.
  13753. You may also link to related files, such as images. Provided you are
  13754. careful with relative file names, and provided you have also
  13755. configured Org to upload the related files, these links will work too.
  13756. See @ref{Complex example}, for an example of this
  13757. usage.
  13758. Eventually, links between published documents can contain some search
  13759. options (see @ref{Search Options}), which will be resolved to
  13760. the appropriate location in the linked file. For example, once
  13761. published to HTML, the following links all point to a dedicated anchor
  13762. in @samp{foo.html}.
  13763. @example
  13764. [[file:foo.org::*heading]]
  13765. [[file:foo.org::#custom-id]]
  13766. [[file:foo.org::target]]
  13767. @end example
  13768. @node Site map
  13769. @subsection Generating a sitemap
  13770. @cindex sitemap, of published pages
  13771. The following properties may be used to control publishing of
  13772. a map of files for a given project.
  13773. @table @asis
  13774. @item @code{:auto-sitemap}
  13775. When non-@code{nil}, publish a sitemap during
  13776. @code{org-publish-current-project} or @code{org-publish-all}.
  13777. @item @code{:sitemap-filename}
  13778. Filename for output of sitemap. Defaults to @samp{sitemap.org}, which
  13779. becomes @samp{sitemap.html}.
  13780. @item @code{:sitemap-title}
  13781. Title of sitemap page. Defaults to name of file.
  13782. @item @code{:sitemap-format-entry}
  13783. @findex org-publish-find-date
  13784. @findex org-publish-find-property
  13785. @findex org-publish-find-title
  13786. With this option one can tell how a site-map entry is formatted
  13787. in the site-map. It is a function called with three arguments:
  13788. the file or directory name relative to base directory of the
  13789. project, the site-map style and the current project. It is
  13790. expected to return a string. Default value turns file names into
  13791. links and use document titles as descriptions. For specific
  13792. formatting needs, one can use @code{org-publish-find-date},
  13793. @code{org-publish-find-title} and @code{org-publish-find-property}, to
  13794. retrieve additional information about published documents.
  13795. @item @code{:sitemap-function}
  13796. Plug-in function to use for generation of the sitemap. It is
  13797. called with two arguments: the title of the site-map and
  13798. a representation of the files and directories involved in the
  13799. project as a nested list, which can further be transformed using
  13800. @code{org-list-to-generic}, @code{org-list-to-subtree} and alike. Default
  13801. value generates a plain list of links to all files in the
  13802. project.
  13803. @item @code{:sitemap-sort-folders}
  13804. Where folders should appear in the sitemap. Set this to @code{first}
  13805. (default) or @code{last} to display folders first or last,
  13806. respectively. When set to @code{ignore}, folders are ignored
  13807. altogether. Any other value mixes files and folders. This
  13808. variable has no effect when site-map style is @code{tree}.
  13809. @item @code{:sitemap-sort-files}
  13810. How the files are sorted in the site map. Set this to
  13811. @code{alphabetically} (default), @code{chronologically} or
  13812. @code{anti-chronologically}. @code{chronologically} sorts the files with
  13813. older date first while @code{anti-chronologically} sorts the files
  13814. with newer date first. @code{alphabetically} sorts the files
  13815. alphabetically. The date of a file is retrieved with
  13816. @code{org-publish-find-date}.
  13817. @item @code{:sitemap-ignore-case}
  13818. Should sorting be case-sensitive? Default @code{nil}.
  13819. @item @code{:sitemap-file-entry-format}
  13820. With this option one can tell how a sitemap's entry is formatted
  13821. in the sitemap. This is a format string with some escape
  13822. sequences: @code{%t} stands for the title of the file, @code{%a} stands for
  13823. the author of the file and @code{%d} stands for the date of the file.
  13824. The date is retrieved with the @code{org-publish-find-date} function
  13825. and formatted with @code{org-publish-sitemap-date-format}. Default
  13826. @code{%t}.
  13827. @item @code{:sitemap-date-format}
  13828. Format string for the @code{format-time-string} function that tells
  13829. how a sitemap entry's date is to be formatted. This property
  13830. bypasses @code{org-publish-sitemap-date-format} which defaults to
  13831. @code{%Y-%m-%d}.
  13832. @end table
  13833. @node Generating an index
  13834. @subsection Generating an index
  13835. @cindex index, in a publishing project
  13836. Org mode can generate an index across the files of a publishing project.
  13837. @table @asis
  13838. @item @code{:makeindex}
  13839. When non-@code{nil}, generate in index in the file @samp{theindex.org} and
  13840. publish it as @samp{theindex.html}.
  13841. @end table
  13842. The file is created when first publishing a project with the
  13843. @code{:makeindex} set. The file only contains a statement @samp{#+INCLUDE:
  13844. "theindex.inc"}. You can then build around this include statement by
  13845. adding a title, style information, etc.
  13846. @cindex @samp{INDEX}, keyword
  13847. Index entries are specified with @samp{INDEX} keyword. An entry that
  13848. contains an exclamation mark creates a sub item.
  13849. @example
  13850. *** Curriculum Vitae
  13851. #+INDEX: CV
  13852. #+INDEX: Application!CV
  13853. @end example
  13854. @node Uploading Files
  13855. @section Uploading Files
  13856. @cindex rsync
  13857. @cindex unison
  13858. For those people already utilizing third party sync tools such as
  13859. Rsync or Unison, it might be preferable not to use the built-in remote
  13860. publishing facilities of Org mode which rely heavily on Tramp. Tramp,
  13861. while very useful and powerful, tends not to be so efficient for
  13862. multiple file transfer and has been known to cause problems under
  13863. heavy usage.
  13864. Specialized synchronization utilities offer several advantages. In
  13865. addition to timestamp comparison, they also do content and
  13866. permissions/attribute checks. For this reason you might prefer to
  13867. publish your web to a local directory---possibly even @emph{in place} with
  13868. your Org files---and then use Unison or Rsync to do the
  13869. synchronization with the remote host.
  13870. Since Unison, for example, can be configured as to which files to
  13871. transfer to a certain remote destination, it can greatly simplify the
  13872. project publishing definition. Simply keep all files in the correct
  13873. location, process your Org files with @code{org-publish} and let the
  13874. synchronization tool do the rest. You do not need, in this scenario,
  13875. to include attachments such as JPG, CSS or PNG files in the project
  13876. definition since the third-party tool syncs them.
  13877. Publishing to a local directory is also much faster than to a remote
  13878. one, so that you can afford more easily to republish entire projects.
  13879. If you set @code{org-publish-use-timestamps-flag} to @code{nil}, you gain the
  13880. main benefit of re-including any changed external files such as source
  13881. example files you might include with @samp{INCLUDE} keyword. The timestamp
  13882. mechanism in Org is not smart enough to detect if included files have
  13883. been modified.
  13884. @node Sample Configuration
  13885. @section Sample Configuration
  13886. Below we provide two example configurations. The first one is
  13887. a simple project publishing only a set of Org files. The second
  13888. example is more complex, with a multi-component project.
  13889. @menu
  13890. * Simple example:: One-component publishing.
  13891. * Complex example:: A multi-component publishing example.
  13892. @end menu
  13893. @node Simple example
  13894. @subsection Example: simple publishing configuration
  13895. This example publishes a set of Org files to the @samp{public_html}
  13896. directory on the local machine.
  13897. @lisp
  13898. (setq org-publish-project-alist
  13899. '(("org"
  13900. :base-directory "~/org/"
  13901. :publishing-directory "~/public_html"
  13902. :section-numbers nil
  13903. :table-of-contents nil
  13904. :style "<link rel=\"stylesheet\"
  13905. href=\"../other/mystyle.css\"
  13906. type=\"text/css\"/>")))
  13907. @end lisp
  13908. @node Complex example
  13909. @subsection Example: complex publishing configuration
  13910. This more complicated example publishes an entire website, including
  13911. Org files converted to HTML, image files, Emacs Lisp source code, and
  13912. style sheets. The publishing directory is remote and private files
  13913. are excluded.
  13914. To ensure that links are preserved, care should be taken to replicate
  13915. your directory structure on the web server, and to use relative file
  13916. paths. For example, if your Org files are kept in @samp{~/org/} and your
  13917. publishable images in @samp{~/images/}, you would link to an image with
  13918. @example
  13919. file:../images/myimage.png
  13920. @end example
  13921. On the web server, the relative path to the image should be the same.
  13922. You can accomplish this by setting up an @samp{images/} folder in the right
  13923. place on the web server, and publishing images to it.
  13924. @lisp
  13925. (setq org-publish-project-alist
  13926. '(("orgfiles"
  13927. :base-directory "~/org/"
  13928. :base-extension "org"
  13929. :publishing-directory "/ssh:user@@host:~/html/notebook/"
  13930. :publishing-function org-html-publish-to-html
  13931. :exclude "PrivatePage.org" ;; regexp
  13932. :headline-levels 3
  13933. :section-numbers nil
  13934. :with-toc nil
  13935. :html-head "<link rel=\"stylesheet\"
  13936. href=\"../other/mystyle.css\" type=\"text/css\"/>"
  13937. :html-preamble t)
  13938. ("images"
  13939. :base-directory "~/images/"
  13940. :base-extension "jpg\\|gif\\|png"
  13941. :publishing-directory "/ssh:user@@host:~/html/images/"
  13942. :publishing-function org-publish-attachment)
  13943. ("other"
  13944. :base-directory "~/other/"
  13945. :base-extension "css\\|el"
  13946. :publishing-directory "/ssh:user@@host:~/html/other/"
  13947. :publishing-function org-publish-attachment)
  13948. ("website" :components ("orgfiles" "images" "other"))))
  13949. @end lisp
  13950. @node Triggering Publication
  13951. @section Triggering Publication
  13952. Once properly configured, Org can publish with the following commands:
  13953. @table @asis
  13954. @item @kbd{C-c C-e X} (@code{org-publish})
  13955. @kindex C-c C-e X
  13956. @findex org-publish
  13957. Prompt for a specific project and publish all files that belong
  13958. to it.
  13959. @item @kbd{C-c C-e P} (@code{org-publish-current-project})
  13960. @kindex C-c C-e P
  13961. @findex org-publish-current-project
  13962. Publish the project containing the current file.
  13963. @item @kbd{C-c C-e F} (@code{org-publish-current-file})
  13964. @kindex C-c C-e F
  13965. @findex org-publish-current-file
  13966. Publish only the current file.
  13967. @item @kbd{C-c C-e E} (@code{org-publish-all})
  13968. @kindex C-c C-e E
  13969. @findex org-publish-all
  13970. Publish every project.
  13971. @end table
  13972. @vindex org-publish-use-timestamps-flag
  13973. Org uses timestamps to track when a file has changed. The above
  13974. functions normally only publish changed files. You can override this
  13975. and force publishing of all files by giving a prefix argument to any
  13976. of the commands above, or by customizing the variable
  13977. @code{org-publish-use-timestamps-flag}. This may be necessary in
  13978. particular if files include other files via @samp{SETUPFILE} or @samp{INCLUDE}
  13979. keywords.
  13980. @node Working with Source Code
  13981. @chapter Working with Source Code
  13982. @cindex source code, working with
  13983. Source code here refers to any plain text collection of computer
  13984. instructions, possibly with comments, written using a human-readable
  13985. programming language. Org can manage source code in an Org document
  13986. when the source code is identified with begin and end markers.
  13987. Working with source code begins with identifying source code blocks.
  13988. A source code block can be placed almost anywhere in an Org document;
  13989. it is not restricted to the preamble or the end of the document.
  13990. However, Org cannot manage a source code block if it is placed inside
  13991. an Org comment or within a fixed width section.
  13992. Here is an example source code block in the Emacs Lisp language:
  13993. @example
  13994. #+BEGIN_SRC emacs-lisp
  13995. (defun org-xor (a b)
  13996. "Exclusive or."
  13997. (if a (not b) b))
  13998. #+END_SRC
  13999. @end example
  14000. Org can manage the source code in the block delimited by @samp{#+BEGIN_SRC}
  14001. @dots{} @samp{#+END_SRC} in several ways that can simplify housekeeping tasks
  14002. essential to modern source code maintenance. Org can edit, format,
  14003. extract, export, and publish source code blocks. Org can also compile
  14004. and execute a source code block, then capture the results. The Org
  14005. mode literature sometimes refers to source code blocks as @emph{live code}
  14006. blocks because they can alter the content of the Org document or the
  14007. material that it exports. Users can control how live they want each
  14008. source code block by tweaking the header arguments (see @ref{Using Header Arguments}) for compiling, execution, extraction, and
  14009. exporting.
  14010. Source code blocks are one of many Org block types, which also include
  14011. @samp{quote}, @samp{export}, @samp{verse}, @samp{latex}, @samp{example}, and @samp{verbatim}. This
  14012. section pertains to blocks between @samp{#+BEGIN_SRC} and @samp{#+END_SRC}.
  14013. For editing and formatting a source code block, Org uses an
  14014. appropriate Emacs major mode that includes features specifically
  14015. designed for source code in that language.
  14016. Org can extract one or more source code blocks and write them to one
  14017. or more source files---a process known as @emph{tangling} in literate
  14018. programming terminology.
  14019. For exporting and publishing, Org's back-ends can format a source code
  14020. block appropriately, often with native syntax highlighting.
  14021. For executing and compiling a source code block, the user can
  14022. configure Org to select the appropriate compiler. Org provides
  14023. facilities to collect the result of the execution or compiler output,
  14024. insert it into the Org document, and/or export it. In addition to
  14025. text results, Org can insert links to other data types, including
  14026. audio, video, and graphics. Org can also link a compiler error
  14027. message to the appropriate line in the source code block.
  14028. An important feature of Org's management of source code blocks is the
  14029. ability to pass variables, functions, and results to one another using
  14030. a common syntax for source code blocks in any language. Although most
  14031. literate programming facilities are restricted to one language or
  14032. another, Org's language-agnostic approach lets the literate programmer
  14033. match each programming task with the appropriate computer language and
  14034. to mix them all together in a single Org document. This
  14035. interoperability among languages explains why Org's source code
  14036. management facility was named @emph{Org Babel} by its originators, Eric
  14037. Schulte and Dan Davison.
  14038. Org mode fulfills the promise of easy verification and maintenance of
  14039. publishing reproducible research by keeping text, data, code,
  14040. configuration settings of the execution environment, the results of
  14041. the execution, and associated narratives, claims, references, and
  14042. internal and external links in a single Org document.
  14043. Details of Org's facilities for working with source code are described
  14044. in the following sections.
  14045. @menu
  14046. * Structure of Code Blocks:: Code block syntax described.
  14047. * Using Header Arguments:: Different ways to set header arguments.
  14048. * Environment of a Code Block:: Arguments, sessions, working directory...
  14049. * Evaluating Code Blocks:: Place results of evaluation in the Org buffer.
  14050. * Results of Evaluation:: Choosing a results type, post-processing...
  14051. * Exporting Code Blocks:: Export contents and/or results.
  14052. * Extracting Source Code:: Create pure source code files.
  14053. * Languages:: List of supported code block languages.
  14054. * Editing Source Code:: Language major-mode editing.
  14055. * Noweb Reference Syntax:: Literate programming in Org mode.
  14056. * Library of Babel:: Use and contribute to a library of useful code blocks.
  14057. * Key bindings and Useful Functions:: Work quickly with code blocks.
  14058. * Batch Execution:: Call functions from the command line.
  14059. @end menu
  14060. @node Structure of Code Blocks
  14061. @section Structure of Code Blocks
  14062. @cindex code block, structure
  14063. @cindex source code, block structure
  14064. @cindex @samp{NAME} keyword, in source blocks
  14065. @cindex @samp{BEGIN_SRC}
  14066. Org offers two ways to structure source code in Org documents: in
  14067. a source code block, and directly inline. Both specifications are
  14068. shown below.
  14069. A source code block conforms to this structure:
  14070. @example
  14071. #+NAME: <name>
  14072. #+BEGIN_SRC <language> <switches> <header arguments>
  14073. <body>
  14074. #+END_SRC
  14075. @end example
  14076. Do not be put-off by having to remember the source block syntax. Org
  14077. mode offers a command for wrapping existing text in a block (see
  14078. @ref{Structure Templates}). Org also works with other completion systems
  14079. in Emacs, some of which predate Org and have custom domain-specific
  14080. languages for defining templates. Regular use of templates reduces
  14081. errors, increases accuracy, and maintains consistency.
  14082. @cindex source code, inline
  14083. An inline code block conforms to this structure:
  14084. @example
  14085. src_<language>@{<body>@}
  14086. @end example
  14087. @noindent
  14088. or
  14089. @example
  14090. src_<language>[<header arguments>]@{<body>@}
  14091. @end example
  14092. @table @asis
  14093. @item @samp{#+NAME: <name>}
  14094. Optional. Names the source block so it can be called, like
  14095. a function, from other source blocks or inline code to evaluate
  14096. or to capture the results. Code from other blocks, other files,
  14097. and from table formulas (see @ref{The spreadsheet}) can use the name
  14098. to reference a source block. This naming serves the same purpose
  14099. as naming Org tables. Org mode requires unique names. For
  14100. duplicate names, Org mode's behavior is undefined.
  14101. @item @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}
  14102. Mandatory. They mark the start and end of a block that Org
  14103. requires. The @samp{#+BEGIN_SRC} line takes additional arguments, as
  14104. described next.
  14105. @item @samp{<language>}
  14106. @cindex language, in code blocks
  14107. Mandatory. It is the identifier of the source code language in
  14108. the block. See @ref{Languages}, for identifiers of supported
  14109. languages.
  14110. @item @samp{<switches>}
  14111. @cindex switches, in code blocks
  14112. Optional. Switches provide finer control of the code execution,
  14113. export, and format (see the discussion of switches in @ref{Literal Examples}).
  14114. @item @samp{<header arguments>}
  14115. @cindex header arguments, in code blocks
  14116. Optional. Heading arguments control many aspects of evaluation,
  14117. export and tangling of code blocks (see @ref{Using Header Arguments}).
  14118. Using Org's properties feature, header arguments can be
  14119. selectively applied to the entire buffer or specific sub-trees of
  14120. the Org document.
  14121. @item @samp{<body>}
  14122. Source code in the dialect of the specified language identifier.
  14123. @end table
  14124. @node Using Header Arguments
  14125. @section Using Header Arguments
  14126. Org comes with many header arguments common to all languages. New
  14127. header arguments are added for specific languages as they become
  14128. available for use in source code blocks. A header argument is
  14129. specified with an initial colon followed by the argument's name in
  14130. lowercase.
  14131. Since header arguments can be set in several ways, Org prioritizes
  14132. them in case of overlaps or conflicts by giving local settings
  14133. a higher priority. Header values in function calls, for example,
  14134. override header values from global defaults.
  14135. @anchor{System-wide header arguments}
  14136. @subheading System-wide header arguments
  14137. @vindex org-babel-default-header-args
  14138. @vindex org-babel-default-header-args
  14139. System-wide values of header arguments can be specified by customizing
  14140. the @code{org-babel-default-header-args} variable, which defaults to the
  14141. following values:
  14142. @example
  14143. :session => "none"
  14144. :results => "replace"
  14145. :exports => "code"
  14146. :cache => "no"
  14147. :noweb => "no"
  14148. @end example
  14149. The example below sets @samp{:noweb} header arguments to @samp{yes}, which makes
  14150. Org expand @samp{:noweb} references by default.
  14151. @lisp
  14152. (setq org-babel-default-header-args
  14153. (cons '(:noweb . "yes")
  14154. (assq-delete-all :noweb org-babel-default-header-args)))
  14155. @end lisp
  14156. @cindex language specific default header arguments
  14157. @cindex default header arguments per language
  14158. Each language can have separate default header arguments by
  14159. customizing the variable @code{org-babel-default-header-args:<LANG>}, where
  14160. @var{<LANG>} is the name of the language. For details, see the
  14161. language-specific online documentation at
  14162. @uref{https://orgmode.org/worg/org-contrib/babel/}.
  14163. @anchor{Header arguments in Org mode properties}
  14164. @subheading Header arguments in Org mode properties
  14165. For header arguments applicable to the buffer, use @samp{PROPERTY} keyword
  14166. anywhere in the Org file (see @ref{Property Syntax}).
  14167. The following example makes all the R code blocks execute in the same
  14168. session. Setting @samp{:results} to @samp{silent} ignores the results of
  14169. executions for all blocks, not just R code blocks; no results inserted
  14170. for any block.
  14171. @example
  14172. #+PROPERTY: header-args:R :session *R*
  14173. #+PROPERTY: header-args :results silent
  14174. @end example
  14175. @vindex org-use-property-inheritance
  14176. Header arguments set through Org's property drawers (see @ref{Property Syntax}) apply at the sub-tree level on down. Since these property
  14177. drawers can appear anywhere in the file hierarchy, Org uses outermost
  14178. call or source block to resolve the values. Org ignores
  14179. @code{org-use-property-inheritance} setting.
  14180. In this example, @samp{:cache} defaults to @samp{yes} for all code blocks in the
  14181. sub-tree.
  14182. @example
  14183. * sample header
  14184. :PROPERTIES:
  14185. :header-args: :cache yes
  14186. :END:
  14187. @end example
  14188. @kindex C-c C-x p
  14189. @findex org-set-property
  14190. Properties defined through @code{org-set-property} function, bound to
  14191. @kbd{C-c C-x p}, apply to all active languages. They override
  14192. properties set in @code{org-babel-default-header-args}.
  14193. @cindex language specific header arguments properties
  14194. @cindex header arguments per language
  14195. Language-specific header arguments are also read from properties
  14196. @samp{header-args:<LANG>} where @var{<LANG>} is the language
  14197. identifier. For example,
  14198. @example
  14199. * Heading
  14200. :PROPERTIES:
  14201. :header-args:clojure: :session *clojure-1*
  14202. :header-args:R: :session *R*
  14203. :END:
  14204. ** Subheading
  14205. :PROPERTIES:
  14206. :header-args:clojure: :session *clojure-2*
  14207. :END:
  14208. @end example
  14209. @noindent
  14210. would force separate sessions for Clojure blocks in @samp{Heading} and
  14211. @samp{Subheading}, but use the same session for all R blocks. Blocks in
  14212. @samp{Subheading} inherit settings from @samp{Heading}.
  14213. @anchor{Code block specific header arguments}
  14214. @subheading Code block specific header arguments
  14215. Header arguments are most commonly set at the source code block level,
  14216. on the @samp{#+BEGIN_SRC} line. Arguments set at this level take
  14217. precedence over those set in the @code{org-babel-default-header-args}
  14218. variable, and also those set as header properties.
  14219. In the following example, setting @samp{:results} to @samp{silent} makes it
  14220. ignore results of the code execution. Setting @samp{:exports} to @samp{code}
  14221. exports only the body of the code block to HTML or @LaTeX{}.
  14222. @example
  14223. #+NAME: factorial
  14224. #+BEGIN_SRC haskell :results silent :exports code :var n=0
  14225. fac 0 = 1
  14226. fac n = n * fac (n-1)
  14227. #+END_SRC
  14228. @end example
  14229. The same header arguments in an inline code block:
  14230. @example
  14231. src_haskell[:exports both]@{fac 5@}
  14232. @end example
  14233. @cindex @samp{HEADER}, keyword
  14234. Code block header arguments can span multiple lines using @samp{#+HEADER:}
  14235. on each line. Note that Org currently accepts the plural spelling of
  14236. @samp{#+HEADER:} only as a convenience for backward-compatibility. It may
  14237. be removed at some point.
  14238. Multi-line header arguments on an unnamed code block:
  14239. @example
  14240. #+HEADER: :var data1=1
  14241. #+BEGIN_SRC emacs-lisp :var data2=2
  14242. (message "data1:%S, data2:%S" data1 data2)
  14243. #+END_SRC
  14244. #+RESULTS:
  14245. : data1:1, data2:2
  14246. @end example
  14247. Multi-line header arguments on a named code block:
  14248. @example
  14249. #+NAME: named-block
  14250. #+HEADER: :var data=2
  14251. #+BEGIN_SRC emacs-lisp
  14252. (message "data:%S" data)
  14253. #+END_SRC
  14254. #+RESULTS: named-block
  14255. : data:2
  14256. @end example
  14257. @anchor{Header arguments in function calls}
  14258. @subheading Header arguments in function calls
  14259. Header arguments in function calls are the most specific and override
  14260. all other settings in case of an overlap. They get the highest
  14261. priority. Two @samp{#+CALL:} examples are shown below. For the complete
  14262. syntax of @samp{CALL} keyword, see @ref{Evaluating Code Blocks}.
  14263. In this example, @samp{:exports results} header argument is applied to the
  14264. evaluation of the @samp{#+CALL:} line.
  14265. @example
  14266. #+CALL: factorial(n=5) :exports results
  14267. @end example
  14268. In this example, @samp{:session special} header argument is applied to the
  14269. evaluation of @samp{factorial} code block.
  14270. @example
  14271. #+CALL: factorial[:session special](n=5)
  14272. @end example
  14273. @node Environment of a Code Block
  14274. @section Environment of a Code Block
  14275. @anchor{Passing arguments}
  14276. @subheading Passing arguments
  14277. @cindex passing arguments to code blocks
  14278. @cindex arguments, in code blocks
  14279. @cindex @samp{var}, header argument
  14280. Use @samp{var} for passing arguments to source code blocks. The specifics
  14281. of variables in code blocks vary by the source language and are
  14282. covered in the language-specific documentation. The syntax for @samp{var},
  14283. however, is the same for all languages. This includes declaring
  14284. a variable, and assigning a default value.
  14285. The following syntax is used to pass arguments to code blocks using
  14286. the @samp{var} header argument.
  14287. @example
  14288. :var NAME=ASSIGN
  14289. @end example
  14290. @noindent
  14291. @var{NAME} is the name of the variable bound in the code block
  14292. body. @var{ASSIGN} is a literal value, such as a string,
  14293. a number, a reference to a table, a list, a literal example, another
  14294. code block---with or without arguments---or the results of evaluating
  14295. a code block.
  14296. Here are examples of passing values by reference:
  14297. @table @asis
  14298. @item table
  14299. A table named with a @samp{NAME} keyword.
  14300. @example
  14301. #+NAME: example-table
  14302. | 1 |
  14303. | 2 |
  14304. | 3 |
  14305. | 4 |
  14306. #+NAME: table-length
  14307. #+BEGIN_SRC emacs-lisp :var table=example-table
  14308. (length table)
  14309. #+END_SRC
  14310. #+RESULTS: table-length
  14311. : 4
  14312. @end example
  14313. When passing a table, you can treat specially the row, or the
  14314. column, containing labels for the columns, or the rows, in the
  14315. table.
  14316. @cindex @samp{colnames}, header argument
  14317. The @samp{colnames} header argument accepts @samp{yes}, @samp{no}, or @samp{nil}
  14318. values. The default value is @samp{nil}: if an input table has column
  14319. names---because the second row is a horizontal rule---then Org
  14320. removes the column names, processes the table, puts back the
  14321. column names, and then writes the table to the results block.
  14322. Using @samp{yes}, Org does the same to the first row, even if the
  14323. initial table does not contain any horizontal rule. When set to
  14324. @samp{no}, Org does not pre-process column names at all.
  14325. @example
  14326. #+NAME: less-cols
  14327. | a |
  14328. |---|
  14329. | b |
  14330. | c |
  14331. #+BEGIN_SRC python :var tab=less-cols :colnames nil
  14332. return [[val + '*' for val in row] for row in tab]
  14333. #+END_SRC
  14334. #+RESULTS:
  14335. | a |
  14336. |----|
  14337. | b* |
  14338. | c* |
  14339. @end example
  14340. @cindex @samp{rownames}, header argument
  14341. Similarly, the @samp{rownames} header argument can take two values:
  14342. @samp{yes} or @samp{no}. When set to @samp{yes}, Org removes the first column,
  14343. processes the table, puts back the first column, and then writes
  14344. the table to the results block. The default is @samp{no}, which means
  14345. Org does not pre-process the first column. Note that Emacs Lisp
  14346. code blocks ignore @samp{rownames} header argument because of the ease
  14347. of table-handling in Emacs.
  14348. @example
  14349. #+NAME: with-rownames
  14350. | one | 1 | 2 | 3 | 4 | 5 |
  14351. | two | 6 | 7 | 8 | 9 | 10 |
  14352. #+BEGIN_SRC python :var tab=with-rownames :rownames yes
  14353. return [[val + 10 for val in row] for row in tab]
  14354. #+END_SRC
  14355. #+RESULTS:
  14356. | one | 11 | 12 | 13 | 14 | 15 |
  14357. | two | 16 | 17 | 18 | 19 | 20 |
  14358. @end example
  14359. @item list
  14360. A simple named list.
  14361. @example
  14362. #+NAME: example-list
  14363. - simple
  14364. - not
  14365. - nested
  14366. - list
  14367. #+BEGIN_SRC emacs-lisp :var x=example-list
  14368. (print x)
  14369. #+END_SRC
  14370. #+RESULTS:
  14371. | simple | list |
  14372. @end example
  14373. Note that only the top level list items are passed along. Nested
  14374. list items are ignored.
  14375. @item code block without arguments
  14376. A code block name, as assigned by @samp{NAME} keyword from the example
  14377. above, optionally followed by parentheses.
  14378. @example
  14379. #+BEGIN_SRC emacs-lisp :var length=table-length()
  14380. (* 2 length)
  14381. #+END_SRC
  14382. #+RESULTS:
  14383. : 8
  14384. @end example
  14385. @item code block with arguments
  14386. A code block name, as assigned by @samp{NAME} keyword, followed by
  14387. parentheses and optional arguments passed within the parentheses.
  14388. @example
  14389. #+NAME: double
  14390. #+BEGIN_SRC emacs-lisp :var input=8
  14391. (* 2 input)
  14392. #+END_SRC
  14393. #+RESULTS: double
  14394. : 16
  14395. #+NAME: squared
  14396. #+BEGIN_SRC emacs-lisp :var input=double(input=1)
  14397. (* input input)
  14398. #+END_SRC
  14399. #+RESULTS: squared
  14400. : 4
  14401. @end example
  14402. @item literal example
  14403. A literal example block named with a @samp{NAME} keyword.
  14404. @example
  14405. #+NAME: literal-example
  14406. #+BEGIN_EXAMPLE
  14407. A literal example
  14408. on two lines
  14409. #+END_EXAMPLE
  14410. #+NAME: read-literal-example
  14411. #+BEGIN_SRC emacs-lisp :var x=literal-example
  14412. (concatenate #'string x " for you.")
  14413. #+END_SRC
  14414. #+RESULTS: read-literal-example
  14415. : A literal example
  14416. : on two lines for you.
  14417. @end example
  14418. @end table
  14419. Indexing variable values enables referencing portions of a variable.
  14420. Indexes are 0 based with negative values counting backwards from the
  14421. end. If an index is separated by commas then each subsequent section
  14422. indexes as the next dimension. Note that this indexing occurs
  14423. @emph{before} other table-related header arguments are applied, such as
  14424. @samp{hlines}, @samp{colnames} and @samp{rownames}. The following example assigns
  14425. the last cell of the first row the table @samp{example-table} to the
  14426. variable @samp{data}:
  14427. @example
  14428. #+NAME: example-table
  14429. | 1 | a |
  14430. | 2 | b |
  14431. | 3 | c |
  14432. | 4 | d |
  14433. #+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
  14434. data
  14435. #+END_SRC
  14436. #+RESULTS:
  14437. : a
  14438. @end example
  14439. Two integers separated by a colon reference a range of variable
  14440. values. In that case the entire inclusive range is referenced. For
  14441. example the following assigns the middle three rows of @samp{example-table}
  14442. to @samp{data}.
  14443. @example
  14444. #+NAME: example-table
  14445. | 1 | a |
  14446. | 2 | b |
  14447. | 3 | c |
  14448. | 4 | d |
  14449. | 5 | 3 |
  14450. #+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
  14451. data
  14452. #+END_SRC
  14453. #+RESULTS:
  14454. | 2 | b |
  14455. | 3 | c |
  14456. | 4 | d |
  14457. @end example
  14458. To pick the entire range, use an empty index, or the single character
  14459. @samp{*}. @samp{0:-1} does the same thing. Example below shows how to
  14460. reference the first column only.
  14461. @example
  14462. #+NAME: example-table
  14463. | 1 | a |
  14464. | 2 | b |
  14465. | 3 | c |
  14466. | 4 | d |
  14467. #+BEGIN_SRC emacs-lisp :var data=example-table[,0]
  14468. data
  14469. #+END_SRC
  14470. #+RESULTS:
  14471. | 1 | 2 | 3 | 4 |
  14472. @end example
  14473. Index referencing can be used for tables and code blocks. Index
  14474. referencing can handle any number of dimensions. Commas delimit
  14475. multiple dimensions, as shown below.
  14476. @example
  14477. #+NAME: 3D
  14478. #+BEGIN_SRC emacs-lisp
  14479. '(((1 2 3) (4 5 6) (7 8 9))
  14480. ((10 11 12) (13 14 15) (16 17 18))
  14481. ((19 20 21) (22 23 24) (25 26 27)))
  14482. #+END_SRC
  14483. #+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
  14484. data
  14485. #+END_SRC
  14486. #+RESULTS:
  14487. | 11 | 14 | 17 |
  14488. @end example
  14489. Note that row names and column names are not removed prior to variable
  14490. indexing. You need to take them into account, even when @samp{colnames} or
  14491. @samp{rownames} header arguments remove them.
  14492. Emacs lisp code can also set the values for variables. To
  14493. differentiate a value from Lisp code, Org interprets any value
  14494. starting with @samp{(}, @samp{[}, @samp{'} or @samp{`} as Emacs Lisp code. The result of
  14495. evaluating that code is then assigned to the value of that variable.
  14496. The following example shows how to reliably query and pass the file
  14497. name of the Org mode buffer to a code block using headers. We need
  14498. reliability here because the file's name could change once the code in
  14499. the block starts executing.
  14500. @example
  14501. #+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
  14502. wc -w $filename
  14503. #+END_SRC
  14504. @end example
  14505. Note that values read from tables and lists are not mistakenly
  14506. evaluated as Emacs Lisp code, as illustrated in the following example.
  14507. @example
  14508. #+NAME: table
  14509. | (a b c) |
  14510. #+HEADER: :var data=table[0,0]
  14511. #+BEGIN_SRC perl
  14512. $data
  14513. #+END_SRC
  14514. #+RESULTS:
  14515. : (a b c)
  14516. @end example
  14517. @anchor{Using sessions}
  14518. @subheading Using sessions
  14519. @cindex using sessions in code blocks
  14520. @cindex @samp{session}, header argument
  14521. Two code blocks can share the same environment. The @samp{session} header
  14522. argument is for running multiple source code blocks under one session.
  14523. Org runs code blocks with the same session name in the same
  14524. interpreter process.
  14525. @table @asis
  14526. @item @samp{none}
  14527. Default. Each code block gets a new interpreter process to
  14528. execute. The process terminates once the block is evaluated.
  14529. @item @var{STRING}
  14530. Any string besides @samp{none} turns that string into the name of that
  14531. session. For example, @samp{:session STRING} names it @samp{STRING}. If
  14532. @samp{session} has no value, then the session name is derived from the
  14533. source language identifier. Subsequent blocks with the same
  14534. source code language use the same session. Depending on the
  14535. language, state variables, code from other blocks, and the
  14536. overall interpreted environment may be shared. Some interpreted
  14537. languages support concurrent sessions when subsequent source code
  14538. language blocks change session names.
  14539. @end table
  14540. Only languages that provide interactive evaluation can have session
  14541. support. Not all languages provide this support, such as C and ditaa.
  14542. Even languages, such as Python and Haskell, that do support
  14543. interactive evaluation impose limitations on allowable language
  14544. constructs that can run interactively. Org inherits those limitations
  14545. for those code blocks running in a session.
  14546. @anchor{Choosing a working directory}
  14547. @subheading Choosing a working directory
  14548. @cindex working directory, in a code block
  14549. @cindex @samp{dir}, header argument
  14550. The @samp{dir} header argument specifies the default directory during code
  14551. block execution. If it is absent, then the directory associated with
  14552. the current buffer is used. In other words, supplying @samp{:dir PATH}
  14553. temporarily has the same effect as changing the current directory with
  14554. @kbd{M-x cd PATH}, and then not setting @samp{dir}. Under the
  14555. surface, @samp{dir} simply sets the value of the Emacs variable
  14556. @code{default-directory}.
  14557. For example, to save the plot file in the @samp{Work/} folder of the home
  14558. directory---notice tilde is expanded:
  14559. @example
  14560. #+BEGIN_SRC R :file myplot.png :dir ~/Work
  14561. matplot(matrix(rnorm(100), 10), type="l")
  14562. #+END_SRC
  14563. @end example
  14564. To evaluate the code block on a remote machine, supply a remote
  14565. directory name using Tramp syntax. For example:
  14566. @example
  14567. #+BEGIN_SRC R :file plot.png :dir /scp:dand@@yakuba.princeton.edu:
  14568. plot(1:10, main=system("hostname", intern=TRUE))
  14569. #+END_SRC
  14570. @end example
  14571. Org first captures the text results as usual for insertion in the Org
  14572. file. Then Org also inserts a link to the remote file, thanks to
  14573. Emacs Tramp. Org constructs the remote path to the file name from
  14574. @samp{dir} and @code{default-directory}, as illustrated here:
  14575. @example
  14576. [[file:/scp:dand@@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
  14577. @end example
  14578. When @samp{dir} is used with @samp{session}, Org sets the starting directory for
  14579. a new session. But Org does not alter the directory of an already
  14580. existing session.
  14581. Do not use @samp{dir} with @samp{:exports results} or with @samp{:exports both} to
  14582. avoid Org inserting incorrect links to remote files. That is because
  14583. Org does not expand @code{default directory} to avoid some underlying
  14584. portability issues.
  14585. @anchor{Inserting headers and footers}
  14586. @subheading Inserting headers and footers
  14587. @cindex headers, in code blocks
  14588. @cindex footers, in code blocks
  14589. @cindex @samp{prologue}, header argument
  14590. The @samp{prologue} header argument is for appending to the top of the code
  14591. block for execution, like a reset instruction. For example, you may
  14592. use @samp{:prologue "reset"} in a Gnuplot code block or, for every such
  14593. block:
  14594. @lisp
  14595. (add-to-list 'org-babel-default-header-args:gnuplot
  14596. '((:prologue . "reset")))
  14597. @end lisp
  14598. @cindex @samp{epilogue}, header argument
  14599. Likewise, the value of the @samp{epilogue} header argument is for appending
  14600. to the end of the code block for execution.
  14601. @node Evaluating Code Blocks
  14602. @section Evaluating Code Blocks
  14603. @cindex code block, evaluating
  14604. @cindex source code, evaluating
  14605. @cindex @samp{RESULTS}, keyword
  14606. A note about security: With code evaluation comes the risk of harm.
  14607. Org safeguards by prompting for user's permission before executing any
  14608. code in the source block. To customize this safeguard, or disable it,
  14609. see @ref{Code Evaluation Security}.
  14610. @anchor{How to evaluate source code}
  14611. @subheading How to evaluate source code
  14612. Org captures the results of the code block evaluation and inserts them
  14613. in the Org file, right after the code block. The insertion point is
  14614. after a newline and the @samp{RESULTS} keyword. Org creates the @samp{RESULTS}
  14615. keyword if one is not already there.
  14616. By default, Org enables only Emacs Lisp code blocks for execution.
  14617. See @ref{Languages} to enable other languages.
  14618. @kindex C-c C-c
  14619. @kindex C-c C-v e
  14620. @findex org-babel-execute-src-block
  14621. Org provides many ways to execute code blocks. @kbd{C-c C-c} or
  14622. @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
  14623. to remove code evaluation from the @kbd{C-c C-c} key binding.} calls the
  14624. @code{org-babel-execute-src-block} function, which executes the code in the
  14625. block, collects the results, and inserts them in the buffer.
  14626. @cindex @samp{CALL}, keyword
  14627. @vindex org-babel-inline-result-wrap
  14628. By calling a named code block@footnote{Actually, the constructs @samp{call_<name>()} and @samp{src_<lang>@{@}}
  14629. are not evaluated when they appear in a keyword line---i.e. lines
  14630. starting with @samp{#+KEYWORD:}, see @ref{In-buffer Settings}.} from an Org mode buffer or
  14631. a table. Org can call the named code blocks from the current Org mode
  14632. buffer or from the ``Library of Babel'' (see @ref{Library of Babel}).
  14633. The syntax for @samp{CALL} keyword is:
  14634. @example
  14635. #+CALL: <name>(<arguments>)
  14636. #+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
  14637. @end example
  14638. The syntax for inline named code blocks is:
  14639. @example
  14640. ... call_<name>(<arguments>) ...
  14641. ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
  14642. @end example
  14643. When inline syntax is used, the result is wrapped based on the
  14644. variable @code{org-babel-inline-result-wrap}, which by default is set to
  14645. @code{"=%s="} to produce verbatim text suitable for markup.
  14646. @table @asis
  14647. @item @samp{<name>}
  14648. 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
  14649. located in another file, start @samp{<name>} with the file name
  14650. followed by a colon. For example, in order to execute a block
  14651. named @samp{clear-data} in @samp{file.org}, you can write the following:
  14652. @example
  14653. #+CALL: file.org:clear-data()
  14654. @end example
  14655. @item @samp{<arguments>}
  14656. Org passes arguments to the code block using standard function
  14657. call syntax. For example, a @samp{#+CALL:} line that passes @samp{4} to
  14658. a code block named @samp{double}, which declares the header argument
  14659. @samp{:var n=2}, would be written as:
  14660. @example
  14661. #+CALL: double(n=4)
  14662. @end example
  14663. @noindent
  14664. Note how this function call syntax is different from the header
  14665. argument syntax.
  14666. @item @samp{<inside header arguments>}
  14667. Org passes inside header arguments to the named code block using
  14668. the header argument syntax. Inside header arguments apply to
  14669. code block evaluation. For example, @samp{[:results output]} collects
  14670. results printed to stdout during code execution of that block.
  14671. Note how this header argument syntax is different from the
  14672. function call syntax.
  14673. @item @samp{<end header arguments>}
  14674. End header arguments affect the results returned by the code
  14675. block. For example, @samp{:results html} wraps the results in
  14676. a @samp{#+BEGIN_EXPORT html} block before inserting the results in the
  14677. Org buffer.
  14678. @end table
  14679. @anchor{Limit code block evaluation}
  14680. @subheading Limit code block evaluation
  14681. @cindex @samp{eval}, header argument
  14682. @cindex control code block evaluation
  14683. The @samp{eval} header argument can limit evaluation of specific code
  14684. blocks and @samp{CALL} keyword. It is useful for protection against
  14685. evaluating untrusted code blocks by prompting for a confirmation.
  14686. @table @asis
  14687. @item @samp{never} or @samp{no}
  14688. Org never evaluates the source code.
  14689. @item @samp{query}
  14690. Org prompts the user for permission to evaluate the source code.
  14691. @item @samp{never-export} or @samp{no-export}
  14692. Org does not evaluate the source code when exporting, yet the
  14693. user can evaluate it interactively.
  14694. @item @samp{query-export}
  14695. Org prompts the user for permission to evaluate the source code
  14696. during export.
  14697. @end table
  14698. If @samp{eval} header argument is not set, then Org determines whether to
  14699. evaluate the source code from the @code{org-confirm-babel-evaluate}
  14700. variable (see @ref{Code Evaluation Security}).
  14701. @anchor{Cache results of evaluation}
  14702. @subheading Cache results of evaluation
  14703. @cindex @samp{cache}, header argument
  14704. @cindex cache results of code evaluation
  14705. The @samp{cache} header argument is for caching results of evaluating code
  14706. blocks. Caching results can avoid re-evaluating a code block that
  14707. have not changed since the previous run. To benefit from the cache
  14708. and avoid redundant evaluations, the source block must have a result
  14709. already present in the buffer, and neither the header
  14710. arguments---including the value of @samp{var} references---nor the text of
  14711. the block itself has changed since the result was last computed. This
  14712. feature greatly helps avoid long-running calculations. For some edge
  14713. cases, however, the cached results may not be reliable.
  14714. The caching feature is best for when code blocks are pure functions,
  14715. that is functions that return the same value for the same input
  14716. arguments (see @ref{Environment of a Code Block}), and that do not have
  14717. side effects, and do not rely on external variables other than the
  14718. input arguments. Functions that depend on a timer, file system
  14719. objects, and random number generators are clearly unsuitable for
  14720. caching.
  14721. A note of warning: when @samp{cache} is used in a session, caching may
  14722. cause unexpected results.
  14723. When the caching mechanism tests for any source code changes, it does
  14724. not expand Noweb style references (see @ref{Noweb Reference Syntax}). For
  14725. reasons why, see @uref{http://thread.gmane.org/gmane.emacs.orgmode/79046}.
  14726. The @samp{cache} header argument can have one of two values: @samp{yes} or @samp{no}.
  14727. @table @asis
  14728. @item @samp{no}
  14729. Default. No caching of results; code block evaluated every
  14730. time.
  14731. @item @samp{yes}
  14732. Whether to run the code or return the cached results is
  14733. determined by comparing the SHA1 hash value of the combined code
  14734. block and arguments passed to it. This hash value is packed on
  14735. the @samp{#+RESULTS:} line from previous evaluation. When hash values
  14736. match, Org does not evaluate the code block. When hash values
  14737. mismatch, Org evaluates the code block, inserts the results,
  14738. recalculates the hash value, and updates @samp{#+RESULTS:} line.
  14739. @end table
  14740. In this example, both functions are cached. But @samp{caller} runs only if
  14741. the result from @samp{random} has changed since the last run.
  14742. @example
  14743. #+NAME: random
  14744. #+BEGIN_SRC R :cache yes
  14745. runif(1)
  14746. #+END_SRC
  14747. #+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
  14748. 0.4659510825295
  14749. #+NAME: caller
  14750. #+BEGIN_SRC emacs-lisp :var x=random :cache yes
  14751. x
  14752. #+END_SRC
  14753. #+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
  14754. 0.254227238707244
  14755. @end example
  14756. @node Results of Evaluation
  14757. @section Results of Evaluation
  14758. @cindex code block, results of evaluation
  14759. @cindex source code, results of evaluation
  14760. @cindex @samp{results}, header argument
  14761. How Org handles results of a code block execution depends on many
  14762. header arguments working together. The primary determinant, however,
  14763. is the @samp{results} header argument. It accepts four classes of options.
  14764. Each code block can take only one option per class:
  14765. @table @asis
  14766. @item collection
  14767. For how the results should be collected from the code block;
  14768. @item type
  14769. For which type of result the code block will return; affects how
  14770. Org processes and inserts results in the Org buffer;
  14771. @item format
  14772. For the result; affects how Org processes and inserts results in
  14773. the Org buffer;
  14774. @item handling
  14775. For processing results after evaluation of the code block;
  14776. @end table
  14777. @anchor{Collection}
  14778. @subheading Collection
  14779. Collection options specify the results. Choose one of the options;
  14780. they are mutually exclusive.
  14781. @table @asis
  14782. @item @samp{value}
  14783. Default. Functional mode. Org gets the value by wrapping the
  14784. code in a function definition in the language of the source
  14785. block. That is why when using @samp{:results value}, code should
  14786. execute like a function and return a value. For languages like
  14787. Python, an explicit @code{return} statement is mandatory when using
  14788. @samp{:results value}. Result is the value returned by the last
  14789. statement in the code block.
  14790. When evaluating the code block in a session (see @ref{Environment of a Code Block}), Org passes the code to an interpreter running as
  14791. an interactive Emacs inferior process. Org gets the value from
  14792. the source code interpreter's last statement output. Org has to
  14793. use language-specific methods to obtain the value. For example,
  14794. from the variable @code{_} in Python and Ruby, and the value of
  14795. @code{.Last.value} in R.
  14796. @item @samp{output}
  14797. Scripting mode. Org passes the code to an external process
  14798. running the interpreter. Org returns the contents of the
  14799. standard output stream as text results.
  14800. When using a session, Org passes the code to the interpreter
  14801. running as an interactive Emacs inferior process. Org
  14802. concatenates any text output from the interpreter and returns the
  14803. collection as a result.
  14804. Note that this collection is not the same as that would be
  14805. collected from stdout of a non-interactive interpreter running as
  14806. an external process. Compare for example these two blocks:
  14807. @example
  14808. #+BEGIN_SRC python :results output
  14809. print "hello"
  14810. 2
  14811. print "bye"
  14812. #+END_SRC
  14813. #+RESULTS:
  14814. : hello
  14815. : bye
  14816. @end example
  14817. In the above non-session mode, the ``2'' is not printed; so it does
  14818. not appear in results.
  14819. @example
  14820. #+BEGIN_SRC python :results output :session
  14821. print "hello"
  14822. 2
  14823. print "bye"
  14824. #+END_SRC
  14825. #+RESULTS:
  14826. : hello
  14827. : 2
  14828. : bye
  14829. @end example
  14830. In the above session, the interactive interpreter receives and
  14831. prints ``2''. Results show that.
  14832. @end table
  14833. @anchor{Type}
  14834. @subheading Type
  14835. Type tells what result types to expect from the execution of the code
  14836. block. Choose one of the options; they are mutually exclusive. The
  14837. default behavior is to automatically determine the result type.
  14838. @table @asis
  14839. @item @samp{table}
  14840. @itemx @samp{vector}
  14841. Interpret the results as an Org table. If the result is a single
  14842. value, create a table with one row and one column. Usage
  14843. example: @samp{:results value table}.
  14844. @cindex @samp{hlines}, header argument
  14845. In-between each table row or below the table headings, sometimes
  14846. results have horizontal lines, which are also known as ``hlines''.
  14847. The @samp{hlines} argument with the default @samp{no} value strips such
  14848. lines from the input table. For most code, this is desirable, or
  14849. else those @samp{hline} symbols raise unbound variable errors.
  14850. A @samp{yes} accepts such lines, as demonstrated in the following
  14851. example.
  14852. @example
  14853. #+NAME: many-cols
  14854. | a | b | c |
  14855. |---+---+---|
  14856. | d | e | f |
  14857. |---+---+---|
  14858. | g | h | i |
  14859. #+NAME: no-hline
  14860. #+BEGIN_SRC python :var tab=many-cols :hlines no
  14861. return tab
  14862. #+END_SRC
  14863. #+RESULTS: no-hline
  14864. | a | b | c |
  14865. | d | e | f |
  14866. | g | h | i |
  14867. #+NAME: hlines
  14868. #+BEGIN_SRC python :var tab=many-cols :hlines yes
  14869. return tab
  14870. #+END_SRC
  14871. #+RESULTS: hlines
  14872. | a | b | c |
  14873. |---+---+---|
  14874. | d | e | f |
  14875. |---+---+---|
  14876. | g | h | i |
  14877. @end example
  14878. @item @samp{list}
  14879. Interpret the results as an Org list. If the result is a single
  14880. value, create a list of one element.
  14881. @item @samp{scalar}
  14882. @itemx @samp{verbatim}
  14883. Interpret literally and insert as quoted text. Do not create
  14884. a table. Usage example: @samp{:results value verbatim}.
  14885. @item @samp{file}
  14886. Interpret as a filename. Save the results of execution of the
  14887. code block to that file, then insert a link to it. You can
  14888. control both the filename and the description associated to the
  14889. link.
  14890. @cindex @samp{file}, header argument
  14891. @cindex @samp{output-dir}, header argument
  14892. Org first tries to generate the filename from the value of the
  14893. @samp{file} header argument and the directory specified using the
  14894. @samp{output-dir} header arguments. If @samp{output-dir} is not specified,
  14895. Org assumes it is the current directory.
  14896. @example
  14897. #+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/
  14898. size(2cm);
  14899. draw(unitcircle);
  14900. #+END_SRC
  14901. @end example
  14902. @cindex @samp{file-ext}, header argument
  14903. If @samp{file} is missing, Org generates the base name of the output
  14904. file from the name of the code block, and its extension from the
  14905. @samp{file-ext} header argument. In that case, both the name and the
  14906. extension are mandatory.
  14907. @example
  14908. #+name: circle
  14909. #+BEGIN_SRC asymptote :results value file :file-ext pdf
  14910. size(2cm);
  14911. draw(unitcircle);
  14912. #+END_SRC
  14913. @end example
  14914. @cindex @samp{file-desc}, header argument
  14915. The @samp{file-desc} header argument defines the description (see
  14916. @ref{Link Format}) for the link. If @samp{file-desc} has no value, Org
  14917. uses the generated file name for both the ``link'' and
  14918. ``description'' parts of the link.
  14919. @end table
  14920. @anchor{Format}
  14921. @subheading Format
  14922. Format pertains to the type of the result returned by the code block.
  14923. Choose one of the options; they are mutually exclusive. The default
  14924. follows from the type specified above.
  14925. @table @asis
  14926. @item @samp{raw}
  14927. Interpreted as raw Org mode. Inserted directly into the buffer.
  14928. Aligned if it is a table. Usage example: @samp{:results value raw}.
  14929. @item @samp{org}
  14930. Results enclosed in a @samp{BEGIN_SRC org} block. For comma-escape,
  14931. either @kbd{@key{TAB}} in the block, or export the file. Usage
  14932. example: @samp{:results value org}.
  14933. @item @samp{html}
  14934. Results enclosed in a @samp{BEGIN_EXPORT html} block. Usage example:
  14935. @samp{:results value html}.
  14936. @item @samp{latex}
  14937. Results enclosed in a @samp{BEGIN_EXPORT latex} block. Usage example:
  14938. @samp{:results value latex}.
  14939. @item @samp{code}
  14940. Result enclosed in a code block. Useful for parsing. Usage
  14941. example: @samp{:results value code}.
  14942. @item @samp{pp}
  14943. Result converted to pretty-print source code. Enclosed in a code
  14944. block. Languages supported: Emacs Lisp, Python, and Ruby. Usage
  14945. example: @samp{:results value pp}.
  14946. @item @samp{drawer}
  14947. Result wrapped in a @samp{RESULTS} drawer. Useful for containing
  14948. @samp{raw} or @samp{org} results for later scripting and automated
  14949. processing. Usage example: @samp{:results value drawer}.
  14950. @end table
  14951. @anchor{Handling}
  14952. @subheading Handling
  14953. Handling options after collecting the results.
  14954. @table @asis
  14955. @item @samp{silent}
  14956. Do not insert results in the Org mode buffer, but echo them in
  14957. the minibuffer. Usage example: @samp{:results output silent}.
  14958. @item @samp{replace}
  14959. Default. Insert results in the Org buffer. Remove previous
  14960. results. Usage example: @samp{:results output replace}.
  14961. @item @samp{append}
  14962. Append results to the Org buffer. Latest results are at the
  14963. bottom. Does not remove previous results. Usage example:
  14964. @samp{:results output append}.
  14965. @item @samp{prepend}
  14966. Prepend results to the Org buffer. Latest results are at the
  14967. top. Does not remove previous results. Usage example: @samp{:results
  14968. output prepend}.
  14969. @end table
  14970. @anchor{Post-processing}
  14971. @subheading Post-processing
  14972. @cindex @samp{post}, header argument
  14973. @cindex @samp{*this*}, in @samp{post} header argument
  14974. The @samp{post} header argument is for post-processing results from block
  14975. evaluation. When @samp{post} has any value, Org binds the results to
  14976. @code{*this*} variable for easy passing to @samp{var} header argument
  14977. specifications (see @ref{Environment of a Code Block}). That makes results
  14978. available to other code blocks, or even for direct Emacs Lisp code
  14979. execution.
  14980. The following two examples illustrate @samp{post} header argument in
  14981. action. The first one shows how to attach an @samp{ATTR_LATEX} keyword
  14982. using @samp{post}.
  14983. @example
  14984. #+NAME: attr_wrap
  14985. #+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output
  14986. echo "#+ATTR_LATEX: :width $width"
  14987. echo "$data"
  14988. #+END_SRC
  14989. #+HEADER: :file /tmp/it.png
  14990. #+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer
  14991. digraph@{
  14992. a -> b;
  14993. b -> c;
  14994. c -> a;
  14995. @}
  14996. #+end_src
  14997. #+RESULTS:
  14998. :RESULTS:
  14999. #+ATTR_LATEX :width 5cm
  15000. [[file:/tmp/it.png]]
  15001. :END:
  15002. @end example
  15003. The second example shows use of @samp{colnames} header argument in @samp{post}
  15004. to pass data between code blocks.
  15005. @example
  15006. #+NAME: round-tbl
  15007. #+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f"
  15008. (mapcar (lambda (row)
  15009. (mapcar (lambda (cell)
  15010. (if (numberp cell)
  15011. (format fmt cell)
  15012. cell))
  15013. row))
  15014. tbl)
  15015. #+end_src
  15016. #+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*)
  15017. set.seed(42)
  15018. data.frame(foo=rnorm(1))
  15019. #+END_SRC
  15020. #+RESULTS:
  15021. | foo |
  15022. |-------|
  15023. | 1.371 |
  15024. @end example
  15025. @node Exporting Code Blocks
  15026. @section Exporting Code Blocks
  15027. @cindex code block, exporting
  15028. @cindex source code, exporting
  15029. It is possible to export the @emph{code} of code blocks, the @emph{results} of
  15030. code block evaluation, @emph{both} the code and the results of code block
  15031. evaluation, or @emph{none}. Org defaults to exporting @emph{code} for most
  15032. languages. For some languages, such as ditaa, Org defaults to
  15033. @emph{results}. To export just the body of code blocks, see @ref{Literal Examples}. To selectively export sub-trees of an Org document, see
  15034. @ref{Exporting}.
  15035. @cindex @samp{export}, header argument
  15036. The @samp{exports} header argument is to specify if that part of the Org
  15037. file is exported to, say, HTML or @LaTeX{} formats.
  15038. @table @asis
  15039. @item @samp{code}
  15040. The default. The body of code is included into the exported
  15041. file. Example: @samp{:exports code}.
  15042. @item @samp{results}
  15043. The results of evaluation of the code is included in the exported
  15044. file. Example: @samp{:exports results}.
  15045. @item @samp{both}
  15046. Both the code and results of evaluation are included in the
  15047. exported file. Example: @samp{:exports both}.
  15048. @item @samp{none}
  15049. Neither the code nor the results of evaluation is included in the
  15050. exported file. Whether the code is evaluated at all depends on
  15051. other options. Example: @samp{:exports none}.
  15052. @end table
  15053. @vindex org-export-use-babel
  15054. To stop Org from evaluating code blocks to speed exports, use the
  15055. header argument @samp{:eval never-export} (see @ref{Evaluating Code Blocks}).
  15056. To stop Org from evaluating code blocks for greater security, set the
  15057. @code{org-export-use-babel} variable to @code{nil}, but understand that header
  15058. arguments will have no effect.
  15059. Turning off evaluation comes in handy when batch processing. For
  15060. example, markup languages for wikis, which have a high risk of
  15061. untrusted code. Stopping code block evaluation also stops evaluation
  15062. of all header arguments of the code block. This may not be desirable
  15063. in some circumstances. So during export, to allow evaluation of just
  15064. the header arguments but not any code evaluation in the source block,
  15065. set @samp{:eval never-export} (see @ref{Evaluating Code Blocks}).
  15066. Org never evaluates code blocks in commented sub-trees when exporting
  15067. (see @ref{Comment Lines}). On the other hand, Org does evaluate code
  15068. blocks in sub-trees excluded from export (see @ref{Export Settings}).
  15069. @node Extracting Source Code
  15070. @section Extracting Source Code
  15071. @cindex tangling
  15072. @cindex source code, extracting
  15073. @cindex code block, extracting source code
  15074. Extracting source code from code blocks is a basic task in literate
  15075. programming. Org has features to make this easy. In literate
  15076. programming parlance, documents on creation are @emph{woven} with code and
  15077. documentation, and on export, the code is tangled for execution by
  15078. a computer. Org facilitates weaving and tangling for producing,
  15079. maintaining, sharing, and exporting literate programming documents.
  15080. Org provides extensive customization options for extracting source
  15081. code.
  15082. When Org tangles code blocks, it expands, merges, and transforms them.
  15083. Then Org recomposes them into one or more separate files, as
  15084. configured through the options. During this tangling process, Org
  15085. expands variables in the source code, and resolves any Noweb style
  15086. references (see @ref{Noweb Reference Syntax}).
  15087. @anchor{Header arguments}
  15088. @subheading Header arguments
  15089. @cindex @samp{tangle}, header argument
  15090. The @samp{tangle} header argument specifies if the code block is exported
  15091. to source file(s).
  15092. @table @asis
  15093. @item @samp{yes}
  15094. Export the code block to source file. The file name for the
  15095. source file is derived from the name of the Org file, and the
  15096. file extension is derived from the source code language
  15097. identifier. Example: @samp{:tangle yes}.
  15098. @item @samp{no}
  15099. The default. Do not extract the code in a source code file.
  15100. Example: @samp{:tangle no}.
  15101. @item @var{FILENAME}
  15102. Export the code block to source file whose file name is derived
  15103. from any string passed to the @samp{tangle} header argument. Org
  15104. derives the file name as being relative to the directory of the
  15105. Org file's location. Example: @samp{:tangle FILENAME}.
  15106. @end table
  15107. @cindex @samp{mkdirp}, header argument
  15108. The @samp{mkdirp} header argument creates parent directories for tangled
  15109. files if the directory does not exist. @samp{yes} enables directory
  15110. creation and @samp{no} inhibits directory creation.
  15111. @cindex @samp{comments}, header argument
  15112. The @samp{comments} header argument controls inserting comments into
  15113. tangled files. These are above and beyond whatever comments may
  15114. already exist in the code block.
  15115. @table @asis
  15116. @item @samp{no}
  15117. The default. Do not insert any extra comments during tangling.
  15118. @item @samp{link}
  15119. Wrap the code block in comments. Include links pointing back to
  15120. the place in the Org file from where the code was tangled.
  15121. @item @samp{yes}
  15122. Kept for backward compatibility; same as @samp{link}.
  15123. @item @samp{org}
  15124. Nearest headline text from Org file is inserted as comment. The
  15125. exact text that is inserted is picked from the leading context of
  15126. the source block.
  15127. @item @samp{both}
  15128. Includes both @samp{link} and @samp{org} options.
  15129. @item @samp{noweb}
  15130. Includes @samp{link} option, expands Noweb references (see @ref{Noweb Reference Syntax}), and wraps them in link comments inside the
  15131. body of the code block.
  15132. @end table
  15133. @cindex @samp{padline}, header argument
  15134. The @samp{padline} header argument controls insertion of newlines to pad
  15135. source code in the tangled file.
  15136. @table @asis
  15137. @item @samp{yes}
  15138. Default. Insert a newline before and after each code block in
  15139. the tangled file.
  15140. @item @samp{no}
  15141. Do not insert newlines to pad the tangled code blocks.
  15142. @end table
  15143. @cindex @samp{shebang}, header argument
  15144. The @samp{shebang} header argument can turn results into executable script
  15145. files. By setting it to a string value---for example, @samp{:shebang
  15146. "#!/bin/bash"}---Org inserts that string as the first line of the
  15147. tangled file that the code block is extracted to. Org then turns on
  15148. the tangled file's executable permission.
  15149. @cindex @samp{no-expand}, header argument
  15150. By default Org expands code blocks during tangling. The @samp{no-expand}
  15151. header argument turns off such expansions. Note that one side-effect
  15152. of expansion by @code{org-babel-expand-src-block} also assigns values (see
  15153. @ref{Environment of a Code Block}) to variables. Expansions also replace
  15154. Noweb references with their targets (see @ref{Noweb Reference Syntax}).
  15155. Some of these expansions may cause premature assignment, hence this
  15156. option. This option makes a difference only for tangling. It has no
  15157. effect when exporting since code blocks for execution have to be
  15158. expanded anyway.
  15159. @anchor{Functions}
  15160. @subheading Functions
  15161. @table @asis
  15162. @item @code{org-babel-tangle}
  15163. @findex org-babel-tangle
  15164. @kindex C-c C-v t
  15165. Tangle the current file. Bound to @kbd{C-c C-v t}.
  15166. With prefix argument only tangle the current code block.
  15167. @item @code{org-babel-tangle-file}
  15168. @findex org-babel-tangle-file
  15169. @kindex C-c C-v f
  15170. Choose a file to tangle. Bound to @kbd{C-c C-v f}.
  15171. @end table
  15172. @anchor{Hooks (1)}
  15173. @subheading Hooks
  15174. @table @asis
  15175. @item @code{org-babel-post-tangle-hook}
  15176. @vindex org-babel-post-tangle-hook
  15177. This hook is run from within code files tangled by
  15178. @code{org-babel-tangle}, making it suitable for post-processing,
  15179. compilation, and evaluation of code in the tangled files.
  15180. @end table
  15181. @anchor{Jumping between code and Org}
  15182. @subheading Jumping between code and Org
  15183. @findex org-babel-tangle-jump-to-org
  15184. Debuggers normally link errors and messages back to the source code.
  15185. But for tangled files, we want to link back to the Org file, not to
  15186. the tangled source file. To make this extra jump, Org uses
  15187. @code{org-babel-tangle-jump-to-org} function with two additional source
  15188. code block header arguments:
  15189. @enumerate
  15190. @item
  15191. Set @samp{padline} to true---this is the default setting.
  15192. @item
  15193. Set @samp{comments} to @samp{link}, which makes Org insert links to the Org
  15194. file.
  15195. @end enumerate
  15196. @node Languages
  15197. @section Languages
  15198. @cindex babel, languages
  15199. @cindex source code, languages
  15200. @cindex code block, languages
  15201. Code blocks in the following languages are supported.
  15202. @multitable {aaaaaaaaaa} {aaaaaaaaaa} {aaaaaaaaaaaaaa} {aaaaaaaaaa}
  15203. @headitem Language
  15204. @tab Identifier
  15205. @tab Language
  15206. @tab Identifier
  15207. @item Asymptote
  15208. @tab asymptote
  15209. @tab Awk
  15210. @tab awk
  15211. @item C
  15212. @tab C
  15213. @tab C++
  15214. @tab C++
  15215. @item Clojure
  15216. @tab clojure
  15217. @tab CSS
  15218. @tab css
  15219. @item D
  15220. @tab d
  15221. @tab ditaa
  15222. @tab ditaa
  15223. @item Graphviz
  15224. @tab dot
  15225. @tab Emacs Calc
  15226. @tab calc
  15227. @item Emacs Lisp
  15228. @tab emacs-lisp
  15229. @tab Fortran
  15230. @tab fortran
  15231. @item Gnuplot
  15232. @tab gnuplot
  15233. @tab Haskell
  15234. @tab haskell
  15235. @item Java
  15236. @tab java
  15237. @tab Javascript
  15238. @tab js
  15239. @item @LaTeX{}
  15240. @tab latex
  15241. @tab Ledger
  15242. @tab ledger
  15243. @item Lisp
  15244. @tab lisp
  15245. @tab Lilypond
  15246. @tab lilypond
  15247. @item Lua
  15248. @tab lua
  15249. @tab MATLAB
  15250. @tab matlab
  15251. @item Mscgen
  15252. @tab mscgen
  15253. @tab Objective Caml
  15254. @tab ocaml
  15255. @item Octave
  15256. @tab octave
  15257. @tab Org mode
  15258. @tab org
  15259. @item Oz
  15260. @tab oz
  15261. @tab Perl
  15262. @tab perl
  15263. @item Plantuml
  15264. @tab plantuml
  15265. @tab Processing.js
  15266. @tab processing
  15267. @item Python
  15268. @tab python
  15269. @tab R
  15270. @tab R
  15271. @item Ruby
  15272. @tab ruby
  15273. @tab Sass
  15274. @tab sass
  15275. @item Scheme
  15276. @tab scheme
  15277. @tab GNU Screen
  15278. @tab screen
  15279. @item Sed
  15280. @tab sed
  15281. @tab shell
  15282. @tab sh
  15283. @item SQL
  15284. @tab sql
  15285. @tab SQLite
  15286. @tab sqlite
  15287. @item Vala
  15288. @tab vala
  15289. @tab
  15290. @tab
  15291. @end multitable
  15292. Additional documentation for some languages is at
  15293. @uref{https://orgmode.org/worg/org-contrib/babel/languages.html}.
  15294. @vindex org-babel-load-languages
  15295. By default, only Emacs Lisp is enabled for evaluation. To enable or
  15296. disable other languages, customize the @code{org-babel-load-languages}
  15297. variable either through the Emacs customization interface, or by
  15298. adding code to the init file as shown next.
  15299. In this example, evaluation is disabled for Emacs Lisp, and enabled
  15300. for R.
  15301. @lisp
  15302. (org-babel-do-load-languages
  15303. 'org-babel-load-languages
  15304. '((emacs-lisp . nil)
  15305. (R . t)))
  15306. @end lisp
  15307. Note that this is not the only way to enable a language. Org also
  15308. enables languages when loaded with @code{require} statement. For example,
  15309. the following enables execution of Clojure code blocks:
  15310. @lisp
  15311. (require 'ob-clojure)
  15312. @end lisp
  15313. @node Editing Source Code
  15314. @section Editing Source Code
  15315. @cindex code block, editing
  15316. @cindex source code, editing
  15317. @kindex C-c '
  15318. Use @kbd{C-c '} to edit the current code block. It opens a new
  15319. major-mode edit buffer containing the body of the source code block,
  15320. ready for any edits. Use @kbd{C-c '} again to close the buffer
  15321. and return to the Org buffer.
  15322. @kindex C-x C-s
  15323. @vindex org-edit-src-auto-save-idle-delay
  15324. @cindex auto-save, in code block editing
  15325. @kbd{C-x C-s} saves the buffer and updates the contents of the
  15326. Org buffer. Set @code{org-edit-src-auto-save-idle-delay} to save the base
  15327. buffer after a certain idle delay time. Set
  15328. @code{org-edit-src-turn-on-auto-save} to auto-save this buffer into
  15329. a separate file using Auto-save mode.
  15330. While editing the source code in the major mode, the Org Src minor
  15331. mode remains active. It provides these customization variables as
  15332. described below. For even more variables, look in the customization
  15333. group @code{org-edit-structure}.
  15334. @table @asis
  15335. @item @code{org-src-lang-modes}
  15336. @vindex org-src-lang-modes
  15337. If an Emacs major-mode named @code{<LANG>-mode} exists, where
  15338. @var{<LANG>} is the language identifier from code block's
  15339. header line, then the edit buffer uses that major mode. Use this
  15340. variable to arbitrarily map language identifiers to major modes.
  15341. @item @code{org-src-window-setup}
  15342. @vindex org-src-window-setup
  15343. For specifying Emacs window arrangement when the new edit buffer
  15344. is created.
  15345. @item @code{org-src-preserve-indentation}
  15346. @cindex indentation, in code blocks
  15347. @vindex org-src-preserve-indentation
  15348. Default is @code{nil}. Source code is indented. This indentation
  15349. applies during export or tangling, and depending on the context,
  15350. may alter leading spaces and tabs. When non-@code{nil}, source code
  15351. is aligned with the leftmost column. No lines are modified
  15352. during export or tangling, which is very useful for white-space
  15353. sensitive languages, such as Python.
  15354. @item @code{org-src-ask-before-returning-to-edit-buffer}
  15355. @vindex org-src-ask-before-returning-to-edit-buffer
  15356. When @code{nil}, Org returns to the edit buffer without further
  15357. prompts. The default prompts for a confirmation.
  15358. @end table
  15359. @vindex org-src-fontify-natively
  15360. @vindex org-src-block-faces
  15361. Set @code{org-src-fontify-natively} to non-@code{nil} to turn on native code
  15362. fontification in the @emph{Org} buffer. Fontification of code blocks can
  15363. give visual separation of text and code on the display page. To
  15364. further customize the appearance of @code{org-block} for specific
  15365. languages, customize @code{org-src-block-faces}. The following example
  15366. shades the background of regular blocks, and colors source blocks only
  15367. for Python and Emacs Lisp languages.
  15368. @lisp
  15369. (require 'color)
  15370. (set-face-attribute 'org-block nil :background
  15371. (color-darken-name
  15372. (face-attribute 'default :background) 3))
  15373. (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
  15374. ("python" (:background "#E5FFB8"))))
  15375. @end lisp
  15376. @node Noweb Reference Syntax
  15377. @section Noweb Reference Syntax
  15378. @cindex code block, Noweb reference
  15379. @cindex syntax, Noweb
  15380. @cindex source code, Noweb reference
  15381. Org supports named blocks in Noweb@footnote{For Noweb literate programming details, see
  15382. @uref{http://www.cs.tufts.edu/~nr/noweb/}.} style syntax:
  15383. @example
  15384. <<CODE-BLOCK-ID>>
  15385. @end example
  15386. Org can replace the construct with the source code, or the results of
  15387. evaluation, of the code block identified as @var{CODE-BLOCK-ID}.
  15388. @cindex @samp{noweb}, header argument
  15389. The @samp{noweb} header argument controls expansion of Noweb syntax
  15390. references. Expansions occur when source code blocks are evaluated,
  15391. tangled, or exported.
  15392. @table @asis
  15393. @item @samp{no}
  15394. Default. No expansion of Noweb syntax references in the body of
  15395. the code when evaluating, tangling, or exporting.
  15396. @item @samp{yes}
  15397. Expansion of Noweb syntax references in the body of the code
  15398. block when evaluating, tangling, or exporting.
  15399. @item @samp{tangle}
  15400. Expansion of Noweb syntax references in the body of the code
  15401. block when tangling. No expansion when evaluating or exporting.
  15402. @item @samp{no-export}
  15403. Expansion of Noweb syntax references in the body of the code
  15404. block when evaluating or tangling. No expansion when exporting.
  15405. @item @samp{strip-export}
  15406. Expansion of Noweb syntax references in the body of the code
  15407. block when expanding prior to evaluating or tangling. Removes
  15408. Noweb syntax references when exporting.
  15409. @item @samp{eval}
  15410. Expansion of Noweb syntax references in the body of the code
  15411. block only before evaluating.
  15412. @end table
  15413. In the following example,
  15414. @example
  15415. #+NAME: initialization
  15416. #+BEGIN_SRC emacs-lisp
  15417. (setq sentence "Never a foot too far, even.")
  15418. #+END_SRC
  15419. #+BEGIN_SRC emacs-lisp :noweb yes
  15420. <<initialization>>
  15421. (reverse sentence)
  15422. #+END_SRC
  15423. @end example
  15424. @noindent
  15425. the second code block is expanded as
  15426. @example
  15427. #+BEGIN_SRC emacs-lisp :noweb yes
  15428. (setq sentence "Never a foot too far, even.")
  15429. (reverse sentence)
  15430. #+END_SRC
  15431. @end example
  15432. Noweb insertions honor prefix characters that appear before the Noweb
  15433. syntax reference. This behavior is illustrated in the following
  15434. example. Because the @samp{<<example>>} Noweb reference appears behind the
  15435. SQL comment syntax, each line of the expanded Noweb reference is
  15436. commented. With:
  15437. @example
  15438. #+NAME: example
  15439. #+BEGIN_SRC text
  15440. this is the
  15441. multi-line body of example
  15442. #+END_SRC
  15443. @end example
  15444. @noindent
  15445. this code block:
  15446. @example
  15447. #+BEGIN_SRC sql :noweb yes
  15448. ---<<example>>
  15449. #+END_SRC
  15450. @end example
  15451. @noindent
  15452. expands to:
  15453. @example
  15454. #+BEGIN_SRC sql :noweb yes
  15455. ---this is the
  15456. ---multi-line body of example
  15457. #+END_SRC
  15458. @end example
  15459. Since this change does not affect Noweb replacement text without
  15460. newlines in them, inline Noweb references are acceptable.
  15461. This feature can also be used for management of indentation in
  15462. exported code snippets. With:
  15463. @example
  15464. #+NAME: if-true
  15465. #+BEGIN_SRC python :exports none
  15466. print('do things when true')
  15467. #+end_src
  15468. #+name: if-false
  15469. #+begin_src python :exports none
  15470. print('do things when false')
  15471. #+end_src
  15472. @end example
  15473. @noindent
  15474. this code block:
  15475. @example
  15476. #+begin_src python :noweb yes :results output
  15477. if true:
  15478. <<if-true>>
  15479. else:
  15480. <<if-false>>
  15481. #+end_src
  15482. @end example
  15483. @noindent
  15484. expands to:
  15485. @example
  15486. if true:
  15487. print('do things when true')
  15488. else:
  15489. print('do things when false')
  15490. @end example
  15491. @cindex @samp{noweb-ref}, header argument
  15492. When expanding Noweb style references, Org concatenates code blocks by
  15493. matching the reference name to either the code block name or, if none
  15494. is found, to the @samp{noweb-ref} header argument.
  15495. For simple concatenation, set this @samp{noweb-ref} header argument at the
  15496. sub-tree or file level. In the example Org file shown next, the body
  15497. of the source code in each block is extracted for concatenation to
  15498. a pure code file when tangled.
  15499. @example
  15500. #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
  15501. <<fullest-disk>>
  15502. #+END_SRC
  15503. * the mount point of the fullest disk
  15504. :PROPERTIES:
  15505. :header-args: :noweb-ref fullest-disk
  15506. :END:
  15507. ** query all mounted disks
  15508. #+BEGIN_SRC sh
  15509. df \
  15510. #+END_SRC
  15511. ** strip the header row
  15512. #+BEGIN_SRC sh
  15513. |sed '1d' \
  15514. #+END_SRC
  15515. ** output mount point of fullest disk
  15516. #+BEGIN_SRC sh
  15517. |awk '@{if (u < +$5) @{u = +$5; m = $6@}@} END @{print m@}'
  15518. #+END_SRC
  15519. @end example
  15520. @cindex @samp{noweb-sep}, header argument
  15521. By default a newline separates each noweb reference concatenation. To
  15522. change this newline separator, edit the @samp{noweb-sep} header argument.
  15523. Eventually, Org can include the results of a code block rather than
  15524. its body. To that effect, append parentheses, possibly including
  15525. arguments, to the code block name, as shown below.
  15526. @example
  15527. <<code-block-name(optional arguments)>>
  15528. @end example
  15529. Note that when using the above approach to a code block's results, the
  15530. code block name set by @samp{NAME} keyword is required; the reference set
  15531. by @samp{noweb-ref} does not work in that case.
  15532. Here is an example that demonstrates how the exported content changes
  15533. when Noweb style references are used with parentheses versus without.
  15534. With:
  15535. @example
  15536. #+NAME: some-code
  15537. #+BEGIN_SRC python :var num=0 :results output :exports none
  15538. print(num*10)
  15539. #+END_SRC
  15540. @end example
  15541. @noindent
  15542. this code block:
  15543. @example
  15544. #+BEGIN_SRC text :noweb yes
  15545. <<some-code>>
  15546. #+END_SRC
  15547. @end example
  15548. @noindent
  15549. expands to:
  15550. @example
  15551. print(num*10)
  15552. @end example
  15553. Below, a similar Noweb style reference is used, but with parentheses,
  15554. while setting a variable @samp{num} to 10:
  15555. @example
  15556. #+BEGIN_SRC text :noweb yes
  15557. <<some-code(num=10)>>
  15558. #+END_SRC
  15559. @end example
  15560. @noindent
  15561. Note that now the expansion contains the results of the code block
  15562. @samp{some-code}, not the code block itself:
  15563. @example
  15564. 100
  15565. @end example
  15566. @node Library of Babel
  15567. @section Library of Babel
  15568. @cindex babel, library of
  15569. @cindex source code, library
  15570. @cindex code block, library
  15571. The ``Library of Babel'' is a collection of code blocks. Like
  15572. a function library, these code blocks can be called from other Org
  15573. files. A collection of useful code blocks is available on @uref{https://orgmode.org/worg/library-of-babel.html, Worg}. For
  15574. remote code block evaluation syntax, see @ref{Evaluating Code Blocks}.
  15575. @kindex C-c C-v i
  15576. @findex org-babel-lob-ingest
  15577. For any user to add code to the library, first save the code in
  15578. regular code blocks of an Org file, and then load the Org file with
  15579. @code{org-babel-lob-ingest}, which is bound to @kbd{C-c C-v i}.
  15580. @node Key bindings and Useful Functions
  15581. @section Key bindings and Useful Functions
  15582. @cindex code block, key bindings
  15583. Many common Org mode key sequences are re-bound depending on
  15584. the context.
  15585. Active key bindings in code blocks:
  15586. @kindex C-c C-c
  15587. @findex org-babel-execute-src-block
  15588. @kindex C-c C-o
  15589. @findex org-babel-open-src-block-result
  15590. @kindex M-UP
  15591. @findex org-babel-load-in-session
  15592. @kindex M-DOWN
  15593. @findex org-babel-pop-to-session
  15594. @multitable @columnfractions 0.2 0.55
  15595. @headitem Key binding
  15596. @tab Function
  15597. @item @kbd{C-c C-c}
  15598. @tab @code{org-babel-execute-src-block}
  15599. @item @kbd{C-c C-o}
  15600. @tab @code{org-babel-open-src-block-result}
  15601. @item @kbd{M-@key{UP}}
  15602. @tab @code{org-babel-load-in-session}
  15603. @item @kbd{M-@key{DOWN}}
  15604. @tab @code{org-babel-pop-to-session}
  15605. @end multitable
  15606. Active key bindings in Org mode buffer:
  15607. @kindex C-c C-v p
  15608. @kindex C-c C-v C-p
  15609. @kindex C-c C-v n
  15610. @kindex C-c C-v C-n
  15611. @kindex C-c C-v e
  15612. @kindex C-c C-v C-e
  15613. @kindex C-c C-v o
  15614. @kindex C-c C-v C-o
  15615. @kindex C-c C-v v
  15616. @kindex C-c C-v C-v
  15617. @kindex C-c C-v u
  15618. @kindex C-c C-v C-u
  15619. @kindex C-c C-v g
  15620. @kindex C-c C-v C-g
  15621. @kindex C-c C-v r
  15622. @kindex C-c C-v C-r
  15623. @kindex C-c C-v b
  15624. @kindex C-c C-v C-b
  15625. @kindex C-c C-v s
  15626. @kindex C-c C-v C-s
  15627. @kindex C-c C-v d
  15628. @kindex C-c C-v C-d
  15629. @kindex C-c C-v t
  15630. @kindex C-c C-v C-t
  15631. @kindex C-c C-v f
  15632. @kindex C-c C-v C-f
  15633. @kindex C-c C-v c
  15634. @kindex C-c C-v C-c
  15635. @kindex C-c C-v j
  15636. @kindex C-c C-v C-j
  15637. @kindex C-c C-v l
  15638. @kindex C-c C-v C-l
  15639. @kindex C-c C-v i
  15640. @kindex C-c C-v C-i
  15641. @kindex C-c C-v I
  15642. @kindex C-c C-v C-I
  15643. @kindex C-c C-v z
  15644. @kindex C-c C-v C-z
  15645. @kindex C-c C-v a
  15646. @kindex C-c C-v C-a
  15647. @kindex C-c C-v h
  15648. @kindex C-c C-v C-h
  15649. @kindex C-c C-v x
  15650. @kindex C-c C-v C-x
  15651. @findex org-babel-previous-src-block
  15652. @findex org-babel-next-src-block
  15653. @findex org-babel-execute-maybe
  15654. @findex org-babel-open-src-block-result
  15655. @findex org-babel-expand-src-block
  15656. @findex org-babel-goto-src-block-head
  15657. @findex org-babel-goto-named-src-block
  15658. @findex org-babel-goto-named-result
  15659. @findex org-babel-execute-buffer
  15660. @findex org-babel-execute-subtree
  15661. @findex org-babel-demarcate-block
  15662. @findex org-babel-tangle
  15663. @findex org-babel-tangle-file
  15664. @findex org-babel-check-src-block
  15665. @findex org-babel-insert-header-arg
  15666. @findex org-babel-load-in-session
  15667. @findex org-babel-lob-ingest
  15668. @findex org-babel-view-src-block-info
  15669. @findex org-babel-switch-to-session-with-code
  15670. @findex org-babel-sha1-hash
  15671. @findex org-babel-describe-bindings
  15672. @findex org-babel-do-key-sequence-in-edit-buffer
  15673. @multitable @columnfractions 0.45 0.55
  15674. @headitem Key binding
  15675. @tab Function
  15676. @item @kbd{C-c C-v p} or @kbd{C-c C-v C-p}
  15677. @tab @code{org-babel-previous-src-block}
  15678. @item @kbd{C-c C-v n} or @kbd{C-c C-v C-n}
  15679. @tab @code{org-babel-next-src-block}
  15680. @item @kbd{C-c C-v e} or @kbd{C-c C-v C-e}
  15681. @tab @code{org-babel-execute-maybe}
  15682. @item @kbd{C-c C-v o} or @kbd{C-c C-v C-o}
  15683. @tab @code{org-babel-open-src-block-result}
  15684. @item @kbd{C-c C-v v} or @kbd{C-c C-v C-v}
  15685. @tab @code{org-babel-expand-src-block}
  15686. @item @kbd{C-c C-v u} or @kbd{C-c C-v C-u}
  15687. @tab @code{org-babel-goto-src-block-head}
  15688. @item @kbd{C-c C-v g} or @kbd{C-c C-v C-g}
  15689. @tab @code{org-babel-goto-named-src-block}
  15690. @item @kbd{C-c C-v r} or @kbd{C-c C-v C-r}
  15691. @tab @code{org-babel-goto-named-result}
  15692. @item @kbd{C-c C-v b} or @kbd{C-c C-v C-b}
  15693. @tab @code{org-babel-execute-buffer}
  15694. @item @kbd{C-c C-v s} or @kbd{C-c C-v C-s}
  15695. @tab @code{org-babel-execute-subtree}
  15696. @item @kbd{C-c C-v d} or @kbd{C-c C-v C-d}
  15697. @tab @code{org-babel-demarcate-block}
  15698. @item @kbd{C-c C-v t} or @kbd{C-c C-v C-t}
  15699. @tab @code{org-babel-tangle}
  15700. @item @kbd{C-c C-v f} or @kbd{C-c C-v C-f}
  15701. @tab @code{org-babel-tangle-file}
  15702. @item @kbd{C-c C-v c} or @kbd{C-c C-v C-c}
  15703. @tab @code{org-babel-check-src-block}
  15704. @item @kbd{C-c C-v j} or @kbd{C-c C-v C-j}
  15705. @tab @code{org-babel-insert-header-arg}
  15706. @item @kbd{C-c C-v l} or @kbd{C-c C-v C-l}
  15707. @tab @code{org-babel-load-in-session}
  15708. @item @kbd{C-c C-v i} or @kbd{C-c C-v C-i}
  15709. @tab @code{org-babel-lob-ingest}
  15710. @item @kbd{C-c C-v I} or @kbd{C-c C-v C-I}
  15711. @tab @code{org-babel-view-src-block-info}
  15712. @item @kbd{C-c C-v z} or @kbd{C-c C-v C-z}
  15713. @tab @code{org-babel-switch-to-session-with-code}
  15714. @item @kbd{C-c C-v a} or @kbd{C-c C-v C-a}
  15715. @tab @code{org-babel-sha1-hash}
  15716. @item @kbd{C-c C-v h} or @kbd{C-c C-v C-h}
  15717. @tab @code{org-babel-describe-bindings}
  15718. @item @kbd{C-c C-v x} or @kbd{C-c C-v C-x}
  15719. @tab @code{org-babel-do-key-sequence-in-edit-buffer}
  15720. @end multitable
  15721. @node Batch Execution
  15722. @section Batch Execution
  15723. @cindex code block, batch execution
  15724. @cindex source code, batch execution
  15725. Org mode features, including working with source code facilities can
  15726. be invoked from the command line. This enables building shell scripts
  15727. for batch processing, running automated system tasks, and expanding
  15728. Org mode's usefulness.
  15729. The sample script shows batch processing of multiple files using
  15730. @code{org-babel-tangle}.
  15731. @example
  15732. #!/bin/sh
  15733. # Tangle files with Org mode
  15734. #
  15735. emacs -Q --batch --eval "
  15736. (progn
  15737. (require 'ob-tangle)
  15738. (dolist (file command-line-args-left)
  15739. (with-current-buffer (find-file-noselect file)
  15740. (org-babel-tangle))))
  15741. " "$@@"
  15742. @end example
  15743. @node Miscellaneous
  15744. @chapter Miscellaneous
  15745. @menu
  15746. * Completion:: M-@key{TAB} guesses completions.
  15747. * Structure Templates:: Quick insertion of structural elements.
  15748. * Speed Keys:: Electric commands at the beginning of a headline.
  15749. * Code Evaluation Security:: Org files evaluate in-line code.
  15750. * Customization:: Adapting Org to your taste.
  15751. * In-buffer Settings:: Overview of keywords.
  15752. * The Very Busy @kbd{C-c C-c} Key:: When in doubt, press @kbd{C-c C-c}.
  15753. * Clean View:: Getting rid of leading stars in the outline.
  15754. * TTY Keys:: Using Org on a tty.
  15755. * Interaction:: With other Emacs packages.
  15756. * Org Crypt:: Encrypting Org files.
  15757. @end menu
  15758. @node Completion
  15759. @section Completion
  15760. @cindex completion, of @TeX{} symbols
  15761. @cindex completion, of TODO keywords
  15762. @cindex completion, of dictionary words
  15763. @cindex completion, of option keywords
  15764. @cindex completion, of tags
  15765. @cindex completion, of property keys
  15766. @cindex completion, of link abbreviations
  15767. @cindex @TeX{} symbol completion
  15768. @cindex TODO keywords completion
  15769. @cindex dictionary word completion
  15770. @cindex option keyword completion
  15771. @cindex tag completion
  15772. @cindex link abbreviations, completion of
  15773. Org has in-buffer completions. Unlike minibuffer completions, which
  15774. are useful for quick command interactions, Org's in-buffer completions
  15775. are more suitable for content creation in Org documents. Type one or
  15776. more letters and invoke the hot key to complete the text in-place.
  15777. Depending on the context and the keys, Org offers different types of
  15778. completions. No minibuffer is involved. Such mode-specific hot keys
  15779. have become an integral part of Emacs and Org provides several
  15780. shortcuts.
  15781. @table @asis
  15782. @item @kbd{M-@key{TAB}}
  15783. @kindex M-TAB
  15784. Complete word at point.
  15785. @itemize
  15786. @item
  15787. At the beginning of a headline, complete TODO keywords.
  15788. @item
  15789. After @samp{\}, complete @TeX{} symbols supported by the exporter.
  15790. @item
  15791. After @samp{*}, complete headlines in the current buffer so that
  15792. they can be used in search links like:
  15793. @example
  15794. [[*find this headline]]
  15795. @end example
  15796. @item
  15797. After @samp{:} in a headline, complete tags. Org deduces the list
  15798. of tags from the @samp{TAGS} in-buffer option (see @ref{Setting Tags}),
  15799. the variable @code{org-tag-alist}, or from all tags used in the
  15800. current buffer.
  15801. @item
  15802. After @samp{:} and not in a headline, complete property keys. The
  15803. list of keys is constructed dynamically from all keys used in
  15804. the current buffer.
  15805. @item
  15806. After @samp{[}, complete link abbreviations (see @ref{Link Abbreviations}).
  15807. @item
  15808. After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
  15809. file-specific @samp{OPTIONS}. After option keyword is complete,
  15810. pressing @kbd{M-@key{TAB}} again inserts example settings for
  15811. this keyword.
  15812. @item
  15813. After @samp{STARTUP} keyword, complete startup items.
  15814. @item
  15815. When point is anywhere else, complete dictionary words using
  15816. Ispell.
  15817. @end itemize
  15818. @end table
  15819. @node Structure Templates
  15820. @section Structure Templates
  15821. @cindex template insertion
  15822. @cindex insertion, of templates
  15823. With just a few keystrokes, it is possible to insert empty structural
  15824. blocks, such as @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}, or to wrap existing
  15825. text in such a block.
  15826. @table @asis
  15827. @item @kbd{C-c C-x w} (@code{org-insert-structure-template})
  15828. Prompt for a type of block structure, and insert the block at
  15829. point. If the region is active, it is wrapped in the block.
  15830. First prompts the user for a key, which is used to look up
  15831. a structure type from the values below. If the key is
  15832. @kbd{@key{TAB}}, the user is prompted to enter a type.
  15833. @end table
  15834. @vindex org-structure-template-alist
  15835. Available structure types are defined in
  15836. @code{org-structure-template-alist}, see the docstring for adding or
  15837. changing values.
  15838. @cindex Tempo
  15839. @cindex template expansion
  15840. @cindex insertion, of templates
  15841. @vindex org-tempo-keywords-alist
  15842. @vindex org-structure-template-alist
  15843. Org Tempo expands snippets to structures defined in
  15844. @code{org-structure-template-alist} and @code{org-tempo-keywords-alist}. For
  15845. example, @kbd{< s @key{TAB}} creates a code block. Enable it by
  15846. customizing @code{org-modules} or add @code{(require 'org-tempo)} to your Emacs
  15847. init file@footnote{For more information, please refer to the commentary section
  15848. in @samp{org-tempo.el}.}.
  15849. @multitable @columnfractions 0.1 0.9
  15850. @item @kbd{a}
  15851. @tab @samp{#+BEGIN_EXPORT ascii} @dots{} @samp{#+END_EXPORT}
  15852. @item @kbd{c}
  15853. @tab @samp{#+BEGIN_CENTER} @dots{} @samp{#+END_CENTER}
  15854. @item @kbd{C}
  15855. @tab @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT}
  15856. @item @kbd{e}
  15857. @tab @samp{#+BEGIN_EXAMPLE} @dots{} @samp{#+END_EXAMPLE}
  15858. @item @kbd{h}
  15859. @tab @samp{#+BEGIN_EXPORT html} @dots{} @samp{#+END_EXPORT}
  15860. @item @kbd{l}
  15861. @tab @samp{#+BEGIN_EXPORT latex} @dots{} @samp{#+END_EXPORT}
  15862. @item @kbd{q}
  15863. @tab @samp{#+BEGIN_QUOTE} @dots{} @samp{#+END_QUOTE}
  15864. @item @kbd{s}
  15865. @tab @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}
  15866. @item @kbd{v}
  15867. @tab @samp{#+BEGIN_VERSE} @dots{} @samp{#+END_VERSE}
  15868. @end multitable
  15869. @node Speed Keys
  15870. @section Speed Keys
  15871. @cindex speed keys
  15872. Single keystrokes can execute custom commands in an Org file when the
  15873. cursor is on a headline. Without the extra burden of a meta or
  15874. modifier key, Speed Keys can speed navigation or execute custom
  15875. commands. Besides faster navigation, Speed Keys may come in handy on
  15876. small mobile devices that do not have full keyboards. Speed Keys may
  15877. also work on TTY devices known for their problems when entering Emacs
  15878. key chords.
  15879. @vindex org-use-speed-commands
  15880. By default, Org has Speed Keys disabled. To activate Speed Keys, set
  15881. the variable @code{org-use-speed-commands} to a non-@code{nil} value. To
  15882. trigger a Speed Key, the cursor must be at the beginning of an Org
  15883. headline, before any of the stars.
  15884. @vindex org-speed-commands-user
  15885. @findex org-speed-command-help
  15886. Org comes with a pre-defined list of Speed Keys. To add or modify
  15887. Speed Keys, customize the variable, @code{org-speed-commands-user}. For
  15888. more details, see the variable's docstring. With Speed Keys
  15889. activated, @kbd{M-x org-speed-command-help}, or @kbd{?} when
  15890. cursor is at the beginning of an Org headline, shows currently active
  15891. Speed Keys, including the user-defined ones.
  15892. @node Code Evaluation Security
  15893. @section Code Evaluation and Security Issues
  15894. Unlike plain text, running code comes with risk. Each @samp{src} code
  15895. block, in terms of risk, is equivalent to an executable file. Org
  15896. therefore puts a few confirmation prompts by default. This is to
  15897. alert the casual user from accidentally running untrusted code.
  15898. For users who do not run code blocks or write code regularly, Org's
  15899. default settings should suffice. However, some users may want to
  15900. tweak the prompts for fewer interruptions. To weigh the risks of
  15901. automatic execution of code blocks, here are some details about code
  15902. evaluation.
  15903. Org evaluates code in the following circumstances:
  15904. @table @asis
  15905. @item @emph{Source code blocks}
  15906. Org evaluates @samp{src} code blocks in an Org file during export.
  15907. Org also evaluates a @samp{src} code block with the @kbd{C-c C-c}
  15908. key chord. Users exporting or running code blocks must load
  15909. files only from trusted sources. Be wary of customizing
  15910. variables that remove or alter default security measures.
  15911. @defopt org-confirm-babel-evaluate
  15912. When @code{t}, Org prompts the user for confirmation before executing
  15913. each code block. When @code{nil}, Org executes code blocks without
  15914. prompting the user for confirmation. When this option is set to
  15915. a custom function, Org invokes the function with these two
  15916. arguments: the source code language and the body of the code
  15917. block. The custom function must return either a @code{t} or @code{nil},
  15918. which determines if the user is prompted. Each source code
  15919. language can be handled separately through this function
  15920. argument.
  15921. @end defopt
  15922. For example, here is how to execute ditaa code blocks without
  15923. prompting:
  15924. @lisp
  15925. (defun my-org-confirm-babel-evaluate (lang body)
  15926. (not (string= lang "ditaa"))) ;don't ask for ditaa
  15927. (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
  15928. @end lisp
  15929. @item @emph{Following @samp{shell} and @samp{elisp} links}
  15930. Org has two link types that can directly evaluate code (see
  15931. @ref{External Links}). Because such code is not visible, these links
  15932. have a potential risk. Org therefore prompts the user when it
  15933. encounters such links. The customization variables are:
  15934. @defopt org-confirm-shell-link-function
  15935. Function that prompts the user before executing a shell link.
  15936. @end defopt
  15937. @defopt org-confirm-elisp-link-function
  15938. Function that prompts the user before executing an Emacs Lisp link.
  15939. @end defopt
  15940. @item @emph{Formulas in tables}
  15941. Formulas in tables (see @ref{The spreadsheet}) are code that is
  15942. evaluated either by the Calc interpreter, or by the Emacs Lisp
  15943. interpreter.
  15944. @end table
  15945. @node Customization
  15946. @section Customization
  15947. @cindex customization
  15948. @cindex options, for customization
  15949. @cindex variables, for customization
  15950. Org has more than 500 variables for customization. They can be
  15951. accessed through the usual @kbd{M-x org-customize} command. Or
  15952. through the Org menu: Org @arrow{} Customization @arrow{} Browse Org Group.
  15953. Org also has per-file settings for some variables (see @ref{In-buffer Settings}).
  15954. @node In-buffer Settings
  15955. @section Summary of In-Buffer Settings
  15956. @cindex in-buffer settings
  15957. @cindex special keywords
  15958. In-buffer settings start with @samp{#+}, followed by a keyword, a colon,
  15959. and then a word for each setting. Org accepts multiple settings on
  15960. the same line. Org also accepts multiple lines for a keyword. This
  15961. manual describes these settings throughout. A summary follows here.
  15962. @cindex refresh set-up
  15963. @kbd{C-c C-c} activates any changes to the in-buffer settings.
  15964. Closing and reopening the Org file in Emacs also activates the
  15965. changes.
  15966. @table @asis
  15967. @item @samp{#+ARCHIVE: %s_done}
  15968. @cindex @samp{ARCHIVE}, keyword
  15969. @vindex org-archive-location
  15970. Sets the archive location of the agenda file. The corresponding
  15971. variable is @code{org-archive-location}.
  15972. @item @samp{#+CATEGORY}
  15973. @cindex @samp{CATEGORY}, keyword
  15974. Sets the category of the agenda file, which applies to the entire
  15975. document.
  15976. @item @samp{#+COLUMNS: %25ITEM ...}
  15977. @cindex @samp{COLUMNS}, property
  15978. Set the default format for columns view. This format applies
  15979. when columns view is invoked in locations where no @samp{COLUMNS}
  15980. property applies.
  15981. @item @samp{#+CONSTANTS: name1=value1 ...}
  15982. @cindex @samp{CONSTANTS}, keyword
  15983. @vindex org-table-formula-constants
  15984. @vindex org-table-formula
  15985. Set file-local values for constants that table formulas can use.
  15986. This line sets the local variable
  15987. @code{org-table-formula-constants-local}. The global version of this
  15988. variable is @code{org-table-formula-constants}.
  15989. @item @samp{#+FILETAGS: :tag1:tag2:tag3:}
  15990. @cindex @samp{FILETAGS}, keyword
  15991. Set tags that all entries in the file inherit from, including the
  15992. top-level entries.
  15993. @item @samp{#+LINK: linkword replace}
  15994. @cindex @samp{LINK}, keyword
  15995. @vindex org-link-abbrev-alist
  15996. Each line specifies one abbreviation for one link. Use multiple
  15997. @samp{LINK} keywords for more, see @ref{Link Abbreviations}. The
  15998. corresponding variable is @code{org-link-abbrev-alist}.
  15999. @item @samp{#+PRIORITIES: highest lowest default}
  16000. @cindex @samp{PRIORITIES}, keyword
  16001. @vindex org-highest-priority
  16002. @vindex org-lowest-priority
  16003. @vindex org-default-priority
  16004. This line sets the limits and the default for the priorities.
  16005. All three must be either letters A--Z or numbers 0--9. The
  16006. highest priority must have a lower ASCII number than the lowest
  16007. priority.
  16008. @item @samp{#+PROPERTY: Property_Name Value}
  16009. @cindex @samp{PROPERTY}, keyword
  16010. This line sets a default inheritance value for entries in the
  16011. current buffer, most useful for specifying the allowed values of
  16012. a property.
  16013. @item @samp{#+SETUPFILE: file}
  16014. @cindex @samp{SETUPFILE}, keyword
  16015. The setup file or a URL pointing to such file is for additional
  16016. in-buffer settings. Org loads this file and parses it for any
  16017. settings in it only when Org opens the main file. If URL is
  16018. specified, the contents are downloaded and stored in a temporary
  16019. file cache. @kbd{C-c C-c} on the settings line parses and
  16020. loads the file, and also resets the temporary file cache. Org
  16021. also parses and loads the document during normal exporting
  16022. process. Org parses the contents of this document as if it was
  16023. included in the buffer. It can be another Org file. To visit
  16024. the file---not a URL---use @kbd{C-c '} while the cursor is
  16025. on the line with the file name.
  16026. @item @samp{#+STARTUP:}
  16027. @cindex @samp{STARTUP}, keyword
  16028. Startup options Org uses when first visiting a file.
  16029. @vindex org-startup-folded
  16030. The first set of options deals with the initial visibility of the
  16031. outline tree. The corresponding variable for global default
  16032. settings is @code{org-startup-folded} with a default value of @code{t},
  16033. which is the same as @code{overview}.
  16034. @table @asis
  16035. @item @samp{overview}
  16036. Top-level headlines only.
  16037. @item @samp{content}
  16038. All headlines.
  16039. @item @samp{showall}
  16040. No folding on any entry.
  16041. @item @samp{showeverything}
  16042. Show even drawer contents.
  16043. @end table
  16044. @vindex org-startup-indented
  16045. Dynamic virtual indentation is controlled by the variable
  16046. @code{org-startup-indented}.@footnote{Note that @code{org-indent-mode} also sets the @code{wrap-prefix}
  16047. property, such that @code{visual-line-mode} (or purely setting @code{word-wrap})
  16048. wraps long lines (including headlines) correctly indented.}
  16049. @table @asis
  16050. @item @samp{indent}
  16051. Start with @code{org-indent-mode} turned on.
  16052. @item @samp{noindent}
  16053. Start with @code{org-indent-mode} turned off.
  16054. @end table
  16055. @vindex org-startup-align-all-tables
  16056. Aligns tables consistently upon visiting a file. The corresponding
  16057. variable is @code{org-startup-align-all-tables} with @code{nil} as default
  16058. value.
  16059. @table @asis
  16060. @item @samp{align}
  16061. Align all tables.
  16062. @item @samp{noalign}
  16063. Do not align tables on startup.
  16064. @end table
  16065. @vindex org-startup-shrink-all-tables
  16066. Shrink table columns with a width cookie. The corresponding
  16067. variable is @code{org-startup-shrink-all-tables} with @code{nil} as default
  16068. value.
  16069. @vindex org-startup-with-inline-images
  16070. When visiting a file, inline images can be automatically displayed.
  16071. The corresponding variable is @code{org-startup-with-inline-images},
  16072. with a default value @code{nil} to avoid delays when visiting a file.
  16073. @table @asis
  16074. @item @samp{inlineimages}
  16075. Show inline images.
  16076. @item @samp{noinlineimages}
  16077. Do not show inline images on startup.
  16078. @end table
  16079. @vindex org-log-done
  16080. @vindex org-log-note-clock-out
  16081. @vindex org-log-repeat
  16082. Logging the closing and reopening of TODO items and clock
  16083. intervals can be configured using these options (see variables
  16084. @code{org-log-done}, @code{org-log-note-clock-out}, and @code{org-log-repeat}).
  16085. @table @asis
  16086. @item @samp{logdone}
  16087. Record a timestamp when an item is marked DONE.
  16088. @item @samp{lognotedone}
  16089. Record timestamp and a note when DONE.
  16090. @item @samp{nologdone}
  16091. Do not record when items are marked DONE.
  16092. @item @samp{logrepeat}
  16093. Record a time when reinstating a repeating item.
  16094. @item @samp{lognoterepeat}
  16095. Record a note when reinstating a repeating item.
  16096. @item @samp{nologrepeat}
  16097. Do not record when reinstating repeating item.
  16098. @item @samp{lognoteclock-out}
  16099. Record a note when clocking out.
  16100. @item @samp{nolognoteclock-out}
  16101. Do not record a note when clocking out.
  16102. @item @samp{logreschedule}
  16103. Record a timestamp when scheduling time changes.
  16104. @item @samp{lognotereschedule}
  16105. Record a note when scheduling time changes.
  16106. @item @samp{nologreschedule}
  16107. Do not record when a scheduling date changes.
  16108. @item @samp{logredeadline}
  16109. Record a timestamp when deadline changes.
  16110. @item @samp{lognoteredeadline}
  16111. Record a note when deadline changes.
  16112. @item @samp{nologredeadline}
  16113. Do not record when a deadline date changes.
  16114. @item @samp{logrefile}
  16115. Record a timestamp when refiling.
  16116. @item @samp{lognoterefile}
  16117. Record a note when refiling.
  16118. @item @samp{nologrefile}
  16119. Do not record when refiling.
  16120. @end table
  16121. @vindex org-hide-leading-stars
  16122. @vindex org-odd-levels-only
  16123. Here are the options for hiding leading stars in outline headings,
  16124. and for indenting outlines. The corresponding variables are
  16125. @code{org-hide-leading-stars} and @code{org-odd-levels-only}, both with
  16126. a default setting @code{nil} (meaning @samp{showstars} and @samp{oddeven}).
  16127. @table @asis
  16128. @item @samp{hidestars}
  16129. Make all but one of the stars starting a headline invisible.
  16130. @item @samp{showstars}
  16131. Show all stars starting a headline.
  16132. @item @samp{indent}
  16133. Virtual indentation according to outline level.
  16134. @item @samp{noindent}
  16135. No virtual indentation according to outline level.
  16136. @item @samp{odd}
  16137. Allow only odd outline levels (1, 3, @dots{}).
  16138. @item @samp{oddeven}
  16139. Allow all outline levels.
  16140. @end table
  16141. @vindex org-put-time-stamp-overlays
  16142. @vindex org-time-stamp-overlay-formats
  16143. To turn on custom format overlays over timestamps (variables
  16144. @code{org-put-time-stamp-overlays} and @code{org-time-stamp-overlay-formats}),
  16145. use:
  16146. @table @asis
  16147. @item @samp{customtime}
  16148. Overlay custom time format.
  16149. @end table
  16150. @vindex constants-unit-system
  16151. The following options influence the table spreadsheet (variable
  16152. @code{constants-unit-system}).
  16153. @table @asis
  16154. @item @samp{constcgs}
  16155. @samp{constants.el} should use the c-g-s unit system.
  16156. @item @samp{constSI}
  16157. @samp{constants.el} should use the SI unit system.
  16158. @end table
  16159. @vindex org-footnote-define-inline
  16160. @vindex org-footnote-auto-label
  16161. @vindex org-footnote-auto-adjust
  16162. To influence footnote settings, use the following keywords. The
  16163. corresponding variables are @code{org-footnote-define-inline},
  16164. @code{org-footnote-auto-label}, and @code{org-footnote-auto-adjust}.
  16165. @table @asis
  16166. @item @samp{fninline}
  16167. Define footnotes inline.
  16168. @item @samp{fnnoinline}
  16169. Define footnotes in separate section.
  16170. @item @samp{fnlocal}
  16171. Define footnotes near first reference, but not inline.
  16172. @item @samp{fnprompt}
  16173. Prompt for footnote labels.
  16174. @item @samp{fnauto}
  16175. Create @samp{[fn:1]}-like labels automatically (default).
  16176. @item @samp{fnconfirm}
  16177. Offer automatic label for editing or confirmation.
  16178. @item @samp{fnadjust}
  16179. Automatically renumber and sort footnotes.
  16180. @item @samp{nofnadjust}
  16181. Do not renumber and sort automatically.
  16182. @end table
  16183. @vindex org-hide-block-startup
  16184. To hide blocks on startup, use these keywords. The corresponding
  16185. variable is @code{org-hide-block-startup}.
  16186. @table @asis
  16187. @item @samp{hideblocks}
  16188. Hide all begin/end blocks on startup.
  16189. @item @samp{nohideblocks}
  16190. Do not hide blocks on startup.
  16191. @end table
  16192. @vindex org-pretty-entities
  16193. The display of entities as UTF-8 characters is governed by the
  16194. variable @code{org-pretty-entities} and the keywords
  16195. @table @asis
  16196. @item @samp{entitiespretty}
  16197. Show entities as UTF-8 characters where possible.
  16198. @item @samp{entitiesplain}
  16199. Leave entities plain.
  16200. @end table
  16201. @item @samp{#+TAGS: TAG1(c1) TAG2(c2)}
  16202. @cindex @samp{TAGS}, keyword
  16203. @vindex org-tag-alist
  16204. These lines (several such lines are allowed) specify the valid
  16205. tags in this file, and (potentially) the corresponding @emph{fast tag
  16206. selection} keys. The corresponding variable is @code{org-tag-alist}.
  16207. @item @samp{#+TODO:}
  16208. @itemx @samp{#+SEQ_TODO:}
  16209. @itemx @samp{#+TYP_TODO:}
  16210. @cindex @samp{SEQ_TODO}, keyword
  16211. @cindex @samp{TODO}, keyword
  16212. @cindex @samp{TYP_TODO}, keyword
  16213. @vindex org-todo-keywords
  16214. These lines set the TODO keywords and their interpretation in the
  16215. current file. The corresponding variable is @code{org-todo-keywords}.
  16216. @end table
  16217. @node The Very Busy @kbd{C-c C-c} Key
  16218. @section The Very Busy @kbd{C-c C-c} Key
  16219. @kindex C-c C-c
  16220. @cindex @kbd{C-c C-c}, overview
  16221. The @kbd{C-c C-c} key in Org serves many purposes depending on
  16222. the context. It is probably the most over-worked, multi-purpose key
  16223. combination in Org. Its uses are well documented throughout this
  16224. manual, but here is a consolidated list for easy reference.
  16225. @itemize
  16226. @item
  16227. If any highlights shown in the buffer from the creation of a sparse
  16228. tree, or from clock display, remove such highlights.
  16229. @item
  16230. If the cursor is in one of the special @samp{KEYWORD} lines, scan the
  16231. buffer for these lines and update the information. Also reset the
  16232. Org file cache used to temporary store the contents of URLs used as
  16233. values for keywords like @samp{SETUPFILE}.
  16234. @item
  16235. If the cursor is inside a table, realign the table. The table
  16236. realigns even if automatic table editor is turned off.
  16237. @item
  16238. If the cursor is on a @samp{TBLFM} keyword, re-apply the formulas to the
  16239. entire table.
  16240. @item
  16241. If the current buffer is a capture buffer, close the note and file
  16242. it. With a prefix argument, also jump to the target location after
  16243. saving the note.
  16244. @item
  16245. If the cursor is on a @samp{<<<target>>>}, update radio targets and
  16246. corresponding links in this buffer.
  16247. @item
  16248. If the cursor is on a property line or at the start or end of
  16249. a property drawer, offer property commands.
  16250. @item
  16251. If the cursor is at a footnote reference, go to the corresponding
  16252. definition, and @emph{vice versa}.
  16253. @item
  16254. If the cursor is on a statistics cookie, update it.
  16255. @item
  16256. If the cursor is in a plain list item with a checkbox, toggle the
  16257. status of the checkbox.
  16258. @item
  16259. If the cursor is on a numbered item in a plain list, renumber the
  16260. ordered list.
  16261. @item
  16262. If the cursor is on the @samp{#+BEGIN} line of a dynamic block, the block
  16263. is updated.
  16264. @item
  16265. If the cursor is at a timestamp, fix the day name in the timestamp.
  16266. @end itemize
  16267. @node Clean View
  16268. @section A Cleaner Outline View
  16269. @cindex hiding leading stars
  16270. @cindex dynamic indentation
  16271. @cindex odd-levels-only outlines
  16272. @cindex clean outline view
  16273. Org's default outline with stars and no indents can become too
  16274. cluttered for short documents. For @emph{book-like} long documents, the
  16275. effect is not as noticeable. Org provides an alternate stars and
  16276. indentation scheme, as shown on the right in the following table. It
  16277. uses only one star and indents text to line with the heading:
  16278. @example
  16279. * Top level headline | * Top level headline
  16280. ** Second level | * Second level
  16281. *** Third level | * Third level
  16282. some text | some text
  16283. *** Third level | * Third level
  16284. more text | more text
  16285. * Another top level headline | * Another top level headline
  16286. @end example
  16287. @noindent
  16288. @cindex Indent mode
  16289. @findex org-indent-mode
  16290. To turn this mode on, use the minor mode, @code{org-indent-mode}. Text
  16291. lines that are not headlines are prefixed with spaces to vertically
  16292. align with the headline text@footnote{The @code{org-indent-mode} also sets the @code{wrap-prefix} correctly
  16293. for indenting and wrapping long lines of headlines or text. This
  16294. minor mode handles @code{visual-line-mode} and directly applied settings
  16295. through @code{word-wrap}.}.
  16296. @vindex org-indent-indentation-per-level
  16297. To make more horizontal space, the headlines are shifted by two stars.
  16298. This can be configured by the @code{org-indent-indentation-per-level}
  16299. variable. Only one star on each headline is visible, the rest are
  16300. masked with the same font color as the background.
  16301. Note that turning on @code{org-indent-mode} sets @code{org-hide-leading-stars}
  16302. to @code{t} and @code{org-adapt-indentation} to @code{nil}.
  16303. @vindex org-startup-indented
  16304. To globally turn on @code{org-indent-mode} for all files, customize the
  16305. variable @code{org-startup-indented}.
  16306. To turn on indenting for individual files, use @samp{STARTUP} keyword as
  16307. follows:
  16308. @example
  16309. #+STARTUP: indent
  16310. @end example
  16311. Indent on startup makes Org use hard spaces to align text with
  16312. headings as shown in examples below.
  16313. @table @asis
  16314. @item @emph{Indentation of text below headlines}
  16315. Indent text to align with the headline.
  16316. @example
  16317. *** Third level
  16318. more text, now indented
  16319. @end example
  16320. @vindex org-adapt-indentation
  16321. Org supports this with paragraph filling, line wrapping, and
  16322. structure editing, preserving or adapting the indentation as
  16323. appropriate@footnote{Also see the variable @code{org-adapt-indentation}.}.
  16324. @item @emph{Hiding leading stars}
  16325. @vindex org-hide-leading-stars
  16326. Org can make leading stars invisible. For global preference,
  16327. configure the variable @code{org-hide-leading-stars}. For per-file
  16328. preference, use these file @samp{STARTUP} options:
  16329. @example
  16330. #+STARTUP: hidestars
  16331. #+STARTUP: showstars
  16332. @end example
  16333. With stars hidden, the tree is shown as:
  16334. @example
  16335. * Top level headline
  16336. * Second level
  16337. * Third level
  16338. ...
  16339. @end example
  16340. @noindent
  16341. @vindex org-hide, face
  16342. Because Org makes the font color the same as the background color
  16343. to hide to stars, sometimes @code{org-hide} face may need tweaking to
  16344. get the effect right. For some black and white combinations,
  16345. @code{grey90} on a white background might mask the stars better.
  16346. @item @emph{Odd levels}
  16347. @vindex org-odd-levels-only
  16348. Using stars for only odd levels, 1, 3, 5, @dots{}, can also clean up
  16349. 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
  16350. on.}.
  16351. For Org to properly handle this cleaner structure during edits
  16352. and exports, configure the variable @code{org-odd-levels-only}. To
  16353. set this per-file, use either one of the following lines:
  16354. @example
  16355. #+STARTUP: odd
  16356. #+STARTUP: oddeven
  16357. @end example
  16358. 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}.
  16359. @end table
  16360. @node TTY Keys
  16361. @section Using Org on a TTY
  16362. @cindex tty key bindings
  16363. Org provides alternative key bindings for TTY and modern mobile
  16364. devices that cannot handle cursor keys and complex modifier key
  16365. chords. Some of these workarounds may be more cumbersome than
  16366. necessary. Users should look into customizing these further based on
  16367. their usage needs. For example, the normal @kbd{S-<cursor>} for
  16368. editing timestamp might be better with @kbd{C-c .} chord.
  16369. @multitable @columnfractions 0.2 0.28 0.15 0.21
  16370. @headitem Default
  16371. @tab Alternative 1
  16372. @tab Speed key
  16373. @tab Alternative 2
  16374. @item @kbd{S-@key{TAB}}
  16375. @tab @kbd{C-u @key{TAB}}
  16376. @tab @kbd{C}
  16377. @tab
  16378. @item @kbd{M-@key{LEFT}}
  16379. @tab @kbd{C-c C-x l}
  16380. @tab @kbd{l}
  16381. @tab @kbd{Esc @key{LEFT}}
  16382. @item @kbd{M-S-@key{LEFT}}
  16383. @tab @kbd{C-c C-x L}
  16384. @tab @kbd{L}
  16385. @tab
  16386. @item @kbd{M-@key{RIGHT}}
  16387. @tab @kbd{C-c C-x r}
  16388. @tab @kbd{r}
  16389. @tab @kbd{Esc @key{RIGHT}}
  16390. @item @kbd{M-S-@key{RIGHT}}
  16391. @tab @kbd{C-c C-x R}
  16392. @tab @kbd{R}
  16393. @tab
  16394. @item @kbd{M-@key{UP}}
  16395. @tab @kbd{C-c C-x u}
  16396. @tab
  16397. @tab @kbd{Esc @key{UP}}
  16398. @item @kbd{M-S-@key{UP}}
  16399. @tab @kbd{C-c C-x U}
  16400. @tab @kbd{U}
  16401. @tab
  16402. @item @kbd{M-@key{DOWN}}
  16403. @tab @kbd{C-c C-x d}
  16404. @tab
  16405. @tab @kbd{Esc @key{DOWN}}
  16406. @item @kbd{M-S-@key{DOWN}}
  16407. @tab @kbd{C-c C-x D}
  16408. @tab @kbd{D}
  16409. @tab
  16410. @item @kbd{S-@key{RET}}
  16411. @tab @kbd{C-c C-x c}
  16412. @tab
  16413. @tab
  16414. @item @kbd{M-@key{RET}}
  16415. @tab @kbd{C-c C-x m}
  16416. @tab
  16417. @tab @kbd{Esc @key{RET}}
  16418. @item @kbd{M-S-@key{RET}}
  16419. @tab @kbd{C-c C-x M}
  16420. @tab
  16421. @tab
  16422. @item @kbd{S-@key{LEFT}}
  16423. @tab @kbd{C-c @key{LEFT}}
  16424. @tab
  16425. @tab
  16426. @item @kbd{S-@key{RIGHT}}
  16427. @tab @kbd{C-c @key{RIGHT}}
  16428. @tab
  16429. @tab
  16430. @item @kbd{S-@key{UP}}
  16431. @tab @kbd{C-c @key{UP}}
  16432. @tab
  16433. @tab
  16434. @item @kbd{S-@key{DOWN}}
  16435. @tab @kbd{C-c @key{DOWN}}
  16436. @tab
  16437. @tab
  16438. @item @kbd{C-S-@key{LEFT}}
  16439. @tab @kbd{C-c C-x @key{LEFT}}
  16440. @tab
  16441. @tab
  16442. @item @kbd{C-S-@key{RIGHT}}
  16443. @tab @kbd{C-c C-x @key{RIGHT}}
  16444. @tab
  16445. @tab
  16446. @end multitable
  16447. @node Interaction
  16448. @section Interaction with Other Packages
  16449. @cindex packages, interaction with other
  16450. Org's compatibility and the level of interaction with other Emacs
  16451. packages are documented here.
  16452. @menu
  16453. * Cooperation:: Packages Org cooperates with.
  16454. * Conflicts:: Packages that lead to conflicts.
  16455. @end menu
  16456. @node Cooperation
  16457. @subsection Packages that Org cooperates with
  16458. @table @asis
  16459. @item @samp{calc.el} by Dave Gillespie
  16460. @cindex @file{calc.el}
  16461. Org uses the Calc package for implementing spreadsheet
  16462. functionality in its tables (see @ref{The spreadsheet}). Org also
  16463. uses Calc for embedded calculations. See @ref{Embedded Mode,GNU Emacs Calc Manual,,calc,}.
  16464. @item @samp{constants.el} by Carsten Dominik
  16465. @cindex @file{constants.el}
  16466. @vindex org-table-formula-constants
  16467. Org can use names for constants in formulas in tables. Org can
  16468. also use calculation suffixes for units, such as @samp{M} for @samp{Mega}.
  16469. For a standard collection of such constants, install the
  16470. @samp{constants} package. Install version 2.0 of this package,
  16471. available at @uref{http://www.astro.uva.nl/~dominik/Tools}. Org checks
  16472. if the function @code{constants-get} has been autoloaded.
  16473. Installation instructions are in the file @samp{constants.el}.
  16474. @item @samp{cdlatex.el} by Carsten Dominik
  16475. @cindex @file{cdlatex.el}
  16476. Org mode can make use of the CD@LaTeX{} package to efficiently enter
  16477. @LaTeX{} fragments into Org files. See @ref{CD@LaTeX{} mode}.
  16478. @item @samp{imenu.el} by Ake Stenhoff and Lars Lindberg
  16479. @cindex @file{imenu.el}
  16480. Imenu creates dynamic menus based on an index of items in a file.
  16481. Org mode supports Imenu menus. Enable it with a mode hook as
  16482. follows:
  16483. @lisp
  16484. (add-hook 'org-mode-hook
  16485. (lambda () (imenu-add-to-menubar "Imenu")))
  16486. @end lisp
  16487. @vindex org-imenu-depth
  16488. By default the index is two levels deep---you can modify the
  16489. depth using the option @code{org-imenu-depth}.
  16490. @item @samp{speedbar.el} by Eric M. Ludlam
  16491. @cindex @file{speedbar.el}
  16492. Speedbar package creates a special Emacs frame for displaying
  16493. files and index items in files. Org mode supports Speedbar;
  16494. users can drill into Org files directly from the Speedbar. The
  16495. @kbd{<} in the Speedbar frame tweaks the agenda commands to
  16496. that file or to a subtree.
  16497. @item @samp{table.el} by Takaaki Ota
  16498. @cindex table editor, @file{table.el}
  16499. @cindex @file{table.el}
  16500. Complex ASCII tables with automatic line wrapping, column- and
  16501. row-spanning, and alignment can be created using the Emacs table
  16502. package by Takaaki Ota. Org mode recognizes such tables and
  16503. exports them properly. @kbd{C-c '} to edit these tables in
  16504. a special buffer, much like Org's code blocks. Because of
  16505. interference with other Org mode functionality, Takaaki Ota
  16506. tables cannot be edited directly in the Org buffer.
  16507. @table @asis
  16508. @item @kbd{C-c '} (@code{org-edit-special})
  16509. @kindex C-c '
  16510. @findex org-edit-special
  16511. Edit a @samp{table.el} table. Works when the cursor is in
  16512. a @samp{table.el} table.
  16513. @item @kbd{C-c ~​} (@code{org-table-create-with-table.el})
  16514. @kindex C-c ~
  16515. @findex org-table-create-with-table.el
  16516. Insert a @samp{table.el} table. If there is already a table at
  16517. point, this command converts it between the @samp{table.el}
  16518. format and the Org mode format. See the documentation
  16519. string of the command @code{org-convert-table} for the
  16520. restrictions under which this is possible.
  16521. @end table
  16522. @end table
  16523. @node Conflicts
  16524. @subsection Packages that conflict with Org mode
  16525. @cindex shift-selection-mode
  16526. @vindex org-support-shift-select
  16527. In Emacs, @code{shift-selection-mode} combines cursor motions with shift
  16528. key to enlarge regions. Emacs sets this mode by default. This
  16529. conflicts with Org's use of @kbd{S-<cursor>} commands to change
  16530. timestamps, TODO keywords, priorities, and item bullet types, etc.
  16531. Since @kbd{S-<cursor>} commands outside of specific contexts do
  16532. not do anything, Org offers the variable @code{org-support-shift-select}
  16533. for customization. Org mode accommodates shift selection by (i)
  16534. making it available outside of the special contexts where special
  16535. commands apply, and (ii) extending an existing active region even if
  16536. the cursor moves across a special context.
  16537. @table @asis
  16538. @item @samp{cua.el} by Kim. F. Storm
  16539. @cindex @file{cua.el}
  16540. @vindex org-replace-disputed-keys
  16541. Org key bindings conflict with @kbd{S-<cursor>} keys used by
  16542. CUA mode. For Org to relinquish these bindings to CUA mode,
  16543. configure the variable @code{org-replace-disputed-keys}. When set,
  16544. Org moves the following key bindings in Org files, and in the
  16545. agenda buffer---but not during date selection.
  16546. @multitable @columnfractions 0.4 0.4
  16547. @item @kbd{S-@key{UP}} @result{} @kbd{M-p}
  16548. @tab @kbd{S-@key{DOWN}} @result{} @kbd{M-n}
  16549. @item @kbd{S-@key{LEFT}} @result{} @kbd{M--}
  16550. @tab @kbd{S-@key{RIGHT}} @result{} @kbd{M-+}
  16551. @item @kbd{C-S-@key{LEFT}} @result{} @kbd{M-S--}
  16552. @tab @kbd{C-S-@key{RIGHT}} @result{} @kbd{M-S-+}
  16553. @end multitable
  16554. @vindex org-disputed-keys
  16555. Yes, these are unfortunately more difficult to remember. If you
  16556. want to have other replacement keys, look at the variable
  16557. @code{org-disputed-keys}.
  16558. @item @samp{ecomplete.el} by Lars Magne Ingebrigtsen
  16559. @cindex @file{ecomplete.el}
  16560. Ecomplete provides ``electric'' address completion in address
  16561. header lines in message buffers. Sadly Orgtbl mode cuts
  16562. Ecomplete's power supply: no completion happens when Orgtbl mode
  16563. is enabled in message buffers while entering text in address
  16564. header lines. If one wants to use ecomplete one should @emph{not}
  16565. follow the advice to automagically turn on Orgtbl mode in message
  16566. buffers (see @ref{Orgtbl Mode}), but instead---after
  16567. filling in the message headers---turn on Orgtbl mode manually
  16568. when needed in the messages body.
  16569. @item @samp{filladapt.el} by Kyle Jones
  16570. @cindex @file{filladapt.el}
  16571. Org mode tries to do the right thing when filling paragraphs,
  16572. list items and other elements. Many users reported problems
  16573. using both @samp{filladapt.el} and Org mode, so a safe thing to do is
  16574. to disable filladapt like this:
  16575. @lisp
  16576. (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
  16577. @end lisp
  16578. @item @samp{viper.el} by Michael Kifer
  16579. @cindex @file{viper.el}
  16580. @kindex C-c /
  16581. Viper uses @kbd{C-c /} and therefore makes this key not
  16582. access the corresponding Org mode command @code{org-sparse-tree}. You
  16583. need to find another key for this command, or override the key in
  16584. @code{viper-vi-global-user-map} with
  16585. @lisp
  16586. (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
  16587. @end lisp
  16588. @item @samp{windmove.el} by Hovav Shacham
  16589. @cindex @file{windmove.el}
  16590. This package also uses the @kbd{S-<cursor>} keys, so
  16591. everything written in the paragraph above about CUA mode also
  16592. applies here. If you want to make the windmove function active
  16593. in locations where Org mode does not have special functionality
  16594. on @kbd{S-<cursor>}, add this to your configuration:
  16595. @lisp
  16596. ;; Make windmove work in Org mode:
  16597. (add-hook 'org-shiftup-final-hook 'windmove-up)
  16598. (add-hook 'org-shiftleft-final-hook 'windmove-left)
  16599. (add-hook 'org-shiftdown-final-hook 'windmove-down)
  16600. (add-hook 'org-shiftright-final-hook 'windmove-right)
  16601. @end lisp
  16602. @item @samp{yasnippet.el}
  16603. @cindex @file{yasnippet.el}
  16604. The way Org mode binds the @kbd{@key{TAB}} key (binding to @code{[tab]}
  16605. instead of @code{"\t"}) overrules YASnippet's access to this key. The
  16606. following code fixed this problem:
  16607. @lisp
  16608. (add-hook 'org-mode-hook
  16609. (lambda ()
  16610. (setq-local yas/trigger-key [tab])
  16611. (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
  16612. @end lisp
  16613. The latest version of YASnippet does not play well with Org mode.
  16614. If the above code does not fix the conflict, start by defining
  16615. the following function:
  16616. @lisp
  16617. (defun yas/org-very-safe-expand ()
  16618. (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
  16619. @end lisp
  16620. Then, tell Org mode to use that function:
  16621. @lisp
  16622. (add-hook 'org-mode-hook
  16623. (lambda ()
  16624. (make-variable-buffer-local 'yas/trigger-key)
  16625. (setq yas/trigger-key [tab])
  16626. (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
  16627. (define-key yas/keymap [tab] 'yas/next-field)))
  16628. @end lisp
  16629. @end table
  16630. @node Org Crypt
  16631. @section Org Crypt
  16632. Org Crypt encrypts the text of an entry, but not the headline, or
  16633. properties. Behind the scene, it uses the Emacs EasyPG library to
  16634. encrypt and decrypt files.
  16635. @vindex org-crypt-tag-matcher
  16636. Any text below a headline that has a @samp{crypt} tag is automatically
  16637. encrypted when the file is saved. To use a different tag, customize
  16638. the @code{org-crypt-tag-matcher} setting.
  16639. Here is a suggestion for Org Crypt settings in Emacs init file:
  16640. @lisp
  16641. (require 'org-crypt)
  16642. (org-crypt-use-before-save-magic)
  16643. (setq org-tags-exclude-from-inheritance '("crypt"))
  16644. (setq org-crypt-key nil)
  16645. ;; GPG key to use for encryption
  16646. ;; Either the Key ID or set to nil to use symmetric encryption.
  16647. (setq auto-save-default nil)
  16648. ;; Auto-saving does not cooperate with org-crypt.el: so you need to
  16649. ;; turn it off if you plan to use org-crypt.el quite often. Otherwise,
  16650. ;; you'll get an (annoying) message each time you start Org.
  16651. ;; To turn it off only locally, you can insert this:
  16652. ;;
  16653. ;; # -*- buffer-auto-save-file-name: nil; -*-
  16654. @end lisp
  16655. Excluding the @samp{crypt} tag from inheritance prevents already encrypted
  16656. text from being encrypted again.
  16657. @node Hacking
  16658. @appendix Hacking
  16659. @cindex hacking
  16660. This appendix describes some ways a user can extend the functionality
  16661. of Org.
  16662. @menu
  16663. * Hooks: Hooks (2). How to reach into Org's internals.
  16664. * Add-on Packages:: Available extensions.
  16665. * Adding Hyperlink Types:: New custom link types.
  16666. * Adding Export Back-ends:: How to write new export back-ends.
  16667. * Tables in Arbitrary Syntax:: Orgtbl for LaTeX and other programs.
  16668. * Dynamic Blocks:: Automatically filled blocks.
  16669. * Special Agenda Views:: Customized views.
  16670. * Speeding Up Your Agendas:: Tips on how to speed up your agendas.
  16671. * Extracting Agenda Information:: Post-processing agenda information.
  16672. * Using the Property API:: Writing programs that use entry properties.
  16673. * Using the Mapping API:: Mapping over all or selected entries.
  16674. @end menu
  16675. @node Hooks (2)
  16676. @appendixsec Hooks
  16677. @cindex hooks
  16678. Org has a large number of hook variables for adding functionality.
  16679. This appendix illustrates using a few. A complete list of hooks with
  16680. documentation is maintained by the Worg project at
  16681. @uref{https://orgmode.org/worg/doc.html#hooks}.
  16682. @node Add-on Packages
  16683. @appendixsec Add-on Packages
  16684. @cindex add-on packages
  16685. Various authors wrote a large number of add-on packages for Org.
  16686. These packages are not part of Emacs, but they are distributed as
  16687. contributed packages with the separate release available at
  16688. @uref{https://orgmode.org}. See the @samp{contrib/README} file in the source code
  16689. directory for a list of contributed files. Worg page with more
  16690. information is at: @uref{https://orgmode.org/worg/org-contrib/}.
  16691. @node Adding Hyperlink Types
  16692. @appendixsec Adding Hyperlink Types
  16693. @cindex hyperlinks, adding new types
  16694. Org has many built-in hyperlink types (see @ref{Hyperlinks}), and an
  16695. interface for adding new link types. The following example shows the
  16696. process of adding Org links to Unix man pages, which look like this
  16697. @example
  16698. [[man:printf][The printf manual]]
  16699. @end example
  16700. @noindent
  16701. The following @samp{org-man.el} file implements it
  16702. @lisp
  16703. ;;; org-man.el - Support for links to man pages in Org mode
  16704. (require 'org)
  16705. (org-link-set-parameters "man"
  16706. :follow org-man-command
  16707. :export #'org-man-export
  16708. :store #'org-man-store-link)
  16709. (defcustom org-man-command 'man
  16710. "The Emacs command to be used to display a man page."
  16711. :group 'org-link
  16712. :type '(choice (const man) (const woman)))
  16713. (defun org-man-store-link ()
  16714. "Store a link to a man page."
  16715. (when (memq major-mode '(Man-mode woman-mode))
  16716. ;; This is a man page, we do make this link.
  16717. (let* ((page (org-man-get-page-name))
  16718. (link (concat "man:" page))
  16719. (description (format "Man page for %s" page)))
  16720. (org-store-link-props
  16721. :type "man"
  16722. :link link
  16723. :description description))))
  16724. (defun org-man-get-page-name ()
  16725. "Extract the page name from the buffer name."
  16726. ;; This works for both `Man-mode' and `woman-mode'.
  16727. (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  16728. (match-string 1 (buffer-name))
  16729. (error "Cannot create link to this man page")))
  16730. (defun org-man-export (link description format)
  16731. "Export a man page link from Org files."
  16732. (let ((path (format "http://man.he.net/?topic=%s&section=all" link))
  16733. (desc (or description link)))
  16734. (pcase format
  16735. (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
  16736. (`latex (format "\\href@{%s@}@{%s@}" path desc))
  16737. (`texinfo (format "@@uref@{%s,%s@}" path desc))
  16738. (`ascii (format "%s (%s)" desc path))
  16739. (t path))))
  16740. (provide 'org-man)
  16741. ;;; org-man.el ends here
  16742. @end lisp
  16743. @noindent
  16744. To activate links to man pages in Org, enter this in the Emacs init
  16745. file:
  16746. @lisp
  16747. (require 'org-man)
  16748. @end lisp
  16749. @noindent
  16750. A review of @samp{org-man.el}:
  16751. @enumerate
  16752. @item
  16753. First, @code{(require 'org)} ensures @samp{org.el} is loaded.
  16754. @item
  16755. @findex org-link-set-parameters
  16756. @vindex org-link-parameters
  16757. Then @code{org-link-set-parameters} defines a new link type with @samp{man}
  16758. prefix and associates functions for following, exporting and
  16759. storing such links. See the variable @code{org-link-parameters} for
  16760. a complete list of possible associations.
  16761. @item
  16762. The rest of the file implements necessary variables and functions.
  16763. For example, @code{org-man-store-link} is responsible for storing a link
  16764. when @code{org-store-link} (see @ref{Handling Links}) is called from a buffer
  16765. displaying a man page. It first checks if the @code{major-mode} is
  16766. appropriate. If check fails, the function returns @code{nil}, which
  16767. means it isn't responsible for creating a link to the current
  16768. buffer. Otherwise the function makes a link string by combining
  16769. the @samp{man:} prefix with the man topic. It also provides a default
  16770. description. The function @code{org-insert-link} can insert it back
  16771. into an Org buffer later on.
  16772. @end enumerate
  16773. @node Adding Export Back-ends
  16774. @appendixsec Adding Export Back-ends
  16775. @cindex Export, writing back-ends
  16776. Org's export engine makes it easy for writing new back-ends. The
  16777. framework on which the engine was built makes it easy to derive new
  16778. back-ends from existing ones.
  16779. @findex org-export-define-backend
  16780. @findex org-export-define-derived-backend
  16781. The two main entry points to the export engine are:
  16782. @code{org-export-define-backend} and @code{org-export-define-derived-backend}.
  16783. To grok these functions, see @samp{ox-latex.el} for an example of defining
  16784. a new back-end from scratch, and @samp{ox-beamer.el} for an example of
  16785. deriving from an existing engine.
  16786. For creating a new back-end from scratch, first set its name as
  16787. a symbol in an alist consisting of elements and export functions. To
  16788. make the back-end visible to the export dispatcher, set @code{:menu-entry}
  16789. keyword. For export options specific to this back-end, set the
  16790. @code{:options-alist}.
  16791. For creating a new back-end from an existing one, set
  16792. @code{:translate-alist} to an alist of export functions. This alist
  16793. replaces the parent back-end functions.
  16794. For complete documentation, see @uref{https://orgmode.org/worg/dev/org-export-reference.html, the Org Export Reference on Worg}.
  16795. @node Tables in Arbitrary Syntax
  16796. @appendixsec Tables in Arbitrary Syntax
  16797. @cindex tables, in other modes
  16798. @cindex lists, in other modes
  16799. @cindex Orgtbl mode
  16800. Due to Org's success in handling tables with Orgtbl, a frequently
  16801. requested feature is the use of Org's table functions in other modes,
  16802. e.g., @LaTeX{}. This would be hard to do in a general way without
  16803. complicated customization nightmares. Moreover, that would take Org
  16804. away from its simplicity roots that Orgtbl has proven. There is,
  16805. however, an alternate approach to accomplishing the same.
  16806. This approach involves implementing a custom @emph{translate} function that
  16807. operates on a native Org @emph{source table} to produce a table in another
  16808. format. This strategy would keep the excellently working Orgtbl
  16809. simple and isolate complications, if any, confined to the translate
  16810. function. To add more alien table formats, we just add more translate
  16811. functions. Also the burden of developing custom translate functions
  16812. for new table formats is in the hands of those who know those formats
  16813. best.
  16814. @menu
  16815. * Radio tables:: Sending and receiving radio tables.
  16816. * A @LaTeX{} example:: Step by step, almost a tutorial.
  16817. * Translator functions:: Copy and modify.
  16818. @end menu
  16819. @node Radio tables
  16820. @appendixsubsec Radio tables
  16821. @cindex radio tables
  16822. Radio tables are target locations for translated tables that are not near
  16823. their source. Org finds the target location and inserts the translated
  16824. table.
  16825. The key to finding the target location is the magic words @samp{BEGIN/END
  16826. RECEIVE ORGTBL}. They have to appear as comments in the current mode.
  16827. If the mode is C, then:
  16828. @example
  16829. /* BEGIN RECEIVE ORGTBL table_name */
  16830. /* END RECEIVE ORGTBL table_name */
  16831. @end example
  16832. @noindent
  16833. At the location of source, Org needs a special line to direct Orgtbl
  16834. to translate and to find the target for inserting the translated
  16835. table. For example:
  16836. @cindex @samp{ORGTBL}, keyword
  16837. @example
  16838. #+ORGTBL: SEND table_name translation_function arguments ...
  16839. @end example
  16840. @noindent
  16841. @samp{table_name} is the table's reference name, which is also used in the
  16842. receiver lines, and the @samp{translation_function} is the Lisp function
  16843. that translates. This line, in addition, may also contain alternating
  16844. key and value arguments at the end. The translation function gets
  16845. these values as a property list. A few standard parameters are
  16846. already recognized and acted upon before the translation function is
  16847. called:
  16848. @table @asis
  16849. @item @samp{:skip N}
  16850. Skip the first N lines of the table. Hlines do count; include
  16851. them if they are to be skipped.
  16852. @item @samp{:skipcols (n1 n2 ...)}
  16853. List of columns to be skipped. First Org automatically discards
  16854. columns with calculation marks and then sends the table to the
  16855. translator function, which then skips columns as specified in
  16856. @samp{skipcols}.
  16857. @end table
  16858. @noindent
  16859. To keep the source table intact in the buffer without being disturbed
  16860. when the source file is compiled or otherwise being worked on, use one
  16861. of these strategies:
  16862. @itemize
  16863. @item
  16864. Place the table in a block comment. For example, in C mode you
  16865. could wrap the table between @samp{/*} and @samp{*/} lines.
  16866. @item
  16867. Put the table after an ``end'' statement. For example @code{\bye} in @TeX{}
  16868. and @code{\end@{document@}} in @LaTeX{}.
  16869. @item
  16870. Comment and un-comment each line of the table during edits. The
  16871. @kbd{M-x orgtbl-toggle-comment} command makes toggling easy.
  16872. @end itemize
  16873. @node A @LaTeX{} example
  16874. @appendixsubsec A @LaTeX{} example of radio tables
  16875. @cindex @LaTeX{}, and Orgtbl mode
  16876. To wrap a source table in @LaTeX{}, use the @samp{comment} environment
  16877. provided by @samp{comment.sty}@footnote{@uref{https://ctan.org/tex-archive/macros/latex/contrib/comment?lang=en}}. To activate it, put
  16878. @code{\usepackage@{comment@}} in the document header. Orgtbl mode inserts
  16879. a radio table skeleton@footnote{Because @samp{LEVEL=2} has 3 stars, @samp{LEVEL=3} has 4 stars, and so
  16880. on.} with the command @kbd{M-x orgtbl-insert-radio-table}, which prompts for a table name. For
  16881. example, if @samp{salesfigures} is the name, the template inserts:
  16882. @example
  16883. % BEGIN RECEIVE ORGTBL salesfigures
  16884. % END RECEIVE ORGTBL salesfigures
  16885. \begin@{comment@}
  16886. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  16887. | | |
  16888. \end@{comment@}
  16889. @end example
  16890. @vindex LaTeX-verbatim-environments
  16891. @noindent
  16892. The line @samp{#+ORGTBL: SEND} tells Orgtbl mode to use the function
  16893. @code{orgtbl-to-latex} to convert the table to @LaTeX{} format, then insert
  16894. the table at the target (receive) location named @samp{salesfigures}. Now
  16895. the table is ready for data entry. It can even use spreadsheet
  16896. features@footnote{If the @samp{TBLFM} keyword contains an odd number of dollar
  16897. characters, this may cause problems with Font Lock in @LaTeX{} mode. As
  16898. shown in the example you can fix this by adding an extra line inside
  16899. the @samp{comment} environment that is used to balance the dollar
  16900. expressions. If you are using AUC@TeX{} with the font-latex library,
  16901. a much better solution is to add the @samp{comment} environment to the
  16902. variable @code{LaTeX-verbatim-environments}.}:
  16903. @example
  16904. % BEGIN RECEIVE ORGTBL salesfigures
  16905. % END RECEIVE ORGTBL salesfigures
  16906. \begin@{comment@}
  16907. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  16908. | Month | Days | Nr sold | per day |
  16909. |-------+------+---------+---------|
  16910. | Jan | 23 | 55 | 2.4 |
  16911. | Feb | 21 | 16 | 0.8 |
  16912. | March | 22 | 278 | 12.6 |
  16913. #+TBLFM: $4=$3/$2;%.1f
  16914. % $ (optional extra dollar to keep Font Lock happy, see footnote)
  16915. \end@{comment@}
  16916. @end example
  16917. @noindent
  16918. After editing, @kbd{C-c C-c} inserts the translated table at the
  16919. target location, between the two marker lines.
  16920. For hand-made custom tables, note that the translator needs to skip
  16921. the first two lines of the source table. Also the command has to
  16922. @emph{splice} out the target table without the header and footer.
  16923. @example
  16924. \begin@{tabular@}@{lrrr@}
  16925. Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
  16926. % BEGIN RECEIVE ORGTBL salesfigures
  16927. % END RECEIVE ORGTBL salesfigures
  16928. \end@{tabular@}
  16929. %
  16930. \begin@{comment@}
  16931. #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  16932. | Month | Days | Nr sold | per day |
  16933. |-------+------+---------+---------|
  16934. | Jan | 23 | 55 | 2.4 |
  16935. | Feb | 21 | 16 | 0.8 |
  16936. | March | 22 | 278 | 12.6 |
  16937. #+TBLFM: $4=$3/$2;%.1f
  16938. \end@{comment@}
  16939. @end example
  16940. The @LaTeX{} translator function @code{orgtbl-to-latex} is already part of
  16941. Orgtbl mode and uses a @samp{tabular} environment to typeset the table and
  16942. marks horizontal lines with @code{\hline}. For additional parameters to
  16943. control output, see @ref{Translator functions}:
  16944. @table @asis
  16945. @item @code{:splice nil/t}
  16946. When non-@code{nil}, return only table body lines; not wrapped in
  16947. tabular environment. Default is @code{nil}.
  16948. @item @code{:fmt FMT}
  16949. Format to warp each field. It should contain @samp{%s} for the
  16950. original field value. For example, to wrap each field value in
  16951. dollar symbol, you could use @samp{:fmt "$%s$"}. Format can also wrap
  16952. a property list with column numbers and formats, for example
  16953. @samp{:fmt (2 "$%s$" 4 "%s\\%%")}. In place of a string, a function
  16954. of one argument can be used; the function must return a formatted
  16955. string.
  16956. @item @code{:efmt EFMT}
  16957. Format numbers as exponentials. The spec should have @samp{%s} twice
  16958. for inserting mantissa and exponent, for example
  16959. @samp{"%s\\times10^@{%s@}"}. This may also be a property list with
  16960. column numbers and formats, for example @samp{:efmt (2
  16961. "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
  16962. @var{EFMT} has been applied to a value, @var{FMT}---see
  16963. above---is also be applied. Functions with two arguments can be
  16964. supplied instead of strings. By default, no special formatting
  16965. is applied.
  16966. @end table
  16967. @node Translator functions
  16968. @appendixsubsec Translator functions
  16969. @cindex HTML, and Orgtbl mode
  16970. @cindex translator function
  16971. @findex orgtbl-to-csv
  16972. @findex orgtbl-to-tsv
  16973. @findex orgtbl-to-latex
  16974. @findex orgtbl-to-html
  16975. @findex orgtbl-to-texinfo
  16976. @findex orgtbl-to-unicode
  16977. @findex orgtbl-to-orgtbl
  16978. @findex orgtbl-to-generic
  16979. Orgtbl mode has built-in translator functions: @code{orgtbl-to-csv}
  16980. (comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values),
  16981. @code{orgtbl-to-latex}, @code{orgtbl-to-html}, @code{orgtbl-to-texinfo},
  16982. @code{orgtbl-to-unicode} and @code{orgtbl-to-orgtbl}. They use the generic
  16983. translator, @code{orgtbl-to-generic}, which delegates translations to
  16984. various export back-ends.
  16985. Properties passed to the function through the @samp{ORGTBL SEND} line take
  16986. precedence over properties defined inside the function. For example,
  16987. this overrides the default @LaTeX{} line endings, @code{\\}, with @code{\\[2mm]}:
  16988. @example
  16989. #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  16990. @end example
  16991. For a new language translator, define a converter function. It can be
  16992. a generic function, such as shown in this example. It marks
  16993. a beginning and ending of a table with @samp{!BTBL!} and @samp{!ETBL!};
  16994. a beginning and ending of lines with @samp{!BL!} and @samp{!EL!}; and uses a TAB
  16995. for a field separator:
  16996. @lisp
  16997. (defun orgtbl-to-language (table params)
  16998. "Convert the orgtbl-mode TABLE to language."
  16999. (orgtbl-to-generic
  17000. table
  17001. (org-combine-plists
  17002. '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")
  17003. params)))
  17004. @end lisp
  17005. @noindent
  17006. The documentation for the @code{orgtbl-to-generic} function shows
  17007. a complete list of parameters, each of which can be passed through to
  17008. @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function using
  17009. that generic function.
  17010. For complicated translations the generic translator function could be
  17011. replaced by a custom translator function. Such a custom function must
  17012. take two arguments and return a single string containing the formatted
  17013. table. The first argument is the table whose lines are a list of
  17014. fields or the symbol @code{hline}. The second argument is the property
  17015. list consisting of parameters specified in the @samp{#+ORGTBL: SEND} line.
  17016. Please share your translator functions by posting them to the Org
  17017. users mailing list, at @email{emacs-orgmode@@gnu.org}.
  17018. @node Dynamic Blocks
  17019. @appendixsec Dynamic Blocks
  17020. @cindex dynamic blocks
  17021. Org supports @emph{dynamic blocks} in Org documents. They are inserted
  17022. with begin and end markers like any other code block, but the contents
  17023. 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
  17024. @ref{Clocking Work Time}).
  17025. Dynamic blocks can have names and function parameters. The syntax is
  17026. similar to source code block specifications:
  17027. @example
  17028. #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  17029. ...
  17030. #+END:
  17031. @end example
  17032. These commands update dynamic blocks:
  17033. @table @asis
  17034. @item @kbd{C-c C-x C-u} (@code{org-dblock-update})
  17035. @kindex C-c C-x C-u
  17036. @findex org-dblock-update
  17037. Update dynamic block at point.
  17038. @item @kbd{C-u C-c C-x C-u}
  17039. @kindex C-u C-c C-x C-u
  17040. Update all dynamic blocks in the current file.
  17041. @end table
  17042. Before updating a dynamic block, Org removes content between the
  17043. @samp{BEGIN} and @samp{END} markers. Org then reads the parameters on the
  17044. @samp{BEGIN} line for passing to the writer function. If the function
  17045. expects to access the removed content, then Org expects an extra
  17046. parameter, @samp{:content}, on the @samp{BEGIN} line.
  17047. The syntax for naming a writer function with a dynamic block labelled
  17048. @samp{myblock} is: @code{org-dblock-write:myblock}. Parameters come from the
  17049. @samp{BEGIN} line.
  17050. The following is an example of a dynamic block and a block writer function
  17051. that updates the time when the function was last run:
  17052. @example
  17053. #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  17054. ...
  17055. #+END:
  17056. @end example
  17057. @noindent
  17058. The dynamic block's writer function:
  17059. @lisp
  17060. (defun org-dblock-write:block-update-time (params)
  17061. (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  17062. (insert "Last block update at: "
  17063. (format-time-string fmt))))
  17064. @end lisp
  17065. To keep dynamic blocks up-to-date in an Org file, use the function,
  17066. @code{org-update-all-dblocks} in hook, such as @code{before-save-hook}. The
  17067. @code{org-update-all-dblocks} function does not run if the file is not in
  17068. Org mode.
  17069. @findex org-narrow-to-block
  17070. Dynamic blocks, like any other block, can be narrowed with
  17071. @code{org-narrow-to-block}.
  17072. @node Special Agenda Views
  17073. @appendixsec Special Agenda Views
  17074. @cindex agenda views, user-defined
  17075. @vindex org-agenda-skip-function
  17076. @vindex org-agenda-skip-function-global
  17077. Org provides a special hook to further limit items in agenda views:
  17078. @code{agenda}, @code{agenda*}@footnote{The @code{agenda*} view is the same as @code{agenda} except that it
  17079. only considers @emph{appointments}, i.e., scheduled and deadline items that
  17080. have a time specification @samp{[h]h:mm} in their time-stamps.}, @code{todo}, @code{alltodo}, @code{tags}, @code{tags-todo},
  17081. @code{tags-tree}. Specify a custom function that tests inclusion of every
  17082. matched item in the view. This function can also skip as much as is
  17083. needed.
  17084. For a global condition applicable to agenda views, use the
  17085. @code{org-agenda-skip-function-global} variable. Org uses a global
  17086. condition with @code{org-agenda-skip-function} for custom searching.
  17087. This example defines a function for a custom view showing TODO items
  17088. with @samp{waiting} status. Manually this is a multi-step search process,
  17089. but with a custom view, this can be automated as follows:
  17090. The custom function searches the subtree for the @samp{waiting} tag and
  17091. returns @code{nil} on match. Otherwise it gives the location from where
  17092. the search continues.
  17093. @lisp
  17094. (defun my-skip-unless-waiting ()
  17095. "Skip trees that are not waiting"
  17096. (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  17097. (if (re-search-forward ":waiting:" subtree-end t)
  17098. nil ; tag found, do not skip
  17099. subtree-end))) ; tag not found, continue after end of subtree
  17100. @end lisp
  17101. To use this custom function in a custom agenda command:
  17102. @lisp
  17103. (org-add-agenda-custom-command
  17104. '("b" todo "PROJECT"
  17105. ((org-agenda-skip-function 'my-skip-unless-waiting)
  17106. (org-agenda-overriding-header "Projects waiting for something: "))))
  17107. @end lisp
  17108. @vindex org-agenda-overriding-header
  17109. Note that this also binds @code{org-agenda-overriding-header} to a more
  17110. meaningful string suitable for the agenda view.
  17111. @vindex org-odd-levels-only
  17112. @vindex org-agenda-skip-function
  17113. Search for entries with a limit set on levels for the custom search.
  17114. This is a general approach to creating custom searches in Org. To
  17115. include all levels, use @samp{LEVEL>0}@footnote{Note that, for @code{org-odd-levels-only}, a level number
  17116. corresponds to order in the hierarchy, not to the number of stars.}. Then to selectively pick
  17117. the matched entries, use @code{org-agenda-skip-function}, which also
  17118. accepts Lisp forms, such as @code{org-agenda-skip-entry-if} and
  17119. @code{org-agenda-skip-subtree-if}. For example:
  17120. @table @asis
  17121. @item @code{(org-agenda-skip-entry-if 'scheduled)}
  17122. Skip current entry if it has been scheduled.
  17123. @item @code{(org-agenda-skip-entry-if 'notscheduled)}
  17124. Skip current entry if it has not been scheduled.
  17125. @item @code{(org-agenda-skip-entry-if 'deadline)}
  17126. Skip current entry if it has a deadline.
  17127. @item @code{(org-agenda-skip-entry-if 'scheduled 'deadline)}
  17128. Skip current entry if it has a deadline, or if it is scheduled.
  17129. @item @code{(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))}
  17130. Skip current entry if the TODO keyword is TODO or WAITING.
  17131. @item @code{(org-agenda-skip-entry-if 'todo 'done)}
  17132. Skip current entry if the TODO keyword marks a DONE state.
  17133. @item @code{(org-agenda-skip-entry-if 'timestamp)}
  17134. Skip current entry if it has any timestamp, may also be deadline
  17135. or scheduled.
  17136. @item @code{(org-agenda-skip-entry-if 'regexp "regular expression")}
  17137. Skip current entry if the regular expression matches in the
  17138. entry.
  17139. @item @code{(org-agenda-skip-entry-if 'notregexp "regular expression")}
  17140. Skip current entry unless the regular expression matches.
  17141. @item @code{(org-agenda-skip-subtree-if 'regexp "regular expression")}
  17142. Same as above, but check and skip the entire subtree.
  17143. @end table
  17144. The following is an example of a search for @samp{waiting} without the
  17145. special function:
  17146. @lisp
  17147. (org-add-agenda-custom-command
  17148. '("b" todo "PROJECT"
  17149. ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  17150. 'regexp ":waiting:"))
  17151. (org-agenda-overriding-header "Projects waiting for something: "))))
  17152. @end lisp
  17153. @node Speeding Up Your Agendas
  17154. @appendixsec Speeding Up Your Agendas
  17155. @cindex agenda views, optimization
  17156. Some agenda commands slow down when the Org files grow in size or
  17157. number. Here are tips to speed up:
  17158. @itemize
  17159. @item
  17160. Reduce the number of Org agenda files to avoid slowdowns due to hard drive
  17161. accesses.
  17162. @item
  17163. Reduce the number of DONE and archived headlines so agenda
  17164. operations that skip over these can finish faster.
  17165. @item
  17166. Do not dim blocked tasks:
  17167. @vindex org-agenda-dim-blocked-tasks
  17168. @lisp
  17169. (setq org-agenda-dim-blocked-tasks nil)
  17170. @end lisp
  17171. @item
  17172. Stop preparing agenda buffers on startup:
  17173. @vindex org-startup-folded
  17174. @vindex org-agenda-inhibit-startup
  17175. @lisp
  17176. (setq org-agenda-inhibit-startup nil)
  17177. @end lisp
  17178. @item
  17179. Disable tag inheritance for agendas:
  17180. @vindex org-agenda-show-inherited-tags
  17181. @vindex org-agenda-use-tag-inheritance
  17182. @lisp
  17183. (setq org-agenda-use-tag-inheritance nil)
  17184. @end lisp
  17185. @end itemize
  17186. These options can be applied to selected agenda views. For more
  17187. details about generation of agenda views, see the docstrings for the
  17188. relevant variables, and this @uref{https://orgmode.org/worg/agenda-optimization.html, dedicated Worg page} for agenda
  17189. optimization.
  17190. @node Extracting Agenda Information
  17191. @appendixsec Extracting Agenda Information
  17192. @cindex agenda, pipe
  17193. @cindex scripts, for agenda processing
  17194. Org provides commands to access agendas through Emacs batch mode.
  17195. Through this command-line interface, agendas are automated for further
  17196. processing or printing.
  17197. @vindex org-agenda-custom-commands
  17198. @findex org-batch-agenda
  17199. @code{org-batch-agenda} creates an agenda view in ASCII and outputs to
  17200. standard output. This command takes one string parameter. When
  17201. string consists of a single character, Org uses it as a key to
  17202. @code{org-agenda-custom-commands}. These are the same ones available
  17203. through the agenda dispatcher (see @ref{Agenda Dispatcher}).
  17204. This example command line directly prints the TODO list to the printer:
  17205. @example
  17206. emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  17207. @end example
  17208. When the string parameter length is two or more characters, Org
  17209. matches it with tags/TODO strings. For example, this example command
  17210. line prints items tagged with @samp{shop}, but excludes items tagged with
  17211. @samp{NewYork}:
  17212. @example
  17213. emacs -batch -l ~/.emacs \
  17214. -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  17215. @end example
  17216. @noindent
  17217. An example showing on-the-fly parameter modifications:
  17218. @example
  17219. emacs -batch -l ~/.emacs \
  17220. -eval '(org-batch-agenda "a" \
  17221. org-agenda-span (quote month) \
  17222. org-agenda-include-diary nil \
  17223. org-agenda-files (quote ("~/org/project.org")))' \
  17224. | lpr
  17225. @end example
  17226. @noindent
  17227. which produces an agenda for the next 30 days from just the
  17228. @samp{~/org/projects.org} file.
  17229. @findex org-batch-agenda-csv
  17230. For structured processing of agenda output, use @code{org-batch-agenda-csv}
  17231. with the following fields:
  17232. @table @asis
  17233. @item category
  17234. The category of the item
  17235. @item head
  17236. The headline, without TODO keyword, TAGS and PRIORITY
  17237. @item type
  17238. The type of the agenda entry, can be
  17239. @multitable {aaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  17240. @item @code{todo}
  17241. @tab selected in TODO match
  17242. @item @code{tagsmatch}
  17243. @tab selected in tags match
  17244. @item @code{diary}
  17245. @tab imported from diary
  17246. @item @code{deadline}
  17247. @tab a deadline
  17248. @item @code{scheduled}
  17249. @tab scheduled
  17250. @item @code{timestamp}
  17251. @tab appointment, selected by timestamp
  17252. @item @code{closed}
  17253. @tab entry was closed on date
  17254. @item @code{upcoming-deadline}
  17255. @tab warning about nearing deadline
  17256. @item @code{past-scheduled}
  17257. @tab forwarded scheduled item
  17258. @item @code{block}
  17259. @tab entry has date block including date
  17260. @end multitable
  17261. @item todo
  17262. The TODO keyword, if any
  17263. @item tags
  17264. All tags including inherited ones, separated by colons
  17265. @item date
  17266. The relevant date, like @samp{2007-2-14}
  17267. @item time
  17268. The time, like @samp{15:00-16:50}
  17269. @item extra
  17270. String with extra planning info
  17271. @item priority-l
  17272. The priority letter if any was given
  17273. @item priority-n
  17274. The computed numerical priority
  17275. @end table
  17276. @noindent
  17277. If the selection of the agenda item was based on a timestamp,
  17278. including those items with @samp{DEADLINE} and @samp{SCHEDULED} keywords, then
  17279. Org includes date and time in the output.
  17280. If the selection of the agenda item was based on a timestamp (or
  17281. deadline/scheduled), then Org includes date and time in the output.
  17282. Here is an example of a post-processing script in Perl. It takes the
  17283. CSV output from Emacs and prints with a checkbox:
  17284. @example
  17285. #!/usr/bin/perl
  17286. # define the Emacs command to run
  17287. $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  17288. # run it and capture the output
  17289. $agenda = qx@{$cmd 2>/dev/null@};
  17290. # loop over all lines
  17291. foreach $line (split(/\n/,$agenda)) @{
  17292. # get the individual values
  17293. ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  17294. $priority_l,$priority_n) = split(/,/,$line);
  17295. # process and print
  17296. print "[ ] $head\n";
  17297. @}
  17298. @end example
  17299. @node Using the Property API
  17300. @appendixsec Using the Property API
  17301. @cindex API, for properties
  17302. @cindex properties, API
  17303. Here is a description of the functions that can be used to work with
  17304. properties.
  17305. @defun org-entry-properties &optional pom which
  17306. Get all properties of the entry at point-or-marker @var{POM}.
  17307. This includes the TODO keyword, the tags, time strings for deadline,
  17308. scheduled, and clocking, and any additional properties defined in the
  17309. entry. The return value is an alist. Keys may occur multiple times
  17310. if the property key was used several times. @var{POM} may also
  17311. be @code{nil}, in which case the current entry is used. If
  17312. @var{WHICH} is @code{nil} or @code{all}, get all properties. If
  17313. @var{WHICH} is @code{special} or @code{standard}, only get that subclass.
  17314. @end defun
  17315. @vindex org-use-property-inheritance
  17316. @findex org-insert-property-drawer
  17317. @defun org-entry-get pom property &optional inherit
  17318. Get value of @var{PROPERTY} for entry at point-or-marker
  17319. @var{POM}. By default, this only looks at properties defined
  17320. locally in the entry. If @var{INHERIT} is non-@code{nil} and the
  17321. entry does not have the property, then also check higher levels of the
  17322. hierarchy. If @var{INHERIT} is the symbol @code{selective}, use
  17323. inheritance if and only if the setting of
  17324. @code{org-use-property-inheritance} selects @var{PROPERTY} for
  17325. inheritance.
  17326. @end defun
  17327. @defun org-entry-delete pom property
  17328. Delete the property @var{PROPERTY} from entry at point-or-marker
  17329. @var{POM}.
  17330. @end defun
  17331. @defun org-entry-put pom property value
  17332. Set @var{PROPERTY} to @var{VALUES} for entry at
  17333. point-or-marker POM.
  17334. @end defun
  17335. @defun org-buffer-property-keys &optional include-specials
  17336. Get all property keys in the current buffer.
  17337. @end defun
  17338. @defun org-insert-property-drawer
  17339. Insert a property drawer for the current entry. Also
  17340. @end defun
  17341. @defun org-entry-put-multivalued-property pom property &rest values
  17342. Set @var{PROPERTY} at point-or-marker @var{POM} to
  17343. @var{VALUES}. @var{VALUES} should be a list of strings.
  17344. They are concatenated, with spaces as separators.
  17345. @end defun
  17346. @defun org-entry-get-multivalued-property pom property
  17347. Treat the value of the property @var{PROPERTY} as
  17348. a whitespace-separated list of values and return the values as a list
  17349. of strings.
  17350. @end defun
  17351. @defun org-entry-add-to-multivalued-property pom property value
  17352. Treat the value of the property @var{PROPERTY} as
  17353. a whitespace-separated list of values and make sure that
  17354. @var{VALUE} is in this list.
  17355. @end defun
  17356. @defun org-entry-remove-from-multivalued-property pom property value
  17357. Treat the value of the property @var{PROPERTY} as
  17358. a whitespace-separated list of values and make sure that
  17359. @var{VALUE} is @emph{not} in this list.
  17360. @end defun
  17361. @defun org-entry-member-in-multivalued-property pom property value
  17362. Treat the value of the property @var{PROPERTY} as
  17363. a whitespace-separated list of values and check if @var{VALUE} is
  17364. in this list.
  17365. @end defun
  17366. @defopt org-property-allowed-value-functions
  17367. Hook for functions supplying allowed values for a specific property.
  17368. The functions must take a single argument, the name of the property,
  17369. and return a flat list of allowed values. If @samp{:ETC} is one of the
  17370. values, use the values as completion help, but allow also other values
  17371. to be entered. The functions must return @code{nil} if they are not
  17372. responsible for this property.
  17373. @end defopt
  17374. @node Using the Mapping API
  17375. @appendixsec Using the Mapping API
  17376. @cindex API, for mapping
  17377. @cindex mapping entries, API
  17378. Org has sophisticated mapping capabilities to find all entries
  17379. satisfying certain criteria. Internally, this functionality is used
  17380. to produce agenda views, but there is also an API that can be used to
  17381. execute arbitrary functions for each or selected entries. The main
  17382. entry point for this API is:
  17383. @defun org-map-entries func &optional match scope &rest skip
  17384. Call @{@{@{(var(FUNC))@}@}@} at each headline selected by @var{MATCH}
  17385. in @var{SCOPE}.
  17386. @var{FUNC} is a function or a Lisp form. With the cursor
  17387. positioned at the beginning of the headline, call the function without
  17388. arguments. Org returns an alist of return values of calls to the
  17389. function.
  17390. To avoid preserving point, Org wraps the call to @var{FUNC} in
  17391. save-excursion form. After evaluation, Org moves the cursor to the
  17392. end of the line that was just processed. Search continues from that
  17393. point forward. This may not always work as expected under some
  17394. conditions, such as if the current sub-tree was removed by a previous
  17395. archiving operation. In such rare circumstances, Org skips the next
  17396. entry entirely when it should not. To stop Org from such skips, make
  17397. @var{FUNC} set the variable @code{org-map-continue-from} to a specific
  17398. buffer position.
  17399. @var{MATCH} is a tags/property/TODO match. Org iterates only
  17400. matched headlines. Org iterates over all headlines when
  17401. @var{MATCH} is @code{nil} or @code{t}.
  17402. @var{SCOPE} determines the scope of this command. It can be any
  17403. of:
  17404. @table @asis
  17405. @item @code{nil}
  17406. The current buffer, respecting the restriction, if any.
  17407. @item @code{tree}
  17408. The subtree started with the entry at point.
  17409. @item @code{region}
  17410. The entries within the active region, if any.
  17411. @item @code{file}
  17412. The current buffer, without restriction.
  17413. @item @code{file-with-archives}
  17414. The current buffer, and any archives associated with it.
  17415. @item @code{agenda}
  17416. All agenda files.
  17417. @item @code{agenda-with-archives}
  17418. All agenda files with any archive files associated with them.
  17419. @item @code{(file1 file2 ...)}
  17420. If this is a list, all files in the list are scanned.
  17421. @end table
  17422. @noindent
  17423. The remaining arguments are treated as settings for the scanner's
  17424. skipping facilities. Valid arguments are:
  17425. @table @asis
  17426. @item @code{archive}
  17427. Skip trees with the archive tag.
  17428. @item @code{comment}
  17429. Skip trees with the COMMENT keyword.
  17430. @item function or Lisp form
  17431. @vindex org-agenda-skip-function
  17432. Used as value for @code{org-agenda-skip-function}, so whenever the
  17433. function returns @code{t}, @var{FUNC} is called for that entry
  17434. and search continues from the point where the function leaves it.
  17435. @end table
  17436. @end defun
  17437. The mapping routine can call any arbitrary function, even functions
  17438. that change meta data or query the property API (see @ref{Using the Property API}). Here are some handy functions:
  17439. @defun org-todo &optional arg
  17440. Change the TODO state of the entry. See the docstring of the
  17441. functions for the many possible values for the argument
  17442. @var{ARG}.
  17443. @end defun
  17444. @defun org-priority &optional action
  17445. Change the priority of the entry. See the docstring of this function
  17446. for the possible values for @var{ACTION}.
  17447. @end defun
  17448. @defun org-toggle-tag tag &optional onoff
  17449. Toggle the tag @var{TAG} in the current entry. Setting
  17450. @var{ONOFF} to either @code{on} or @code{off} does not toggle tag, but
  17451. ensure that it is either on or off.
  17452. @end defun
  17453. @defun org-promote
  17454. Promote the current entry.
  17455. @end defun
  17456. @defun org-demote
  17457. Demote the current entry.
  17458. @end defun
  17459. This example turns all entries tagged with @samp{TOMORROW} into TODO
  17460. entries with keyword @samp{UPCOMING}. Org ignores entries in comment trees
  17461. and archive trees.
  17462. @lisp
  17463. (org-map-entries '(org-todo "UPCOMING")
  17464. "+TOMORROW" 'file 'archive 'comment)
  17465. @end lisp
  17466. The following example counts the number of entries with TODO keyword
  17467. @samp{WAITING}, in all agenda files.
  17468. @lisp
  17469. (length (org-map-entries t "/+WAITING" 'agenda))
  17470. @end lisp
  17471. @node MobileOrg
  17472. @appendix MobileOrg
  17473. @cindex iPhone
  17474. @cindex smartphone
  17475. @cindex android
  17476. @cindex MobileOrg
  17477. MobileOrg is a companion mobile app that runs on iOS and Android
  17478. devices. MobileOrg enables offline-views and capture support for an
  17479. Org mode system that is rooted on a ``real'' computer. MobileOrg can
  17480. record changes to existing entries.
  17481. The @uref{https://github.com/MobileOrg/, iOS implementation} for the @emph{iPhone/iPod Touch/iPad} series of
  17482. devices, was started by Richard Moreland and is now in the hands of
  17483. Sean Escriva. Android users should check out @uref{http://wiki.github.com/matburt/mobileorg-android/, MobileOrg Android} by
  17484. Matt Jones. Though the two implementations are not identical, they
  17485. offer similar features.
  17486. This appendix describes Org's support for agenda view formats
  17487. compatible with MobileOrg. It also describes synchronizing changes,
  17488. such as to notes, between MobileOrg and the computer.
  17489. To change tags and TODO states in MobileOrg, first customize the
  17490. variables @code{org-todo-keywords} and @code{org-tag-alist}. These should cover
  17491. all the important tags and TODO keywords, even if Org files use only
  17492. some of them. Though MobileOrg has in-buffer settings, it understands
  17493. TODO states @emph{sets} (see @ref{Per-file keywords}) and
  17494. @emph{mutually exclusive} tags (see @ref{Setting Tags}) only for those set in
  17495. these variables.
  17496. @menu
  17497. * Setting Up the Staging Area:: For the mobile device.
  17498. * Pushing to MobileOrg:: Uploading Org files and agendas.
  17499. * Pulling from MobileOrg:: Integrating captured and flagged items.
  17500. @end menu
  17501. @node Setting Up the Staging Area
  17502. @appendixsec Setting Up the Staging Area
  17503. MobileOrg needs access to a file directory on a server to interact
  17504. with Emacs. With a public server, consider encrypting the files.
  17505. MobileOrg version 1.5 supports encryption for the iPhone. Org also
  17506. requires @samp{openssl} installed on the local computer. To turn on
  17507. encryption, set the same password in MobileOrg and in Emacs. Set the
  17508. password in the variable @code{org-mobile-use-encryption}@footnote{If Emacs is configured for safe storing of passwords, then
  17509. configure the variable, @code{org-mobile-encryption-password}; please read
  17510. the docstring of that variable.}. Note
  17511. that even after MobileOrg encrypts the file contents, the file name
  17512. remains visible on the file systems of the local computer, the server,
  17513. and the mobile device.
  17514. For a server to host files, consider options like @uref{http://dropbox.com, Dropbox.com}
  17515. account@footnote{An alternative is to use a WebDAV server. MobileOrg
  17516. documentation has details of WebDAV server configuration. Additional
  17517. help is at this @uref{https://orgmode.org/worg/org-faq.html#mobileorg_webdav, FAQ entry}.}. On first connection, MobileOrg creates a directory
  17518. @samp{MobileOrg} on Dropbox. Pass its location to Emacs through an
  17519. initialisation file variable as follows:
  17520. @lisp
  17521. (setq org-mobile-directory "~/Dropbox/MobileOrg")
  17522. @end lisp
  17523. Org copies files to the above directory for MobileOrg. Org also uses
  17524. the same directory for sharing notes between Org and MobileOrg.
  17525. @node Pushing to MobileOrg
  17526. @appendixsec Pushing to MobileOrg
  17527. @vindex org-mobile-files
  17528. @vindex org-directory
  17529. Org pushes files listed in @code{org-mobile-files} to
  17530. @code{org-mobile-directory}. Files include agenda files (as listed in
  17531. @code{org-agenda-files}). Customize @code{org-mobile-files} to add other files.
  17532. File names are staged with paths relative to @code{org-directory}, so all
  17533. files should be inside this directory@footnote{Symbolic links in @code{org-directory} need to have the same name
  17534. as their targets.}.
  17535. Push creates a special Org file @samp{agendas.org} with custom agenda views
  17536. defined by the user@footnote{While creating the agendas, Org mode forces ID properties on
  17537. all referenced entries, so that these entries can be uniquely
  17538. identified if MobileOrg flags them for further action. To avoid
  17539. setting properties configure the variable
  17540. @code{org-mobile-force-id-on-agenda-items} to @code{nil}. Org mode then relies
  17541. on outline paths, assuming they are unique.}.
  17542. Finally, Org writes the file @samp{index.org}, containing links to other
  17543. files. MobileOrg reads this file first from the server to determine
  17544. what other files to download for agendas. For faster downloads,
  17545. MobileOrg only reads files whose checksums@footnote{Checksums are stored automatically in the file
  17546. @samp{checksums.dat}.} have changed.
  17547. @node Pulling from MobileOrg
  17548. @appendixsec Pulling from MobileOrg
  17549. When MobileOrg synchronizes with the server, it pulls the Org files
  17550. for viewing. It then appends to the file @samp{mobileorg.org} on the
  17551. server the captured entries, pointers to flagged and changed entries.
  17552. Org integrates its data in an inbox file format.
  17553. @enumerate
  17554. @item
  17555. @vindex org-mobile-inbox-for-pull
  17556. Org moves all entries found in @samp{mobileorg.org}@footnote{The file will be empty after this operation.} and appends
  17557. them to the file pointed to by the variable
  17558. @code{org-mobile-inbox-for-pull}. Each captured entry and each editing
  17559. event is a top-level entry in the inbox file.
  17560. @item
  17561. After moving the entries, Org attempts changes to MobileOrg. Some
  17562. changes are applied directly and without user interaction.
  17563. Examples include changes to tags, TODO state, headline and body
  17564. text. Entries for further action are tagged as @samp{FLAGGED}. Org
  17565. marks entries with problems with an error message in the inbox.
  17566. They have to be resolved manually.
  17567. @item
  17568. Org generates an agenda view for flagged entries for user
  17569. intervention to clean up. For notes stored in flagged entries,
  17570. MobileOrg displays them in the echo area when the cursor is on the
  17571. corresponding agenda item.
  17572. @table @asis
  17573. @item @kbd{?}
  17574. @kindex ?
  17575. Pressing @kbd{?} displays the entire flagged note in
  17576. another window. Org also pushes it to the kill ring. To
  17577. store flagged note as a normal note, use @kbd{? z C-y C-c C-c}. Pressing@kbd{?} twice does these things: first
  17578. it removes the @samp{FLAGGED} tag; second, it removes the flagged
  17579. note from the property drawer; third, it signals that manual
  17580. editing of the flagged entry is now finished.
  17581. @end table
  17582. @end enumerate
  17583. @kindex ? @r{(Agenda dispatcher)}
  17584. From the agenda dispatcher, @kbd{?} returns to the view to finish
  17585. processing flagged entries. Note that these entries may not be the
  17586. most recent since MobileOrg searches files that were last pulled. To
  17587. get an updated agenda view with changes since the last pull, pull
  17588. again.
  17589. @node History and Acknowledgments
  17590. @appendix History and Acknowledgments
  17591. @anchor{From Carsten}
  17592. @appendixsec From Carsten
  17593. Org was born in 2003, out of frustration over the user interface of
  17594. the Emacs Outline mode. I was trying to organize my notes and
  17595. projects, and using Emacs seemed to be the natural way to go.
  17596. However, having to remember eleven different commands with two or
  17597. three keys per command, only to hide and show parts of the outline
  17598. tree, that seemed entirely unacceptable to me. Also, when using
  17599. outlines to take notes, I constantly wanted to restructure the tree,
  17600. organizing it parallel to my thoughts and plans. @emph{Visibility cycling}
  17601. and @emph{structure editing} were originally implemented in the package
  17602. @samp{outline-magic.el}, but quickly moved to the more general @samp{org.el}.
  17603. As this environment became comfortable for project planning, the next
  17604. step was adding @emph{TODO entries}, basic @emph{timestamps}, and @emph{table
  17605. support}. These areas highlighted the two main goals that Org still
  17606. has today: to be a new, outline-based, plain text mode with innovative
  17607. and intuitive editing features, and to incorporate project planning
  17608. functionality directly into a notes file.
  17609. Since the first release, literally thousands of emails to me or to the
  17610. @email{emacs-orgmode@@gnu.org, mailing list} have provided a constant stream of bug reports, feedback,
  17611. new ideas, and sometimes patches and add-on code. Many thanks to
  17612. everyone who has helped to improve this package. I am trying to keep
  17613. here a list of the people who had significant influence in shaping one
  17614. or more aspects of Org. The list may not be complete, if I have
  17615. forgotten someone, please accept my apologies and let me know.
  17616. Before I get to this list, a few special mentions are in order:
  17617. @table @asis
  17618. @item Bastien Guerry
  17619. Bastien has written a large number of extensions to Org (most of
  17620. them integrated into the core by now), including the @LaTeX{}
  17621. exporter and the plain list parser. His support during the early
  17622. days was central to the success of this project. Bastien also
  17623. invented Worg, helped establishing the Web presence of Org, and
  17624. sponsored hosting costs for the orgmode.org website. Bastien
  17625. stepped in as maintainer of Org between 2011 and 2013, at a time
  17626. when I desperately needed a break.
  17627. @item Eric Schulte and Dan Davison
  17628. Eric and Dan are jointly responsible for the Org Babel system,
  17629. which turns Org into a multi-language environment for evaluating
  17630. code and doing literate programming and reproducible research.
  17631. This has become one of Org's killer features that define what Org
  17632. is today.
  17633. @item John Wiegley
  17634. John has contributed a number of great ideas and patches directly
  17635. to Org, including the attachment system (@samp{org-attach.el}),
  17636. integration with Apple Mail (@samp{org-mac-message.el}), hierarchical
  17637. dependencies of TODO items, habit tracking (@samp{org-habits.el}), and
  17638. encryption (@samp{org-crypt.el}). Also, the capture system is really
  17639. an extended copy of his great @samp{remember.el}.
  17640. @item Sebastian Rose
  17641. Without Sebastian, the HTML/XHTML publishing of Org would be the
  17642. pitiful work of an ignorant amateur. Sebastian has pushed this
  17643. part of Org onto a much higher level. He also wrote
  17644. @samp{org-info.js}, a Java script for displaying webpages derived from
  17645. Org using an Info-like or a folding interface with single-key
  17646. navigation.
  17647. @end table
  17648. @noindent
  17649. See below for the full list of contributions! Again, please let me
  17650. know what I am missing here!
  17651. @anchor{From Bastien}
  17652. @appendixsec From Bastien
  17653. I (Bastien) have been maintaining Org between 2011 and 2013. This
  17654. appendix would not be complete without adding a few more
  17655. acknowledgments and thanks.
  17656. I am first grateful to Carsten for his trust while handing me over the
  17657. maintainership of Org. His unremitting support is what really helped
  17658. me getting more confident over time, with both the community and the
  17659. code.
  17660. When I took over maintainership, I knew I would have to make Org more
  17661. collaborative than ever, as I would have to rely on people that are
  17662. more knowledgeable than I am on many parts of the code. Here is
  17663. a list of the persons I could rely on, they should really be
  17664. considered co-maintainers, either of the code or the community:
  17665. @table @asis
  17666. @item Eric Schulte
  17667. Eric is maintaining the Babel parts of Org. His reactivity here
  17668. kept me away from worrying about possible bugs here and let me
  17669. focus on other parts.
  17670. @item Nicolas Goaziou
  17671. Nicolas is maintaining the consistency of the deepest parts of
  17672. Org. His work on @samp{org-element.el} and @samp{ox.el} has been
  17673. outstanding, and it opened the doors for many new ideas and
  17674. features. He rewrote many of the old exporters to use the new
  17675. export engine, and helped with documenting this major change.
  17676. More importantly (if that's possible), he has been more than
  17677. reliable during all the work done for Org 8.0, and always very
  17678. reactive on the mailing list.
  17679. @item Achim Gratz
  17680. Achim rewrote the building process of Org, turning some @emph{ad hoc}
  17681. tools into a flexible and conceptually clean process. He
  17682. patiently coped with the many hiccups that such a change can
  17683. create for users.
  17684. @item Nick Dokos
  17685. The Org mode mailing list would not be such a nice place without
  17686. Nick, who patiently helped users so many times. It is impossible
  17687. to overestimate such a great help, and the list would not be so
  17688. active without him.
  17689. @end table
  17690. I received support from so many users that it is clearly impossible to
  17691. be fair when shortlisting a few of them, but Org's history would not
  17692. be complete if the ones above were not mentioned in this manual.
  17693. @anchor{List of Contributions}
  17694. @appendixsec List of Contributions
  17695. @itemize
  17696. @item
  17697. Russel Adams came up with the idea for drawers.
  17698. @item
  17699. Thomas Baumann wrote @samp{org-bbdb.el} and @samp{org-mhe.el}.
  17700. @item
  17701. Christophe Bataillon created the great unicorn logo that we use on
  17702. the Org mode website.
  17703. @item
  17704. Alex Bochannek provided a patch for rounding timestamps.
  17705. @item
  17706. Jan Böcker wrote @samp{org-docview.el}.
  17707. @item
  17708. Brad Bozarth showed how to pull RSS feed data into Org files.
  17709. @item
  17710. Tom Breton wrote @samp{org-choose.el}.
  17711. @item
  17712. Charles Cave's suggestion sparked the implementation of templates
  17713. for Remember, which are now templates for capture.
  17714. @item
  17715. Pavel Chalmoviansky influenced the agenda treatment of items with
  17716. specified time.
  17717. @item
  17718. Gregory Chernov patched support for Lisp forms into table
  17719. calculations and improved XEmacs compatibility, in particular by
  17720. porting @samp{nouline.el} to XEmacs.
  17721. @item
  17722. Sacha Chua suggested copying some linking code from Planner.
  17723. @item
  17724. Baoqiu Cui contributed the DocBook exporter.
  17725. @item
  17726. Eddward DeVilla proposed and tested checkbox statistics. He also
  17727. came up with the idea of properties, and that there should be an API
  17728. for them.
  17729. @item
  17730. Nick Dokos tracked down several nasty bugs.
  17731. @item
  17732. Kees Dullemond used to edit projects lists directly in HTML and so
  17733. inspired some of the early development, including HTML export. He
  17734. also asked for a way to narrow wide table columns.
  17735. @item
  17736. Thomas S. Dye contributed documentation on Worg and helped
  17737. integrating the Org Babel documentation into the manual.
  17738. @item
  17739. Christian Egli converted the documentation into Texinfo format,
  17740. inspired the agenda, patched CSS formatting into the HTML exporter,
  17741. and wrote @samp{org-taskjuggler.el}.
  17742. @item
  17743. David Emery provided a patch for custom CSS support in exported HTML
  17744. agendas.
  17745. @item
  17746. Nic Ferrier contributed mailcap and XOXO support.
  17747. @item
  17748. Miguel A. Figueroa-Villanueva implemented hierarchical checkboxes.
  17749. @item
  17750. John Foerch figured out how to make incremental search show context
  17751. around a match in a hidden outline tree.
  17752. @item
  17753. Raimar Finken wrote @samp{org-git-line.el}.
  17754. @item
  17755. Mikael Fornius works as a mailing list moderator.
  17756. @item
  17757. Austin Frank works as a mailing list moderator.
  17758. @item
  17759. Eric Fraga drove the development of Beamer export with ideas and
  17760. testing.
  17761. @item
  17762. Barry Gidden did proofreading the manual in preparation for the book
  17763. publication through Network Theory Ltd.
  17764. @item
  17765. Niels Giesen had the idea to automatically archive DONE trees.
  17766. @item
  17767. Nicolas Goaziou rewrote much of the plain list code.
  17768. @item
  17769. Kai Grossjohann pointed out key-binding conflicts with other
  17770. packages.
  17771. @item
  17772. Brian Gough of Network Theory Ltd publishes the Org mode manual as
  17773. a book.
  17774. @item
  17775. Bernt Hansen has driven much of the support for auto-repeating
  17776. tasks, task state change logging, and the clocktable. His clear
  17777. explanations have been critical when we started to adopt the Git
  17778. version control system.
  17779. @item
  17780. Manuel Hermenegildo has contributed various ideas, small fixes and
  17781. patches.
  17782. @item
  17783. Phil Jackson wrote @samp{org-irc.el}.
  17784. @item
  17785. Scott Jaderholm proposed footnotes, control over whitespace between
  17786. folded entries, and column view for properties.
  17787. @item
  17788. Matt Jones wrote MobileOrg Android.
  17789. @item
  17790. Tokuya Kameshima wrote @samp{org-wl.el} and @samp{org-mew.el}.
  17791. @item
  17792. Shidai Liu (``Leo'') asked for embedded @LaTeX{} and tested it. He also
  17793. provided frequent feedback and some patches.
  17794. @item
  17795. Matt Lundin has proposed last-row references for table formulas and
  17796. named invisible anchors. He has also worked a lot on the FAQ.
  17797. @item
  17798. David Maus wrote @samp{org-atom.el}, maintains the issues file for Org,
  17799. and is a prolific contributor on the mailing list with competent
  17800. replies, small fixes and patches.
  17801. @item
  17802. Jason F. McBrayer suggested agenda export to CSV format.
  17803. @item
  17804. Max Mikhanosha came up with the idea of refiling.
  17805. @item
  17806. Dmitri Minaev sent a patch to set priority limits on a per-file
  17807. basis.
  17808. @item
  17809. Stefan Monnier provided a patch to keep the Emacs Lisp compiler
  17810. happy.
  17811. @item
  17812. Richard Moreland wrote MobileOrg for the iPhone.
  17813. @item
  17814. Rick Moynihan proposed allowing multiple TODO sequences in a file
  17815. and being able to quickly restrict the agenda to a subtree.
  17816. @item
  17817. Todd Neal provided patches for links to Info files and Elisp forms.
  17818. @item
  17819. Greg Newman refreshed the unicorn logo into its current form.
  17820. @item
  17821. Tim O'Callaghan suggested in-file links, search options for general
  17822. file links, and tags.
  17823. @item
  17824. Osamu Okano wrote @samp{orgcard2ref.pl}, a Perl program to create a text
  17825. version of the reference card.
  17826. @item
  17827. Takeshi Okano translated the manual and David O'Toole's tutorial
  17828. into Japanese.
  17829. @item
  17830. Oliver Oppitz suggested multi-state TODO items.
  17831. @item
  17832. Scott Otterson sparked the introduction of descriptive text for
  17833. links, among other things.
  17834. @item
  17835. Pete Phillips helped during the development of the TAGS feature,
  17836. and provided frequent feedback.
  17837. @item
  17838. Martin Pohlack provided the code snippet to bundle character
  17839. insertion into bundles of 20 for undo.
  17840. @item
  17841. T.V. Raman reported bugs and suggested improvements.
  17842. @item
  17843. Matthias Rempe (Oelde) provided ideas, Windows support, and quality
  17844. control.
  17845. @item
  17846. Paul Rivier provided the basic implementation of named footnotes.
  17847. He also acted as mailing list moderator for some time.
  17848. @item
  17849. Kevin Rogers contributed code to access VM files on remote hosts.
  17850. @item
  17851. Frank Ruell solved the mystery of the @samp{keymapp nil} bug, a conflict
  17852. with @samp{allout.el}.
  17853. @item
  17854. Jason Riedy generalized the send-receive mechanism for Orgtbl
  17855. tables with extensive patches.
  17856. @item
  17857. Philip Rooke created the Org reference card, provided lots of
  17858. feedback, developed and applied standards to the Org documentation.
  17859. @item
  17860. Christian Schlauer proposed angular brackets around links, among
  17861. other things.
  17862. @item
  17863. Paul Sexton wrote @samp{org-ctags.el}.
  17864. @item
  17865. Tom Shannon's @samp{organizer-mode.el} inspired linking to VM/BBDB/Gnus.
  17866. @item
  17867. Ilya Shlyakhter proposed the Archive Sibling, line numbering in
  17868. literal examples, and remote highlighting for referenced code lines.
  17869. @item
  17870. Stathis Sideris wrote the @samp{ditaa.jar} ASCII to PNG converter that is
  17871. now packaged into Org's @samp{contrib/} directory.
  17872. @item
  17873. Daniel Sinder came up with the idea of internal archiving by locking
  17874. subtrees.
  17875. @item
  17876. Dale Smith proposed link abbreviations.
  17877. @item
  17878. James TD Smith has contributed a large number of patches for
  17879. useful tweaks and features.
  17880. @item
  17881. Adam Spiers asked for global linking commands, inspired the link
  17882. extension system, added support for Mairix, and proposed the mapping
  17883. API.
  17884. @item
  17885. Ulf Stegemann created the table to translate special symbols to
  17886. HTML, @LaTeX{}, UTF-8, Latin-1 and ASCII.
  17887. @item
  17888. Andy Stewart contributed code to @samp{org-w3m.el}, to copy
  17889. HTML content with links transformation to Org syntax.
  17890. @item
  17891. David O'Toole wrote @samp{org-publish.el} and drafted the
  17892. manual chapter about publishing.
  17893. @item
  17894. Jambunathan K. contributed the ODT exporter.
  17895. @item
  17896. Sebastien Vauban reported many issues with @LaTeX{} and Beamer export
  17897. and enabled source code highlighting in Gnus.
  17898. @item
  17899. Stefan Vollmar organized a video-recorded talk at the
  17900. Max-Planck-Institute for Neurology. He also inspired the creation
  17901. of a concept index for HTML export.
  17902. @item
  17903. Jürgen Vollmer contributed code generating the table of contents in
  17904. HTML output.
  17905. @item
  17906. Samuel Wales has provided important feedback and bug reports.
  17907. @item
  17908. Chris Wallace provided a patch implementing the @samp{QUOTE} block.
  17909. @item
  17910. David Wainberg suggested archiving, and improvements to the
  17911. linking system.
  17912. @item
  17913. Carsten Wimmer suggested some changes and helped fix a bug in
  17914. linking to Gnus.
  17915. @item
  17916. Roland Winkler requested additional key bindings to make Org work on
  17917. a TTY.
  17918. @item
  17919. Piotr Zielinski wrote @samp{org-mouse.el}, proposed agenda
  17920. blocks and contributed various ideas and code snippets.
  17921. @item
  17922. Marco Wahl wrote @samp{org-eww.el}.
  17923. @end itemize
  17924. @node GNU Free Documentation License
  17925. @appendix GNU Free Documentation License
  17926. @include doclicense.texi
  17927. @node Main Index
  17928. @chapter Main Index
  17929. @printindex cp
  17930. @node Key Index
  17931. @chapter Key Index
  17932. @printindex ky
  17933. @node Command and Function Index
  17934. @chapter Command and Function Index
  17935. @printindex fn
  17936. @node Variable Index
  17937. @chapter Variable Index
  17938. This is not a complete index of variables and faces, only the ones
  17939. that are mentioned in the manual. For a more complete list, use
  17940. @kbd{M-x org-customize} and then click yourself through the tree.
  17941. @printindex vr
  17942. @bye